diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue deleted file mode 100644 index f7ccfbf1b..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue +++ /dev/null @@ -1,72 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue deleted file mode 100644 index 45e3650c2..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue +++ /dev/null @@ -1,64 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue deleted file mode 100644 index 2526d688c..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue index cc92edf38..bf6c8b280 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue @@ -9,6 +9,14 @@ import http from "@/plugins/http"; import type { typeItem } from "@/modules/11_discipline/interface/response/channel"; import { checkPermission } from "@/utils/permissions"; +import Header from "@/components/DialogHeader.vue"; + +const modal = ref(false); +const isEdit = ref(false); +const isRead = ref(false); +const isId = ref(""); +const channel = ref(""); + const dataStore = useDisciplineChannelDataStore(); const mixin = useCounterMixin(); const { dialogRemove, showLoader, messageError, hideLoader, success } = mixin; @@ -39,9 +47,27 @@ const pagination = ref({ /** * clickไปหน้าเพิ่มchanel */ -function clickAdd() { - dataStore.getType(""); - router.push(`/discipline/channel/add`); +function clickAdd(check: boolean) { + modal.value = true; + isEdit.value = check; +} +/** + * clickไปหน้าเพิ่มchanel + */ +function clickEdit(check: boolean, id: string, name: string) { + modal.value = true; + isEdit.value = check; + isId.value = id; + channel.value = name; +} +/** + * clickไปหน้าเพิ่มchanel + */ +function clickRead(check: boolean, name: string) { + modal.value = true; + isEdit.value = check; + isRead.value = true; + channel.value = name; } /** get data */ @@ -96,6 +122,42 @@ function editPage(data: typeItem) { dataStore.getType(data.name); router.push(`/discipline/channel/${data.id}`); } + +function closeDialog() { + modal.value = false; + channel.value = ""; + isId.value = ""; + isRead.value = false; +} + +function inputEdit(val: boolean) { + return { + "full-width cursor-pointer ": val, + "full-width cursor-pointer inputgreen": !val, + }; +} + +function onSubmit() { + const url = isEdit.value + ? config.API.complaintChannelbyId(isId.value) + : config.API.complaintChannel(); + showLoader(); + http[isEdit.value ? "put" : "post"](url, { + name: channel.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + getComplaintChanal(); + closeDialog(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +} + /**เมื่อเริ่มโหลดหน้า เรียกใช้ฟังชั่น*/ onMounted(() => { getComplaintChanal(); @@ -109,9 +171,9 @@ onMounted(() => {
{ >
+ + + + +
+ + + + + + + + + บันทึกข้อมูล + + + +