113113 </template >
114114 </Card >
115115 <LogoutButton />
116+
117+ <!-- Success Dialog -->
118+ <Dialog
119+ v-model:visible =" showSuccessDialog"
120+ modal
121+ header =" Success"
122+ :closable =" true"
123+ :close-on-escape =" true"
124+ :style =" { width: '90vw', maxWidth: '500px' }"
125+ >
126+ <p class =" text-base mb-2" >Your project preferences have been successfully submitted.</p >
127+ <p class =" text-base mb-4" >You can return to this page anytime to update your preferences.</p >
128+
129+ <div class =" flex flex-col sm:flex-row gap-2 justify-center" >
130+ <Button
131+ label =" Close"
132+ @click =" showSuccessDialog = false"
133+ class =" flex-1 sm:flex-none"
134+ severity =" secondary"
135+ />
136+ </div >
137+ </Dialog >
116138 </div >
117139</template >
118140
@@ -135,6 +157,7 @@ import type { FileDetailsDto } from "../../dtos/file-details-dto";
135157import type { StudentSubmissionDto } from " ../../dtos/student-submission-dto" ;
136158import { Column , DataTable } from " primevue" ;
137159import { useRoute } from ' vue-router' ;
160+ import Dialog from " primevue/dialog" ;
138161
139162const toast = useToast ();
140163const route = useRoute ();
@@ -147,6 +170,7 @@ const maxNumberOfPreferences = 10;
147170const warningMessage = " A maximum of " + maxNumberOfPreferences + " preferences has been selected. Anything more than the top " + maxNumberOfPreferences + " preferences will not be saved" ;
148171let exceededPreferenceLimit = false
149172const loading = ref (false )
173+ const showSuccessDialog = ref (false )
150174
151175const projectsRaw = ref ([] as ProjectDto []);
152176const projects = ref ([[], []] as ProjectDto [][]);
@@ -166,7 +190,7 @@ onMounted(async () => {
166190 loading .value = true
167191 try {
168192 await loadProjects ()
169- const maybeStudent = await ApiService .get <StudentSubmissionDto | undefined >(" /students/me" )
193+ const maybeStudent = await ApiService .get <StudentSubmissionDto | undefined >(` /students/me?classId=${ classId } ` )
170194 if (maybeStudent ) {
171195 console .log (maybeStudent )
172196 files .value = maybeStudent .files ?? []
@@ -241,7 +265,7 @@ const submitForm = async () => {
241265 if (result == null ) {
242266 toast .add ({ severity: ' error' , summary: ' Failed' , detail: ' Submission failed. If the issue persists contact developers' , life: 5000 });
243267 } else {
244- toast . add ({ severity: ' success ' , summary: ' Success ' , detail: ' Submitted preferences ' , life: 5000 }) ;
268+ showSuccessDialog . value = true ;
245269 }
246270};
247271
0 commit comments