Skip to content

Commit a3f6d5a

Browse files
author
Hieu Lam - TMA
authored
fix-8819: Unexpected error displayed when saving event in Speaker section (#9064)
1 parent 1efa6f7 commit a3f6d5a

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

app/components/forms/wizard/sessions-speakers-step.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,6 @@ export default Component.extend(EventWizardMixin, FormMixin, {
226226
if (this.data.event.customForms && !this.data.event.customForms.length) {
227227
this.set('data.event.customForms', this.getCustomForm(this.data.event));
228228
}
229-
230-
if (this.data.event.sessionTypes && !this.data.event.sessionTypes.length) {
231-
this.data.event.sessionTypes.addObject(this.store.createRecord('session-type'));
232-
}
233-
234-
if (this.data.event.tracks && !this.data.event.tracks.length) {
235-
this.data.event.tracks.addObject(this.store.createRecord('track'));
236-
}
237-
238-
if (this.data.event.microlocations && !this.data.event.microlocations.length) {
239-
this.data.event.microlocations.addObject(this.store.createRecord('microlocation'));
240-
}
241229
},
242230

243231
actions: {
@@ -301,6 +289,35 @@ export default Component.extend(EventWizardMixin, FormMixin, {
301289
},
302290
onChange() {
303291
this.onValid(() => {});
292+
},
293+
toggleSessionSpeaker() {
294+
if (!this.data.event.isSessionsSpeakersEnabled) {
295+
this.set('data.event.isSessionsSpeakersEnabled', true);
296+
if (this.data.event.sessionTypes && !this.data.event.sessionTypes.length) {
297+
this.data.event.sessionTypes.addObject(this.store.createRecord('session-type'));
298+
}
299+
300+
if (this.data.event.tracks && !this.data.event.tracks.length) {
301+
this.data.event.tracks.addObject(this.store.createRecord('track'));
302+
}
303+
304+
if (this.data.event.microlocations && !this.data.event.microlocations.length) {
305+
this.data.event.microlocations.addObject(this.store.createRecord('microlocation'));
306+
}
307+
} else {
308+
this.set('data.event.isSessionsSpeakersEnabled', false);
309+
if (this.data.event.sessionTypes && this.data.event.sessionTypes.length) {
310+
this.data.event.sessionTypes.clear();
311+
}
312+
313+
if (this.data.event.tracks && this.data.event.tracks.length) {
314+
this.data.event.tracks.clear();
315+
}
316+
317+
if (this.data.event.microlocations && this.data.event.microlocations.length) {
318+
this.data.event.microlocations.clear();
319+
}
320+
}
304321
}
305322
}
306323
});

app/templates/components/forms/wizard/sessions-speakers-step.hbs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@
55
<div class="ui {{if this.data.event.isSessionsSpeakersEnabled 'basic'}} segment">
66
<div class="center aligned text">
77
<div class="field">
8-
<div class="ui slider checkbox">
9-
<Input @type="checkbox" @checked={{this.data.event.isSessionsSpeakersEnabled}} />
8+
<div class="d-flex" style="justify-content: center;">
9+
<UiCheckbox
10+
@class="ui slider"
11+
@checked={{if this.data.event.isSessionsSpeakersEnabled 'active'}}
12+
@onChange={{action "toggleSessionSpeaker"}} />
1013
<label class="weight-300" style="font-size: large">
1114
{{if this.data.event.isSessionsSpeakersEnabled (t 'Turn off') (t 'Turn on')}}
1215
{{t 'Sessions & Speakers'}}
1316
</label>
1417
</div>
18+
{{!-- <div class="ui slider checkbox">
19+
<Input @type="checkbox" @checked={{this.data.event.isSessionsSpeakersEnabled}} />
20+
<label class="weight-300" style="font-size: large">
21+
{{if this.data.event.isSessionsSpeakersEnabled (t 'Turn off') (t 'Turn on')}}
22+
{{t 'Sessions & Speakers'}}
23+
</label>
24+
</div> --}}
1525
</div>
1626
</div>
1727
</div>

0 commit comments

Comments
 (0)