Skip to content

Commit 9ed8888

Browse files
Hieu Lam - TMAkhangonodkhangnorbusan
authored
feature-8791: Consent of refund policy for the attendee form (#8812)
* feature-8791: Consent of refund policy for the attendee form * feature-8791: Merge code development * feature-8791: Consent of refund policy for the attendee form * feature-8791: Add translate * feature-8791: Consent of refund policy for the attendee form * feature-8791: Consent of refund policy for the attendee form --------- Co-authored-by: Khang On - TMA <[email protected]> Co-authored-by: khangon <[email protected]> Co-authored-by: Norbert Preining <[email protected]>
1 parent 040804f commit 9ed8888

File tree

24 files changed

+224
-72
lines changed

24 files changed

+224
-72
lines changed

app/components/forms/orders/order-form.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,17 @@ export default Component.extend(FormMixin, {
469469
]
470470
};
471471

472+
const isConsentOfRefundPolicyValidation = {
473+
optional : true,
474+
rules : [
475+
{
476+
type : 'regExp',
477+
value : compulsoryProtocolValidUrlPattern,
478+
prompt : this.l10n.t('Please enter a valid URL.')
479+
}
480+
]
481+
};
482+
472483
const languageForm1Validation = {
473484
rules: [
474485
{
@@ -608,6 +619,7 @@ export default Component.extend(FormMixin, {
608619
validationRules.fields[`instagram_required_${ index}`] = instagramRequiredValidation;
609620
validationRules.fields[`linkedin_${ index}`] = linkedinValidation;
610621
validationRules.fields[`linkedin_required_${ index}`] = linkedinRequiredValidation;
622+
validationRules.fields[`is_consent_of_refund_policy_required_${ index}`] = isConsentOfRefundPolicyValidation;
611623
validationRules.fields[`is_consent_form_field_${ index}`] = isConsentFormFieldValidation;
612624
validationRules.fields[`language_form_1_required_${ index}`] = languageForm1Validation;
613625
validationRules.fields[`language_form_2_required_${ index}`] = languageForm2Validation;
@@ -627,16 +639,28 @@ export default Component.extend(FormMixin, {
627639
},
628640

629641
allFields: computed('fields', function() {
630-
const requiredFixed = this.fields.toArray()?.filter(field => field.isFixed);
631-
const customFields = orderBy(this.fields.toArray()?.filter(field => !field.isFixed), ['position']);
642+
let customFields = [];
643+
const requiredFixed = [];
644+
this.fields.forEach(field => {
645+
if (field.isFixed) {
646+
requiredFixed.push(field);
647+
} else {
648+
customFields.push(field);
649+
}
650+
field.nameConvert = field.name;
651+
if (field.name === 'Consent of refund policy') {
652+
field.nameConvert = 'I agree to the terms of the refund policy of the event.';
653+
}
654+
});
655+
customFields = orderBy(customFields, ['position']);
632656
return groupBy(requiredFixed.concat(customFields), field => field.get('form'));
633657
}),
634658

635659
genders : orderBy(genders, 'name'),
636660
ageGroups : orderBy(ageGroups, 'position'),
637661
countries : orderBy(countries, 'name'),
638662
years : orderBy(years, 'year'),
639-
languageForms : orderBy(languageForms, 'item'),
663+
languageForms : orderBy(languageForms, 'name'),
640664
homeWikis : orderBy(homeWikis, 'item'),
641665

642666
actions: {

app/mixins/custom-form.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,23 @@ export default Mixin.create(MutableArray, {
661661
isPublic : false,
662662
event : parent
663663
}),
664+
this.store.createRecord('custom-form', {
665+
name : 'Consent of refund policy',
666+
fieldIdentifier : 'is_consent_of_refund_policy',
667+
formID : _formID,
668+
form : 'attendee',
669+
type : 'checkbox',
670+
isRequired : false,
671+
isIncluded : false,
672+
isPublic : false,
673+
event : parent
674+
}),
664675
this.store.createRecord('custom-form', {
665676
name : 'Consent form field',
666677
fieldIdentifier : 'is_consent_form_field',
667678
formID : _formID,
668679
form : 'attendee',
669-
type : 'select',
680+
type : 'checkbox',
670681
isRequired : false,
671682
isIncluded : false,
672683
isPublic : false,

app/models/attendee.js

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,45 @@ export default ModelBase.extend({
77
/**
88
* Attributes
99
*/
10-
city : attr('string'),
11-
firstname : attr('string'),
12-
lastname : attr('string'),
13-
isCheckedIn : attr('boolean', { defaultValue: false }),
14-
checkinTimes : attr('string'),
15-
checkoutTimes : attr('string'),
16-
state : attr('string'),
17-
address : attr('string'),
18-
pdfUrl : attr('string'),
19-
country : attr('string'),
20-
email : attr('string'),
21-
jobTitle : attr('string'),
22-
phone : attr('string'),
23-
company : attr('string'),
24-
taxBusinessInfo : attr('string'),
25-
billingAddress : attr('string'),
26-
homeAddress : attr('string'),
27-
shippingAddress : attr('string'),
28-
workAddress : attr('string'),
29-
workPhone : attr('string'),
30-
website : attr('string'),
31-
blog : attr('string'),
32-
twitter : attr('string'),
33-
facebook : attr('string'),
34-
github : attr('string'),
35-
instagram : attr('string'),
36-
linkedin : attr('string'),
37-
gender : attr('string'),
38-
ageGroup : attr('string'),
39-
acceptReceiveEmails : attr('boolean', { defaultValue: true }),
40-
acceptVideoRecording : attr('boolean', { defaultValue: true }),
41-
acceptShareDetails : attr('boolean', { defaultValue: true }),
42-
birthDate : attr('moment'),
43-
complexFieldValues : attr(),
44-
language_form_1 : attr('string'),
45-
language_form_2 : attr('string'),
46-
home_wiki : attr('string'),
47-
is_consent_form_field : attr('boolean', { defaultValue: false }),
10+
city : attr('string'),
11+
firstname : attr('string'),
12+
lastname : attr('string'),
13+
isCheckedIn : attr('boolean', { defaultValue: false }),
14+
checkinTimes : attr('string'),
15+
checkoutTimes : attr('string'),
16+
state : attr('string'),
17+
address : attr('string'),
18+
pdfUrl : attr('string'),
19+
country : attr('string'),
20+
email : attr('string'),
21+
jobTitle : attr('string'),
22+
phone : attr('string'),
23+
company : attr('string'),
24+
taxBusinessInfo : attr('string'),
25+
billingAddress : attr('string'),
26+
homeAddress : attr('string'),
27+
shippingAddress : attr('string'),
28+
workAddress : attr('string'),
29+
workPhone : attr('string'),
30+
website : attr('string'),
31+
blog : attr('string'),
32+
twitter : attr('string'),
33+
facebook : attr('string'),
34+
github : attr('string'),
35+
instagram : attr('string'),
36+
linkedin : attr('string'),
37+
gender : attr('string'),
38+
ageGroup : attr('string'),
39+
acceptReceiveEmails : attr('boolean', { defaultValue: true }),
40+
acceptVideoRecording : attr('boolean', { defaultValue: true }),
41+
acceptShareDetails : attr('boolean', { defaultValue: true }),
42+
birthDate : attr('moment'),
43+
complexFieldValues : attr(),
44+
is_consent_of_refund_policy : attr('boolean', { defaultValue: false }),
45+
language_form_1 : attr('string'),
46+
language_form_2 : attr('string'),
47+
home_wiki : attr('string'),
48+
is_consent_form_field : attr('boolean', { defaultValue: false }),
4849

4950
/**
5051
* Relationships

app/models/custom-form.js

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,36 @@ export default ModelBase.extend({
8282
speaker: SPEAKER_FORM_FIELDS,
8383

8484
attendee: {
85-
firstname : tn.t('First Name'),
86-
lastname : tn.t('Last Name'),
87-
email : tn.t('Email'),
88-
address : tn.t('Address (Street, Building, Number etc.)'),
89-
city : tn.t('City'),
90-
state : tn.t('State'),
91-
country : tn.t('Country'),
92-
jobTitle : tn.t('Job Title'),
93-
phone : tn.t('Phone'),
94-
taxBusinessInfo : tn.t('Tax Business Info'),
95-
company : tn.t('Organisation'),
96-
workPhone : tn.t('Work Phone'),
97-
website : tn.t('Website'),
98-
blog : tn.t('Blog'),
99-
twitter : tn.t('Twitter'),
100-
facebook : tn.t('Facebook'),
101-
github : tn.t('GitHub'),
102-
instagram : tn.t('Instagram'),
103-
linkedin : tn.t('LinkedIn'),
104-
mastodon : tn.t('Mastodon'),
105-
gender : tn.t('Gender'),
106-
acceptReceiveEmails : tn.t('Email consent'),
107-
acceptVideoRecording : tn.t('Photo & video & text consent'),
108-
acceptShareDetails : tn.t('Partner contact consent'),
109-
ageGroup : tn.t('Age Group'),
110-
homeWiki : tn.t('What is your home wiki'),
111-
languageForm1 : tn.t('What is your native language, or what language are you most fluent in?'),
112-
languageForm2 : tn.t('Are you fluent in any other of the following languages?'),
113-
is_consent_form_field : tn.t('Consent form field')
85+
firstname : tn.t('First Name'),
86+
lastname : tn.t('Last Name'),
87+
email : tn.t('Email'),
88+
address : tn.t('Address (Street, Building, Number etc.)'),
89+
city : tn.t('City'),
90+
state : tn.t('State'),
91+
country : tn.t('Country'),
92+
jobTitle : tn.t('Job Title'),
93+
phone : tn.t('Phone'),
94+
taxBusinessInfo : tn.t('Tax Business Info'),
95+
company : tn.t('Organisation'),
96+
workPhone : tn.t('Work Phone'),
97+
website : tn.t('Website'),
98+
blog : tn.t('Blog'),
99+
twitter : tn.t('Twitter'),
100+
facebook : tn.t('Facebook'),
101+
github : tn.t('GitHub'),
102+
instagram : tn.t('Instagram'),
103+
linkedin : tn.t('LinkedIn'),
104+
mastodon : tn.t('Mastodon'),
105+
gender : tn.t('Gender'),
106+
acceptReceiveEmails : tn.t('Email consent'),
107+
acceptVideoRecording : tn.t('Photo & video & text consent'),
108+
acceptShareDetails : tn.t('Partner contact consent'),
109+
ageGroup : tn.t('Age Group'),
110+
isConsentOfRefundPolicy : tn.t('Consent of refund policy'),
111+
homeWiki : tn.t('What is your home wiki'),
112+
languageForm1 : tn.t('What is your native language, or what language are you most fluent in?'),
113+
languageForm2 : tn.t('Are you fluent in any other of the following languages?'),
114+
is_consent_form_field : tn.t('Consent form field')
114115
},
115116

116117
ready() {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@
225225
<span> {{t 'and the'}} </span>
226226
<a href="https://foundation.wikimedia.org/wiki/Policy:Friendly_space_policy">{{t 'Friendly Space Policy'}}</a>
227227
<span> .</span>
228+
{{else if (eq field.type 'checkbox')}}
229+
{{#if (and (not-eq field.fieldIdentifier "language_form_1") (not-eq field.fieldIdentifier "language_form_2"))}}
230+
<UiCheckbox
231+
@checked={{get holder field.identifierPath}}
232+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
233+
@onChange={{action (mut (get holder field.identifierPath))}}/>
234+
{{t field.nameConvert}}
235+
{{/if}}
228236
{{/if}}
229237
{{#if (eq field.type 'year')}}
230238
<UiDropdown

translations/ar.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12106,6 +12106,12 @@ msgstr "ما هي لغتك الأم ، أو ما هي اللغة التي تتق
1210612106
msgid "Are you fluent in any other of the following languages?"
1210712107
msgstr "هل تتقن أي لغة أخرى من اللغات التالية؟"
1210812108

12109+
msgid "Consent of refund policy"
12110+
msgstr ""
12111+
12112+
msgid "I agree to the terms of the refund policy of the event."
12113+
msgstr ""
12114+
1210912115
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
1211012116
msgid "I agree to the terms of the"
1211112117
msgstr ""

translations/bn.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11658,6 +11658,11 @@ msgstr "আপনার মাতৃভাষা কি, বা আপনি ক
1165811658
msgid "Are you fluent in any other of the following languages?"
1165911659
msgstr "আপনি কি নিচের অন্য কোন ভাষায় পারদর্শী?"
1166011660

11661+
msgid "Consent of refund policy"
11662+
msgstr "ফেরত নীতির সম্মতি"
11663+
11664+
msgid "I agree to the terms of the refund policy of the event."
11665+
msgstr "আমি ইভেন্টের রিফান্ড নীতির শর্তাবলীতে সম্মত।"
1166111666
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
1166211667
msgid "I agree to the terms of the"
1166311668
msgstr "আমি শর্তাবলী সম্মত"

translations/de.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11673,6 +11673,11 @@ msgstr "Was ist Ihre Muttersprache bzw. welche Sprache beherrschen Sie am besten
1167311673
msgid "Are you fluent in any other of the following languages?"
1167411674
msgstr "Beherrschen Sie eine der folgenden Sprachen fließend?"
1167511675

11676+
msgid "Consent of refund policy"
11677+
msgstr "Zustimmung zur Rückerstattungsrichtlinie"
11678+
11679+
msgid "I agree to the terms of the refund policy of the event."
11680+
msgstr "Ich stimme den Bedingungen der Rückerstattungsrichtlinie der Veranstaltung zu."
1167611681
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
1167711682
msgid "I agree to the terms of the"
1167811683
msgstr "Ich stimme den Bedingungen zu"

translations/en.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11668,6 +11668,11 @@ msgstr "What is your native language, or what language are you most fluent in?"
1166811668
msgid "Are you fluent in any other of the following languages?"
1166911669
msgstr "Are you fluent in any other of the following languages?"
1167011670

11671+
msgid "Consent of refund policy"
11672+
msgstr "Consent of refund policy"
11673+
11674+
msgid "I agree to the terms of the refund policy of the event."
11675+
msgstr "I agree to the terms of the refund policy of the event."
1167111676
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
1167211677
msgid "I agree to the terms of the"
1167311678
msgstr "I agree to the terms of the"

translations/es.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11657,6 +11657,11 @@ msgstr "¿Cuál es su idioma nativo, o qué idioma domina con mayor fluidez?"
1165711657
msgid "Are you fluent in any other of the following languages?"
1165811658
msgstr "¿Hablas con fluidez alguno de los siguientes idiomas?"
1165911659

11660+
msgid "Consent of refund policy"
11661+
msgstr "Consentimiento de la política de reembolso"
11662+
11663+
msgid "I agree to the terms of the refund policy of the event."
11664+
msgstr "Acepto los términos de la política de reembolso del evento."
1166011665
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
1166111666
msgid "I agree to the terms of the"
1166211667
msgstr "Estoy de acuerdo con los términos del"

0 commit comments

Comments
 (0)