11<template >
22 <div class =" flex flex-col size-full overflow-y-auto gap-8 px-6 py-8" >
33 <div
4- class =" rounded-3xl bg-base-100 shadow-lg flex flex-col border border-base-300"
4+ class =" rounded-3xl bg-base-100 shadow-lg flex flex-col border border-base-300"
55 >
66 <div class =" p-8 gap-4 admin-overview-grid" >
7- <FontAwesomeIcon class =" opacity-75" icon =" user" />
7+ <FontAwesomeIcon class =" opacity-75" icon =" user" />
88 <span class =" text-body text-primary"
9- >{{ registeredSupervisorsAmount }}/{{ allSupervisorsAmount }}</span
9+ >{{ registeredSupervisorsAmount }}/{{ allSupervisorsAmount }}</span
1010 >
1111 <span class =" text-x-small opacity-50"
12- >{{ t("admin.supervisorAmount") }}
12+ >{{ t("admin.supervisorAmount") }}
1313 </span >
1414
15- <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
15+ <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
1616 <span class =" text-body text-primary"
17- >{{ availableSpots }}/{{ totalSpots }}</span
17+ >{{ availableSpots }}/{{ totalSpots }}</span
1818 >
1919 <span class =" text-x-small opacity-50"
20- >{{ t("admin.availableSpots") }}
20+ >{{ t("admin.availableSpots") }}
2121 </span >
2222 </div >
23- <hr class =" border-base-300" >
23+ <hr class =" border-base-300" / >
2424 <div class =" p-8 gap-4 admin-overview-grid" >
25- <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
25+ <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
2626 <span class =" text-body text-primary"
27- >{{ acceptedSupervisionRequestsCount }}/{{ amountOfStudents }}</span
27+ >{{ acceptedSupervisionRequestsCount }}/{{ amountOfStudents }}</span
2828 >
2929 <span class =" text-x-small opacity-50" >{{
30- t("admin.studentsWithSupervisor")
31- }}</span >
30+ t("admin.studentsWithSupervisor")
31+ }}</span >
3232
33- <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
33+ <FontAwesomeIcon class =" opacity-75" icon =" user-group" />
3434 <span class =" text-body text-primary" >{{
35- pendingSupervisionRequestsCount
36- }}</span >
35+ pendingSupervisionRequestsCount
36+ }}</span >
3737 <span class =" text-x-small opacity-50" >{{
38- t("admin.waitingStudents")
39- }}</span >
38+ t("admin.waitingStudents")
39+ }}</span >
4040 </div >
4141 </div >
4242
4343 <CustomButton
44- :text =" t('generic.upload')"
45- color =" info"
46- left-icon =" cloud-upload-alt"
47- wide
48- @click =" navigateTo('/admin/upload')"
44+ :text =" t('generic.upload')"
45+ color =" info"
46+ left-icon =" cloud-upload-alt"
47+ wide
48+ @click =" navigateTo('/admin/upload')"
4949 />
5050
5151 <CustomButton
52- :text =" t('generic.download')"
53- color =" success"
54- left-icon =" file-download"
55- wide
56- @click =" navigateTo('/admin/download')"
52+ :text =" t('generic.download')"
53+ color =" success"
54+ left-icon =" file-download"
55+ wide
56+ @click =" navigateTo('/admin/download')"
5757 />
5858
5959 <CustomButton
60- :text =" t('generic.addAdmin')"
61- color =" warning"
62- left-icon =" gear"
63- wide
64- @click =" navigateTo('/admin/add-admin')"
60+ :text =" t('generic.addAdmin')"
61+ color =" warning"
62+ left-icon =" gear"
63+ wide
64+ @click =" navigateTo('/admin/add-admin')"
6565 />
6666
67- <!-- < CustomButton-->
68- <!-- color="error" -->
69- <!-- left-icon="trash-can" -->
70- <!-- text="Delete Data" -->
71- <!-- wide-->
72- <!-- @click="navigateTo('/admin/delete')"-->
73- <!-- /> -- >
67+ <CustomButton
68+ :text = " t('appHeader.admin.deleteData') "
69+ color = " error "
70+ left-icon = " trash-can "
71+ wide
72+ @click =" navigateTo('/admin/delete')"
73+ / >
7474 </div >
7575</template >
7676
7777<script lang="ts" setup>
7878import { FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
79- import { HttpMethods , supervisionRequestStatus , UserRoles , } from " #shared/enums/enums" ;
79+ import {
80+ HttpMethods ,
81+ supervisionRequestStatus ,
82+ UserRoles ,
83+ } from " #shared/enums/enums" ;
8084import type { UserCreateData , UserData } from " #shared/types/userInterfaces" ;
8185import type { SupervisorProfile } from " #shared/types/supervisorInterfaces" ;
8286import type { SupervisionRequest } from " #shared/types/requests" ;
@@ -119,43 +123,43 @@ const getSupervisorInfo = async () => {
119123 }
120124 allUsers .value = data .value || [];
121125 const allSupervisors = data .value ?.filter (
122- (user ) => user .role === UserRoles .SUPERVISOR
126+ (user ) => user .role === UserRoles .SUPERVISOR
123127 );
124128 const registeredSupervisors = allSupervisors ?.filter (
125- (user ) => user .is_registered
129+ (user ) => user .is_registered
126130 );
127131 allSupervisorsAmount .value = allSupervisors ?.length || 0 ;
128132 registeredSupervisorsAmount .value = registeredSupervisors ?.length || 0 ;
129133};
130134
131135const getAvailableSpots = async () => {
132136 const allSupervisorProfiles = await $fetch <SupervisorProfile []>(
133- " /api/supervisors" ,
134- {
135- method: " GET" ,
136- headers: {
137- " Content-Type" : " application/json" ,
138- Accept: " application/json" ,
139- },
140- }
137+ " /api/supervisors" ,
138+ {
139+ method: " GET" ,
140+ headers: {
141+ " Content-Type" : " application/json" ,
142+ Accept: " application/json" ,
143+ },
144+ }
141145 );
142146 console .log (" all supervisors:" );
143147 console .log (allSupervisorProfiles );
144148 totalSpots .value =
145- allSupervisorProfiles .reduce (
146- (acc : number , supervisor : SupervisorProfile ) => {
147- return acc + supervisor .total_spots ;
148- },
149- 0
150- ) || 0 ;
149+ allSupervisorProfiles .reduce (
150+ (acc : number , supervisor : SupervisorProfile ) => {
151+ return acc + supervisor .total_spots ;
152+ },
153+ 0
154+ ) || 0 ;
151155
152156 availableSpots .value =
153- allSupervisorProfiles .reduce (
154- (acc : number , supervisor : SupervisorProfile ) => {
155- return acc + supervisor .available_spots ;
156- },
157- 0
158- ) || 0 ;
157+ allSupervisorProfiles .reduce (
158+ (acc : number , supervisor : SupervisorProfile ) => {
159+ return acc + supervisor .available_spots ;
160+ },
161+ 0
162+ ) || 0 ;
159163};
160164
161165const getAmountOfStudentsThatHaveASupervisorAndRequestStates = async () => {
@@ -168,43 +172,43 @@ const getAmountOfStudentsThatHaveASupervisorAndRequestStates = async () => {
168172 });
169173 amountOfStudents .value = allStudents .length ;
170174 const acceptedRequests = await $fetch <SupervisionRequest []>(
171- " /api/supervision-requests" ,
172- {
173- method: " GET" ,
174- headers: {
175- " Content-Type" : " application/json" ,
176- Accept: " application/json" ,
177- },
178- query: {
179- request_state: supervisionRequestStatus .ACCEPTED ,
180- },
181- }
175+ " /api/supervision-requests" ,
176+ {
177+ method: " GET" ,
178+ headers: {
179+ " Content-Type" : " application/json" ,
180+ Accept: " application/json" ,
181+ },
182+ query: {
183+ request_state: supervisionRequestStatus .ACCEPTED ,
184+ },
185+ }
182186 );
183187 acceptedSupervisionRequestsCount .value = acceptedRequests .length || 0 ;
184188
185189 const pendingSupervisionRequests = await $fetch <SupervisionRequest []>(
186- " /api/supervision-requests" ,
187- {
188- method: " GET" ,
189- headers: {
190- " Content-Type" : " application/json" ,
191- Accept: " application/json" ,
192- },
193- query: {
194- request_state: supervisionRequestStatus .PENDING ,
195- },
196- }
190+ " /api/supervision-requests" ,
191+ {
192+ method: " GET" ,
193+ headers: {
194+ " Content-Type" : " application/json" ,
195+ Accept: " application/json" ,
196+ },
197+ query: {
198+ request_state: supervisionRequestStatus .PENDING ,
199+ },
200+ }
197201 );
198202 pendingSupervisionRequestsCount .value =
199- pendingSupervisionRequests .length || 0 ;
203+ pendingSupervisionRequests .length || 0 ;
200204};
201205
202206const getAdminRegistrationStatus = async () => {
203207 if (! registrationStore .status ?.is_registered ) {
204208 if (! isLoaded .value ) await until (isLoaded ).toBe (true );
205209 const adminEmail = ref ({} as UserCreateData );
206210 adminEmail .value .email =
207- user .value ?.primaryEmailAddress ?.emailAddress || " " ;
211+ user .value ?.primaryEmailAddress ?.emailAddress || " " ;
208212 await useFetch (" /api/users/" , {
209213 method: HttpMethods .POST ,
210214 body: {
0 commit comments