Skip to content

Commit 060859f

Browse files
author
daretobedifferent18
committed
Merge branch 'ticket-table-resp-3511' of https://github.com/daretobedifferent18/open-event-frontend into ticket-table-resp-3511
2 parents 3fea114 + 67c31ed commit 060859f

File tree

13 files changed

+82
-115
lines changed

13 files changed

+82
-115
lines changed

app/components/country-dropdown.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Component from '@glimmer/component';
2+
import { orderBy, filter } from 'lodash-es';
3+
import { paymentCountries } from 'open-event-frontend/utils/dictionary/payment';
4+
import { countries, Country } from 'open-event-frontend/utils/dictionary/demography';
5+
6+
export default class CountryDropdown extends Component {
7+
get countries(): Country[] {
8+
return orderBy(countries, 'name');
9+
}
10+
11+
get paymentCountries(): Country[] {
12+
return orderBy(filter(countries, country => paymentCountries.includes(country.code)), 'name');
13+
}
14+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<form class="field">
2+
<label class={{if @required 'required'}}>{{@placeholder}}</label>
3+
<UiDropdown
4+
@class="search selection"
5+
@selected={{@val}}
6+
@forceSelection={{false}}
7+
@fullTextSearch={{true}}>
8+
<Input
9+
@type="hidden"
10+
@autocomplete="no"
11+
@value={{@val}}
12+
@id={{@id}} />
13+
<i class="dropdown icon"></i>
14+
<div class="default text">{{t 'Select country'}}</div>
15+
<div class="menu">
16+
{{#each (if @paymentCountries this.paymentCountries this.countries) as |country|}}
17+
<div class="item" data-value="{{country.name}}">
18+
<i class="{{lowercase country.code}} flag"></i>
19+
{{country.name}}
20+
</div>
21+
{{/each}}
22+
</div>
23+
</UiDropdown>
24+
</form>

app/templates/components/forms/admin/settings/billing.hbs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,11 @@
4545
<label class="required" for="adminBillingPaypalEmail">{{t 'Paypal Email'}}</label>
4646
<Input @type="email" @id="adminBillingPaypalEmail" @value={{this.model.adminBillingPaypalEmail}} />
4747
</div>
48-
<div class="field">
49-
<label class="required">{{t 'Country'}}</label>
50-
<UiDropdown @class="search selection" @selected={{this.model.adminBillingCountry}} @forceSelection={{false}} @fullTextSearch={{true}}>
51-
<Input @type="hidden" @autocomplete="no" @id="adminBillingCountry" @value={{this.model.adminBillingCountry}} />
52-
<i class="dropdown icon"></i>
53-
<div class="default text">{{t 'Select country'}}</div>
54-
<div class="menu">
55-
{{#each this.countries as |country|}}
56-
<div class="item" data-value="{{country.name}}">
57-
<i class="{{lowercase country.code}} flag"></i>
58-
{{country.name}}
59-
</div>
60-
{{/each}}
61-
</div>
62-
</UiDropdown>
63-
</div>
48+
<CountryDropdown
49+
@required={{true}}
50+
@placeholder={{t 'Country'}}
51+
@val={{this.model.adminBillingCountry}}
52+
@id="adminBillingCountry" />
6453
<div class="field">
6554
<label for="adminBillingTaxInfo">{{t 'Tax ID'}}</label>
6655
<Input @type="text" @id="adminBillingTaxInfo" @value={{this.model.adminBillingTaxInfo}} />

app/templates/components/forms/admin/settings/ticket-fees-form.hbs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,11 @@
5252
{{#each this.ticketFees as |ticketFee|}}
5353
<div class="ui five column very relaxed grid">
5454
<div class="ui field three wide column">
55-
<label class="required">{{t 'Select country'}}</label>
56-
<UiDropdown
57-
@class="search selection"
58-
@selected={{ticketFee.country}}
59-
@forceSelection={{false}}
60-
@fullTextSearch={{true}}>
61-
<Input
62-
@type="hidden"
63-
@autocomplete="no"
64-
@value={{ticketFee.country}} />
65-
<i class="dropdown icon"></i>
66-
<div class="default text">{{t 'Select country'}}</div>
67-
<div class="menu">
68-
{{#each this.paymentCountries as |paymentCountry|}}
69-
<div class="item" data-value="{{paymentCountry.name}}">
70-
<i class="{{lowercase paymentCountry.code}} flag"></i>
71-
{{paymentCountry.name}}
72-
</div>
73-
{{/each}}
74-
</div>
75-
</UiDropdown>
55+
<CountryDropdown
56+
@required={{true}}
57+
@paymentCountries={{true}}
58+
@placeholder={{t 'Select country'}}
59+
@val={{ticketFee.country}} />
7660
</div>
7761
<div class="ui field four wide column">
7862
<label class="required">{{t 'Select currency'}}</label>

app/templates/components/forms/orders/order-form.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</div>
6262
{{#each this.allFields.attendee as |field|}}
6363
{{#if field.isIncluded}}
64-
<div class="field">
64+
<form class="field">
6565
<label class="{{if field.isRequired 'required'}}" for="name">{{field.name}}</label>
6666
{{#if (is-input-field field.type) }}
6767
{{#if field.isLongText}}
@@ -140,7 +140,7 @@
140140
</div>
141141
</UiDropdown>
142142
{{/if}}
143-
</div>
143+
</form>
144144
{{/if}}
145145
{{/each}}
146146
{{/each}}

app/templates/components/forms/session-speaker-form.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
{{#if this.addNewSpeaker}}
139139
{{#each this.allFields.speaker as |field|}}
140140
{{#if field.isIncluded}}
141-
<div class="field">
141+
<form class="field">
142142
<label class="{{if field.isRequired 'required'}}" for="name">{{field.name}}</label>
143143
{{#if (is-input-field field.type) }}
144144
{{#if field.isLongText}}
@@ -242,7 +242,7 @@
242242
</UiDropdown>
243243
{{/if}}
244244
{{/if}}
245-
</div>
245+
</form>
246246
{{/if}}
247247
{{/each}}
248248
{{/if}}
@@ -256,7 +256,7 @@
256256
{{/if}}
257257
{{#each this.allFields.speaker as |field|}}
258258
{{#if field.isIncluded}}
259-
<div class="field">
259+
<form class="field">
260260
<label class="{{if field.isRequired 'required'}}" for="name">{{field.name}}</label>
261261
{{#if (is-input-field field.type) }}
262262
{{#if field.isLongText}}
@@ -364,7 +364,7 @@
364364
</UiDropdown>
365365
{{/if}}
366366
{{/if}}
367-
</div>
367+
</form>
368368
{{/if}}
369369
{{/each}}
370370
{{/if}}

app/templates/components/forms/user-payment-info-form.hbs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,10 @@
5454
@id="state"
5555
@value={{this.userBillingInfo.billingState}} />
5656
</div>
57-
<div class="field">
58-
<label >{{t 'Country'}}</label>
59-
<UiDropdown
60-
@class="search selection"
61-
@selected={{this.userBillingInfo.billingCountry}}
62-
@forceSelection={{false}}
63-
@fullTextSearch={{true}}>
64-
<Input
65-
@type="hidden"
66-
@autocomplete="no"
67-
@id="country"
68-
@value={{this.userBillingInfo.billingCountry}} />
69-
<i class="dropdown icon"></i>
70-
<div class="default text">{{t 'Select country'}}</div>
71-
<div class="menu">
72-
{{#each this.countries as |country|}}
73-
<div class="item" data-value="{{country.name}}">
74-
<i class="{{lowercase country.code}} flag"></i>
75-
{{country.name}}
76-
</div>
77-
{{/each}}
78-
</div>
79-
</UiDropdown>
80-
</div>
57+
<CountryDropdown
58+
@placeholder={{t 'Country'}}
59+
@val={{this.userBillingInfo.billingCountry}}
60+
@id="country" />
8161
<div class="field">
8262
<label for="taxID">{{t 'Tax ID or Business ID'}}</label>
8363
<Input

app/templates/components/forms/wizard/basic-details-step.hbs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -315,30 +315,12 @@
315315
<div class="field">
316316
<h4>{{t 'Add Payment Details'}}</h4>
317317
<div class="two fields">
318-
<div class="field">
319-
<label class="required">{{t 'Select country'}}</label>
320-
<UiDropdown
321-
@class="search selection"
322-
@selected={{this.data.event.paymentCountry}}
323-
@forceSelection={{false}}
324-
@fullTextSearch={{true}}>
325-
<Input
326-
@type="hidden"
327-
@autocomplete="no"
328-
@id="payment_country"
329-
@value={{this.data.event.paymentCountry}} />
330-
<i class="dropdown icon"></i>
331-
<div class="default text">{{t 'Select country'}}</div>
332-
<div class="menu">
333-
{{#each this.paymentCountries as |paymentCountry|}}
334-
<div class="item" data-value="{{paymentCountry.name}}">
335-
<i class="{{lowercase paymentCountry.code}} flag"></i>
336-
{{paymentCountry.name}}
337-
</div>
338-
{{/each}}
339-
</div>
340-
</UiDropdown>
341-
</div>
318+
<CountryDropdown
319+
@required={{true}}
320+
@paymentCountries={{true}}
321+
@placeholder={{t 'Select country'}}
322+
@val={{this.data.event.paymentCountry}}
323+
@id={{'payment_country'}} />
342324
<div class="field">
343325
<label class="required">{{t 'Select currency'}}</label>
344326
<UiDropdown

app/templates/components/modals/tax-info-modal.hbs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,11 @@
44
</div>
55
<div class="y-scrollable scrollable-modal content">
66
<form class="ui form" autocomplete="off" {{action 'updateTaxInfo' on='submit' preventDefault=true}}>
7-
<div class="field">
8-
<label class="required">{{t 'Choose country'}}</label>
9-
<UiDropdown @class="search selection" @selected={{this.tax.country}} @forceSelection={{false}} @fullTextSearch={{true}}>
10-
<Input @type="hidden" @autocomplete="tax-country" @id="tax_country" @value={{this.tax.country}} />
11-
<i class="dropdown icon"></i>
12-
<div class="default text">{{t 'Select country'}}</div>
13-
<div class="menu">
14-
{{#each this.countries as |country|}}
15-
<div class="item" data-value="{{country.name}}">
16-
<i class="{{lowercase country.code}} flag"></i>
17-
{{country.name}}
18-
</div>
19-
{{/each}}
20-
</div>
21-
</UiDropdown>
22-
</div>
7+
<CountryDropdown
8+
@required={{true}}
9+
@placeholder={{t 'Choose country'}}
10+
@val={{this.tax.country}}
11+
@id="tax_country" />
2312
<div class="field">
2413
<label class="required">{{t 'Tax name'}}</label>
2514
<Input @type="text" @id="tax_name" @value={{this.tax.name}} />

app/templates/components/widgets/forms/billing-info.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
@id="zip_code"
4040
@value={{this.data.zipcode}} />
4141
</div>
42-
<div class="field">
42+
<form class="field">
4343
<label class="required">{{t 'Select country'}}</label>
4444
<UiDropdown
4545
@class="search selection"
@@ -61,4 +61,4 @@
6161
{{/each}}
6262
</div>
6363
</UiDropdown>
64-
</div>
64+
</form>

0 commit comments

Comments
 (0)