Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed career program add and a role validation for opt program CRUD #642

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions frontend/src/components/Forms/OptionalProgramsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
max-width="500px"
>
<template v-slot:activator="{ props }">
<v-btn color="bcGovBlue" prepend-icon="mdi-plus" class="float-right text-none mt-n12 mb-8" @click="openCreateOptionalProgramDialog()" text="Add Optional Program">
<v-btn v-if="hasPermissions('STUDENT', 'optionalProgramUpdate')" color="bcGovBlue" prepend-icon="mdi-plus" class="float-right text-none mt-n12 mb-8" @click="openCreateOptionalProgramDialog()" text="Add Optional Program">
</v-btn>
</template>

Expand Down Expand Up @@ -190,9 +190,7 @@ export default {
studentCareerPrograms: "getStudentCareerPrograms",
studentGradStatus: "getStudentGradStatus",
}),
...mapState(useAccessStore, {
allowOptionalProgramUpdate: "allowOptionalProgramUpdate",
}),
...mapState(useAccessStore, ["hasPermissions"]),
optionalProgramChange() {
return this.form.selectedOptionalProgram;
},
Expand Down Expand Up @@ -278,7 +276,7 @@ export default {
return `${item.code} - ${item.name}`;
}
},
...mapActions(useStudentStore, ["addStudentOptionalProgram"]),
...mapActions(useStudentStore, ["addStudentOptionalProgram", "addStudentCareerPrograms"]),
async fetchPrograms() {
try {
const response = await ProgramManagementService.getOptionalPrograms();
Expand Down Expand Up @@ -324,10 +322,13 @@ export default {
this.form.selectedOptionalProgram = null;
},
submitForm() {
this.addStudentOptionalProgram(
this.form.selectedOptionalProgram,
this.form.selectedCareerPrograms
);
if(this.isCareerProgram(this.form.selectedOptionalProgram)) {
this.addStudentCareerPrograms(this.form.selectedCareerPrograms)
} else {
this.addStudentOptionalProgram(
this.form.selectedOptionalProgram
);
}
this.closeCreateOptionalProgramDialog();
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
>
<template v-slot:activator="{ props }">
<v-btn
v-if="hasPermissions('STUDENT', 'optionalProgramUpdate')"
v-bind="props"
color="error"
icon="mdi-delete-forever"
Expand Down Expand Up @@ -340,6 +341,9 @@
<v-dialog v-model="deleteDialog[item.id]">
<template v-slot:activator="{ props }">
<v-btn
v-if="
hasPermissions('STUDENT', 'optionalProgramUpdate')
"
v-bind="props"
color="error"
icon="mdi-delete-forever"
Expand Down Expand Up @@ -584,6 +588,7 @@ export default {
removeStudentOptionalProgram: "removeStudentOptionalProgram",
removeStudentCareerProgram: "removeStudentCareerProgram",
}),
...mapState(useAccessStore, ["hasPermissions"]),
isProgramComplete(date, program) {
return isProgramComplete(date, program);
},
Expand Down
Loading