From 0f8c9832ee7b9c826033b5adcb4fb9985079c891 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Fri, 15 Mar 2024 11:11:16 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1?= =?UTF-8?q?=E0=B8=B9=E0=B8=A5=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A:=20=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=AA=E0=B9=84=E0=B8=95=E0=B8=A5?= =?UTF-8?q?=E0=B9=8C/validate/=E0=B9=83=E0=B8=AA=E0=B9=88catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/insignia/InsigniaList.vue | 164 ++++++++++-------- .../components/insignia/InsigniaType.vue | 87 ++++++---- 2 files changed, 152 insertions(+), 99 deletions(-) diff --git a/src/modules/01_metadataNew/components/insignia/InsigniaList.vue b/src/modules/01_metadataNew/components/insignia/InsigniaList.vue index 8ff7e51b4..909c98e87 100644 --- a/src/modules/01_metadataNew/components/insignia/InsigniaList.vue +++ b/src/modules/01_metadataNew/components/insignia/InsigniaList.vue @@ -13,18 +13,18 @@ const store = useInsigniaDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -// const props = defineProps({ -// fetchData: { -// type: Function, -// default: () => "", -// }, -// }); const insigniaTypeName = defineModel("insigniaTypeName", { required: true, }); -const { dialogRemove, dialogConfirm, showLoader, hideLoader, messageError } = - mixin; +const { + dialogRemove, + dialogConfirm, + showLoader, + hideLoader, + messageError, + success, +} = mixin; const $q = useQuasar(); const columns = ref([ { @@ -216,26 +216,49 @@ async function addData() { }) .then(() => { fetchData(id.value); + success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } async function editData(idData: string) { - await http.put(config.API.insigniaNewIdOrg(idData), { - name: name.value, - isActive: isActive.value, - shortName: shortName.value, - note: note.value == "" ? "-" : note.value, - insigniaTypeId: id.value, - }); - fetchData(id.value); + await http + .put(config.API.insigniaNewIdOrg(idData), { + name: name.value, + isActive: isActive.value, + shortName: shortName.value, + note: note.value == "" ? "-" : note.value, + insigniaTypeId: id.value, + }) + .then(() => { + fetchData(id.value); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(idData: string) { - await http.delete(config.API.insigniaNewIdOrg(idData)); - fetchData(id.value); + await http + .delete(config.API.insigniaNewIdOrg(idData)) + .then(() => { + fetchData(id.value); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } import { defineEmits } from "vue"; @@ -382,7 +405,7 @@ const dialogOrder = ref(false); - +
(false); - - - - +
+ +
+
+ +
+
+ +
+
+ +
@@ -463,7 +490,6 @@ const dialogOrder = ref(false); unelevated label="บันทึก" color="public" - class="q-px-md" > บันทึกข้อมูล diff --git a/src/modules/01_metadataNew/components/insignia/InsigniaType.vue b/src/modules/01_metadataNew/components/insignia/InsigniaType.vue index 9353c4022..216586c40 100644 --- a/src/modules/01_metadataNew/components/insignia/InsigniaType.vue +++ b/src/modules/01_metadataNew/components/insignia/InsigniaType.vue @@ -95,8 +95,6 @@ const visibleColumns = ref([ "isActive", ]); -// const row = ref([]); - async function fetchData() { showLoader(); await http @@ -125,24 +123,53 @@ function onclickDetail(id: string) { } async function addData() { - await http.post(config.API.insigniaTypeOrg, { - name: name.value, - isActive: isActive.value, - }); - fetchData(); + await http + .post(config.API.insigniaTypeOrg, { + name: name.value, + isActive: isActive.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.insigniaTypeNewIdOrg(id), { - name: name.value, - isActive: isActive.value, - }); - fetchData(); + await http + .put(config.API.insigniaTypeNewIdOrg(id), { + name: name.value, + isActive: isActive.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.insigniaTypeNewIdOrg(id)); - fetchData(); + await http + .delete(config.API.insigniaTypeNewIdOrg(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } function validateForm() { @@ -287,7 +314,7 @@ async function onSubmit() { - + - +
+ +
@@ -333,7 +361,6 @@ async function onSubmit() { unelevated label="บันทึก" color="public" - class="q-px-md" > บันทึกข้อมูล From 6833f1cdbd91c9d8ee263df768ef49b6f3fc04b9 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Fri, 15 Mar 2024 11:13:07 +0700 Subject: [PATCH 2/3] =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1?= =?UTF-8?q?=E0=B8=B9=E0=B8=A5=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A:=20clear=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../01_metadataNew/components/insignia/InsigniaList.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/01_metadataNew/components/insignia/InsigniaList.vue b/src/modules/01_metadataNew/components/insignia/InsigniaList.vue index 909c98e87..50635562c 100644 --- a/src/modules/01_metadataNew/components/insignia/InsigniaList.vue +++ b/src/modules/01_metadataNew/components/insignia/InsigniaList.vue @@ -2,7 +2,7 @@ import { ref, onMounted } from "vue"; import type { QTableProps } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; -import { useRouter, useRoute } from "vue-router"; +import { useRoute } from "vue-router"; import { useInsigniaDataStore } from "@/modules/01_metadataNew/stores/InsigniaStore"; import dialogHeader from "@/components/DialogHeader.vue"; import TableDraggable from "@/modules/01_metadataNew/components/insignia/TableDraggable.vue"; @@ -10,7 +10,6 @@ import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; const store = useInsigniaDataStore(); -const router = useRouter(); const mixin = useCounterMixin(); const insigniaTypeName = defineModel("insigniaTypeName", { From 5cece3379305dce2f24b7d0c5ec8ce16864c865a Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 15 Mar 2024 11:24:53 +0700 Subject: [PATCH 3/3] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=95=E0=B8=B4:=20api=20registry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/registry/api.registry.ts | 13 +++++++++++-- src/app.config.ts | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index ecc1fd7fd..49a69dc12 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -1,5 +1,14 @@ import env from "../index"; +const registryNew = `${env.API_URI}/org/profile/`; + export default { - -} \ No newline at end of file + registryNew, + profileNewInsign: `${registryNew}insignia`, + profileNewInsignByProfileId: (profileId: string) => + `${registryNew}insignia/${profileId}`, + profileNewInsignByInsignId: (insignId: string) => + `${registryNew}insignia/${insignId}`, + profileNewInsignHisByInsignId: (insignId: string) => + `${registryNew}insignia/history/${insignId}`, +}; diff --git a/src/app.config.ts b/src/app.config.ts index cf5b00d2f..96cc78b06 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -23,6 +23,7 @@ import recruit from "./api/recruiting/api.recruit"; /** API Profile List */ import profile from "./api/registry/api.profile"; +import registry from "./api/registry/api.registry"; /** API Report2 List */ import report2 from "./api/recruiting/api.report2"; @@ -98,6 +99,7 @@ const API = { //profile ...profile, + ...registry, //report2 ...report2,