diff --git a/src/api/evaluate/api.evaluate.ts b/src/api/evaluate/api.evaluate.ts index cb4d9da..932ca4f 100644 --- a/src/api/evaluate/api.evaluate.ts +++ b/src/api/evaluate/api.evaluate.ts @@ -3,6 +3,7 @@ import env from "../index"; const evaluation = `${env.API_URI}/evaluation`; export default { + evaluationList:() =>`${evaluation}/user`, evaluationCheckStatus: () => `${evaluation}/check-status`, evaluationCheckStep: (id: string) => `${evaluation}/check/${id}`, evaluationCheckById: (id: string) => `${evaluation}/check/${id}`, diff --git a/src/modules/06_evaluate/components/EvaluateStepMain.vue b/src/modules/06_evaluate/components/EvaluateStepMain.vue index 7ab52aa..7d38e0a 100644 --- a/src/modules/06_evaluate/components/EvaluateStepMain.vue +++ b/src/modules/06_evaluate/components/EvaluateStepMain.vue @@ -52,8 +52,6 @@ function onClickPopupHistory() { } async function onCilckNextStep() { - console.log(store.step); - const functionCreateDoc: (() => Promise) | null = store.step === 1 ? await saveStep1 @@ -94,6 +92,13 @@ async function onCilckNextStep() { } async function validateForm() { + console.log(downloadFileRef.value); + + store.checkFileupload = !store.checkFileupload; + console.log(store.checkFileupload); + + const emptyValues = downloadFileRef.value.filter((e: any) => e === ""); + const hasError = []; for (const key in formCommandRef) { if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) { @@ -105,13 +110,21 @@ async function validateForm() { } } if (hasError.every((result) => result === true)) { - store.step === 2 ? saveStep2() : saveStep6(); + if (emptyValues.length > 0) { + console.log("There are empty values in the array."); + } else { + store.step === 2 ? saveStep2() : saveStep6(); + } + + // store.step === 2 && emptyValues.length > 0 ? saveStep2() : saveStep6(); } } const pdfSrc = ref(); -async function updateFilePDF(url: any) { +const urlDownloadFile = ref(""); +async function updateFilePDF(url: any, urlDownload: string) { pdfSrc.value = url; + urlDownloadFile.value = urlDownload; } /** function เช็คการยื่นข้อประเมิน*/ @@ -123,7 +136,6 @@ async function fetchCheckStatus() { const data = res.data.result; const id = route.params.type === "expert" ? data.expertId : data.specialExpertId; - router.push(`/evaluate/detail/${route.params.type}/${id}`); }) .catch((err) => { @@ -324,13 +336,13 @@ const formCommandRef: FormCommandRef = { fileEvaluation5: fileEvaluation5Ref, fileEvaluation6: fileEvaluation6Ref, }; +const downloadFileRef = ref(); function updateformCommand(val: any, ref: any) { formCommand.commanderFullname = val.commanderFullname; formCommand.commanderPosition = val.commanderPosition; formCommand.commanderAboveFullname = val.commanderAboveFullname; formCommand.commanderAbovePosition = val.commanderAbovePosition; - commanderFullnameRef.value = ref.commanderFullnameRef; commanderPositionRef.value = ref.commanderPositionRef; commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef; @@ -341,7 +353,9 @@ function updateformCommand(val: any, ref: any) { fileEvaluation4Ref.value = ref.fileEvaluation4Ref; fileEvaluation5Ref.value = ref.fileEvaluation5Ref; fileEvaluation6Ref.value = ref.fileEvaluation6Ref; + downloadFileRef.value = ref.downloadFile; } + async function saveStep2() { dialogConfirm( $q, @@ -572,10 +586,12 @@ onMounted(async () => { diff --git a/src/modules/06_evaluate/components/Stepper.vue b/src/modules/06_evaluate/components/Stepper.vue index 7f339dd..163e00f 100644 --- a/src/modules/06_evaluate/components/Stepper.vue +++ b/src/modules/06_evaluate/components/Stepper.vue @@ -74,7 +74,7 @@ const store = useEvaluateStore(); @@ -83,7 +83,7 @@ const store = useEvaluateStore(); diff --git a/src/modules/06_evaluate/components/TableListEvaluate.vue b/src/modules/06_evaluate/components/TableListEvaluate.vue index 7d5fdf1..557c241 100644 --- a/src/modules/06_evaluate/components/TableListEvaluate.vue +++ b/src/modules/06_evaluate/components/TableListEvaluate.vue @@ -1,17 +1,12 @@