Skip to content

Commit c0a353f

Browse files
committed
Merge branch 'SCRUM-308-Frontend-update-readme' of https://github.com/App-Dev-3/Superwise into SCRUM-308-Frontend-update-readme
2 parents 967cd29 + 5b3d30e commit c0a353f

File tree

5 files changed

+362
-93
lines changed

5 files changed

+362
-93
lines changed

Frontend/i18n/locales/de-DE.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,21 @@
3030
"uploadSupervisorsFileName": "wähle *.csv aus",
3131
"uploadTagsDescription": "Dies aktualisiert die Tags und die Ähnlichkeitswerte",
3232
"uploadTagsFileName": "wähle updated_tag_list.json aus",
33-
"waitingStudents": "warten derzeit auf die Genehmigung der Betreuung"
33+
"waitingStudents": "warten derzeit auf die Genehmigung der Betreuung",
34+
"deleteUser": {
35+
"title": "Benutzer Löschen",
36+
"searchPlaceholder": "Benutzer nach Name, E-Mail oder Rolle suchen...",
37+
"selectedUser": "Ausgewählter Benutzer:",
38+
"noUsersFound": "Keine Benutzer gefunden für",
39+
"searchInstruction": "Tippen Sie, um nach Benutzern zu suchen...",
40+
"description": "Dies setzt das Benutzerkonto vollständig auf den nicht registrierten Zustand zurück, wobei die E-Mail-Adresse für eine erneute Registrierung erhalten bleibt.",
41+
"deleteButton": "Benutzer Löschen",
42+
"deleting": "Lösche...",
43+
"selectUserError": "Bitte wählen Sie einen Benutzer zum Löschen aus",
44+
"generalError": "Ein Fehler ist beim Zurücksetzen des Benutzers aufgetreten",
45+
"permissionError": "Berechtigung verweigert - Admin-Benutzer können nicht zurückgesetzt werden",
46+
"userNotFoundError": "Benutzer nicht gefunden"
47+
}
3448
},
3549
"appHeader": {
3650
"addAdmin": "Admin Hinzufügen",
@@ -480,4 +494,4 @@
480494
"somethingWentWrong": "Etwas ist schief gelaufen, bitte versuchen Sie es später noch einmal",
481495
"addedStudentAsSupervisee": "Student wurde als Betreuer hinzugefügt"
482496
}
483-
}
497+
}

Frontend/i18n/locales/en-GB.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,21 @@
3030
"uploadSupervisorsFileName": "select *.csv",
3131
"uploadTagsDescription": "This updates the tags and the similarity scores",
3232
"uploadTagsFileName": "select updated_tag_list.json",
33-
"waitingStudents": "are currently waiting for supervision approval"
33+
"waitingStudents": "are currently waiting for supervision approval",
34+
"deleteUser": {
35+
"title": "Delete User",
36+
"searchPlaceholder": "Search users by name, email, or role...",
37+
"selectedUser": "Selected User:",
38+
"noUsersFound": "No users found matching",
39+
"searchInstruction": "Type to search for users...",
40+
"description": "This completely resets the user account to unregistered state while preserving email for re-registration.",
41+
"deleteButton": "Delete User",
42+
"deleting": "Deleting...",
43+
"selectUserError": "Please select a user to delete",
44+
"generalError": "An error occurred while resetting the user",
45+
"permissionError": "Permission denied - cannot reset admin users",
46+
"userNotFoundError": "User not found"
47+
}
3448
},
3549
"appHeader": {
3650
"addAdmin": "Add Admin",

Frontend/pages/admin/dashboard.vue

Lines changed: 90 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,86 @@
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>
7878
import { 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";
8084
import type { UserCreateData, UserData } from "#shared/types/userInterfaces";
8185
import type { SupervisorProfile } from "#shared/types/supervisorInterfaces";
8286
import 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
131135
const 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
161165
const 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
202206
const 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

Comments
 (0)