diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 17f21f7eb..6dc129465 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -78,4 +78,8 @@ export default { orgPosMasterListEmp: `${orgEmployeePos}/master/list`, orgPosMasterEmp: `${orgEmployeePos}/master`, orgPosSortEmp: `${orgEmployeePos}/sort`, + orgPosPositionEmpById: (id: string) => `${orgEmployeePos}/position/${id}`, + orgPosMoveEmp: `${orgEmployeePos}/move`, + orgProfileEmp: `${orgEmployeePos}/profile`, + orgSearchProfileEmp: `${orgProfile}-employee/search`, }; diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index 7b484cfe0..4c106ad34 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -2,8 +2,8 @@ import env from "../index"; const salary = `${env.API_URI}/salary`; const salaryRate = `${env.API_URI}/salary/rate`; const salaryPeriod = `${env.API_URI}/salary/period`; - const salaryOrg = `${env.API_URI}/org/employee`; +const salaryFormula = `${env.API_URI}/salary/formula`; export default { salaryChart: salary, @@ -20,6 +20,7 @@ export default { salaryRateListByid: (id: string) => `${salaryRate}/${id}`, salaryReportByid: (id: string) => `${salary}/report/${id}`, salaryPeriod: () => `${salary}/period`, + salaryPeriodActive: () => `${salary}/period/active`, /** รายการเงินเดือน*/ keycloakPositionByid: (id: string) => @@ -45,5 +46,8 @@ export default { salaryEmployeeRateListByid: (id: string) => `${salaryRate}/employee/${id}`, salaryEmployeePosType:()=>`${salaryOrg}/pos/type`, - salaryEmployeePositionType:(key:string)=>`${salaryOrg}/pos/position?keyword=${key}&type=positionType` + salaryFormula:()=>`${salaryFormula}`, + salaryFormulaById:(id:string)=>`${salaryFormula}/${id}`, + salaryEmployeePositionType:(key:string)=>`${salaryOrg}/pos/position?keyword=${key}&type=positionType`, + salaryEmployeeActive :()=>`${salary}/employee/active` }; 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, diff --git a/src/modules/01_metadataNew/components/insignia/InsigniaList.vue b/src/modules/01_metadataNew/components/insignia/InsigniaList.vue index 8ff7e51b4..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,21 +10,20 @@ import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; 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 +215,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 +404,7 @@ const dialogOrder = ref(false); - +
(false); - - - - +
+ +
+
+ +
+
+ +
+
+ +
@@ -463,7 +489,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" > บันทึกข้อมูล diff --git a/src/modules/01_metadataNew/components/personal/01ListPrefix.vue b/src/modules/01_metadataNew/components/personal/01ListPrefix.vue index ac074dfa6..2e982f834 100644 --- a/src/modules/01_metadataNew/components/personal/01ListPrefix.vue +++ b/src/modules/01_metadataNew/components/personal/01ListPrefix.vue @@ -57,7 +57,7 @@ const TABLE_COLUMNS = [ const $q = useQuasar(); const store = usePersonalDataStore(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const filterKeyword = ref(""); const dialog = ref(false); @@ -72,36 +72,11 @@ const visibleColumns = ref([ "lastUpdateFullName", ]); -const data = [ - { - id: "1", - name: "ว่าที่ร้อยตรี", - createdAt: new Date(), - lastUpdatedAt: new Date(), - lastUpdateFullName: "สาวิตรี ศรีสมัย", - }, - { - id: "2", - name: "นางสาว", - createdAt: new Date(), - lastUpdatedAt: new Date(), - lastUpdateFullName: "System Administrator", - }, - { - id: "3", - name: "นาย", - createdAt: new Date(), - lastUpdatedAt: new Date(), - lastUpdateFullName: "คณะกรรมการ ตรวจรับ", - }, -]; - async function fetchData() { showLoader(); await http .get(config.API.orgPrefix) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -113,22 +88,51 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgPrefix, { - name: prefix.value, - }); - fetchData(); + await http + .post(config.API.orgPrefix, { + name: prefix.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgPrefixId(id), { - name: prefix.value, - }); - fetchData(); + await http + .put(config.API.orgPrefixId(id), { + name: prefix.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgPrefixId(id)); - fetchData(); + await http + .delete(config.API.orgPrefixId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/02ListRank.vue b/src/modules/01_metadataNew/components/personal/02ListRank.vue index 9463345fa..b2b1a0b7b 100644 --- a/src/modules/01_metadataNew/components/personal/02ListRank.vue +++ b/src/modules/01_metadataNew/components/personal/02ListRank.vue @@ -59,7 +59,7 @@ const columns = [ const store = usePersonalDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const $q = useQuasar(); @@ -81,7 +81,6 @@ async function fetchData() { await http .get(config.API.orgRank) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -93,22 +92,51 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgRank, { - name: rank.value, - }); - fetchData(); + await http + .post(config.API.orgRank, { + name: rank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgRankId(id), { - name: rank.value, - }); - fetchData(); + await http + .put(config.API.orgRankId(id), { + name: rank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgRankId(id)); - fetchData(); + await http + .delete(config.API.orgRankId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/03ListBloodGroup.vue b/src/modules/01_metadataNew/components/personal/03ListBloodGroup.vue index d0d095aec..a8a9eb0fc 100644 --- a/src/modules/01_metadataNew/components/personal/03ListBloodGroup.vue +++ b/src/modules/01_metadataNew/components/personal/03ListBloodGroup.vue @@ -13,7 +13,7 @@ import config from "@/app.config"; const store = usePersonalDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const columns = [ { name: "bloodGroup", @@ -81,7 +81,6 @@ async function fetchData() { await http .get(config.API.orgBloodGroup) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -93,22 +92,51 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgBloodGroup, { - name: bloodGroup.value, - }); - fetchData(); + await http + .post(config.API.orgBloodGroup, { + name: bloodGroup.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgBloodGroupId(id), { - name: bloodGroup.value, - }); - fetchData(); + await http + .put(config.API.orgBloodGroupId(id), { + name: bloodGroup.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgBloodGroupId(id)); - fetchData(); + await http + .delete(config.API.orgBloodGroupId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/04ListGender.vue b/src/modules/01_metadataNew/components/personal/04ListGender.vue index a27c46878..c0c185118 100644 --- a/src/modules/01_metadataNew/components/personal/04ListGender.vue +++ b/src/modules/01_metadataNew/components/personal/04ListGender.vue @@ -13,7 +13,7 @@ import config from "@/app.config"; const store = usePersonalDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const columns = [ { name: "gender", @@ -81,7 +81,6 @@ async function fetchData() { await http .get(config.API.orgGender) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -93,22 +92,51 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgGender, { - name: gender.value, - }); - fetchData(); + await http + .post(config.API.orgGender, { + name: gender.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgGenderId(id), { - name: gender.value, - }); - fetchData(); + await http + .put(config.API.orgGenderId(id), { + name: gender.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgGenderId(id)); - fetchData(); + await http + .delete(config.API.orgGenderId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/05ListReligion.vue b/src/modules/01_metadataNew/components/personal/05ListReligion.vue index e6254821c..483cde13f 100644 --- a/src/modules/01_metadataNew/components/personal/05ListReligion.vue +++ b/src/modules/01_metadataNew/components/personal/05ListReligion.vue @@ -13,7 +13,7 @@ import config from "@/app.config"; const store = usePersonalDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const columns = [ { name: "religion", @@ -81,7 +81,6 @@ async function fetchData() { await http .get(config.API.orgReligion) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -93,22 +92,51 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgReligion, { - name: religion.value, - }); - fetchData(); + await http + .post(config.API.orgReligion, { + name: religion.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgReligionId(id), { - name: religion.value, - }); - fetchData(); + await http + .put(config.API.orgReligionId(id), { + name: religion.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgReligionId(id)); - fetchData(); + await http + .delete(config.API.orgReligionId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/06ListRelationship.vue b/src/modules/01_metadataNew/components/personal/06ListRelationship.vue index 45b691e39..60c0f2cd2 100644 --- a/src/modules/01_metadataNew/components/personal/06ListRelationship.vue +++ b/src/modules/01_metadataNew/components/personal/06ListRelationship.vue @@ -12,7 +12,7 @@ import config from "@/app.config"; const store = usePersonalDataStore(); const router = useRouter(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const columns = [ { name: "relationship", @@ -110,7 +110,6 @@ async function fetchData() { await http .get(config.API.orgRelationship) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -122,22 +121,50 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgRelationship, { - name: relationship.value, - }); - fetchData(); + await http + .post(config.API.orgRelationship, { + name: relationship.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } - async function editData(id: string) { - await http.put(config.API.orgRelationshipId(id), { - name: relationship.value, - }); - fetchData(); + await http + .put(config.API.orgRelationshipId(id), { + name: relationship.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgRelationshipId(id)); - fetchData(); + await http + .delete(config.API.orgRelationshipId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/07ListEducationLevel.vue b/src/modules/01_metadataNew/components/personal/07ListEducationLevel.vue index 8a7ebcaba..c2d2c382c 100644 --- a/src/modules/01_metadataNew/components/personal/07ListEducationLevel.vue +++ b/src/modules/01_metadataNew/components/personal/07ListEducationLevel.vue @@ -11,7 +11,7 @@ import config from "@/app.config"; const store = usePersonalDataStore(); const mixin = useCounterMixin(); -const { dialogRemove, messageError, showLoader, hideLoader } = mixin; +const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const columns = [ { name: "name", @@ -91,7 +91,6 @@ async function fetchData() { await http .get(config.API.orgEducationLevel) .then(async (res) => { - console.log(res.data.result); store.save(res.data.result); }) .catch((err) => { @@ -103,24 +102,53 @@ async function fetchData() { } async function addData() { - await http.post(config.API.orgEducationLevel, { - name: educationLevel.value, - rank: educationRank.value, - }); - fetchData(); + await http + .post(config.API.orgEducationLevel, { + name: educationLevel.value, + rank: educationRank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function editData(id: string) { - await http.put(config.API.orgEducationLevelId(id), { - name: educationLevel.value, - rank: educationRank.value, - }); - fetchData(); + await http + .put(config.API.orgEducationLevelId(id), { + name: educationLevel.value, + rank: educationRank.value, + }) + .then(() => { + fetchData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } async function deleteData(id: string) { - await http.delete(config.API.orgEducationLevelId(id)); - fetchData(); + await http + .delete(config.API.orgEducationLevelId(id)) + .then(() => { + fetchData(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(async () => { diff --git a/src/modules/01_metadataNew/components/personal/DialogForm.vue b/src/modules/01_metadataNew/components/personal/DialogForm.vue index 7b6e40557..0845140a6 100644 --- a/src/modules/01_metadataNew/components/personal/DialogForm.vue +++ b/src/modules/01_metadataNew/components/personal/DialogForm.vue @@ -63,7 +63,7 @@ async function onSubmit() {