set up viewing of users application history
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m22s
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m22s
This commit is contained in:
@@ -2,7 +2,7 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
import pool from '../db';
|
import pool from '../db';
|
||||||
import { approveApplication, createApplication, denyApplication, getApplicationByID, getApplicationComments, getApplicationList, getMemberApplication } from '../services/applicationService';
|
import { approveApplication, createApplication, denyApplication, getAllMemberApplications, getApplicationByID, getApplicationComments, getApplicationList, getMemberApplication } from '../services/applicationService';
|
||||||
import { MemberState, setUserState } from '../services/memberService';
|
import { MemberState, setUserState } from '../services/memberService';
|
||||||
import { getRankByName, insertMemberRank } from '../services/rankService';
|
import { getRankByName, insertMemberRank } from '../services/rankService';
|
||||||
import { ApplicationFull, CommentRow } from "@app/shared/types/application"
|
import { ApplicationFull, CommentRow } from "@app/shared/types/application"
|
||||||
@@ -38,6 +38,20 @@ router.get('/all', async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/meList', async (req, res) => {
|
||||||
|
|
||||||
|
let userID = req.user.id;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let application = await getAllMemberApplications(userID);
|
||||||
|
|
||||||
|
return res.status(200).json(application);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load applications: \n', error);
|
||||||
|
return res.status(500).json(error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
router.get('/me', async (req, res) => {
|
router.get('/me', async (req, res) => {
|
||||||
|
|
||||||
let userID = req.user.id;
|
let userID = req.user.id;
|
||||||
@@ -62,6 +76,33 @@ router.get('/me', async (req, res) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// GET /application/:id
|
||||||
|
router.get('/me/:id', async (req: Request, res: Response) => {
|
||||||
|
let appID = Number(req.params.id);
|
||||||
|
let member = req.user.id;
|
||||||
|
try {
|
||||||
|
const application = await getApplicationByID(appID);
|
||||||
|
if (application === undefined)
|
||||||
|
return res.sendStatus(204);
|
||||||
|
console.log(application.member_id, member)
|
||||||
|
if (application.member_id != member) {
|
||||||
|
return res.sendStatus(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
const comments: CommentRow[] = await getApplicationComments(appID);
|
||||||
|
|
||||||
|
const output: ApplicationFull = {
|
||||||
|
application,
|
||||||
|
comments,
|
||||||
|
}
|
||||||
|
return res.status(200).json(output);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error('Query failed:', err);
|
||||||
|
return res.status(500).json({ error: 'Failed to load application' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// GET /application/:id
|
// GET /application/:id
|
||||||
router.get('/:id', async (req, res) => {
|
router.get('/:id', async (req, res) => {
|
||||||
let appID = req.params.id;
|
let appID = req.params.id;
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ export async function getMemberApplication(memberID: number): Promise<Applicatio
|
|||||||
return app[0];
|
return app[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// export async function getAllMemberApplications(memberID: number): Promise<ApplicationListRow[]> {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function getApplicationByID(appID: number): Promise<ApplicationRow> {
|
export async function getApplicationByID(appID: number): Promise<ApplicationRow> {
|
||||||
const sql =
|
const sql =
|
||||||
@@ -49,6 +46,19 @@ export async function getApplicationList(): Promise<ApplicationListRow[]> {
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getAllMemberApplications(memberID: number): Promise<ApplicationListRow[]> {
|
||||||
|
const sql = `SELECT
|
||||||
|
app.id,
|
||||||
|
app.member_id,
|
||||||
|
app.submitted_at,
|
||||||
|
app.app_status
|
||||||
|
FROM applications AS app WHERE app.member_id = ? ORDER BY submitted_at DESC;`;
|
||||||
|
|
||||||
|
const rows: ApplicationListRow[] = await pool.query(sql, [memberID])
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function approveApplication(id: number) {
|
export async function approveApplication(id: number) {
|
||||||
const sql = `
|
const sql = `
|
||||||
UPDATE applications
|
UPDATE applications
|
||||||
|
|||||||
@@ -122,6 +122,26 @@ export async function getAllApplications(): Promise<ApplicationFull> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function loadMyApplications(): Promise<ApplicationFull> {
|
||||||
|
const res = await fetch(`${addr}/application/meList`, { credentials: 'include' })
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
return res.json()
|
||||||
|
} else {
|
||||||
|
console.error("Something went wrong approving the application")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getMyApplication(id: number): Promise<ApplicationFull> {
|
||||||
|
const res = await fetch(`${addr}/application/me/${id}`, { credentials: 'include' })
|
||||||
|
if (res.status === 204) return null
|
||||||
|
if (res.status === 403) throw new Error("Unauthorized");
|
||||||
|
if (!res.ok) throw new Error('Failed to load application')
|
||||||
|
const json = await res.json()
|
||||||
|
// Accept either the object at root or under `application`
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
export async function approveApplication(id: Number) {
|
export async function approveApplication(id: Number) {
|
||||||
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST' })
|
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST' })
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ function blurAfter() {
|
|||||||
<!-- <DropdownMenuItem>My Profile</DropdownMenuItem> -->
|
<!-- <DropdownMenuItem>My Profile</DropdownMenuItem> -->
|
||||||
<!-- <DropdownMenuItem>Settings</DropdownMenuItem> -->
|
<!-- <DropdownMenuItem>Settings</DropdownMenuItem> -->
|
||||||
<DropdownMenuItem @click="$router.push('/join')">My Application</DropdownMenuItem>
|
<DropdownMenuItem @click="$router.push('/join')">My Application</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem @click="$router.push('/applications')">Application History</DropdownMenuItem>
|
||||||
<DropdownMenuItem :variant="'destructive'" @click="logout()">Logout</DropdownMenuItem>
|
<DropdownMenuItem :variant="'destructive'" @click="logout()">Logout</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
import ApplicationChat from '@/components/application/ApplicationChat.vue';
|
import ApplicationChat from '@/components/application/ApplicationChat.vue';
|
||||||
import ApplicationForm from '@/components/application/ApplicationForm.vue';
|
import ApplicationForm from '@/components/application/ApplicationForm.vue';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { ApplicationData, approveApplication, denyApplication, loadApplication, postApplication, postChatMessage, ApplicationStatus } from '@/api/application';
|
import { ApplicationData, approveApplication, denyApplication, loadApplication, postApplication, postChatMessage, ApplicationStatus, getMyApplication, ApplicationFull } from '@/api/application';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import Button from '@/components/ui/button/Button.vue';
|
import Button from '@/components/ui/button/Button.vue';
|
||||||
import { CheckIcon, XIcon } from 'lucide-vue-next';
|
import { CheckIcon, XIcon } from 'lucide-vue-next';
|
||||||
|
import Unauthorized from './Unauthorized.vue';
|
||||||
|
|
||||||
const appData = ref<ApplicationData>(null);
|
const appData = ref<ApplicationData>(null);
|
||||||
const appID = ref<number | null>(null);
|
const appID = ref<number | null>(null);
|
||||||
@@ -19,13 +20,12 @@ const loading = ref<boolean>(true);
|
|||||||
const member_name = ref<string>();
|
const member_name = ref<string>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mode?: "create" | "view-self" | "view-recruiter"
|
mode?: "create" | "view-self" | "view-recruiter" | "view-self-id"
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const finalMode = ref<"create" | "view-self" | "view-recruiter">("create");
|
const finalMode = ref<"create" | "view-self" | "view-recruiter" | "view-self-id">("create");
|
||||||
|
|
||||||
async function loadByID(id: number | string) {
|
function loadData(raw: ApplicationFull) {
|
||||||
const raw = await loadApplication(id);
|
|
||||||
|
|
||||||
const data = raw.application;
|
const data = raw.application;
|
||||||
|
|
||||||
@@ -40,20 +40,20 @@ async function loadByID(id: number | string) {
|
|||||||
readOnly.value = true;
|
readOnly.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const router = useRoute();
|
const route = useRoute();
|
||||||
|
const unauthorized = ref(false);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
||||||
//recruiter mode
|
//recruiter mode
|
||||||
if (props.mode === 'view-recruiter') {
|
if (props.mode === 'view-recruiter') {
|
||||||
finalMode.value = 'view-recruiter';
|
finalMode.value = 'view-recruiter';
|
||||||
await loadByID(Number(router.params.id));
|
loadData(await loadApplication(Number(route.params.id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
//viewer mode
|
//viewer mode
|
||||||
if (props.mode === 'view-self') {
|
if (props.mode === 'view-self') {
|
||||||
finalMode.value = 'view-self';
|
finalMode.value = 'view-self';
|
||||||
await loadByID('me');
|
loadData(await loadApplication("me"))
|
||||||
}
|
}
|
||||||
|
|
||||||
//creator mode
|
//creator mode
|
||||||
@@ -64,34 +64,23 @@ onMounted(async () => {
|
|||||||
newApp.value = true;
|
newApp.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.mode === 'view-self-id') {
|
||||||
|
finalMode.value = 'view-self-id';
|
||||||
|
try {
|
||||||
|
let raw = await getMyApplication(Number(route.params.id))
|
||||||
|
loadData(raw);
|
||||||
|
unauthorized.value = false;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
if (error.message === "Unauthorized") {
|
||||||
|
unauthorized.value = true;
|
||||||
|
} else {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loading.value = false;
|
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) {
|
async function postComment(comment) {
|
||||||
@@ -107,7 +96,7 @@ async function postApp(appData) {
|
|||||||
newApp.value = false;
|
newApp.value = false;
|
||||||
emit('submit');
|
emit('submit');
|
||||||
}
|
}
|
||||||
// TODO: Handle fail to post
|
// TODO: Handle fail to post
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleApprove(id) {
|
async function handleApprove(id) {
|
||||||
@@ -122,52 +111,58 @@ async function handleDeny(id) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="!loading" class="w-full h-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">
|
<div v-if="unauthorized" class="flex justify-center w-full my-10">
|
||||||
<!-- Application header -->
|
You do not have permission to view this application.
|
||||||
<div>
|
</div>
|
||||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">{{ member_name }}</h3>
|
<div v-else>
|
||||||
<p class="text-muted-foreground">Submitted: {{ submitDate.toLocaleString("en-US", {
|
<div v-if="!newApp" class="flex flex-row justify-between items-center py-2 mb-8">
|
||||||
year: "numeric",
|
<!-- Application header -->
|
||||||
month: "long",
|
<div>
|
||||||
day: "numeric",
|
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">{{ member_name }}</h3>
|
||||||
hour: "2-digit",
|
<p class="text-muted-foreground">Submitted: {{ submitDate.toLocaleString("en-US", {
|
||||||
minute: "2-digit"
|
|
||||||
}) }}</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-right" :class="[
|
|
||||||
'font-semibold',
|
|
||||||
status === ApplicationStatus.Pending && 'text-yellow-500',
|
|
||||||
status === ApplicationStatus.Accepted && 'text-green-500',
|
|
||||||
status === ApplicationStatus.Denied && 'text-red-500'
|
|
||||||
]">{{ status }}</h3>
|
|
||||||
<p v-if="status != ApplicationStatus.Pending" class="text-muted-foreground">{{ status }}: {{
|
|
||||||
decisionDate.toLocaleString("en-US", {
|
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
month: "long",
|
month: "long",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit"
|
minute: "2-digit"
|
||||||
}) }}</p>
|
}) }}</p>
|
||||||
<div class="mt-2" v-else-if="finalMode === 'view-recruiter'">
|
</div>
|
||||||
<Button variant="success" class="mr-2" :onclick="() => { handleApprove(appID) }">
|
<div>
|
||||||
<CheckIcon></CheckIcon>
|
<h3 class="text-right" :class="[
|
||||||
</Button>
|
'font-semibold',
|
||||||
<Button variant="destructive" :onClick="() => { handleDeny(appID) }">
|
status === ApplicationStatus.Pending && 'text-yellow-500',
|
||||||
<XIcon></XIcon>
|
status === ApplicationStatus.Accepted && 'text-green-500',
|
||||||
</Button>
|
status === ApplicationStatus.Denied && 'text-red-500'
|
||||||
|
]">{{ status }}</h3>
|
||||||
|
<p v-if="status != ApplicationStatus.Pending" class="text-muted-foreground">{{ status }}: {{
|
||||||
|
decisionDate.toLocaleString("en-US", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit"
|
||||||
|
}) }}</p>
|
||||||
|
<div class="mt-2" v-else-if="finalMode === 'view-recruiter'">
|
||||||
|
<Button variant="success" class="mr-2" :onclick="() => { handleApprove(appID) }">
|
||||||
|
<CheckIcon></CheckIcon>
|
||||||
|
</Button>
|
||||||
|
<Button variant="destructive" :onClick="() => { handleDeny(appID) }">
|
||||||
|
<XIcon></XIcon>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="flex flex-row justify-between items-center py-2 mb-8">
|
||||||
|
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">Apply to join the 17th Rangers</h3>
|
||||||
|
</div>
|
||||||
|
<ApplicationForm :read-only="readOnly" :data="appData" @submit="(e) => { postApp(e) }" class="mb-7">
|
||||||
|
</ApplicationForm>
|
||||||
|
<div v-if="!newApp" class="pb-15">
|
||||||
|
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight mb-4">Discussion</h3>
|
||||||
|
<ApplicationChat :messages="chatData" @post="postComment"></ApplicationChat>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex flex-row justify-between items-center py-2 mb-8">
|
|
||||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">Apply to join the 17th Rangers</h3>
|
|
||||||
</div>
|
|
||||||
<ApplicationForm :read-only="readOnly" :data="appData" @submit="(e) => { postApp(e) }" class="mb-7 pb-15">
|
|
||||||
</ApplicationForm>
|
|
||||||
<div v-if="!newApp" class="pb-15">
|
|
||||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight mb-4">Discussion</h3>
|
|
||||||
<ApplicationChat :messages="chatData" @post="postComment"></ApplicationChat>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO: Implement some kinda loading screen -->
|
<!-- TODO: Implement some kinda loading screen -->
|
||||||
<div v-else class="flex items-center justify-center h-full">Loading</div>
|
<div v-else class="flex items-center justify-center h-full">Loading</div>
|
||||||
|
|||||||
147
ui/src/pages/MyApplications.vue
Normal file
147
ui/src/pages/MyApplications.vue
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<script setup>
|
||||||
|
import { getAllApplications, approveApplication, denyApplication, ApplicationStatus, loadMyApplications } from '@/api/application';
|
||||||
|
import {
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCaption,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from '@/components/ui/table'
|
||||||
|
import Button from '@/components/ui/button/Button.vue';
|
||||||
|
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();
|
||||||
|
// relative time formatter (uses user locale)
|
||||||
|
const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' })
|
||||||
|
// exact date/time for tooltip
|
||||||
|
const exactFmt = new Intl.DateTimeFormat(undefined, {
|
||||||
|
dateStyle: 'medium', timeStyle: 'short', timeZone: 'America/Toronto'
|
||||||
|
})
|
||||||
|
|
||||||
|
function formatAgo(iso) {
|
||||||
|
const d = new Date(iso)
|
||||||
|
if (isNaN(d)) return ''
|
||||||
|
let diff = (d.getTime() - now) / 1000 // seconds relative to page load
|
||||||
|
const divisions = [
|
||||||
|
{ amount: 60, name: 'second' },
|
||||||
|
{ amount: 60, name: 'minute' },
|
||||||
|
{ amount: 24, name: 'hour' },
|
||||||
|
{ amount: 7, name: 'day' },
|
||||||
|
{ amount: 4.34524, name: 'week' }, // avg weeks per month
|
||||||
|
{ amount: 12, name: 'month' },
|
||||||
|
{ amount: Infinity, name: 'year' },
|
||||||
|
]
|
||||||
|
for (const div of divisions) {
|
||||||
|
if (Math.abs(diff) < div.amount) {
|
||||||
|
return rtf.format(Math.round(diff), div.name)
|
||||||
|
}
|
||||||
|
diff /= div.amount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatExact(iso) {
|
||||||
|
const d = new Date(iso)
|
||||||
|
return isNaN(d) ? '' : exactFmt.format(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
function openApplication(id) {
|
||||||
|
router.push(`/applications/${id}`)
|
||||||
|
openPanel.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
watch(() => route.params.id, (newId) => {
|
||||||
|
if (newId === undefined) {
|
||||||
|
openPanel.value = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const openPanel = ref(false);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
appList.value = await loadMyApplications();
|
||||||
|
|
||||||
|
//preload application
|
||||||
|
if (route.params.id != undefined) {
|
||||||
|
openApplication(route.params.id)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<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 mb-5">My Applications</h1>
|
||||||
|
<Table>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead>Date Submitted</TableHead>
|
||||||
|
<TableHead class="text-right">Status</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody class="overflow-y-auto scrollbar-themed">
|
||||||
|
<TableRow v-for="app in appList" :key="app.id" class="cursor-pointer"
|
||||||
|
:onClick="() => { openApplication(app.id) }">
|
||||||
|
<TableCell :title="formatExact(app.submitted_at)">
|
||||||
|
{{ formatAgo(app.submitted_at) }}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell class="text-right font-semibold" :class="[
|
||||||
|
,
|
||||||
|
app.app_status === ApplicationStatus.Pending && 'text-yellow-500',
|
||||||
|
app.app_status === ApplicationStatus.Accepted && 'text-green-500',
|
||||||
|
app.app_status === ApplicationStatus.Denied && 'text-destructive'
|
||||||
|
]">{{ app.app_status }}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
<div class="overflow-y-auto max-h-[80vh] h-full mt-5 scrollbar-themed">
|
||||||
|
<Application :mode="'view-self-id'"></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>
|
||||||
@@ -6,19 +6,20 @@ const router = createRouter({
|
|||||||
routes: [
|
routes: [
|
||||||
// PUBLIC
|
// PUBLIC
|
||||||
{ path: '/join', component: () => import('@/pages/Join.vue') },
|
{ path: '/join', component: () => import('@/pages/Join.vue') },
|
||||||
|
{ path: '/applications', component: () => import('@/pages/MyApplications.vue'), meta: { requiresAuth: true } },
|
||||||
|
{ path: '/applications/:id', component: () => import('@/pages/MyApplications.vue'), meta: { requiresAuth: true } },
|
||||||
|
|
||||||
// AUTH REQUIRED
|
// AUTH REQUIRED
|
||||||
{ path: '/apply', component: () => import('@/pages/Application.vue'), meta: { requiresAuth: true } },
|
|
||||||
{ path: '/', component: () => import('@/pages/Homepage.vue') },
|
{ path: '/', component: () => import('@/pages/Homepage.vue') },
|
||||||
|
|
||||||
// MEMBER ROUTES
|
// MEMBER ROUTES
|
||||||
{ path: '/members', component: () => import('@/pages/memberList.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
{ 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: '/loa', component: () => import('@/pages/SubmitLOA.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
||||||
{ path: '/transfer', component: () => import('@/pages/Transfer.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', 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/event/:id', component: () => import('@/pages/Calendar.vue'), meta: { requiresAuth: true, memberOnly: true }, },
|
||||||
|
|
||||||
{ path: '/trainingReport', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
{ 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 } },
|
{ path: '/trainingReport/new', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
||||||
{ path: '/trainingReport/:id', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
{ path: '/trainingReport/:id', component: () => import('@/pages/TrainingReport.vue'), meta: { requiresAuth: true, memberOnly: true } },
|
||||||
|
|||||||
Reference in New Issue
Block a user