File tree Expand file tree Collapse file tree 13 files changed +82
-115
lines changed Expand file tree Collapse file tree 13 files changed +82
-115
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 45
45
<label class =" required" for =" adminBillingPaypalEmail" >{{ t ' Paypal Email' }} </label >
46
46
<Input @type =" email" @id =" adminBillingPaypalEmail" @value ={{ this.model.adminBillingPaypalEmail }} />
47
47
</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" />
64
53
<div class =" field" >
65
54
<label for =" adminBillingTaxInfo" >{{ t ' Tax ID' }} </label >
66
55
<Input @type =" text" @id =" adminBillingTaxInfo" @value ={{ this.model.adminBillingTaxInfo }} />
Original file line number Diff line number Diff line change 52
52
{{ #each this.ticketFees as |ticketFee |}}
53
53
<div class =" ui five column very relaxed grid" >
54
54
<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 }} />
76
60
</div >
77
61
<div class =" ui field four wide column" >
78
62
<label class =" required" >{{ t ' Select currency' }} </label >
Original file line number Diff line number Diff line change 61
61
</div >
62
62
{{ #each this.allFields.attendee as |field |}}
63
63
{{ #if field.isIncluded }}
64
- <div class =" field" >
64
+ <form class =" field" >
65
65
<label class =" {{ if field.isRequired ' required' }} " for =" name" >{{ field.name }} </label >
66
66
{{ #if (is-input-field field.type ) }}
67
67
{{ #if field.isLongText }}
140
140
</div >
141
141
</UiDropdown >
142
142
{{ /if }}
143
- </div >
143
+ </form >
144
144
{{ /if }}
145
145
{{ /each }}
146
146
{{ /each }}
Original file line number Diff line number Diff line change 138
138
{{ #if this.addNewSpeaker }}
139
139
{{ #each this.allFields.speaker as |field |}}
140
140
{{ #if field.isIncluded }}
141
- <div class =" field" >
141
+ <form class =" field" >
142
142
<label class =" {{ if field.isRequired ' required' }} " for =" name" >{{ field.name }} </label >
143
143
{{ #if (is-input-field field.type ) }}
144
144
{{ #if field.isLongText }}
242
242
</UiDropdown >
243
243
{{ /if }}
244
244
{{ /if }}
245
- </div >
245
+ </form >
246
246
{{ /if }}
247
247
{{ /each }}
248
248
{{ /if }}
256
256
{{ /if }}
257
257
{{ #each this.allFields.speaker as |field |}}
258
258
{{ #if field.isIncluded }}
259
- <div class =" field" >
259
+ <form class =" field" >
260
260
<label class =" {{ if field.isRequired ' required' }} " for =" name" >{{ field.name }} </label >
261
261
{{ #if (is-input-field field.type ) }}
262
262
{{ #if field.isLongText }}
364
364
</UiDropdown >
365
365
{{ /if }}
366
366
{{ /if }}
367
- </div >
367
+ </form >
368
368
{{ /if }}
369
369
{{ /each }}
370
370
{{ /if }}
Original file line number Diff line number Diff line change 54
54
@id =" state"
55
55
@value ={{ this.userBillingInfo.billingState }} />
56
56
</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" />
81
61
<div class =" field" >
82
62
<label for =" taxID" >{{ t ' Tax ID or Business ID' }} </label >
83
63
<Input
Original file line number Diff line number Diff line change 315
315
<div class =" field" >
316
316
<h4 >{{ t ' Add Payment Details' }} </h4 >
317
317
<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' }} />
342
324
<div class =" field" >
343
325
<label class =" required" >{{ t ' Select currency' }} </label >
344
326
<UiDropdown
Original file line number Diff line number Diff line change 4
4
</div >
5
5
<div class =" y-scrollable scrollable-modal content" >
6
6
<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" />
23
12
<div class =" field" >
24
13
<label class =" required" >{{ t ' Tax name' }} </label >
25
14
<Input @type =" text" @id =" tax_name" @value ={{ this.tax.name }} />
Original file line number Diff line number Diff line change 39
39
@id =" zip_code"
40
40
@value ={{ this.data.zipcode }} />
41
41
</div >
42
- <div class =" field" >
42
+ <form class =" field" >
43
43
<label class =" required" >{{ t ' Select country' }} </label >
44
44
<UiDropdown
45
45
@class =" search selection"
61
61
{{ /each }}
62
62
</div >
63
63
</UiDropdown >
64
- </div >
64
+ </form >
You can’t perform that action at this time.
0 commit comments