From 70c22858a0ae5b92a57420ad04b9107013134147 Mon Sep 17 00:00:00 2001 From: DIVYAM TAYAL Date: Fri, 20 Nov 2020 09:10:19 +0530 Subject: [PATCH] fix: Only show country dropdown without autocomplete (#5652) Co-authored-by: iamareebjamal --- app/components/country-dropdown.ts | 14 +++++++++ app/templates/components/country-dropdown.hbs | 24 +++++++++++++++ .../forms/admin/settings/billing.hbs | 21 ++++--------- .../forms/admin/settings/ticket-fees-form.hbs | 26 ++++------------ .../components/forms/orders/order-form.hbs | 4 +-- .../components/forms/session-speaker-form.hbs | 8 ++--- .../forms/user-payment-info-form.hbs | 28 +++-------------- .../forms/wizard/basic-details-step.hbs | 30 ++++--------------- .../components/modals/tax-info-modal.hbs | 21 ++++--------- .../components/widgets/forms/billing-info.hbs | 4 +-- app/utils/dictionary/demography.ts | 7 ++++- 11 files changed, 77 insertions(+), 110 deletions(-) create mode 100644 app/components/country-dropdown.ts create mode 100644 app/templates/components/country-dropdown.hbs diff --git a/app/components/country-dropdown.ts b/app/components/country-dropdown.ts new file mode 100644 index 00000000000..e043c52a2ab --- /dev/null +++ b/app/components/country-dropdown.ts @@ -0,0 +1,14 @@ +import Component from '@glimmer/component'; +import { orderBy, filter } from 'lodash-es'; +import { paymentCountries } from 'open-event-frontend/utils/dictionary/payment'; +import { countries, Country } from 'open-event-frontend/utils/dictionary/demography'; + +export default class CountryDropdown extends Component { + get countries(): Country[] { + return orderBy(countries, 'name'); + } + + get paymentCountries(): Country[] { + return orderBy(filter(countries, country => paymentCountries.includes(country.code)), 'name'); + } +} diff --git a/app/templates/components/country-dropdown.hbs b/app/templates/components/country-dropdown.hbs new file mode 100644 index 00000000000..cbe7d6fcd20 --- /dev/null +++ b/app/templates/components/country-dropdown.hbs @@ -0,0 +1,24 @@ +
+ + + + +
{{t 'Select country'}}
+ +
+
diff --git a/app/templates/components/forms/admin/settings/billing.hbs b/app/templates/components/forms/admin/settings/billing.hbs index 6698dff2d6b..cf306f1392f 100644 --- a/app/templates/components/forms/admin/settings/billing.hbs +++ b/app/templates/components/forms/admin/settings/billing.hbs @@ -45,22 +45,11 @@ -
- - - - -
{{t 'Select country'}}
- -
-
+
diff --git a/app/templates/components/forms/admin/settings/ticket-fees-form.hbs b/app/templates/components/forms/admin/settings/ticket-fees-form.hbs index 726c05c97c5..3ce70dcb978 100644 --- a/app/templates/components/forms/admin/settings/ticket-fees-form.hbs +++ b/app/templates/components/forms/admin/settings/ticket-fees-form.hbs @@ -52,27 +52,11 @@ {{#each this.ticketFees as |ticketFee|}}
- - - - -
{{t 'Select country'}}
- -
+
diff --git a/app/templates/components/forms/orders/order-form.hbs b/app/templates/components/forms/orders/order-form.hbs index 13d0ebae278..5e2123beddc 100644 --- a/app/templates/components/forms/orders/order-form.hbs +++ b/app/templates/components/forms/orders/order-form.hbs @@ -61,7 +61,7 @@
{{#each this.allFields.attendee as |field|}} {{#if field.isIncluded}} -
+
{{#if (is-input-field field.type) }} {{#if field.isLongText}} @@ -140,7 +140,7 @@
{{/if}} -
+ {{/if}} {{/each}} {{/each}} diff --git a/app/templates/components/forms/session-speaker-form.hbs b/app/templates/components/forms/session-speaker-form.hbs index 3e0537c2d2a..ce9be369f52 100644 --- a/app/templates/components/forms/session-speaker-form.hbs +++ b/app/templates/components/forms/session-speaker-form.hbs @@ -138,7 +138,7 @@ {{#if this.addNewSpeaker}} {{#each this.allFields.speaker as |field|}} {{#if field.isIncluded}} -
+
{{#if (is-input-field field.type) }} {{#if field.isLongText}} @@ -242,7 +242,7 @@ {{/if}} {{/if}} -
+ {{/if}} {{/each}} {{/if}} @@ -256,7 +256,7 @@ {{/if}} {{#each this.allFields.speaker as |field|}} {{#if field.isIncluded}} -
+
{{#if (is-input-field field.type) }} {{#if field.isLongText}} @@ -364,7 +364,7 @@ {{/if}} {{/if}} -
+ {{/if}} {{/each}} {{/if}} diff --git a/app/templates/components/forms/user-payment-info-form.hbs b/app/templates/components/forms/user-payment-info-form.hbs index af1fcd3b4db..5607e51acd1 100644 --- a/app/templates/components/forms/user-payment-info-form.hbs +++ b/app/templates/components/forms/user-payment-info-form.hbs @@ -54,30 +54,10 @@ @id="state" @value={{this.userBillingInfo.billingState}} />
-
- - - - -
{{t 'Select country'}}
- -
-
+

{{t 'Add Payment Details'}}

-
- - - - -
{{t 'Select country'}}
- -
-
+
-
- - - - -
{{t 'Select country'}}
- -
-
+
diff --git a/app/templates/components/widgets/forms/billing-info.hbs b/app/templates/components/widgets/forms/billing-info.hbs index ac8460e63b4..b38eb7a5988 100644 --- a/app/templates/components/widgets/forms/billing-info.hbs +++ b/app/templates/components/widgets/forms/billing-info.hbs @@ -39,7 +39,7 @@ @id="zip_code" @value={{this.data.zipcode}} />
-
+ -
+ diff --git a/app/utils/dictionary/demography.ts b/app/utils/dictionary/demography.ts index 67932649a0a..ce9ff70c6ad 100644 --- a/app/utils/dictionary/demography.ts +++ b/app/utils/dictionary/demography.ts @@ -1,8 +1,13 @@ +export interface Country { + name: string; + code: string; +} + /** * Using a lean list of countries instead of an external dependency. * All the libraries have a lot of extra data which is of no use to us at this point and unnecessarily takes up more space. */ -export const countries = [ +export const countries: Country[] = [ { name : 'Andorra', code : 'AD'