Skip to content

Commit 9663982

Browse files
feat: Separate required and optional attendee fields (#4916)
1 parent b1474c3 commit 9663982

File tree

3 files changed

+79
-55
lines changed

3 files changed

+79
-55
lines changed

app/components/forms/wizard/attendee-step.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import Component from '@ember/component';
2+
import { computed } from '@ember/object';
23
import FormMixin from 'open-event-frontend/mixins/form';
34

45
export default Component.extend(FormMixin, {
6+
7+
fixedFields: computed('data.customForms', function() {
8+
return this.data.customForms?.filter(field => field.isFixed);
9+
}),
10+
11+
editableFields: computed('data.customForms', function() {
12+
return this.data.customForms?.filter(field => !field.isFixed);
13+
}),
14+
515
actions: {
616
saveDraft() {
717
this.onValid(() => {

app/templates/components/forms/wizard/attendee-step.hbs

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,20 @@
2525
</div>
2626
</div>
2727
</div>
28+
<div class="ui hidden divider"></div>
29+
<h3 class="ui dividing header">
30+
<i class="checkmark box icon"></i>
31+
<div class="content">
32+
{{t 'Required Form Fields'}}
33+
</div>
34+
</h3>
35+
<div class="ui two column stackable grid">
36+
<div class="column">
37+
<Forms::Wizard::CustomForms::Table
38+
@fields={{this.fixedFields}} />
39+
</div>
40+
</div>
2841
{{#if this.data.event.isTicketFormEnabled}}
29-
<div class="ui hidden divider"></div>
3042
<h3 class="ui dividing header">
3143
<i class="checkmark box icon"></i>
3244
<div class="content">
@@ -35,60 +47,8 @@
3547
</h3>
3648
<div class="ui two column stackable grid">
3749
<div class="column">
38-
<table class="ui selectable celled table">
39-
<thead>
40-
<tr>
41-
{{#if this.device.isMobile}}
42-
<th class="center aligned">
43-
{{t 'Options'}}
44-
</th>
45-
{{else}}
46-
<th class="right aligned">
47-
{{t 'Option'}}
48-
</th>
49-
<th class="center aligned">
50-
{{t 'Type'}}
51-
</th>
52-
<th class="center aligned">
53-
{{t 'Include'}}
54-
</th>
55-
<th class="center aligned">
56-
{{t 'Require'}}
57-
</th>
58-
{{/if}}
59-
</tr>
60-
</thead>
61-
<tbody>
62-
{{#each this.data.customForms as |field|}}
63-
<tr class="{{if field.isIncluded 'positive'}}">
64-
<td class="{{if this.device.isMobile 'center' 'right'}} aligned">
65-
<label class="{{if field.isFixed 'required'}}">
66-
{{field.name}}
67-
</label>
68-
</td>
69-
<td class="center aligned">
70-
{{field.type}}
71-
</td>
72-
<td class="center aligned">
73-
<UiCheckbox
74-
@class="slider"
75-
@checked={{field.isIncluded}}
76-
@disabled={{field.isFixed}}
77-
@onChange={{action (mut field.isIncluded)}}
78-
@label={{if this.device.isMobile (t "Include")}} />
79-
</td>
80-
<td class="center aligned">
81-
<UiCheckbox
82-
@class="slider"
83-
@checked={{field.isRequired}}
84-
@disabled={{field.isFixed}}
85-
@onChange={{action (mut field.isRequired)}}
86-
@label={{if this.device.isMobile (t "Require")}} />
87-
</td>
88-
</tr>
89-
{{/each}}
90-
</tbody>
91-
</table>
50+
<Forms::Wizard::CustomForms::Table
51+
@fields={{this.editableFields}} />
9252
</div>
9353
</div>
9454
<Forms::Wizard::CustomFormInput
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<table class="ui selectable celled table">
2+
<thead>
3+
<tr>
4+
{{#if this.device.isMobile}}
5+
<th class="center aligned">
6+
{{t 'Options'}}
7+
</th>
8+
{{else}}
9+
<th class="right aligned">
10+
{{t 'Option'}}
11+
</th>
12+
<th class="center aligned">
13+
{{t 'Type'}}
14+
</th>
15+
<th class="center aligned">
16+
{{t 'Include'}}
17+
</th>
18+
<th class="center aligned">
19+
{{t 'Require'}}
20+
</th>
21+
{{/if}}
22+
</tr>
23+
</thead>
24+
<tbody>
25+
{{#each @fields as |field|}}
26+
<tr class="{{if field.isIncluded 'positive'}}">
27+
<td class="{{if this.device.isMobile 'center' 'right'}} aligned">
28+
<label class="{{if field.isFixed 'required'}}">
29+
{{field.name}}
30+
</label>
31+
</td>
32+
<td class="center aligned">
33+
{{field.type}}
34+
</td>
35+
<td class="center aligned">
36+
<UiCheckbox
37+
@class="slider"
38+
@checked={{field.isIncluded}}
39+
@disabled={{field.isFixed}}
40+
@onChange={{action (mut field.isIncluded)}}
41+
@label={{if this.device.isMobile (t "Include")}} />
42+
</td>
43+
<td class="center aligned">
44+
<UiCheckbox
45+
@class="slider"
46+
@checked={{field.isRequired}}
47+
@disabled={{field.isFixed}}
48+
@onChange={{action (mut field.isRequired)}}
49+
@label={{if this.device.isMobile (t "Require")}} />
50+
</td>
51+
</tr>
52+
{{/each}}
53+
</tbody>
54+
</table>

0 commit comments

Comments
 (0)