Skip to content

Commit 7abb852

Browse files
Merge pull request #29 from COS301-SE-2024/feature/frontend/modals
Modals completed
2 parents 94b3ea4 + e1a9d37 commit 7abb852

File tree

11 files changed

+376
-195
lines changed

11 files changed

+376
-195
lines changed

src/client/src/lib/components/admin/+Admins.svelte

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script lang="ts">
2-
import { Button } from 'flowbite-svelte';
2+
import AddAdmin from '$lib/components/modals/+AddAdmin.svelte';
3+
import EditAdmin from '$lib/components/modals/+EditAdmin.svelte';
4+
import Remove from '$lib/components/modals/+Remove.svelte';
35
const admins = [
46
{
57
name: 'Katlego Tau',
@@ -103,52 +105,7 @@
103105
</div>
104106

105107
<div class="mt-4 flex items-center gap-x-3">
106-
<button
107-
class="flex w-1/2 items-center justify-center gap-x-2 rounded-lg border bg-white px-5 py-2 text-sm text-gray-700 transition-colors duration-200 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 sm:w-auto"
108-
>
109-
<svg
110-
width="20"
111-
height="20"
112-
viewBox="0 0 20 20"
113-
fill="none"
114-
xmlns="http://www.w3.org/2000/svg"
115-
>
116-
<g clip-path="url(#clip0_3098_154395)">
117-
<path
118-
d="M13.3333 13.3332L9.99997 9.9999M9.99997 9.9999L6.66663 13.3332M9.99997 9.9999V17.4999M16.9916 15.3249C17.8044 14.8818 18.4465 14.1806 18.8165 13.3321C19.1866 12.4835 19.2635 11.5359 19.0351 10.6388C18.8068 9.7417 18.2862 8.94616 17.5555 8.37778C16.8248 7.80939 15.9257 7.50052 15 7.4999H13.95C13.6977 6.52427 13.2276 5.61852 12.5749 4.85073C11.9222 4.08295 11.104 3.47311 10.1817 3.06708C9.25943 2.66104 8.25709 2.46937 7.25006 2.50647C6.24304 2.54358 5.25752 2.80849 4.36761 3.28129C3.47771 3.7541 2.70656 4.42249 2.11215 5.23622C1.51774 6.04996 1.11554 6.98785 0.935783 7.9794C0.756025 8.97095 0.803388 9.99035 1.07431 10.961C1.34523 11.9316 1.83267 12.8281 2.49997 13.5832"
119-
stroke="currentColor"
120-
stroke-width="1.67"
121-
stroke-linecap="round"
122-
stroke-linejoin="round"
123-
/>
124-
</g>
125-
<defs>
126-
<clipPath id="clip0_3098_154395">
127-
<rect width="20" height="20" fill="white" />
128-
</clipPath>
129-
</defs>
130-
</svg>
131-
132-
<span>Import</span>
133-
</button>
134-
135-
<Button>
136-
<svg
137-
xmlns="http://www.w3.org/2000/svg"
138-
fill="none"
139-
viewBox="0 0 24 24"
140-
stroke-width="1.5"
141-
stroke="currentColor"
142-
class="h-5 w-5"
143-
>
144-
<path
145-
stroke-linecap="round"
146-
stroke-linejoin="round"
147-
d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
148-
/>
149-
</svg>
150-
<span>Add Admin</span>
151-
</Button>
108+
<AddAdmin />
152109
</div>
153110
</div>
154111

@@ -249,24 +206,8 @@
249206
>
250207
<td class="whitespace-nowrap px-4 py-4 text-sm">
251208
<div class="flex items-center gap-x-6">
252-
<button
253-
class="text-gray-500 transition-colors duration-200 hover:text-yellow-500 focus:outline-none dark:text-gray-300 dark:hover:text-yellow-500"
254-
>
255-
<svg
256-
xmlns="http://www.w3.org/2000/svg"
257-
fill="none"
258-
viewBox="0 0 24 24"
259-
stroke-width="1.5"
260-
stroke="currentColor"
261-
class="h-5 w-5"
262-
>
263-
<path
264-
stroke-linecap="round"
265-
stroke-linejoin="round"
266-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
267-
/>
268-
</svg>
269-
</button>
209+
<Remove />
210+
<EditAdmin />
270211
</div>
271212
</td>
272213
</tr>

src/client/src/lib/components/admin/+Lectures.svelte

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script lang="ts">
2-
import { Button } from 'flowbite-svelte';
2+
import AddLecturer from '$lib/components/modals/+AddLecturer.svelte';
3+
import EditLecturer from '$lib/components/modals/+EditLecturer.svelte';
4+
import Remove from '$lib/components/modals/+Remove.svelte';
35
const lecturers = [
46
{
57
name: 'Azola Lukhozi',
@@ -104,52 +106,7 @@
104106
</div>
105107

106108
<div class="mt-4 flex items-center gap-x-3">
107-
<button
108-
class="flex w-1/2 items-center justify-center gap-x-2 rounded-lg border bg-white px-5 py-2 text-sm text-gray-700 transition-colors duration-200 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 sm:w-auto"
109-
>
110-
<svg
111-
width="20"
112-
height="20"
113-
viewBox="0 0 20 20"
114-
fill="none"
115-
xmlns="http://www.w3.org/2000/svg"
116-
>
117-
<g clip-path="url(#clip0_3098_154395)">
118-
<path
119-
d="M13.3333 13.3332L9.99997 9.9999M9.99997 9.9999L6.66663 13.3332M9.99997 9.9999V17.4999M16.9916 15.3249C17.8044 14.8818 18.4465 14.1806 18.8165 13.3321C19.1866 12.4835 19.2635 11.5359 19.0351 10.6388C18.8068 9.7417 18.2862 8.94616 17.5555 8.37778C16.8248 7.80939 15.9257 7.50052 15 7.4999H13.95C13.6977 6.52427 13.2276 5.61852 12.5749 4.85073C11.9222 4.08295 11.104 3.47311 10.1817 3.06708C9.25943 2.66104 8.25709 2.46937 7.25006 2.50647C6.24304 2.54358 5.25752 2.80849 4.36761 3.28129C3.47771 3.7541 2.70656 4.42249 2.11215 5.23622C1.51774 6.04996 1.11554 6.98785 0.935783 7.9794C0.756025 8.97095 0.803388 9.99035 1.07431 10.961C1.34523 11.9316 1.83267 12.8281 2.49997 13.5832"
120-
stroke="currentColor"
121-
stroke-width="1.67"
122-
stroke-linecap="round"
123-
stroke-linejoin="round"
124-
/>
125-
</g>
126-
<defs>
127-
<clipPath id="clip0_3098_154395">
128-
<rect width="20" height="20" fill="white" />
129-
</clipPath>
130-
</defs>
131-
</svg>
132-
133-
<span>Import</span>
134-
</button>
135-
136-
<Button>
137-
<svg
138-
xmlns="http://www.w3.org/2000/svg"
139-
fill="none"
140-
viewBox="0 0 24 24"
141-
stroke-width="1.5"
142-
stroke="currentColor"
143-
class="h-5 w-5"
144-
>
145-
<path
146-
stroke-linecap="round"
147-
stroke-linejoin="round"
148-
d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
149-
/>
150-
</svg>
151-
<span>Add Lecturer</span>
152-
</Button>
109+
<AddLecturer />
153110
</div>
154111
</div>
155112

@@ -250,24 +207,8 @@
250207
>
251208
<td class="whitespace-nowrap px-4 py-4 text-sm">
252209
<div class="flex items-center gap-x-6">
253-
<button
254-
class="text-gray-500 transition-colors duration-200 hover:text-yellow-500 focus:outline-none dark:text-gray-300 dark:hover:text-yellow-500"
255-
>
256-
<svg
257-
xmlns="http://www.w3.org/2000/svg"
258-
fill="none"
259-
viewBox="0 0 24 24"
260-
stroke-width="1.5"
261-
stroke="currentColor"
262-
class="h-5 w-5"
263-
>
264-
<path
265-
stroke-linecap="round"
266-
stroke-linejoin="round"
267-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
268-
/>
269-
</svg>
270-
</button>
210+
<Remove />
211+
<EditLecturer />
271212
</div>
272213
</td>
273214
</tr>

src/client/src/lib/components/admin/+Students.svelte

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script lang="ts">
2-
import { Button } from 'flowbite-svelte';
2+
import AddStudent from '$lib/components/modals/+AddStudent.svelte';
3+
import EditStudent from '$lib/components/modals/+EditStudent.svelte';
4+
import Remove from '$lib/components/modals/+Remove.svelte';
35
const students = [
46
{
57
name: 'Azola Lukhozi',
@@ -103,52 +105,7 @@
103105
</div>
104106

105107
<div class="mt-4 flex items-center gap-x-3">
106-
<button
107-
class="flex w-1/2 items-center justify-center gap-x-2 rounded-lg border bg-white px-5 py-2 text-sm text-gray-700 transition-colors duration-200 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 sm:w-auto"
108-
>
109-
<svg
110-
width="20"
111-
height="20"
112-
viewBox="0 0 20 20"
113-
fill="none"
114-
xmlns="http://www.w3.org/2000/svg"
115-
>
116-
<g clip-path="url(#clip0_3098_154395)">
117-
<path
118-
d="M13.3333 13.3332L9.99997 9.9999M9.99997 9.9999L6.66663 13.3332M9.99997 9.9999V17.4999M16.9916 15.3249C17.8044 14.8818 18.4465 14.1806 18.8165 13.3321C19.1866 12.4835 19.2635 11.5359 19.0351 10.6388C18.8068 9.7417 18.2862 8.94616 17.5555 8.37778C16.8248 7.80939 15.9257 7.50052 15 7.4999H13.95C13.6977 6.52427 13.2276 5.61852 12.5749 4.85073C11.9222 4.08295 11.104 3.47311 10.1817 3.06708C9.25943 2.66104 8.25709 2.46937 7.25006 2.50647C6.24304 2.54358 5.25752 2.80849 4.36761 3.28129C3.47771 3.7541 2.70656 4.42249 2.11215 5.23622C1.51774 6.04996 1.11554 6.98785 0.935783 7.9794C0.756025 8.97095 0.803388 9.99035 1.07431 10.961C1.34523 11.9316 1.83267 12.8281 2.49997 13.5832"
119-
stroke="currentColor"
120-
stroke-width="1.67"
121-
stroke-linecap="round"
122-
stroke-linejoin="round"
123-
/>
124-
</g>
125-
<defs>
126-
<clipPath id="clip0_3098_154395">
127-
<rect width="20" height="20" fill="white" />
128-
</clipPath>
129-
</defs>
130-
</svg>
131-
132-
<span>Import</span>
133-
</button>
134-
135-
<Button>
136-
<svg
137-
xmlns="http://www.w3.org/2000/svg"
138-
fill="none"
139-
viewBox="0 0 24 24"
140-
stroke-width="1.5"
141-
stroke="currentColor"
142-
class="h-5 w-5"
143-
>
144-
<path
145-
stroke-linecap="round"
146-
stroke-linejoin="round"
147-
d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
148-
/>
149-
</svg>
150-
<span>Add Student</span>
151-
</Button>
108+
<AddStudent />
152109
</div>
153110
</div>
154111

@@ -249,24 +206,8 @@
249206
>
250207
<td class="whitespace-nowrap px-4 py-4 text-sm">
251208
<div class="flex items-center gap-x-6">
252-
<button
253-
class="text-gray-500 transition-colors duration-200 hover:text-yellow-500 focus:outline-none dark:text-gray-300 dark:hover:text-yellow-500"
254-
>
255-
<svg
256-
xmlns="http://www.w3.org/2000/svg"
257-
fill="none"
258-
viewBox="0 0 24 24"
259-
stroke-width="1.5"
260-
stroke="currentColor"
261-
class="h-5 w-5"
262-
>
263-
<path
264-
stroke-linecap="round"
265-
stroke-linejoin="round"
266-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
267-
/>
268-
</svg>
269-
</button>
209+
<Remove />
210+
<EditStudent />
270211
</div>
271212
</td>
272213
</tr>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<script>
2+
import { Button, Modal, Label, Input } from 'flowbite-svelte';
3+
4+
let formModal = false;
5+
6+
// Function to handle form submission
7+
async function handleSubmit(event) {
8+
event.preventDefault();
9+
}
10+
</script>
11+
12+
<Button on:click={() => (formModal = true)} class="mx-2">
13+
<svg
14+
xmlns="http://www.w3.org/2000/svg"
15+
fill="none"
16+
viewBox="0 0 24 24"
17+
stroke-width="1.5"
18+
stroke="currentColor"
19+
class="h-5 w-5"
20+
>
21+
<path
22+
stroke-linecap="round"
23+
stroke-linejoin="round"
24+
d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
25+
/>
26+
</svg>
27+
<span class="px-2">Add Admin</span>
28+
</Button>
29+
30+
<Modal bind:open={formModal} size="xs" autoclose={false} class="w-full">
31+
<form class="flex flex-col space-y-6" on:submit={handleSubmit}>
32+
<h3 class="mb-4 text-xl font-medium text-gray-900 dark:text-white">Add New Admin</h3>
33+
34+
<Label for="name" class="mb-2 mt-2 space-y-2">Name</Label>
35+
<Input type="text" id="name" name="name" placeholder="Example University" size="md" required />
36+
37+
<Label for="email" class="mb-2 mt-2 space-y-2">Email</Label>
38+
<Input type="text" id="email" name="email" placeholder="[email protected]" size="md" required />
39+
40+
<Label for="email" class="mb-2 mt-2 space-y-2">Department</Label>
41+
<Input type="text" id="department" name="department" placeholder="Arts" size="md" required />
42+
43+
<Button type="submit" class="w-full1">Add Admin</Button>
44+
</form>
45+
</Modal>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<script>
2+
import { Button, Modal, Label, Input } from 'flowbite-svelte';
3+
4+
let formModal = false;
5+
6+
// Function to handle form submission
7+
async function handleSubmit(event) {
8+
event.preventDefault();
9+
}
10+
</script>
11+
12+
<Button on:click={() => (formModal = true)} class="mx-2">
13+
<svg
14+
xmlns="http://www.w3.org/2000/svg"
15+
fill="none"
16+
viewBox="0 0 24 24"
17+
stroke-width="1.5"
18+
stroke="currentColor"
19+
class="h-5 w-5"
20+
>
21+
<path
22+
stroke-linecap="round"
23+
stroke-linejoin="round"
24+
d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
25+
/>
26+
</svg>
27+
<span class="px-2">Add Lecturer</span>
28+
</Button>
29+
30+
<Modal bind:open={formModal} size="xs" autoclose={false} class="w-full">
31+
<form class="flex flex-col space-y-6" on:submit={handleSubmit}>
32+
<h3 class="mb-4 text-xl font-medium text-gray-900 dark:text-white">Add Lecturer</h3>
33+
34+
<Label for="name" class="mb-2 mt-2 space-y-2">Name</Label>
35+
<Input type="text" id="name" name="name" placeholder="Example University" size="md" required />
36+
37+
<Label for="email" class="mb-2 mt-2 space-y-2">Email</Label>
38+
<Input type="text" id="email" name="email" placeholder="[email protected]" size="md" required />
39+
40+
<Label for="email" class="mb-2 mt-2 space-y-2">Role</Label>
41+
<Input type="text" id="role" name="role" placeholder="Lecturer" size="md" required />
42+
43+
<Button type="submit" class="w-full1">Add Lecturer</Button>
44+
</form>
45+
</Modal>

0 commit comments

Comments
 (0)