Skip to content

Commit d5a8abb

Browse files
committed
+ (Engagement) Improved the process of adding individuals to an LMS class by adding a "Save Then Add" button. This allows administrators to add multiple students more efficiently without reopening the "Add Student" dialog each time.
1 parent 3d5cc97 commit d5a8abb

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

Rock.JavaScript.Obsidian.Blocks/src/Lms/LearningClassSecondaryLists/learningClassSecondaryLists.partial.obs

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@
5757
</template>
5858
</TabbedContent>
5959

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">
6168
<NotificationBox v-show="participantModalError.length > 0" alertType="danger">
6269
{{ participantModalError }}
6370
</NotificationBox>
6471

6572
<PersonPicker
6673
formControlClasses="input-width-md margin-l-sm"
6774
v-model="personAlias"
75+
v-model:isSearchModeOpen="isPersonPickerSearchModeOpen"
6876
:excludeDeceased="true"
6977
:enableSelfSelection="true"
7078
label="Individual"
@@ -163,6 +171,9 @@
163171
// Participant Modal properties.
164172
const participantModalError = ref("");
165173
const isParticipantModalOpen = ref(false);
174+
const isPersonPickerSearchModeOpen = ref(true);
175+
const isParticipantFormSubmitting = ref(false);
176+
const isSaveThenAdd = ref(false);
166177
const isAddingFacilitator = ref(false);
167178
/** Used to force a refresh of the facilitators grid. */
168179
const isRefreshingFacilitators = ref(false);
@@ -174,13 +185,13 @@
174185
const participantAttributes = ref<Record<string, PublicAttributeBag>>({});
175186
const participantAttributeValues = ref<Record<string, string>>({});
176187

177-
// #endregion
188+
// #endregion Values
178189

179190
// #region Computed Values
180191

181192
const isModalSaveButtonDisabled = computed(() => isRefreshingStudents.value === true || isRefreshingFacilitators.value === true);
182193

183-
// #endregion
194+
// #endregion Computed Values
184195

185196
// #region Functions
186197

@@ -210,7 +221,16 @@
210221
}
211222
}
212223

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
214234

215235
// #region Event Handlers
216236

@@ -372,6 +392,9 @@
372392
return result.isSuccess;
373393
}
374394

395+
/**
396+
* Called when the the modal's save button has been clicked by the individual.
397+
*/
375398
async function onSaveParticipant(): Promise<void> {
376399
const participant: LearningParticipantBag = {
377400
currentGradePercent: 0,
@@ -416,16 +439,22 @@
416439
return;
417440
}
418441

419-
isParticipantModalOpen.value = false;
442+
if (!isSaveThenAdd.value) {
443+
isParticipantModalOpen.value = false;
444+
}
445+
else {
446+
resetParticipantModal();
447+
}
420448
}
421449

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;
427456
}
428457

429-
// #endregion
458+
// #endregion Event Handlers
430459

431460
</script>

0 commit comments

Comments
 (0)