Mega recruitment pipeline overhaul
This commit is contained in:
@@ -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()
|
||||
|
||||
31
ui/src/components/ui/stepper/Stepper.vue
Normal file
31
ui/src/components/ui/stepper/Stepper.vue
Normal 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>
|
||||
25
ui/src/components/ui/stepper/StepperDescription.vue
Normal file
25
ui/src/components/ui/stepper/StepperDescription.vue
Normal 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>
|
||||
36
ui/src/components/ui/stepper/StepperIndicator.vue
Normal file
36
ui/src/components/ui/stepper/StepperIndicator.vue
Normal 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>
|
||||
33
ui/src/components/ui/stepper/StepperItem.vue
Normal file
33
ui/src/components/ui/stepper/StepperItem.vue
Normal 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>
|
||||
33
ui/src/components/ui/stepper/StepperSeparator.vue
Normal file
33
ui/src/components/ui/stepper/StepperSeparator.vue
Normal 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>
|
||||
24
ui/src/components/ui/stepper/StepperTitle.vue
Normal file
24
ui/src/components/ui/stepper/StepperTitle.vue
Normal 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>
|
||||
29
ui/src/components/ui/stepper/StepperTrigger.vue
Normal file
29
ui/src/components/ui/stepper/StepperTrigger.vue
Normal 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>
|
||||
7
ui/src/components/ui/stepper/index.js
Normal file
7
ui/src/components/ui/stepper/index.js
Normal 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";
|
||||
@@ -17,48 +17,95 @@ const decisionDate = ref<Date | null>(null);
|
||||
const submitDate = ref<Date | null>(null);
|
||||
const loading = ref<boolean>(true);
|
||||
const member_name = ref<string>();
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const router = useRoute();
|
||||
|
||||
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 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);
|
||||
//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="max-w-3xl mx-auto">
|
||||
<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>
|
||||
|
||||
@@ -1,24 +1,134 @@
|
||||
<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
|
||||
</h1>
|
||||
<p class=" mb-8">
|
||||
Welcome — click below to get started.
|
||||
</p>
|
||||
<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 } from 'lucide-vue-next'
|
||||
import { computed } from 'vue';
|
||||
import Application from './Application.vue';
|
||||
|
||||
<Button class="w-44" @click="goToLogin">Get started</Button>
|
||||
function goToLogin() {
|
||||
const redirectUrl = encodeURIComponent(window.location.origin + '/join')
|
||||
window.location.href = `https://aj17thdevapi.nexuszone.net/login?redirect=${redirectUrl}`;
|
||||
}
|
||||
const steps = [
|
||||
{
|
||||
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: 'Acceptance',
|
||||
description: 'Join the 17th and get started',
|
||||
},
|
||||
]
|
||||
|
||||
let userStore = useUserStore();
|
||||
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 4;
|
||||
break;
|
||||
case "denied":
|
||||
return 4;
|
||||
break;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<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']">
|
||||
<Check v-if="state === 'completed'" class="size-5" />
|
||||
<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 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="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="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 === 4" class="w-full max-w-2xl p-8">
|
||||
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left">
|
||||
Welcome to the 17th Ranger Battalion
|
||||
</h1>
|
||||
|
||||
<p class="text-left text-muted-foreground mb-6">
|
||||
Yadda yadda here are your resources and stuff or something.
|
||||
</p>
|
||||
</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>
|
||||
@@ -9,7 +9,7 @@ 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 } },
|
||||
|
||||
Reference in New Issue
Block a user