finalized application acceptance system and started making types shared across front and backend
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import ApplicationChat from '@/components/application/ApplicationChat.vue';
|
||||
import ApplicationForm from '@/components/application/ApplicationForm.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { ApplicationData, approveApplication, denyApplication, loadApplication, postApplication, postChatMessage, Status } from '@/api/application';
|
||||
import { ApplicationData, approveApplication, denyApplication, loadApplication, postApplication, postChatMessage, ApplicationStatus } from '@/api/application';
|
||||
import { useRoute } from 'vue-router';
|
||||
import Button from '@/components/ui/button/Button.vue';
|
||||
import { CheckIcon, XIcon } from 'lucide-vue-next';
|
||||
@@ -12,7 +12,7 @@ const appID = ref<number | null>(null);
|
||||
const chatData = ref<object[]>([])
|
||||
const readOnly = ref<boolean>(false);
|
||||
const newApp = ref<boolean>(null);
|
||||
const status = ref<Status>(null);
|
||||
const status = ref<ApplicationStatus>(null);
|
||||
const decisionDate = ref<Date | null>(null);
|
||||
const submitDate = ref<Date | null>(null);
|
||||
const loading = ref<boolean>(true);
|
||||
@@ -54,6 +54,7 @@ async function postComment(comment) {
|
||||
}
|
||||
|
||||
async function postApp(appData) {
|
||||
console.log("test")
|
||||
const res = await postApplication(appData);
|
||||
if (res.ok) {
|
||||
readOnly.value = true;
|
||||
@@ -89,11 +90,11 @@ async function handleDeny(id) {
|
||||
<div>
|
||||
<h3 class="text-right" :class="[
|
||||
'font-semibold',
|
||||
status === Status.Pending && 'text-yellow-500',
|
||||
status === Status.Accepted && 'text-green-500',
|
||||
status === Status.Denied && 'text-red-500'
|
||||
status === ApplicationStatus.Pending && 'text-yellow-500',
|
||||
status === ApplicationStatus.Accepted && 'text-green-500',
|
||||
status === ApplicationStatus.Denied && 'text-red-500'
|
||||
]">{{ status }}</h3>
|
||||
<p v-if="status != Status.Pending" class="text-muted-foreground">{{ status }}: {{
|
||||
<p v-if="status != ApplicationStatus.Pending" class="text-muted-foreground">{{ status }}: {{
|
||||
decisionDate.toLocaleString("en-US", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { getAllApplications, approveApplication, denyApplication, Status } from '@/api/application';
|
||||
import { getAllApplications, approveApplication, denyApplication, ApplicationStatus } from '@/api/application';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -87,7 +87,7 @@ onMounted(async () => {
|
||||
<TableCell :title="formatExact(app.submitted_at)">
|
||||
{{ formatAgo(app.submitted_at) }}
|
||||
</TableCell>
|
||||
<TableCell v-if="app.app_status === Status.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>
|
||||
@@ -97,9 +97,9 @@ onMounted(async () => {
|
||||
</TableCell>
|
||||
<TableCell class="text-right font-semibold" :class="[
|
||||
,
|
||||
app.app_status === Status.Pending && 'text-yellow-500',
|
||||
app.app_status === Status.Accepted && 'text-green-500',
|
||||
app.app_status === Status.Denied && 'text-destructive'
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user