Skip to content

Commit

Permalink
Added student side logic to student page
Browse files Browse the repository at this point in the history
  • Loading branch information
EMcNugget committed Nov 11, 2024
1 parent 41e6870 commit 331d25a
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/routes/(authed)/dash/sessions/[sessionId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
await invalidateAll();
rescheduleOpen = false;
}
function check_time(t: string) {
const start_time = DateTime.fromISO(t);
const now = DateTime.now();
const interval = start_time.diff(now, 'hours');
if (interval.hours < 24) {
return false;
} else {
return true;
}
}
</script>

<div class="flex flex-col gap-4">
Expand Down Expand Up @@ -91,8 +103,8 @@
{data.sessionInfo.sessionType.category} - {data.sessionInfo.sessionType.name}
</p>
<p><b>Duration:</b> {data.sessionInfo.sessionType.length} minutes</p>
{#if data.isMentor}
<h2 class="font-bold text-lg">Mentor/Staff Actions</h2>
{#if data.isMentor || check_time(data.sessionInfo.session.start)}
<h2 class="font-bold text-lg">Session Actions</h2>
<div>
<Button
onclick={() => {
Expand All @@ -111,6 +123,11 @@
Reschedule
</Button>
</div>
{:else}
<p class="text-red-500">
You cannot cancel or reschedule this session as it is less than 24 hours away. Please contact
your instructor if you need to cancel or reschedule.
</p>
{/if}
</div>

Expand All @@ -130,7 +147,11 @@
<ModalBody>
<div class="px-4">
<p class="text-red-500">
It is your responsibility to inform the student of the cancellation.
{#if data.isMentor}
It is your responsibility to inform the student of the cancellation.
{:else}
It is your responsibility to inform the instructor of the cancellation.
{/if}
</p>
</div>
</ModalBody>
Expand Down Expand Up @@ -169,7 +190,11 @@
</div>

<p class="text-red-500">
It is your responsibility to inform the student of the rescheduling.
{#if data.isMentor}
It is your responsibility to inform the student of the rescheduling.
{:else}
It is your responsibility to inform the instructor of the rescheduling.
{/if}
</p>
</div>
</ModalBody>
Expand Down

0 comments on commit 331d25a

Please sign in to comment.