Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-13 18:06:14 +07:00
commit 2edda09818
8 changed files with 645 additions and 598 deletions

View file

@ -1,12 +1,13 @@
import env from "../index"; import env from "../index";
const registryNew = `${env.API_URI}/org/profile/`; const registryNew = `${env.API_URI}/org/profile`;
const metadata = `${env.API_URI}/org/metadata/`; const metadata = `${env.API_URI}/org/metadata/`;
const salaryNew = `${env.API_URI}/org/profile/salary`; const salaryNew = `${env.API_URI}/org/profile/salary`;
export default { export default {
registryNew, registryNew: (type: string) => `${registryNew}${type}`,
registryNewByProfileId: (profileId: string) => `${registryNew}${profileId}`, registryNewByProfileId: (profileId: string, type: string) =>
`${registryNew}${type}/${profileId}`,
// metadata // metadata
profileNewMetaMain: `${metadata}main/person`, profileNewMetaMain: `${metadata}main/person`,
@ -15,132 +16,132 @@ export default {
profileNewSubDistrictByDId: (id: string) => `${metadata}district/${id}`, profileNewSubDistrictByDId: (id: string) => `${metadata}district/${id}`,
// ประวัติส่วนตัว // ประวัติส่วนตัว
profileNewProfileByProfileId: (profileId: string) => profileNewProfileById: (dataId: string, type: string) =>
`${registryNew}${profileId}`, `${registryNew}${type}/${dataId}`,
profileNewProfileById: (dataId: string) => `${registryNew}${dataId}`, profileNewProfileHisById: (dataId: string, type: string) =>
profileNewProfileHisById: (dataId: string) => `${registryNew}${type}/history/${dataId}`,
`${registryNew}history/${dataId}`,
// ข้อมูลที่อยู่ // ข้อมูลที่อยู่
profileNewAddressByProfileId: (profileId: string) => profileNewAddressByProfileId: (profileId: string, type: string) =>
`${registryNew}address/${profileId}`, `${registryNew}${type}/address/${profileId}`,
profileNewAddressById: (dataId: string) => `${registryNew}address/${dataId}`, profileNewAddressById: (dataId: string, type: string) =>
profileNewAddressHisById: (dataId: string) => `${registryNew}${type}/address/${dataId}`,
`${registryNew}address/history/${dataId}`, profileNewAddressHisById: (dataId: string, type: string) =>
`${registryNew}${type}/address/history/${dataId}`,
// บันทึกวันที่ไม่ได้รับเงินเดือนฯ // บันทึกวันที่ไม่ได้รับเงินเดือนฯ
profileNewNoPaid: `${registryNew}nopaid`, profileNewNoPaid: `${registryNew}/nopaid`,
profileNewNoPaidByProfileId: (profileId: string) => profileNewNoPaidByProfileId: (profileId: string) =>
`${registryNew}nopaid/${profileId}`, `${registryNew}/nopaid/${profileId}`,
profileNewNoPaidById: (dataId: string) => `${registryNew}nopaid/${dataId}`, profileNewNoPaidById: (dataId: string) => `${registryNew}/nopaid/${dataId}`,
profileNewNoPaidHisById: (dataId: string) => profileNewNoPaidHisById: (dataId: string) =>
`${registryNew}nopaid/history/${dataId}`, `${registryNew}/nopaid/history/${dataId}`,
// เครื่องราชฯ // เครื่องราชฯ
profileNewInsign: `${registryNew}insignia`, profileNewInsign: `${registryNew}/insignia`,
profileNewInsignByProfileId: (profileId: string) => profileNewInsignByProfileId: (profileId: string) =>
`${registryNew}insignia/${profileId}`, `${registryNew}/insignia/${profileId}`,
profileNewInsignById: (dataId: string) => `${registryNew}insignia/${dataId}`, profileNewInsignById: (dataId: string) => `${registryNew}/insignia/${dataId}`,
profileNewInsignHisById: (dataId: string) => profileNewInsignHisById: (dataId: string) =>
`${registryNew}insignia/history/${dataId}`, `${registryNew}/insignia/history/${dataId}`,
// ประกาศเกียรติคุณ // ประกาศเกียรติคุณ
profileNewHonor: `${registryNew}honor`, profileNewHonor: `${registryNew}/honor`,
profileNewHonorByProfileId: (profileId: string) => profileNewHonorByProfileId: (profileId: string) =>
`${registryNew}honor/${profileId}`, `${registryNew}/honor/${profileId}`,
profileNewHonorById: (dataId: string) => `${registryNew}honor/${dataId}`, profileNewHonorById: (dataId: string) => `${registryNew}/honor/${dataId}`,
profileNewHonorHisById: (dataId: string) => profileNewHonorHisById: (dataId: string) =>
`${registryNew}honor/history/${dataId}`, `${registryNew}/honor/history/${dataId}`,
// ผลการประเมินการปฏิบัติราชการ // ผลการประเมินการปฏิบัติราชการ
profileNewAssessments: `${registryNew}assessments`, profileNewAssessments: `${registryNew}/assessments`,
profileNewAssessmentsByProfileId: (profileId: string) => profileNewAssessmentsByProfileId: (profileId: string) =>
`${registryNew}assessments/${profileId}`, `${registryNew}/assessments/${profileId}`,
profileNewAssessmentsById: (dataId: string) => profileNewAssessmentsById: (dataId: string) =>
`${registryNew}assessments/${dataId}`, `${registryNew}/assessments/${dataId}`,
profileNewAssessmentsHisById: (dataId: string) => profileNewAssessmentsHisById: (dataId: string) =>
`${registryNew}assessments/history/${dataId}`, `${registryNew}/assessments/history/${dataId}`,
// การฝึกอบรม // การฝึกอบรม
profileNewTraining: `${registryNew}training`, profileNewTraining: `${registryNew}/training`,
profileNewTrainingByProfileId: (profileId: string) => profileNewTrainingByProfileId: (profileId: string) =>
`${registryNew}training/${profileId}`, `${registryNew}/training/${profileId}`,
profileNewTrainingByTrainingId: (trainingId: string) => profileNewTrainingByTrainingId: (trainingId: string) =>
`${registryNew}training/${trainingId}`, `${registryNew}/training/${trainingId}`,
profileNewTrainingHisByTrainingId: (trainingId: string) => profileNewTrainingHisByTrainingId: (trainingId: string) =>
`${registryNew}training/history/${trainingId}`, `${registryNew}/training/history/${trainingId}`,
// ประวัติการศึกษา // ประวัติการศึกษา
profileNewEducation: `${registryNew}educations`, profileNewEducation: `${registryNew}/educations`,
profileNewEducationByProfileId: (profileId: string) => profileNewEducationByProfileId: (profileId: string) =>
`${registryNew}educations/${profileId}`, `${registryNew}/educations/${profileId}`,
profileNewEducationByEducationId: (educationId: string) => profileNewEducationByEducationId: (educationId: string) =>
`${registryNew}educations/${educationId}`, `${registryNew}/educations/${educationId}`,
profileNewEducationHisByEducationId: (educationsId: string) => profileNewEducationHisByEducationId: (educationsId: string) =>
`${registryNew}educations/history/${educationsId}`, `${registryNew}/educations/history/${educationsId}`,
// ความสามารถพิเศษ // ความสามารถพิเศษ
profileNewAbility: `${registryNew}ability`, profileNewAbility: `${registryNew}/ability`,
profileNewAbilityByProfileId: (profileId: string) => profileNewAbilityByProfileId: (profileId: string) =>
`${registryNew}ability/${profileId}`, `${registryNew}/ability/${profileId}`,
profileNewAbilityByAbilityId: (abilityId: string) => profileNewAbilityByAbilityId: (abilityId: string) =>
`${registryNew}ability/${abilityId}`, `${registryNew}/ability/${abilityId}`,
profileNewAbilityHisByAbilityId: (abilityId: string) => profileNewAbilityHisByAbilityId: (abilityId: string) =>
`${registryNew}ability/history/${abilityId}`, `${registryNew}/ability/history/${abilityId}`,
// ใบอนุญาตประกอบวิชาชีพ // ใบอนุญาตประกอบวิชาชีพ
profileNewCertificate: `${registryNew}certificate`, profileNewCertificate: `${registryNew}/certificate`,
profileNewCertificateByProfileId: (profileId: string) => profileNewCertificateByProfileId: (profileId: string) =>
`${registryNew}certificate/${profileId}`, `${registryNew}/certificate/${profileId}`,
profileNewCertificateByCertificateId: (certificateId: string) => profileNewCertificateByCertificateId: (certificateId: string) =>
`${registryNew}certificate/${certificateId}`, `${registryNew}/certificate/${certificateId}`,
profileNewCertificateHisByCertificateId: (certificateId: string) => profileNewCertificateHisByCertificateId: (certificateId: string) =>
`${registryNew}certificate/history/${certificateId}`, `${registryNew}/certificate/history/${certificateId}`,
// ข้อมูลอื่นๆ // ข้อมูลอื่นๆ
profileNewOther: `${registryNew}other`, profileNewOther: `${registryNew}/other`,
profileNewOtherByProfileId: (profileId: string) => profileNewOtherByProfileId: (profileId: string) =>
`${registryNew}other/${profileId}`, `${registryNew}/other/${profileId}`,
profileNewOtherById: (dataId: string) => `${registryNew}other/${dataId}`, profileNewOtherById: (dataId: string) => `${registryNew}/other/${dataId}`,
profileNewOtherHisById: (dataId: string) => profileNewOtherHisById: (dataId: string) =>
`${registryNew}other/history/${dataId}`, `${registryNew}/other/history/${dataId}`,
// ข้อมูลครอบครัว // ข้อมูลครอบครัว
profileNewFamily: `${registryNew}family`, profileNewFamily: `${registryNew}/family`,
profileNewFamilyByProfileId: (profileId: string) => profileNewFamilyByProfileId: (profileId: string) =>
`${registryNew}family/${profileId}`, `${registryNew}/family/${profileId}`,
profileNewFamilyByFamilyId: (familyId: string) => profileNewFamilyByFamilyId: (familyId: string) =>
`${registryNew}family/${familyId}`, `${registryNew}/family/${familyId}`,
profileNewFamilyHisByFamilyId: (familyId: string) => profileNewFamilyHisByFamilyId: (familyId: string) =>
`${registryNew}family/history/${familyId}`, `${registryNew}/family/history/${familyId}`,
// วินัย // วินัย
profileNewDiscipline: `${registryNew}discipline`, profileNewDiscipline: `${registryNew}/discipline`,
profileNewDisciplineByProfileId: (profileId: string) => profileNewDisciplineByProfileId: (profileId: string) =>
`${registryNew}discipline/${profileId}`, `${registryNew}/discipline/${profileId}`,
profileNewDisciplineByDisciplineId: (disciplineId: string) => profileNewDisciplineByDisciplineId: (disciplineId: string) =>
`${registryNew}discipline/${disciplineId}`, `${registryNew}/discipline/${disciplineId}`,
profileNewDisciplineHisByDisciplineId: (disciplineId: string) => profileNewDisciplineHisByDisciplineId: (disciplineId: string) =>
`${registryNew}discipline/history/${disciplineId}`, `${registryNew}/discipline/history/${disciplineId}`,
// ปฏิบัติราชการพิเศษ // ปฏิบัติราชการพิเศษ
profileNewDuty: `${registryNew}duty`, profileNewDuty: `${registryNew}/duty`,
profileNewDutyByProfileId: (profileId: string) => profileNewDutyByProfileId: (profileId: string) =>
`${registryNew}duty/${profileId}`, `${registryNew}/duty/${profileId}`,
profileNewDutyByDutyId: (dutyId: string) => `${registryNew}duty/${dutyId}`, profileNewDutyByDutyId: (dutyId: string) => `${registryNew}/duty/${dutyId}`,
profileNewDutyHisByDutyId: (dutyId: string) => profileNewDutyHisByDutyId: (dutyId: string) =>
`${registryNew}duty/history/${dutyId}`, `${registryNew}/duty/history/${dutyId}`,
//ข้อมูลราชการ //ข้อมูลราชการ
profileNewGovernment: () => `${registryNew}government`, profileNewGovernment: () => `${registryNew}/government`,
profileNewGovernmentById: (id: string) => `${registryNew}government/${id}`, profileNewGovernmentById: (id: string) => `${registryNew}/government/${id}`,
profileNewGovernmentHistory: (id: string) => profileNewGovernmentHistory: (id: string) =>
`${registryNew}government/history/${id}`, `${registryNew}/government/history/${id}`,
//การลา //การลา
profileNewLeave: () => `${registryNew}leave`, profileNewLeave: () => `${registryNew}/leave`,
profileNewLeaveById: (id: string) => `${registryNew}leave/${id}`, profileNewLeaveById: (id: string) => `${registryNew}/leave/${id}`,
profileNewLeaveHistory: (id: string) => `${registryNew}leave/history/${id}`, profileNewLeaveHistory: (id: string) => `${registryNew}/leave/history/${id}`,
profileCheckDate: () => `${env.API_URI}/leave/user/check`, profileCheckDate: () => `${env.API_URI}/leave/user/check`,
profileNewLeaveType: () => `${env.API_URI}/leave/type`, profileNewLeaveType: () => `${env.API_URI}/leave/type`,
@ -153,11 +154,11 @@ export default {
`${salaryNew}/swap/${type}/${id}`, `${salaryNew}/swap/${type}/${id}`,
// ประวัติการเปลี่ยนชื่อ-นามสกุล // ประวัติการเปลี่ยนชื่อ-นามสกุล
profileNewChangeName: `${registryNew}changeName`, profileNewChangeName: (type: string) => `${registryNew}${type}/changeName`,
profileNewChangeNameByProfileId: (profileId: string) => profileNewChangeNameByProfileId: (profileId: string, type: string) =>
`${registryNew}changeName/${profileId}`, `${registryNew}${type}/changeName/${profileId}`,
profileNewChangeNameByChangeNameId: (changeNameId: string) => profileNewChangeNameByChangeNameId: (changeNameId: string, type: string) =>
`${registryNew}changeName/${changeNameId}`, `${registryNew}${type}/changeName/${changeNameId}`,
profileNewChangeNameHisByChangeNameId: (changeNameId: string) => profileNewChangeNameHisByChangeNameId: (changeNameId: string, type: string) =>
`${registryNew}changeName/history/${changeNameId}`, `${registryNew}${type}/changeName/history/${changeNameId}`,
}; };

View file

@ -23,6 +23,7 @@ const props = defineProps({
fetchData: { type: Function }, fetchData: { type: Function },
fetchType: { type: Function }, fetchType: { type: Function },
total: { type: Number }, total: { type: Number },
empType: { type: String },
}); });
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -166,7 +167,11 @@ function onClickHistory() {
} }
function onClickViewDetail(id: string) { function onClickViewDetail(id: string) {
router.push(`/registry-new/${id}`); if (props.empType === "officer") {
router.push(`/registry-new/${id}`);
} else {
router.push(`/registry-new-employee/${id}`);
}
} }
watch( watch(

View file

@ -28,6 +28,9 @@ const { calculateAge, fetchPerson, filterSelector } = store;
const profileId = ref<string>( const profileId = ref<string>(
route.params.id ? route.params.id.toString() : "" route.params.id ? route.params.id.toString() : ""
); );
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const currentPage = ref<number>(1); const currentPage = ref<number>(1);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
@ -256,7 +259,7 @@ const visibleColumnsHistory = ref<String[]>([
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewProfileByProfileId(profileId.value)) .get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => { .then((res) => {
informaData.value = res.data.result; informaData.value = res.data.result;
if (informaData.value) { if (informaData.value) {
@ -281,7 +284,7 @@ const calculateMaxDate = () => {
async function editData() { async function editData() {
showLoader(); showLoader();
await http await http
.put(config.API.profileNewProfileById(id.value), { .put(config.API.profileNewProfileById(id.value, empType.value), {
...formData, ...formData,
}) })
.then((res) => { .then((res) => {
@ -299,7 +302,6 @@ async function editData() {
function onClickOpenDialog() { function onClickOpenDialog() {
if (!informaData.value) return; if (!informaData.value) return;
modal.value = true; modal.value = true;
id.value = informaData.value.id; id.value = informaData.value.id;
age.value = calculateAge(informaData.value.birthDate); age.value = calculateAge(informaData.value.birthDate);
formData.citizenId = informaData.value.citizenId; formData.citizenId = informaData.value.citizenId;
@ -332,7 +334,7 @@ function onSubmit() {
async function clickHistory() { async function clickHistory() {
modalHistory.value = true; modalHistory.value = true;
await http await http
.get(config.API.profileNewProfileHisById(id.value)) .get(config.API.profileNewProfileHisById(id.value,empType.value))
.then((res) => { .then((res) => {
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
}) })
@ -383,7 +385,14 @@ onMounted(async () => {
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
<q-btn dense flat round icon="mdi-history" color="info" @click="clickHistory"> <q-btn
dense
flat
round
icon="mdi-history"
color="info"
@click="clickHistory"
>
<q-tooltip>ประวแกไขขอมลสวนต</q-tooltip> <q-tooltip>ประวแกไขขอมลสวนต</q-tooltip>
</q-btn> </q-btn>
</div> </div>
@ -465,297 +474,297 @@ onMounted(async () => {
<q-card> <q-card>
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
tittle="แก้ไขประวัติส่วนตัว" tittle="แก้ไขประวัติส่วนตัว"
:close="() => (modal = false)" :close="() => (modal = false)"
/> />
<q-separator /> <q-separator />
<q-card-section style="max-height: 50vh" class="scroll"> <q-card-section style="max-height: 50vh" class="scroll">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
maxlength="13" maxlength="13"
mask="#############" mask="#############"
v-model="formData.citizenId" v-model="formData.citizenId"
class="inputgreen" class="inputgreen"
:label="dataLabel.citizenId" :label="dataLabel.citizenId"
:rules="[ :rules="[
(val: string) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`, (val: string) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`,
(val: string) => (val: string) =>
val.length >= 13 || val.length >= 13 ||
`${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`, `${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`,
]" ]"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
use-input use-input
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
input-debounce="0" input-debounce="0"
option-label="name" option-label="name"
option-value="name" option-value="name"
v-model="formData.prefix" v-model="formData.prefix"
class="inputgreen" class="inputgreen"
:options="store.Ops.prefixOps" :options="store.Ops.prefixOps"
:label="dataLabel.prefix" :label="dataLabel.prefix"
:rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
clearable clearable
use-input use-input
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
input-debounce="0" input-debounce="0"
option-label="name" option-label="name"
option-value="name" option-value="name"
v-model="formData.rank" v-model="formData.rank"
class="inputgreen" class="inputgreen"
:options="store.Ops.rankOps" :options="store.Ops.rankOps"
:label="dataLabel.rank" :label="dataLabel.rank"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="formData.firstName" v-model="formData.firstName"
class="inputgreen" class="inputgreen"
:label="dataLabel.firstName" :label="dataLabel.firstName"
:rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="formData.lastName" v-model="formData.lastName"
class="inputgreen" class="inputgreen"
:label="dataLabel.lastName" :label="dataLabel.lastName"
:rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<datepicker <datepicker
autoApply autoApply
:max-date="calculateMaxDate()" :max-date="calculateMaxDate()"
borderless borderless
:enableTimePicker="false" :enableTimePicker="false"
week-start="0" week-start="0"
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="formData.birthDate" v-model="formData.birthDate"
:locale="'th'" :locale="'th'"
> >
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
<template #year-overlay-value="{ value }"> <template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input
for="inputDatereceive" for="inputDatereceive"
ref="dateReceivedRef" ref="dateReceivedRef"
outlined outlined
dense dense
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
:model-value=" :model-value="
formData.birthDate != null formData.birthDate != null
? date2Thai(formData.birthDate) ? date2Thai(formData.birthDate)
: null : null
" "
:label="dataLabel.birthDate" :label="dataLabel.birthDate"
:rules="[ :rules="[
(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`, (val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`,
]" ]"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
> >
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
readonly readonly
v-model="age" v-model="age"
:label="dataLabel.age" :label="dataLabel.age"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
use-input use-input
clearable clearable
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
input-debounce="0" input-debounce="0"
option-label="name" option-label="name"
option-value="name" option-value="name"
v-model="formData.gender" v-model="formData.gender"
class="inputgreen" class="inputgreen"
:options="store.Ops.genderOps" :options="store.Ops.genderOps"
:label="dataLabel.gender" :label="dataLabel.gender"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
use-input use-input
clearable clearable
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
option-value="name" option-value="name"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
class="inputgreen" class="inputgreen"
v-model="formData.relationship" v-model="formData.relationship"
:options="store.Ops.statusOps" :options="store.Ops.statusOps"
:label="dataLabel.relationship" :label="dataLabel.relationship"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
v-model="formData.nationality" v-model="formData.nationality"
:label="dataLabel.nationality" :label="dataLabel.nationality"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
dense dense
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
v-model="formData.ethnicity" v-model="formData.ethnicity"
:label="dataLabel.ethnicity" :label="dataLabel.ethnicity"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
use-input use-input
clearable clearable
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
option-value="name" option-value="name"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
v-model="formData.religion" v-model="formData.religion"
class="inputgreen" class="inputgreen"
:options="store.Ops.religionOps" :options="store.Ops.religionOps"
:label="dataLabel.religion" :label="dataLabel.religion"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps'
)" )"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
dense dense
outlined outlined
use-input use-input
clearable clearable
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
option-value="name" option-value="name"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
v-model="formData.bloodGroup" v-model="formData.bloodGroup"
class="inputgreen" class="inputgreen"
:options="store.Ops.bloodOps" :options="store.Ops.bloodOps"
:label="dataLabel.bloodGroup" :label="dataLabel.bloodGroup"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps'
)" )"
/> />
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
mask="##########"
class="inputgreen"
v-model="formData.phone"
:label="dataLabel.phone"
/>
</div>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
mask="##########"
class="inputgreen"
v-model="formData.phone"
:label="dataLabel.phone"
/>
</div>
</div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn
dense dense
unelevated unelevated
label="บันทึก" label="บันทึก"
id="onSubmit" id="onSubmit"
type="submit" type="submit"
color="public" color="public"
class="q-px-md" class="q-px-md"
> >
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</q-form> </q-form>
</q-card> </q-card>
@ -764,92 +773,90 @@ onMounted(async () => {
<q-dialog v-model="modalHistory" persistent> <q-dialog v-model="modalHistory" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader <DialogHeader
tittle="ประวัติแก้ไขข้อมูลส่วนตัว" tittle="ประวัติแก้ไขข้อมูลส่วนตัว"
:close="() => (modalHistory = false)" :close="() => (modalHistory = false)"
/> />
<q-separator /> <q-separator />
<q-card-section style="max-height: 50vh" class="scroll"> <q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm"> <div class="row q-gutter-sm q-mb-sm">
<q-space /> <q-space />
<q-input <q-input
standout standout
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
>
<template v-slot:append>
<q-icon
v-if="filterHistory == ''"
name="search"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense dense
:columns="columnsHistory" v-model="filterHistory"
:rows="rowsHistory" ref="filterRef"
class="custom-header-table" outlined
v-model:pagination="pagination" placeholder="ค้นหา"
:rows-per-page-options="[10, 25, 50, 100]" debounce="300"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
> >
> <template v-slot:append>
<template v-slot:header="props"> <q-icon
<q-tr :props="props"> v-if="filterHistory == ''"
<q-th v-for="col in props.cols" :key="col.name" :props="props"> name="search"
<span class="text-weight-medium">{{ col.label }}</span> @click.stop.prevent="filterHistory = ''"
</q-th> class="cursor-pointer"
</q-tr> />
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template> </template>
<template v-slot:body="props"> </q-input>
<q-tr :props="props" class="cursor-pointer"> <q-select
<q-td v-for="col in props.cols" :key="col.id"> v-model="visibleColumnsHistory"
<div> multiple
{{ col.value ? col.value : "-" }} outlined
</div> dense
</q-td> options-dense
</q-tr> :display-value="$q.lang.table.columns"
</template> emit-value
</d-table> map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columnsHistory"
:rows="rowsHistory"
class="custom-header-table"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right"> </q-card-actions>
</q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -30,6 +30,10 @@ const {
const submitDisable = ref<boolean>(true); const submitDisable = ref<boolean>(true);
const { fetchPerson } = store; const { fetchPerson } = store;
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const editId = ref<string>(""); const editId = ref<string>("");
const dialog = ref<boolean>(false); const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("create"); const dialogStatus = ref<string>("create");
@ -315,7 +319,7 @@ async function uploadFileURL(uploadUrl: string, file: any) {
async function fetchDataPersonal() { async function fetchDataPersonal() {
showLoader(); showLoader();
await http await http
.get(config.API.registryNewByProfileId(profileId.value)) .get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => { .then((res) => {
profileInfo.value = res.data.result; profileInfo.value = res.data.result;
}) })
@ -353,7 +357,7 @@ async function fetchProfile(id: string) {
async function addData() { async function addData() {
await http await http
.post(config.API.profileNewChangeName, { .post(config.API.profileNewChangeName(empType.value), {
...changeNameData, ...changeNameData,
}) })
.then((res) => { .then((res) => {
@ -372,10 +376,13 @@ async function addData() {
function editData(idData: string) { function editData(idData: string) {
http http
.patch(config.API.profileNewChangeNameByChangeNameId(idData), { .patch(
...changeNameData, config.API.profileNewChangeNameByChangeNameId(idData, empType.value),
profileId: undefined, {
}) ...changeNameData,
profileId: undefined,
}
)
.then(() => { .then(() => {
fetchData(profileId.value); fetchData(profileId.value);
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -429,7 +436,7 @@ function deleteFileData(idData: string) {
async function fetchHistoryData(id: string) { async function fetchHistoryData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewChangeNameHisByChangeNameId(id)) .get(config.API.profileNewChangeNameHisByChangeNameId(id, empType.value))
.then(async (res) => { .then(async (res) => {
historyRows.value = res.data.result; historyRows.value = res.data.result;
}) })
@ -456,7 +463,7 @@ function closeHistoryDialog() {
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewChangeNameByProfileId(id)) .get(config.API.profileNewChangeNameByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = res.data.result; rows.value = res.data.result;
}) })
@ -901,39 +908,38 @@ watch(
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn
id="onSubmit" id="onSubmit"
type="submit" type="submit"
dense dense
:disable="submitDisable" :disable="submitDisable"
unelevated unelevated
label="บันทึก" label="บันทึก"
color="public" color="public"
class="q-px-md" class="q-px-md"
@click=" @click="
() => { () => {
if (!!fileUpload && dialogStatus === 'create') { if (!!fileUpload && dialogStatus === 'create') {
alertUpload = false; alertUpload = false;
} else { } else {
alertUpload = true; alertUpload = true;
}
} }
" }
> "
<q-tooltip>นทกขอม</q-tooltip> >
</q-btn> <q-tooltip>นทกขอม</q-tooltip>
</q-card-actions> </q-btn>
</q-card-actions>
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
<q-dialog v-model="historyDialog" class="dialog" persistent> <q-dialog v-model="historyDialog" class="dialog" persistent>
<q-card style="min-width: 70%"> <q-card style="min-width: 70%">
<dialog-header <dialog-header
tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล" tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล"
:close="closeHistoryDialog" :close="closeHistoryDialog"
/> />
<q-separator /> <q-separator />
<q-card-section style="max-height: 50vh" class="scroll"> <q-card-section style="max-height: 50vh" class="scroll">
@ -1003,7 +1009,7 @@ watch(
</template> </template>
</d-table> </d-table>
</q-card-section> </q-card-section>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -35,6 +35,9 @@ const {
const profileId = ref<string>( const profileId = ref<string>(
route.params.id ? route.params.id.toString() : "" route.params.id ? route.params.id.toString() : ""
); );
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const currentPage = ref<number>(1); const currentPage = ref<number>(1);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
@ -251,7 +254,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewAddressByProfileId(profileId.value)) .get(config.API.profileNewAddressByProfileId(profileId.value,empType.value))
.then((res) => { .then((res) => {
Object.assign(addressData, res.data.result); Object.assign(addressData, res.data.result);
@ -366,7 +369,7 @@ async function fetchAll() {
async function editData() { async function editData() {
showLoader(); showLoader();
await http await http
.patch(config.API.profileNewAddressById(id.value), { .patch(config.API.profileNewAddressById(id.value,empType.value), {
...formData, ...formData,
id: undefined, id: undefined,
}) })
@ -420,7 +423,7 @@ async function onClickOpenDialog() {
async function clickHistory() { async function clickHistory() {
modalHistory.value = true; modalHistory.value = true;
await http await http
.get(config.API.profileNewAddressHisById(id.value)) .get(config.API.profileNewAddressHisById(id.value,empType.value))
.then((res) => { .then((res) => {
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
}) })
@ -482,14 +485,21 @@ onMounted(async () => {
<q-btn <q-btn
flat flat
round round
dense="" dense
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
color="primary" color="primary"
@click="onClickOpenDialog" @click="onClickOpenDialog"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
<q-btn dense flat round icon="mdi-history" color="info" @click="clickHistory"> <q-btn
dense
flat
round
icon="mdi-history"
color="info"
@click="clickHistory"
>
<q-tooltip>ประวอมลทอย</q-tooltip> <q-tooltip>ประวอมลทอย</q-tooltip>
</q-btn> </q-btn>
</div> </div>
@ -572,6 +582,127 @@ onMounted(async () => {
<DialogHeader tittle="แก้ไขข้อมูลที่อยู่" :close="clickClose" /> <DialogHeader tittle="แก้ไขข้อมูลที่อยู่" :close="clickClose" />
<q-separator color="grey-4" /> <q-separator color="grey-4" />
<q-card-section style="max-height: 60vh" class="scroll"> <q-card-section style="max-height: 60vh" class="scroll">
<div class="col-12 q-pb-xs">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
type="textarea"
class="inputgreen"
v-model="formData.registrationAddress"
:label="dataLabel.registrationAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
/>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationProvinceId"
:options="store.Ops.provinceOps"
:label="dataLabel.registrationProvince"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
@update:model-value="(value:string) => selectProvince(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationDistrictId"
:options="store.Ops.districtOps"
:label="dataLabel.registrationDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
@update:model-value="(value:string) => selectDistrict(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationSubDistrictId"
:options="store.Ops.subdistrictOps"
:label="dataLabel.registrationSubDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]"
@update:model-value="(value:string) => selectSubDistrict(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="formData.registrationZipCode"
:label="dataLabel.registrationZipCode"
/>
</div>
</div>
<!-- same address ? -->
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-medium"
>อยจจนตรงกบทอยตามทะเบยนบาน</label
>
<q-radio
dense
val="1"
label="ใช่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
<q-radio
dense
val="0"
label="ไม่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
</div>
<!-- current address -->
<div v-if="sameAddress === '0'">
<div class="col-12 q-pb-xs"> <div class="col-12 q-pb-xs">
<q-input <q-input
dense dense
@ -580,9 +711,9 @@ onMounted(async () => {
hide-bottom-space hide-bottom-space
type="textarea" type="textarea"
class="inputgreen" class="inputgreen"
v-model="formData.registrationAddress" v-model="formData.currentAddress"
:label="dataLabel.registrationAddress" :label="dataLabel.currentAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
/> />
</div> </div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
@ -599,11 +730,11 @@ onMounted(async () => {
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
class="inputgreen" class="inputgreen"
v-model="formData.registrationProvinceId" v-model="formData.currentProvinceId"
:options="store.Ops.provinceOps" :options="store.Ops.provinceOps"
:label="dataLabel.registrationProvince" :label="dataLabel.currentProvince"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]" :rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
@update:model-value="(value:string) => selectProvince(value, '1')" @update:model-value="(value:string) => selectProvince(value, '2')"
@filter="(inputValue:string, @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps' doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) " ) "
@ -622,11 +753,11 @@ onMounted(async () => {
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
class="inputgreen" class="inputgreen"
v-model="formData.registrationDistrictId" v-model="formData.currentDistrictId"
:options="store.Ops.districtOps" :options="store.Ops.districtCOps"
:label="dataLabel.registrationDistrict" :label="dataLabel.currentDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]" :rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
@update:model-value="(value:string) => selectDistrict(value, '1')" @update:model-value="(value:string) => selectDistrict(value, '2')"
@filter="(inputValue:string, @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps' doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) " ) "
@ -645,11 +776,11 @@ onMounted(async () => {
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
class="inputgreen" class="inputgreen"
v-model="formData.registrationSubDistrictId" v-model="formData.currentSubDistrictId"
:options="store.Ops.subdistrictOps" :options="store.Ops.subdistrictCOps"
:label="dataLabel.registrationSubDistrict" :label="dataLabel.currentSubDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]" :rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]"
@update:model-value="(value:string) => selectSubDistrict(value, '1')" @update:model-value="(value:string) => selectSubDistrict(value, '2')"
@filter="(inputValue:string, @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps' doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) " ) "
@ -662,133 +793,12 @@ onMounted(async () => {
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="formData.registrationZipCode" v-model="formData.currentZipCode"
:label="dataLabel.registrationZipCode" :label="dataLabel.registrationZipCode"
/> />
</div> </div>
</div> </div>
<!-- same address ? --> </div>
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-medium"
>อยจจนตรงกบทอยตามทะเบยนบาน</label
>
<q-radio
dense
val="1"
label="ใช่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
<q-radio
dense
val="0"
label="ไม่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
</div>
<!-- current address -->
<div v-if="sameAddress === '0'">
<div class="col-12 q-pb-xs">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
type="textarea"
class="inputgreen"
v-model="formData.currentAddress"
:label="dataLabel.currentAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
/>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentProvinceId"
:options="store.Ops.provinceOps"
:label="dataLabel.currentProvince"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
@update:model-value="(value:string) => selectProvince(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentDistrictId"
:options="store.Ops.districtCOps"
:label="dataLabel.currentDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
@update:model-value="(value:string) => selectDistrict(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentSubDistrictId"
:options="store.Ops.subdistrictCOps"
:label="dataLabel.currentSubDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]"
@update:model-value="(value:string) => selectSubDistrict(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="formData.currentZipCode"
:label="dataLabel.registrationZipCode"
/>
</div>
</div>
</div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">

View file

@ -23,6 +23,16 @@ export default [
Role: "organization", Role: "organization",
}, },
}, },
{
path: "/registry-new-employee/:id",
name: "registryNewEmployeeByid",
component: detailPage,
meta: {
Auth: true,
Key: [7],
Role: "organization",
},
},
// { // {
// path: "/registry-new/list", // path: "/registry-new/list",

View file

@ -37,6 +37,10 @@ const {
} = mixin; } = mixin;
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const formDetail = ref<ResponseObject>(); const formDetail = ref<ResponseObject>();
const itemsMenu = ref<DataOption[]>([ const itemsMenu = ref<DataOption[]>([
{ {
@ -142,7 +146,7 @@ async function fetchProfile(id: string) {
async function fetchDataPersonal() { async function fetchDataPersonal() {
showLoader(); showLoader();
await http await http
.get(config.API.registryNewByProfileId(profileId.value)) .get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => { .then((res) => {
formDetail.value = res.data.result; formDetail.value = res.data.result;
}) })

View file

@ -148,7 +148,10 @@ async function fetchDataPerson(search: boolean = false) {
// check type person empType.value // check type person empType.value
http http
.get(config.API.registryNew, { params: queryParams }) .get(
config.API.registryNew(empType.value !== "officer" ? "-employee" : ""),
{ params: queryParams }
)
.then((res) => { .then((res) => {
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
dataPersonMain.value = res.data.result.data; dataPersonMain.value = res.data.result.data;
@ -646,6 +649,7 @@ onMounted(async () => {
:fetchData="fetchDataPerson" :fetchData="fetchDataPerson"
:fetchType="fetchType" :fetchType="fetchType"
:total="total" :total="total"
:empType="empType"
/> />
</q-card-section> </q-card-section>
</q-card> </q-card>