|
57 | 57 | </template> |
58 | 58 | </TabbedContent> |
59 | 59 |
|
60 | | - <Modal v-model="isParticipantModalOpen" :title="modalTitle" saveText="Save" @save="onSaveParticipant" :isSaveButtonDisabled="isModalSaveButtonDisabled"> |
| 60 | + <Modal v-model="isParticipantModalOpen" |
| 61 | + v-model:submit="isParticipantFormSubmitting" |
| 62 | + :title="modalTitle" |
| 63 | + saveText="Save" |
| 64 | + saveThenAddText="Save Then Add" |
| 65 | + @save="onSaveParticipant" |
| 66 | + @saveThenAdd="onSaveThenAddParticipant" |
| 67 | + :isSaveButtonDisabled="isModalSaveButtonDisabled"> |
61 | 68 | <NotificationBox v-show="participantModalError.length > 0" alertType="danger"> |
62 | 69 | {{ participantModalError }} |
63 | 70 | </NotificationBox> |
64 | 71 |
|
65 | 72 | <PersonPicker |
66 | 73 | formControlClasses="input-width-md margin-l-sm" |
67 | 74 | v-model="personAlias" |
| 75 | + v-model:isSearchModeOpen="isPersonPickerSearchModeOpen" |
68 | 76 | :excludeDeceased="true" |
69 | 77 | :enableSelfSelection="true" |
70 | 78 | label="Individual" |
|
163 | 171 | // Participant Modal properties. |
164 | 172 | const participantModalError = ref(""); |
165 | 173 | const isParticipantModalOpen = ref(false); |
| 174 | + const isPersonPickerSearchModeOpen = ref(true); |
| 175 | + const isParticipantFormSubmitting = ref(false); |
| 176 | + const isSaveThenAdd = ref(false); |
166 | 177 | const isAddingFacilitator = ref(false); |
167 | 178 | /** Used to force a refresh of the facilitators grid. */ |
168 | 179 | const isRefreshingFacilitators = ref(false); |
|
174 | 185 | const participantAttributes = ref<Record<string, PublicAttributeBag>>({}); |
175 | 186 | const participantAttributeValues = ref<Record<string, string>>({}); |
176 | 187 |
|
177 | | - // #endregion |
| 188 | + // #endregion Values |
178 | 189 |
|
179 | 190 | // #region Computed Values |
180 | 191 |
|
181 | 192 | const isModalSaveButtonDisabled = computed(() => isRefreshingStudents.value === true || isRefreshingFacilitators.value === true); |
182 | 193 |
|
183 | | - // #endregion |
| 194 | + // #endregion Computed Values |
184 | 195 |
|
185 | 196 | // #region Functions |
186 | 197 |
|
|
210 | 221 | } |
211 | 222 | } |
212 | 223 |
|
213 | | - // #endregion |
| 224 | + /** Resets the refs for the Participant Modal. */ |
| 225 | + function resetParticipantModal(): void { |
| 226 | + participantModalError.value = ""; |
| 227 | + personAlias.value = undefined; |
| 228 | + participantNote.value = ""; |
| 229 | + isSaveThenAdd.value = false; |
| 230 | + isPersonPickerSearchModeOpen.value = true; |
| 231 | + } |
| 232 | + |
| 233 | + // #endregion Functions |
214 | 234 |
|
215 | 235 | // #region Event Handlers |
216 | 236 |
|
|
372 | 392 | return result.isSuccess; |
373 | 393 | } |
374 | 394 |
|
| 395 | + /** |
| 396 | + * Called when the the modal's save button has been clicked by the individual. |
| 397 | + */ |
375 | 398 | async function onSaveParticipant(): Promise<void> { |
376 | 399 | const participant: LearningParticipantBag = { |
377 | 400 | currentGradePercent: 0, |
|
416 | 439 | return; |
417 | 440 | } |
418 | 441 |
|
419 | | - isParticipantModalOpen.value = false; |
| 442 | + if (!isSaveThenAdd.value) { |
| 443 | + isParticipantModalOpen.value = false; |
| 444 | + } |
| 445 | + else { |
| 446 | + resetParticipantModal(); |
| 447 | + } |
420 | 448 | } |
421 | 449 |
|
422 | | - /** Resets the refs for the Participant Modal. */ |
423 | | - function resetParticipantModal(): void { |
424 | | - participantModalError.value = ""; |
425 | | - personAlias.value = undefined; |
426 | | - participantNote.value = ""; |
| 450 | + /** |
| 451 | + * Called when the the modal's save then add button has been clicked by the individual. |
| 452 | + */ |
| 453 | + async function onSaveThenAddParticipant(): Promise<void> { |
| 454 | + isSaveThenAdd.value = true; |
| 455 | + isParticipantFormSubmitting.value = true; |
427 | 456 | } |
428 | 457 |
|
429 | | - // #endregion |
| 458 | + // #endregion Event Handlers |
430 | 459 |
|
431 | 460 | </script> |
0 commit comments