added policy system and self LOA management

This commit is contained in:
2025-12-11 20:28:49 -05:00
parent bcde81093d
commit 710b24e5a7
8 changed files with 170 additions and 23 deletions

View File

@@ -90,7 +90,9 @@ onMounted(async () => {
}
try {
if (!props.adminMode) {
policyString.value = await getLoaPolicy();
let policy = await getLoaPolicy() as any;
policyString.value = policy;
policyRef.value.innerHTML = policyString.value;
}
} catch (error) {
console.error(error);
@@ -101,6 +103,8 @@ onMounted(async () => {
resetForm({ values: { member_id: currentMember.value?.member_id } });
});
const policyRef = ref<HTMLElement>(null);
const defaultPlaceholder = today(getLocalTimeZone())
const minEndDate = computed(() => {
@@ -123,14 +127,10 @@ const maxEndDate = computed(() => {
<template>
<div class="flex flex-row-reverse gap-6 mx-auto w-full" :class="!adminMode ? 'max-w-5xl' : 'max-w-5xl'">
<div v-if="!adminMode" class="flex-1 flex space-x-4 rounded-md border p-4">
<div class="flex-2 space-y-1">
<p class="text-sm font-medium leading-none">
LOA Policy
</p>
<p class="text-sm text-muted-foreground">
Policy goes here.
</p>
<div v-if="!adminMode" class="flex-1 flex flex-col space-x-4 rounded-md border p-4">
<p class="scroll-m-20 text-2xl font-semibold tracking-tight">LOA Policy</p>
<div ref="policyRef">
<!-- LOA policy gets loaded here -->
</div>
</div>
<div class="flex-1 flex flex-col gap-5">
@@ -200,7 +200,7 @@ const maxEndDate = computed(() => {
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" :class="cn(
'w-[280px] justify-start text-left font-normal',
'w-full justify-start text-left font-normal',
!field.value && 'text-muted-foreground',
)">
<CalendarIcon class="mr-2 h-4 w-4" />
@@ -228,7 +228,7 @@ const maxEndDate = computed(() => {
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" :class="cn(
'w-[280px] justify-start text-left font-normal',
'w-full justify-start text-left font-normal',
!field.value && 'text-muted-foreground',
)">
<CalendarIcon class="mr-2 h-4 w-4" />