hooked up new LOA creation system

This commit is contained in:
2025-12-11 12:06:00 -05:00
parent 9d217aafaf
commit 7ab06b6a4c
5 changed files with 22 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ import PopoverContent from "@/components/ui/popover/PopoverContent.vue";
import { cn } from "@/lib/utils";
import { CalendarIcon } from "lucide-vue-next"
import Textarea from "@/components/ui/textarea/Textarea.vue";
import { getLoaPolicy, getLoaTypes, submitLOA } from "@/api/loa"; // <-- import the submit function
import { adminSubmitLOA, getLoaPolicy, getLoaTypes, submitLOA } from "@/api/loa"; // <-- import the submit function
import { LOARequest, LOAType } from "@shared/types/loa";
import { useForm, Field as VeeField } from "vee-validate";
import {
@@ -68,8 +68,20 @@ const { handleSubmit, values, resetForm } = useForm({
validationSchema: toTypedSchema(loaSchema),
})
const onSubmit = handleSubmit((values) => {
const onSubmit = handleSubmit(async (values) => {
console.log(values);
const out: LOARequest = {
member_id: values.member_id,
start_date: values.start_date,
end_date: values.end_date,
type_id: values.type.id,
reason: values.reason
};
if (props.adminMode) {
await adminSubmitLOA(out);
} else {
await submitLOA(out);
}
})
onMounted(async () => {