From e969ff7ba4331edd003fe20e3c6d97d2952ece1e Mon Sep 17 00:00:00 2001 From: Net Date: Fri, 19 Jul 2024 14:33:29 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=AA=E0=B8=96=E0=B8=B2=E0=B8=99=E0=B8=B0=20=E0=B8=81?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=20=E0=B8=A5=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../04_system/components/cardAutoBackup.vue | 35 +++++++++++++------ src/modules/04_system/stores/main.ts | 14 ++++++++ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/modules/04_system/components/cardAutoBackup.vue b/src/modules/04_system/components/cardAutoBackup.vue index de062591..285e4a3b 100644 --- a/src/modules/04_system/components/cardAutoBackup.vue +++ b/src/modules/04_system/components/cardAutoBackup.vue @@ -42,6 +42,8 @@ const { createSchedule, editSchedule, deleteSchedule, + + toggleSchedule, } = useDataStore(); const storeData = useDataStore(); const { dataBackUp, restoreRunTotal, dataSchedule } = storeToRefs(storeData); @@ -180,7 +182,8 @@ async function onSubmit() { function onDelete(id: string) { dialogRemove($q, async () => { showLoader(); - deleteBackUp(id); + await deleteSchedule(id); + await getSchedule(); }); } @@ -210,13 +213,13 @@ const tabItems = ref([ ]); const dayColors: { [key: string]: string } = { - monday: "#FFFF00", // Yellow - tuesday: "#FF69B4", // Pink - wednesday: "#008000", // Green - thursday: "#FFA500", // Orange - friday: "#0000FF", // Blue - saturday: "#800080", // Purple - sunday: "#FF0000", // Red + mon: "#FFC700", // Yellow + tue: "#FF69B4", // Pink + wed: "#008000", // Green + thu: "#FFA500", // Orange + fri: "#0000FF", // Blue + sat: "#800080", // Purple + sun: "#FF0000", // Red }; const dayNames: { [key: string]: string } = { @@ -359,7 +362,17 @@ onMounted(async () => { {{ date2Thai(props.row.startAt, true, false) }} - + + + { icon="edit" color="primary" size="12px" - @click.petvent="onDelete(props.row.name)" + @click.petvent="onDelete(props.row.id)" > ลบข้อมูลสำรอง @@ -381,7 +394,7 @@ onMounted(async () => { icon="delete" color="red" size="12px" - @click.petvent="onRestore(props.row.name)" + @click.petvent="onDelete(props.row.id)" > คืนค่า diff --git a/src/modules/04_system/stores/main.ts b/src/modules/04_system/stores/main.ts index 6f8028d1..39b74b24 100644 --- a/src/modules/04_system/stores/main.ts +++ b/src/modules/04_system/stores/main.ts @@ -294,6 +294,18 @@ export const useDataStore = defineStore("systemStore", () => { }); } + async function toggleSchedule(id: string) { + showLoader(); + await http + .post(config.API.backup + "/schedule/" + id + "/toggle") + .then(async (res) => { + return res.data; + }) + .finally(() => { + hideLoader(); + }); + } + async function deleteSchedule(id: string) { showLoader(); await http @@ -327,5 +339,7 @@ export const useDataStore = defineStore("systemStore", () => { createSchedule, editSchedule, deleteSchedule, + + toggleSchedule, }; });