25 Commits

Author SHA1 Message Date
8c1b132f8d Merge branch 'Calendar-Improvements' of https://gitea.iceberg-gaming.com/17th-Ranger-Battalion-ORG/milsim-site-v4 into Calendar-Improvements
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m17s
2025-12-05 16:47:27 -05:00
4e69b419f0 Merge branch 'main' into Calendar-Improvements
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m18s
2025-12-05 15:43:49 -06:00
a233b15ad4 Switched clock icon to something more readable at that size 2025-12-05 16:34:00 -05:00
94b5bfcff7 Added support for public read only calendar #53
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m18s
2025-12-05 16:28:42 -05:00
09d20fd18f prevented header wiggle when editable value changes
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m18s
2025-12-05 16:16:51 -05:00
89280dd3a7 Added (hidden) attendees summary
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m18s
2025-12-05 16:12:25 -05:00
575455a0fc overhauled attendance visualization to be more useful for planning
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m22s
2025-12-05 16:04:32 -05:00
ccb132b9b0 Improvements to event details UI to address #41
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m30s
2025-12-05 12:53:32 -05:00
98138f51f4 Fixed glitchtip disabled state inverted (whoops)
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m12s
2025-12-04 23:42:28 -05:00
e550f862bc event details area initial redesign 2025-12-04 23:41:55 -05:00
6d6789c4a6 Disabled attendance buttons if event end time is past current time to address #55
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m13s
2025-12-04 22:55:57 -05:00
5a7b3ba2ab fixed application form sizing
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m12s
2025-12-03 19:23:50 -05:00
2de6b18135 Fixed scrolling on unauthroized page 2025-12-03 19:16:10 -05:00
aedcbd9492 Sticky'd navbar
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m11s
2025-12-03 19:14:47 -05:00
f985e0234c Merge pull request 'Onboarding-Reworko' (#52) from Onboarding-Reworko into main
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m11s
Reviewed-on: #52
2025-12-03 16:58:17 -06:00
66ad8df0c1 Merge branch 'main' into Onboarding-Reworko
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m10s
2025-12-03 16:58:03 -06:00
9bc3098d58 Merge pull request 'Navbar-Rework' (#50) from Navbar-Rework into main
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m11s
Reviewed-on: #50
2025-12-03 16:57:56 -06:00
cf98bba0cd fixed loading placeholder location 2025-12-03 17:56:59 -05:00
d31cb50d71 Added navigation to application stuff under the profile menu 2025-12-03 17:53:31 -05:00
4e6745553b added application view to final stage of onboarding 2025-12-03 17:44:41 -05:00
faf183a23d fixed scrolling issues 2025-12-03 17:01:52 -05:00
3449dcec5c minor UX refinements 2025-12-03 16:05:47 -05:00
12d538dafc vastly modified acceptance/denial display 2025-12-03 15:36:49 -05:00
b79e78c2a6 overhauled recruiter tools 2025-12-03 15:20:37 -05:00
b8f18c060e Mega recruitment pipeline overhaul 2025-12-03 13:37:03 -05:00
23 changed files with 861 additions and 212 deletions

View File

@@ -38,12 +38,27 @@ router.get('/all', async (req, res) => {
});
router.get('/me', async (req, res) => {
let userID = req.user.id;
console.log("application/me")
try {
let application = await getMemberApplication(userID);
let app = getMemberApplication(userID);
console.log(app);
if (application === undefined)
res.sendStatus(204);
const comments: CommentRow[] = await getApplicationComments(application.id);
const output: ApplicationFull = {
application,
comments,
}
return res.status(200).json(output);
} catch (error) {
console.error('Failed to load application:', error);
return res.status(500).json(error);
}
})
// GET /application/:id

View File

@@ -123,15 +123,9 @@ export async function setAttendanceStatus(memberID: number, eventID: number, sta
}
export async function getEventAttendance(eventID: number): Promise<CalendarSignup[]> {
const sql = `
SELECT
s.member_id,
s.status,
m.name AS member_name
FROM calendar_events_signups s
LEFT JOIN members m ON s.member_id = m.id
WHERE s.event_id = ?
`;
return await pool.query(sql, [eventID]);
const sql = "CALL `sp_GetCalendarEventSignups`(?)"
const res = await pool.query(sql, [eventID]);
console.log(res[0]);
return res[0];
}

View File

@@ -26,6 +26,7 @@ export interface CalendarSignup {
eventID: number;
status: CalendarAttendance;
member_name?: string;
member_unit?: string;
}
export interface CalendarEventShort {

View File

@@ -22,6 +22,7 @@ const environment = import.meta.env.VITE_ENVIRONMENT;
<template>
<div class="flex flex-col min-h-screen">
<div class="sticky top-0 bg-background z-50">
<Navbar class="flex"></Navbar>
<Alert v-if="environment == 'dev'" class="m-2 mx-auto w-5xl" variant="info">
<AlertDescription class="flex flex-row items-center text-nowrap gap-5 mx-auto">
@@ -34,6 +35,7 @@ const environment = import.meta.env.VITE_ENVIRONMENT;
<Button variant="secondary">End LOA</Button>
</AlertDescription>
</Alert>
</div>
<RouterView class="flex-1 min-h-0"></RouterView>
</div>

View File

@@ -74,7 +74,7 @@ export enum ApplicationStatus {
const addr = import.meta.env.VITE_APIHOST;
export async function loadApplication(id: number | string): Promise<ApplicationFull | null> {
const res = await fetch(`${addr}/application/${id}`)
const res = await fetch(`${addr}/application/${id}`, { credentials: 'include' })
if (res.status === 204) return null
if (!res.ok) throw new Error('Failed to load application')
const json = await res.json()

View File

@@ -156,6 +156,12 @@ function blurAfter() {
<RouterLink to="/join" @click="blurAfter">Join</RouterLink>
</NavigationMenuLink>
</NavigationMenuItem>
<!-- Calendar -->
<NavigationMenuItem>
<NavigationMenuLink as-child :class="navigationMenuTriggerStyle()">
<RouterLink to="/calendar" @click="blurAfter">Calendar</RouterLink>
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
</div>
@@ -167,8 +173,9 @@ function blurAfter() {
<p>{{ userStore.user.name }}</p>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>My Profile</DropdownMenuItem>
<DropdownMenuItem>Settings</DropdownMenuItem>
<!-- <DropdownMenuItem>My Profile</DropdownMenuItem> -->
<!-- <DropdownMenuItem>Settings</DropdownMenuItem> -->
<DropdownMenuItem @click="$router.push('/join')">My Application</DropdownMenuItem>
<DropdownMenuItem :variant="'destructive'" @click="logout()">Logout</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>

View File

@@ -38,7 +38,7 @@ function onSubmit(values: { text: string }, { resetForm }: { resetForm: () => vo
<Form :validation-schema="commentSchema" @submit="onSubmit">
<FormField name="text" v-slot="{ componentField }">
<FormItem>
<FormLabel class="sr-only">Comment</FormLabel>
<FormLabel>Comment</FormLabel>
<FormControl>
<Textarea v-bind="componentField" rows="3" placeholder="Write a comment…"
class="bg-neutral-800 resize-none w-full" />

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { CalendarEvent, CalendarSignup } from '@shared/types/calendar'
import { CircleAlert, Clock, EllipsisVertical, MapPin, User, X } from 'lucide-vue-next';
import { computed, onMounted, ref, watch } from 'vue';
import { CircleAlert, Clock4, EllipsisVertical, MapPin, User, X } from 'lucide-vue-next';
import { computed, ref, watch } from 'vue';
import ButtonGroup from '../ui/button-group/ButtonGroup.vue';
import Button from '../ui/button/Button.vue';
import { CalendarAttendance, getCalendarEvent, setCalendarEventAttendance, setCancelCalendarEvent } from '@/api/calendar';
@@ -11,24 +11,13 @@ import DropdownMenu from '../ui/dropdown-menu/DropdownMenu.vue';
import DropdownMenuTrigger from '../ui/dropdown-menu/DropdownMenuTrigger.vue';
import DropdownMenuContent from '../ui/dropdown-menu/DropdownMenuContent.vue';
import DropdownMenuItem from '../ui/dropdown-menu/DropdownMenuItem.vue';
import { Calendar } from 'lucide-vue-next';
const route = useRoute();
// const eventID = computed(() => {
// const id = route.params.id;
// if (typeof id === 'string') return id;
// return undefined;
// });
const loaded = ref<boolean>(false);
const activeEvent = ref<CalendarEvent | null>(null);
// onMounted(async () => {
// let eventID = route.params.id;
// console.log(eventID);
// activeEvent.value = await getCalendarEvent(Number(eventID));
// loaded.value = true;
// });
watch(
() => route.params.id,
async (id) => {
@@ -45,23 +34,27 @@ const emit = defineEmits<{
(e: 'edit', event: CalendarEvent): void
}>()
// const activeEvent = computed(() => props.event)
const startFmt = new Intl.DateTimeFormat(undefined, {
weekday: 'short', year: 'numeric', month: 'short', day: 'numeric',
hour: 'numeric', minute: '2-digit'
const dateFmt = new Intl.DateTimeFormat(undefined, {
weekday: 'long', month: 'short', day: 'numeric',
})
const endFmt = new Intl.DateTimeFormat(undefined, {
const timeFmt = new Intl.DateTimeFormat(undefined, {
hour: 'numeric', minute: '2-digit'
})
const whenText = computed(() => {
if (!activeEvent.value?.start) return ''
const s = new Date(activeEvent.value.start)
const e = activeEvent.value?.end ? new Date(activeEvent.value.end) : null
return e
? `${startFmt.format(s)} ${endFmt.format(e)}`
: `${startFmt.format(s)}`
const dateText = computed(() => {
let start = dateFmt.format(new Date(activeEvent.value.start));
let end = dateFmt.format(new Date(activeEvent.value.end));
if (start === end)
return start;
else
return `${start} - ${end}`;
})
const timeText = computed(() => {
let startTime = timeFmt.format(new Date(activeEvent.value.start))
let endTime = timeFmt.format(new Date(activeEvent.value.end))
return [startTime, endTime]
})
const attending = computed<CalendarSignup[]>(() => { return activeEvent.value.eventSignups.filter((s) => s.status == CalendarAttendance.Attending) })
@@ -71,6 +64,7 @@ const viewedState = ref<CalendarAttendance>(CalendarAttendance.Attending);
let user = useUserStore();
const myAttendance = computed<CalendarSignup | null>(() => {
if (!user.isLoggedIn) return null;
return activeEvent.value.eventSignups.find(
(s) => s.member_id === user.user.id
) || null;
@@ -83,6 +77,7 @@ async function setAttendance(state: CalendarAttendance) {
}
const canEditEvent = computed(() => {
if (!user.isLoggedIn) return false;
if (user.user.id == activeEvent.value.creator_id)
return true;
});
@@ -97,17 +92,94 @@ async function forceReload() {
activeEvent.value = await getCalendarEvent(activeEvent.value.id);
}
const isPast = computed(() => {
const end = new Date(activeEvent.value.end)
// is current date later than end date
return new Date() < end;
})
const attendanceTab = ref<"Alpha" | "Echo" | "Other">("Alpha");
const attendanceList = computed<CalendarSignup[]>(() => {
let out: CalendarSignup[] = [];
if (attendanceTab.value === 'Alpha') {
out = activeEvent.value.eventSignups?.filter((s) => s.member_unit === 'Alpha Company');
} else if (attendanceTab.value === 'Echo') {
out = activeEvent.value.eventSignups?.filter((s) => s.member_unit === 'Echo Company')
} else {
out = activeEvent.value.eventSignups?.filter((s) => s.member_unit != 'Alpha Company' && s.member_unit != 'Echo Company')
}
const statusOrder: Record<CalendarAttendance, number> = {
[CalendarAttendance.Attending]: 1,
[CalendarAttendance.Maybe]: 2,
[CalendarAttendance.NotAttending]: 3,
};
out.sort((a, b) => statusOrder[a.status] - statusOrder[b.status]);
return out;
})
const attendanceCountsByGroup = computed(() => {
const signups = activeEvent.value.eventSignups ?? [];
return {
Alpha: signups.filter(s => s.member_unit === "Alpha Company").length,
Echo: signups.filter(s => s.member_unit === "Echo Company").length,
Other: signups.filter(s =>
s.member_unit !== "Alpha Company" &&
s.member_unit !== "Echo Company"
).length,
};
});
const attendanceStatusSummary = computed(() => {
const signups = activeEvent.value.eventSignups ?? [];
return {
attending: signups.filter(s => s.status === CalendarAttendance.Attending).length,
maybe: signups.filter(s => s.status === CalendarAttendance.Maybe).length,
notAttending: signups.filter(s => s.status === CalendarAttendance.NotAttending).length,
};
});
const statusColor = (status: CalendarAttendance) => {
switch (status) {
case CalendarAttendance.Attending:
return "text-success";
case CalendarAttendance.Maybe:
return "text-yellow-600";
case CalendarAttendance.NotAttending:
return "text-destructive";
default:
return "";
}
};
const displayStatus = (status: CalendarAttendance) => {
switch (status) {
case CalendarAttendance.Attending:
return "Attending";
case CalendarAttendance.Maybe:
return "Maybe";
case CalendarAttendance.NotAttending:
return "Declined";
default:
return status;
}
};
defineExpose({ forceReload })
</script>
<template>
<div v-if="loaded">
<!-- Header -->
<div class="flex items-center justify-between gap-3 border-b px-4 py-3">
<div class="flex items-center justify-between gap-3 border-b px-4 py-3 h-14">
<h2 class="text-lg font-semibold break-all">
{{ activeEvent?.name || 'Event' }}
</h2>
<div class="flex gap-4">
<div class="flex gap-4 items-center">
<DropdownMenu v-if="canEditEvent">
<DropdownMenuTrigger>
<button
@@ -119,8 +191,7 @@ defineExpose({forceReload})
<DropdownMenuItem @click="emit('edit', activeEvent)">
Edit
</DropdownMenuItem>
<DropdownMenuItem v-if="activeEvent.cancelled"
@click="setCancel(false)">
<DropdownMenuItem v-if="activeEvent.cancelled" @click="setCancel(false)">
Un-Cancel
</DropdownMenuItem>
<DropdownMenuItem v-else @click="setCancel(true)">
@@ -142,7 +213,7 @@ defineExpose({forceReload})
<CircleAlert></CircleAlert> This event has been cancelled
</div>
</section>
<section class="w-full">
<section v-if="isPast && user.isLoggedIn" class="w-full">
<ButtonGroup class="flex w-full">
<Button variant="outline"
:class="myAttendance?.status === CalendarAttendance.Attending ? 'border-2 border-primary text-primary' : ''"
@@ -155,24 +226,21 @@ defineExpose({forceReload})
@click="setAttendance(CalendarAttendance.NotAttending)">Declined</Button>
</ButtonGroup>
</section>
<!-- When -->
<section v-if="whenText" class="space-y-2 w-full">
<div class="inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-sm">
<Clock class="size-4 opacity-80" />
<span class="font-medium">{{ whenText }}</span>
<!-- Meta -->
<section class="space-y-3 w-full">
<p class="text-lg font-semibold">Details</p>
<div class="text-foreground/80 flex gap-3 items-center">
<Calendar :size="20"></Calendar> {{ dateText }}
</div>
<div class="text-foreground/80 flex gap-3 items-center">
<Clock4 :size="20"></Clock4> {{ timeText[0] }} - {{ timeText[1] }}
</div>
<div class="text-foreground/80 flex gap-3 items-center">
<MapPin :size="20"></MapPin> {{ activeEvent.location || "Unknown" }}
</div>
<div class="text-foreground/80 flex gap-3 items-center">
<User :size="20"></User> {{ activeEvent.creator_name || "Unknown User" }}
</div>
</section>
<!-- Quick meta chips -->
<section class="flex flex-wrap gap-2 w-full">
<span class="inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs">
<MapPin class="size-3.5 opacity-80" />
<span class="font-medium">{{ activeEvent.location || "Unknown" }}</span>
</span>
<span class="inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs">
<User class="size-3.5 opacity-80" />
<span class="font-medium">Created by: {{ activeEvent.creator_name || "Unknown User"
}}</span>
</span>
</section>
<!-- Description -->
<section class="space-y-2 w-full">
@@ -181,46 +249,41 @@ defineExpose({forceReload})
{{ activeEvent.description }}
</p>
</section>
<!-- Attendance -->
<!-- attendance -->
<section class="space-y-2 w-full">
<div class="flex items-center gap-5">
<p class="text-lg font-semibold">Attendance</p>
<!-- <div class="text-muted-foreground flex gap-6">
<p>Going <span class="ml-1">{{ attendanceStatusSummary.attending }}</span></p>
<p>Maybe <span class="ml-1">{{ attendanceStatusSummary.maybe }}</span></p>
<p>Declined <span class="ml-1">{{ attendanceStatusSummary.notAttending }}</span></p>
</div> -->
</div>
<div class="flex flex-col border bg-muted/50 rounded-lg min-h-24 my-2">
<div class="flex w-full pt-2 border-b *:w-full *:text-center *:pb-1 *:cursor-pointer">
<label
:class="viewedState === CalendarAttendance.Attending ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="viewedState = CalendarAttendance.Attending">Going {{ attending.length }}</label>
<label
:class="viewedState === CalendarAttendance.Maybe ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="viewedState = CalendarAttendance.Maybe">Maybe {{ maybe.length }}</label>
<label
:class="viewedState === CalendarAttendance.NotAttending ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="viewedState = CalendarAttendance.NotAttending">Declined {{ declined.length
}}</label>
<label :class="attendanceTab === 'Alpha' ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="attendanceTab = 'Alpha'">Alpha {{ attendanceCountsByGroup.Alpha }}</label>
<label :class="attendanceTab === 'Echo' ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="attendanceTab = 'Echo'">Echo {{ attendanceCountsByGroup.Echo }}</label>
<label :class="attendanceTab === 'Other' ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="attendanceTab = 'Other'">Other {{ attendanceCountsByGroup.Other }}</label>
</div>
<div class="px-5 py-4 min-h-28">
<div v-if="viewedState === CalendarAttendance.Attending" v-for="person in attending">
<p>{{ person.member_name }}</p>
<div class="pb-1 min-h-48">
<div class="grid grid-cols-2 font-semibold text-muted-foreground border-b py-1 px-3 mb-2">
<p>Name</p>
<p class="text-right">Status</p>
</div>
<div v-if="viewedState === CalendarAttendance.Maybe" v-for="person in maybe">
<p>{{ person.member_name }}</p>
</div>
<div v-if="viewedState === CalendarAttendance.NotAttending" v-for="person in declined">
<div v-for="person in attendanceList" :key="person.member_id"
class="grid grid-cols-2 py-1 *:px-3 hover:bg-muted">
<p>{{ person.member_name }}</p>
<p :class="statusColor(person.status)" class="text-right">
{{ displayStatus(person.status) }}
</p>
</div>
</div>
</div>
</section>
</div>
<!-- Footer (optional actions) -->
<!-- <div class="border-t px-4 py-3 flex items-center justify-end gap-2">
<button class="rounded-md border px-3 py-1.5 text-sm hover:bg-muted/40 transition">
Edit
</button>
<button
class="rounded-md bg-primary text-primary-foreground px-3 py-1.5 text-sm hover:opacity-90 transition">
Open details
</button>
</div> -->
</div>
</template>

View File

@@ -0,0 +1,31 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperRoot, useForwardPropsEmits } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
defaultValue: { type: Number, required: false },
orientation: { type: String, required: false },
dir: { type: String, required: false },
modelValue: { type: Number, required: false },
linear: { type: Boolean, required: false },
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const emits = defineEmits(["update:modelValue"]);
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardPropsEmits(delegatedProps, emits);
</script>
<template>
<StepperRoot
v-slot="slotProps"
:class="cn('flex gap-2', props.class)"
v-bind="forwarded"
>
<slot v-bind="slotProps" />
</StepperRoot>
</template>

View File

@@ -0,0 +1,25 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperDescription, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperDescription
v-slot="slotProps"
v-bind="forwarded"
:class="cn('text-xs text-muted-foreground', props.class)"
>
<slot v-bind="slotProps" />
</StepperDescription>
</template>

View File

@@ -0,0 +1,36 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperIndicator, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperIndicator
v-slot="slotProps"
v-bind="forwarded"
:class="
cn(
'inline-flex items-center justify-center rounded-full text-muted-foreground/50 w-8 h-8',
// Disabled
'group-data-[disabled]:text-muted-foreground group-data-[disabled]:opacity-50',
// Active
'group-data-[state=active]:bg-primary group-data-[state=active]:text-primary-foreground',
// Completed
'group-data-[state=completed]:bg-accent group-data-[state=completed]:text-accent-foreground',
props.class,
)
"
>
<slot v-bind="slotProps" />
</StepperIndicator>
</template>

View File

@@ -0,0 +1,33 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperItem, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
step: { type: Number, required: true },
disabled: { type: Boolean, required: false },
completed: { type: Boolean, required: false },
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperItem
v-slot="slotProps"
v-bind="forwarded"
:class="
cn(
'flex items-center gap-2 group data-[disabled]:pointer-events-none',
props.class,
)
"
>
<slot v-bind="slotProps" />
</StepperItem>
</template>

View File

@@ -0,0 +1,33 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperSeparator, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
orientation: { type: String, required: false },
decorative: { type: Boolean, required: false },
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperSeparator
v-bind="forwarded"
:class="
cn(
'bg-muted',
// Disabled
'group-data-[disabled]:bg-muted group-data-[disabled]:opacity-50',
// Completed
'group-data-[state=completed]:bg-accent',
props.class,
)
"
/>
</template>

View File

@@ -0,0 +1,24 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperTitle, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperTitle
v-bind="forwarded"
:class="cn('text-md font-semibold whitespace-nowrap', props.class)"
>
<slot />
</StepperTitle>
</template>

View File

@@ -0,0 +1,29 @@
<script setup>
import { reactiveOmit } from "@vueuse/core";
import { StepperTrigger, useForwardProps } from "reka-ui";
import { cn } from "@/lib/utils";
const props = defineProps({
asChild: { type: Boolean, required: false },
as: { type: null, required: false },
class: { type: null, required: false },
});
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>
<template>
<StepperTrigger
v-bind="forwarded"
:class="
cn(
'p-1 flex flex-col items-center text-center gap-1 rounded-md',
props.class,
)
"
>
<slot />
</StepperTrigger>
</template>

View File

@@ -0,0 +1,7 @@
export { default as Stepper } from "./Stepper.vue";
export { default as StepperDescription } from "./StepperDescription.vue";
export { default as StepperIndicator } from "./StepperIndicator.vue";
export { default as StepperItem } from "./StepperItem.vue";
export { default as StepperSeparator } from "./StepperSeparator.vue";
export { default as StepperTitle } from "./StepperTitle.vue";
export { default as StepperTrigger } from "./StepperTrigger.vue";

View File

@@ -20,7 +20,7 @@ const app = createApp(App)
app.use(createPinia())
app.use(router)
if (!!import.meta.env.VITE_DISABLE_GLITCHTIP) {
if (!import.meta.env.VITE_DISABLE_GLITCHTIP) {
let dsn = import.meta.env.VITE_GLITCHTIP_DSN;
let environment = import.meta.env.VITE_ENVIRONMENT;

View File

@@ -17,19 +17,15 @@ const decisionDate = ref<Date | null>(null);
const submitDate = ref<Date | null>(null);
const loading = ref<boolean>(true);
const member_name = ref<string>();
onMounted(async () => {
try {
//get app ID from URL param
const router = useRoute();
const appIDRaw = router.params.id;
if (appIDRaw === undefined) {
//new app
appData.value = null
readOnly.value = false;
newApp.value = true;
} else {
//load app
const raw = await loadApplication(appIDRaw.toString());
const props = defineProps<{
mode?: "create" | "view-self" | "view-recruiter"
}>()
const finalMode = ref<"create" | "view-self" | "view-recruiter">("create");
async function loadByID(id: number | string) {
const raw = await loadApplication(id);
const data = raw.application;
@@ -43,22 +39,73 @@ onMounted(async () => {
newApp.value = false;
readOnly.value = true;
}
} catch (e) {
console.error(e);
const router = useRoute();
onMounted(async () => {
//recruiter mode
if (props.mode === 'view-recruiter') {
finalMode.value = 'view-recruiter';
await loadByID(Number(router.params.id));
}
//viewer mode
if (props.mode === 'view-self') {
finalMode.value = 'view-self';
await loadByID('me');
}
//creator mode
if (props.mode === 'create') {
finalMode.value = 'create';
appData.value = null
readOnly.value = false;
newApp.value = true;
}
loading.value = false;
// try {
// //get app ID from URL param
// if (appIDRaw === undefined) {
// //new app
// appData.value = null
// readOnly.value = false;
// newApp.value = true;
// } else {
// //load app
// const raw = await loadApplication(appIDRaw.toString());
// const data = raw.application;
// appID.value = data.id;
// appData.value = data.app_data;
// chatData.value = raw.comments;
// status.value = data.app_status;
// decisionDate.value = new Date(data.decision_at);
// submitDate.value = data.submitted_at ? new Date(data.submitted_at) : null;
// member_name.value = data.member_name;
// newApp.value = false;
// readOnly.value = true;
// }
// } catch (e) {
// console.error(e);
// }
})
async function postComment(comment) {
chatData.value.push(await postChatMessage(comment, appID.value));
}
const emit = defineEmits(['submit']);
async function postApp(appData) {
console.log("test")
const res = await postApplication(appData);
if (res.ok) {
readOnly.value = true;
newApp.value = false;
emit('submit');
}
// TODO: Handle fail to post
}
@@ -74,7 +121,7 @@ async function handleDeny(id) {
</script>
<template>
<div v-if="!loading" class="max-w-3xl mx-auto my-20">
<div v-if="!loading" class="w-full h-20">
<div v-if="!newApp" class="flex flex-row justify-between items-center py-2 mb-8">
<!-- Application header -->
<div>
@@ -102,7 +149,7 @@ async function handleDeny(id) {
hour: "2-digit",
minute: "2-digit"
}) }}</p>
<div class="mt-2" v-else>
<div class="mt-2" v-else-if="finalMode === 'view-recruiter'">
<Button variant="success" class="mr-2" :onclick="() => { handleApprove(appID) }">
<CheckIcon></CheckIcon>
</Button>
@@ -123,5 +170,5 @@ async function handleDeny(id) {
</div>
</div>
<!-- TODO: Implement some kinda loading screen -->
<div v-else>Loading</div>
<div v-else class="flex items-center justify-center h-full">Loading</div>
</template>

View File

@@ -3,15 +3,14 @@ import { ref, watch, nextTick, computed, onMounted } from 'vue'
import FullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'
import { X, Clock, MapPin, User, ListTodo, ChevronLeft, ChevronRight, Plus } from 'lucide-vue-next'
import { ChevronLeft, ChevronRight, Plus } from 'lucide-vue-next'
import CreateCalendarEvent from '@/components/calendar/CreateCalendarEvent.vue'
import { getCalendarEvent, getMonthCalendarEvents } from '@/api/calendar'
import { CalendarEvent, CalendarEventShort } from '@shared/types/calendar'
import { Calendar } from '@fullcalendar/core'
import { CalendarEvent } from '@shared/types/calendar'
import ViewCalendarEvent from '@/components/calendar/ViewCalendarEvent.vue'
import { useRouter, useRoute } from 'vue-router'
import { useCalendarEvents } from '@/composables/useCalendarEvents'
import { useCalendarNavigation } from '@/composables/useCalendarNavigation'
import { useUserStore } from '@/stores/user'
const monthLabels = [
'January', 'February', 'March', 'April', 'May', 'June',
@@ -24,6 +23,7 @@ function api() {
const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
function buildFullDate(month: number, year: number): Date {
return new Date(year, month, 1); //default to first of month
@@ -48,6 +48,7 @@ const dialogRef = ref<any>(null)
// NEW: handle day/time slot clicks to start creating an event
function onDateClick(arg: { dateStr: string }) {
if (!userStore.isLoggedIn) return;
dialogRef.value?.openDialog(arg.dateStr);
// For now, just open the panel with a draft payload.
// activeEvent.value = {
@@ -202,7 +203,7 @@ onMounted(() => {
@click="goToday">
Today
</button>
<button
<button v-if="userStore.isLoggedIn"
class="cursor-pointer ml-1 inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground hover:opacity-90"
@click="onCreateEvent">
<Plus class="h-4 w-4" />
@@ -216,7 +217,8 @@ onMounted(() => {
<aside v-if="panelOpen"
class="3xl:w-lg 2xl:w-md border-l bg-card text-foreground flex flex-col overflow-auto scrollbar-themed"
:style="{ height: 'calc(100vh - 61px)', position: 'sticky', top: '64px' }">
<ViewCalendarEvent ref="eventViewRef" @close="() => { router.push('/calendar'); }" @reload="loadEvents()" @edit="(val) => {dialogRef.openDialog(null, 'edit', val)}">
<ViewCalendarEvent ref="eventViewRef" @close="() => { router.push('/calendar'); }"
@reload="loadEvents()" @edit="(val) => { dialogRef.openDialog(null, 'edit', val) }">
</ViewCalendarEvent>
</aside>
</div>

View File

@@ -1,24 +1,258 @@
<script setup lang="ts">
import ApplicationForm from '@/components/application/ApplicationForm.vue';
import Button from '@/components/ui/button/Button.vue';
import {
Stepper,
StepperDescription,
StepperIndicator,
StepperItem,
StepperSeparator,
StepperTitle,
StepperTrigger,
} from '@/components/ui/stepper'
import { useUserStore } from '@/stores/user';
import { Check, Circle, Dot, Users, X } from 'lucide-vue-next'
import { computed, ref } from 'vue';
import Application from './Application.vue';
function goToLogin() {
const redirectUrl = encodeURIComponent(window.location.origin + '/join')
window.location.href = `https://aj17thdevapi.nexuszone.net/login?redirect=${redirectUrl}`;
}
let userStore = useUserStore();
const steps = computed(() => {
const isDenied = userStore.state === 'denied'
return [
{
step: 1,
title: 'Create account',
description: 'Begin by setting up your account',
},
{
step: 2,
title: 'Submit application',
description: 'Provide a few details about yourself',
},
{
step: 3,
title: 'Application review',
description: 'Our team will review your submission',
},
{
step: 4,
title: isDenied ? 'Application denied' : 'Acceptance',
description: isDenied
? 'Your application was not approved'
: 'Get started with the 17th Rangers',
},
]
})
const currentStep = computed<number>(() => {
if (!userStore.isLoggedIn)
return 1;
switch (userStore.state) {
case "guest":
return 2;
break;
case "applicant":
return 3;
break;
case "member":
return 5;
break;
case "denied":
return 5;
break;
}
})
const finalPanel = ref<'app' | 'message'>('message');
</script>
<template>
<div class="min-h-screen flex items-center justify-center ">
<div class="w-full max-w-2xl mx-auto p-8 text-center">
<h1 class="text-4xl sm:text-5xl font-extrabold mb-4">
welcome to the 17th
<div class="flex flex-col items-center mt-10 w-full">
<!-- Stepper Container -->
<div class="w-full flex justify-center">
<div class="w-full max-w-7xl">
<Stepper class="flex w-full items-start gap-2" v-model="currentStep">
<StepperItem v-for="step in steps" :key="step.step" v-slot="{ state }"
class="relative flex w-full flex-col items-center" :step="step.step">
<StepperSeparator v-if="step.step !== steps[steps.length - 1]?.step"
class="absolute left-[calc(50%+20px)] right-[calc(-50%+10px)] top-5 block h-0.5 rounded-full bg-muted group-data-[state=completed]:bg-primary" />
<StepperTrigger as-child>
<Button :variant="state === 'completed' || state === 'active' ? 'default' : 'outline'"
size="icon" class="z-10 rounded-full shrink-0"
:class="[state === 'active' && 'ring-2 ring-ring ring-offset-2 ring-offset-background']">
<template v-if="state === 'completed'">
<X v-if="step.step === 4 && userStore.state === 'denied'" class="size-5" />
<Check v-else class="size-5" />
</template>
<Circle v-if="state === 'active'" />
<Dot v-if="state === 'inactive'" />
</Button>
</StepperTrigger>
<div class="mt-2 flex flex-col items-center text-center">
<StepperTitle class="text-sm font-semibold transition lg:text-base"
:class="[state === 'active' && 'text-primary']">
{{ step.title }}
</StepperTitle>
<StepperDescription
class="sr-only text-xs text-muted-foreground transition md:not-sr-only lg:text-sm"
:class="[state === 'active' && 'text-primary']">
{{ step.description }}
</StepperDescription>
</div>
</StepperItem>
</Stepper>
</div>
</div>
<!-- Content -->
<div class="mt-12 mb-20 flex w-full max-w-6xl justify-center">
<div v-if="currentStep === 1" class="w-full max-w-2xl p-8">
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left">
Create your account
</h1>
<p class=" mb-8">
Welcome click below to get started.
<p class="text-left text-muted-foreground mb-6">
You'll be redirected to our secure sign-in system to set up your account
and begin your application.
</p>
<Button class="w-44" @click="goToLogin">Get started</Button>
<Button class="px-6 py-3" @click="goToLogin">
Continue to account creation
</Button>
</div>
<Application v-else-if="currentStep === 2" @submit="userStore.loadUser()" :mode="'create'"></Application>
<Application v-else-if="currentStep === 3" :mode="'view-self'"></Application>
<div v-if="currentStep === 5" class="w-full p-8 pt-0">
<div class="mb-5">
<div class="flex w-min *:px-10 pt-2 border-b *:w-full *:text-center *:pb-1 *:cursor-pointer">
<label :class="finalPanel === 'message' ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="finalPanel = 'message'">Message
</label>
<label :class="finalPanel === 'app' ? 'border-b-3 border-foreground' : 'mb-[2px]'"
@click="finalPanel = 'app'">Application
</label>
</div>
</div>
<div v-if="finalPanel === 'message'">
<!-- Accepted message -->
<div v-if="userStore.state === 'member'">
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left">
Welcome to the 17th Ranger Battalion
</h1>
<div class="space-y-4 text-muted-foreground text-left leading-relaxed">
<p>
Your application to the 17th Ranger Battalion has been <strong>accepted</strong>!
Were excited to welcome you to the community.
</p>
<p>
There are just a couple of steps to complete before joining us on the battlefield:
</p>
<!-- MODPACK SECTION -->
<h2 class="text-xl font-semibold text-foreground mt-6">1. Download the Modpack</h2>
<p>
Youll need to download our private server modpack. This can take some time, so we
recommend
starting as soon as possible. The link below leads to our
<strong>Shadow Mod</strong>, which automatically pulls all required dependencies.
</p>
<ul class="list-disc pl-6 space-y-1">
<li>Subscribe to the Shadow Mod.</li>
<li>When prompted, choose <em>“Yes”</em> to download all associated mods.</li>
</ul>
<p>
<a href="https://www.guilded.gg/Iceberg-gaming/groups/v3j2vAP3/channels/6979335e-60f7-4ab9-9590-66df69367d1e/docs/2013948655"
class="text-primary underline" target="_blank">
Click here for the full installation guide
</a>
</p>
<!-- CONTACT SECTION -->
<h2 class="text-xl font-semibold text-foreground mt-6">2. Contact a Corporal or Higher</h2>
<p>
Once you have the modpack installed, connect on TeamSpeak or post in Discord. Anyone
with
the
rank of <strong>Corporal or above</strong> can help get you set up.
</p>
<ul class="list-none pl-0 space-y-1">
<li><strong>TeamSpeak:</strong><a href="ts3server://ts.iceberg-gaming.com"
class="text-primary underline"
target="_blank">ts3server://ts.iceberg-gaming.com</a>
</li>
<li>
<strong>Discord:</strong>
<a href="https://discord.gg/7hDQCEb" class="text-primary underline"
target="_blank">https://discord.gg/7hDQCEb</a>
</li>
</ul>
<p>
They will assist you with your initial assessments and training. Basic trainings run on
a
rotating schedule or can be requested through our Battalion Forms. Dont hesitate to hop
in
during weeknights or Saturday operations to start playing with us!
</p>
<!-- FINAL NOTES -->
<h2 class="text-xl font-semibold text-foreground mt-6">3. Get Familiar with the Unit</h2>
<p>
Please take a moment to read through our <strong>Code of Conduct</strong>,
<strong>Ranks</strong>, and <strong>Structure</strong> pages. We also encourage you to
browse
our forums and introduce yourself.
</p>
<p>
If you have any questions, feel free to reach out on TeamSpeak, Discord, or Guilded,
someone
will always be around to help.
</p>
</div>
</div>
<!-- Denied message -->
<div v-else-if="userStore.state === 'denied'">
<div class="w-full max-w-2xl p-8">
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left text-destructive">
Application Not Approved
</h1>
<div class="space-y-4 text-muted-foreground text-left leading-relaxed">
<p>
Thank you for your interest in joining the <strong>17th Ranger Battalion</strong>.
After reviewing your application, we regret to inform you that we are not able to
approve it at this time.
</p>
<p>
If you would like more information, you are encouraged to
<strong>reach out and inquire</strong> about the reason your application was not
approved.
We are always happy to provide clarification where possible.
</p>
<p>
You are welcome to <strong>resubmit your application in the future</strong> should
your
circumstances change or when we may be better able to incorporate you into the unit.
</p>
<p>
All the best,<br />
<span class="text-foreground font-medium">The 17th Ranger Battalion Recruitment
Team</span>
</p>
</div>
</div>
</div>
</div>
<div v-if="finalPanel === 'app'">
<Application :mode="'view-self'"></Application>
</div>
</div>
</div>
</div>
</template>
<script setup>
import Button from '@/components/ui/button/Button.vue';
function goToLogin() {
window.location.href = 'https://aj17thdevapi.nexuszone.net/login';
}
</script>

View File

@@ -10,9 +10,10 @@ import {
TableRow,
} from '@/components/ui/table'
import Button from '@/components/ui/button/Button.vue';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { CheckIcon, XIcon } from 'lucide-vue-next';
import Application from './Application.vue';
const appList = ref([]);
const now = Date.now();
@@ -61,18 +62,40 @@ async function handleDeny(id) {
const router = useRouter();
function openApplication(id) {
router.push(`./application/${id}`)
router.push(`/administration/applications/${id}`)
openPanel.value = true;
}
function closeApplication() {
router.push('/administration/applications')
openPanel.value = false;
}
const route = useRoute();
watch(() => route.params.id, (newId) => {
if (newId === undefined) {
openPanel.value = false;
}
})
const openPanel = ref(false);
onMounted(async () => {
appList.value = await getAllApplications();
//preload application
if (route.params.id != undefined) {
openApplication(route.params.id)
}
})
</script>
<template>
<div class="mx-auto w-full max-w-5xl">
<h1 class="my-4">Manage Applications</h1>
<div class="px-20 mx-auto max-w-[100rem] w-full flex mt-5 h-52 min-h-0 overflow-hidden">
<!-- application list -->
<div :class="openPanel == false ? 'w-full' : 'w-2/5'" class="pr-9">
<h1 class="scroll-m-20 text-2xl font-semibold tracking-tight">Manage Applications</h1>
<Table>
<!-- <TableCaption>A list of your recent invoices.</TableCaption> -->
<TableHeader>
<TableRow>
<TableHead>User</TableHead>
@@ -80,14 +103,15 @@ onMounted(async () => {
<TableHead class="text-right">Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableBody class="overflow-y-auto scrollbar-themed">
<TableRow v-for="app in appList" :key="app.id" class="cursor-pointer"
:onClick="() => { openApplication(app.id) }">
<TableCell class="font-medium">{{ app.member_name }}</TableCell>
<TableCell :title="formatExact(app.submitted_at)">
{{ formatAgo(app.submitted_at) }}
</TableCell>
<TableCell v-if="app.app_status === ApplicationStatus.Pending" class="inline-flex items-end gap-2">
<TableCell v-if="app.app_status === ApplicationStatus.Pending"
class="inline-flex items-end gap-2">
<Button variant="success" @click.stop="() => { handleApprove(app.id) }">
<CheckIcon></CheckIcon>
</Button>
@@ -105,4 +129,46 @@ onMounted(async () => {
</TableBody>
</Table>
</div>
<div v-if="openPanel" class="pl-9 border-l w-3/5" :key="$route.params.id">
<div class="mb-5 flex justify-between">
<p class="scroll-m-20 text-2xl font-semibold tracking-tight"> Application</p>
<button @click="closeApplication()" class="cursor-pointer">
<XIcon></XIcon>
</button>
</div>
<div class="overflow-y-auto max-h-[80vh] h-full mt-5 scrollbar-themed">
<Application :mode="'view-recruiter'"></Application>
</div>
</div>
</div>
</template>
<style scoped>
/* Firefox */
.scrollbar-themed {
scrollbar-width: thin;
scrollbar-color: #555 #1f1f1f;
padding-right: 6px;
}
/* Chrome, Edge, Safari */
.scrollbar-themed::-webkit-scrollbar {
width: 10px;
/* slightly wider to allow padding look */
}
.scrollbar-themed::-webkit-scrollbar-track {
background: #1f1f1f;
margin-left: 6px;
/* ❗ adds space between content + scrollbar */
}
.scrollbar-themed::-webkit-scrollbar-thumb {
background: #555;
border-radius: 9999px;
}
.scrollbar-themed::-webkit-scrollbar-thumb:hover {
background: #777;
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div class="min-h-screen flex flex-col items-center justify-center text-center px-6">
<div class="flex flex-col items-center justify-center text-center px-6">
<h1 class="text-5xl font-bold mb-4">Unauthorized</h1>
<p class="text-lg text-muted-foreground max-w-md mb-6">
You don't have permission to access this page.

View File

@@ -9,15 +9,15 @@ const router = createRouter({
// AUTH REQUIRED
{ path: '/apply', component: () => import('@/pages/Application.vue'), meta: { requiresAuth: true } },
{ path: '/', component: () => import('@/pages/Homepage.vue'), meta: { requiresAuth: true } },
{ path: '/', component: () => import('@/pages/Homepage.vue') },
// MEMBER ROUTES
{ path: '/members', component: () => import('@/pages/memberList.vue'), meta: { requiresAuth: true, memberOnly: true } },
{ path: '/loa', component: () => import('@/pages/SubmitLOA.vue'), meta: { requiresAuth: true, memberOnly: true } },
{ path: '/transfer', component: () => import('@/pages/Transfer.vue'), meta: { requiresAuth: true, memberOnly: true } },
{ path: '/calendar', component: () => import('@/pages/Calendar.vue'), meta: { requiresAuth: true, memberOnly: true }, },
{ path: '/calendar/event/:id', component: () => import('@/pages/Calendar.vue'), meta: { requiresAuth: true, memberOnly: true }, },
{ path: '/calendar', component: () => import('@/pages/Calendar.vue'), meta: { }, },
{ path: '/calendar/event/:id', component: () => import('@/pages/Calendar.vue'), meta: { }, },
{ path: '/trainingReport', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
{ path: '/trainingReport/new', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
@@ -29,7 +29,7 @@ const router = createRouter({
meta: { requiresAuth: true, memberOnly: true, roles: ['staff', 'admin'] },
children: [
{ path: 'applications', component: () => import('@/pages/ManageApplications.vue') },
{ path: 'application/:id', component: () => import('@/pages/Application.vue') },
{ path: 'applications/:id', component: () => import('@/pages/ManageApplications.vue') },
{ path: 'rankChange', component: () => import('@/pages/RankChange.vue') },
{ path: 'applications/:id', component: () => import('@/pages/Application.vue') },
{ path: 'transfer', component: () => import('@/pages/ManageTransfers.vue') },