From d1d0404fffd713b30cedf6408852c9ba5f56ee8a Mon Sep 17 00:00:00 2001 From: waruneeta Date: Thu, 17 Aug 2023 11:32:50 +0700 Subject: [PATCH] modify dialogRemove function (mixin) --- src/stores/mixin.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 8a625357b..463b8e2ac 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -441,12 +441,21 @@ export const useCounterMixin = defineStore("mixin", () => { }); }; - const dialogRemove = (q: any, ok?: Function, cancel?: Function) => { + const dialogRemove = ( + q: any, + ok?: Function, + title?: string, // ถ้ามี cancel action ใส่เป็น null + desc?: string, // ถ้ามี cancel action ใส่เป็น null + cancel?: Function + ) => { q.dialog({ component: CustomComponent, componentProps: { - title: "ยืนยันการลบข้อมูล", - message: "ต้องการยืนยันการลบข้อมูลนี้ใช่หรือไม่?", + title: title && title != null ? title : "ยืนยันการลบข้อมูล", + message: + desc && desc != null + ? desc + : "ต้องการยืนยันการลบข้อมูลนี้ใช่หรือไม่?", icon: "delete", color: "red", textOk: "ตกลง", @@ -792,6 +801,6 @@ export const useCounterMixin = defineStore("mixin", () => { // common dialog dialogConfirm, dialogRemove, - dialogMessageNotify + dialogMessageNotify, }; });