2024-04-03 18:28:59 +07:00
|
|
|
<script setup lang="ts">
|
2024-06-27 08:32:31 +00:00
|
|
|
import { ref, onMounted, watch, computed } from 'vue';
|
2024-04-05 17:26:40 +07:00
|
|
|
import { storeToRefs } from 'pinia';
|
2024-06-27 08:32:31 +00:00
|
|
|
import { dialog } from 'src/stores/utils';
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
import useFlowStore from 'src/stores/flow';
|
2024-04-10 14:00:55 +07:00
|
|
|
import useUserStore from 'stores/user';
|
|
|
|
|
import useBranchStore from 'src/stores/branch';
|
|
|
|
|
|
2024-04-19 13:54:57 +07:00
|
|
|
import {
|
|
|
|
|
User,
|
|
|
|
|
UserAttachmentCreate,
|
|
|
|
|
UserCreate,
|
|
|
|
|
UserTypeStats,
|
|
|
|
|
} from 'src/stores/user/types';
|
2024-04-10 14:00:55 +07:00
|
|
|
import { BranchUserStats } from 'src/stores/branch/types';
|
2024-04-18 18:27:22 +07:00
|
|
|
import useAddressStore from 'src/stores/address';
|
2024-06-13 17:13:09 +07:00
|
|
|
import ButtonAddComponent from 'src/components/ButtonAddCompoent.vue';
|
2024-04-05 17:36:54 +07:00
|
|
|
import PersonCard from 'components/home/PersonCard.vue';
|
2024-04-03 18:28:59 +07:00
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
2024-04-05 17:36:54 +07:00
|
|
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
|
|
|
|
import SelectorList from 'components/SelectorList.vue';
|
2024-04-10 20:26:32 +07:00
|
|
|
import AddButton from 'components/AddButton.vue';
|
2024-04-05 17:43:16 +07:00
|
|
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
2024-04-05 19:05:51 +07:00
|
|
|
import FormDialog from 'src/components/FormDialog.vue';
|
2024-04-17 15:44:13 +07:00
|
|
|
import FormInformation from 'src/components/02_personnel-management/FormInformation.vue';
|
|
|
|
|
import FormPerson from 'src/components/02_personnel-management/FormPerson.vue';
|
2024-04-11 22:17:24 +07:00
|
|
|
import FormByType from 'src/components/02_personnel-management/FormByType.vue';
|
2024-04-18 18:27:22 +07:00
|
|
|
import DrawerInfo from 'src/components/DrawerInfo.vue';
|
2024-04-19 13:54:57 +07:00
|
|
|
import InfoForm from 'src/components/02_personnel-management/InfoForm.vue';
|
2024-06-27 08:32:31 +00:00
|
|
|
import ProfileUpload from 'src/components/ProfileUpload.vue';
|
2024-04-04 15:03:39 +07:00
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
const { locale } = useI18n();
|
2024-06-26 17:03:49 +07:00
|
|
|
|
|
|
|
|
const flowStore = useFlowStore();
|
2024-04-05 17:26:40 +07:00
|
|
|
const userStore = useUserStore();
|
2024-04-10 17:00:28 +07:00
|
|
|
const branchStore = useBranchStore();
|
2024-04-18 18:27:22 +07:00
|
|
|
const adrressStore = useAddressStore();
|
2024-04-05 17:26:40 +07:00
|
|
|
const { data: userData } = storeToRefs(userStore);
|
2024-04-03 18:28:59 +07:00
|
|
|
|
2024-04-10 14:00:55 +07:00
|
|
|
const defaultFormData = {
|
|
|
|
|
provinceId: null,
|
|
|
|
|
districtId: null,
|
|
|
|
|
subDistrictId: null,
|
|
|
|
|
telephoneNo: '',
|
|
|
|
|
email: '',
|
|
|
|
|
zipCode: '',
|
|
|
|
|
gender: '',
|
|
|
|
|
addressEN: '',
|
|
|
|
|
address: '',
|
|
|
|
|
trainingPlace: null,
|
|
|
|
|
importNationality: null,
|
|
|
|
|
sourceNationality: null,
|
|
|
|
|
licenseExpireDate: null,
|
|
|
|
|
licenseIssueDate: null,
|
|
|
|
|
licenseNo: null,
|
2024-04-18 09:06:21 +07:00
|
|
|
discountCondition: null,
|
2024-04-10 14:00:55 +07:00
|
|
|
retireDate: null,
|
|
|
|
|
startDate: null,
|
|
|
|
|
registrationNo: null,
|
|
|
|
|
lastNameEN: '',
|
|
|
|
|
lastName: '',
|
|
|
|
|
firstNameEN: '',
|
|
|
|
|
firstName: '',
|
|
|
|
|
userRole: '',
|
|
|
|
|
userType: '',
|
|
|
|
|
profileImage: null,
|
2024-04-11 22:17:24 +07:00
|
|
|
birthDate: null,
|
2024-04-18 09:06:21 +07:00
|
|
|
responsibleArea: null,
|
|
|
|
|
username: '',
|
2024-04-18 18:27:22 +07:00
|
|
|
status: 'CREATED',
|
2024-04-19 13:54:57 +07:00
|
|
|
checkpoint: null,
|
|
|
|
|
checkpointEN: null,
|
2024-04-10 14:00:55 +07:00
|
|
|
};
|
2024-04-10 17:00:28 +07:00
|
|
|
|
2024-04-22 14:04:06 +07:00
|
|
|
const userCode = ref<string>();
|
2024-04-18 18:27:22 +07:00
|
|
|
const currentUser = ref<User>();
|
2024-04-25 04:07:12 +00:00
|
|
|
const infoDrawerEdit = ref(false);
|
2024-04-19 09:06:38 +07:00
|
|
|
const infoPersonId = ref<string>('');
|
2024-04-18 18:27:22 +07:00
|
|
|
const infoPersonCard = ref();
|
|
|
|
|
const infoDrawer = ref(false);
|
2024-04-18 09:06:21 +07:00
|
|
|
const profileSubmit = ref(false);
|
2024-04-10 23:17:39 +07:00
|
|
|
const urlProfile = ref<string>();
|
2024-04-10 17:00:28 +07:00
|
|
|
const isEdit = ref(false);
|
2024-04-05 19:05:51 +07:00
|
|
|
const modal = ref(false);
|
2024-04-18 18:27:22 +07:00
|
|
|
const statusToggle = ref(true);
|
2024-04-18 16:35:47 +07:00
|
|
|
const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all');
|
|
|
|
|
const inputSearch = ref('');
|
2024-04-18 18:27:22 +07:00
|
|
|
const userId = ref<string>();
|
|
|
|
|
const selectorLabel = ref<string>('');
|
|
|
|
|
const hqId = ref<string>();
|
|
|
|
|
const brId = ref<string>();
|
2024-04-10 23:17:39 +07:00
|
|
|
const formDialogRef = ref();
|
|
|
|
|
const userStats = ref<BranchUserStats[]>();
|
2024-04-22 17:52:37 +07:00
|
|
|
const sortedUserStats = computed(() => {
|
|
|
|
|
return userStats.value?.slice().sort((a, b) => b.count - a.count);
|
|
|
|
|
});
|
2024-04-10 23:17:39 +07:00
|
|
|
const typeStats = ref<UserTypeStats>();
|
2024-04-19 13:54:57 +07:00
|
|
|
const agencyFile = ref<File[]>([]);
|
|
|
|
|
const agencyFileList = ref<{ name: string; url: string }[]>([]);
|
2024-04-10 17:00:28 +07:00
|
|
|
const formData = ref<UserCreate>({
|
|
|
|
|
provinceId: null,
|
|
|
|
|
districtId: null,
|
|
|
|
|
subDistrictId: null,
|
|
|
|
|
telephoneNo: '',
|
|
|
|
|
email: '',
|
|
|
|
|
zipCode: '',
|
|
|
|
|
gender: '',
|
|
|
|
|
addressEN: '',
|
|
|
|
|
address: '',
|
|
|
|
|
trainingPlace: null,
|
|
|
|
|
importNationality: null,
|
|
|
|
|
sourceNationality: null,
|
|
|
|
|
licenseExpireDate: null,
|
|
|
|
|
licenseIssueDate: null,
|
|
|
|
|
licenseNo: null,
|
2024-04-18 18:27:22 +07:00
|
|
|
discountCondition: null,
|
2024-04-10 17:00:28 +07:00
|
|
|
retireDate: null,
|
|
|
|
|
startDate: null,
|
|
|
|
|
registrationNo: null,
|
|
|
|
|
lastNameEN: '',
|
|
|
|
|
lastName: '',
|
|
|
|
|
firstNameEN: '',
|
|
|
|
|
firstName: '',
|
|
|
|
|
userRole: '',
|
|
|
|
|
userType: '',
|
|
|
|
|
profileImage: null,
|
|
|
|
|
birthDate: null,
|
2024-04-18 09:06:21 +07:00
|
|
|
responsibleArea: null,
|
|
|
|
|
checkpoint: null,
|
|
|
|
|
checkpointEN: null,
|
|
|
|
|
username: '',
|
2024-04-18 18:27:22 +07:00
|
|
|
status: 'CREATED',
|
2024-04-10 17:00:28 +07:00
|
|
|
});
|
2024-04-05 19:05:51 +07:00
|
|
|
|
2024-04-10 19:32:15 +07:00
|
|
|
const profileFile = ref<File | undefined>(undefined);
|
|
|
|
|
const inputFile = document.createElement('input');
|
|
|
|
|
inputFile.type = 'file';
|
|
|
|
|
inputFile.accept = 'image/*';
|
|
|
|
|
|
2024-04-17 11:32:18 +07:00
|
|
|
const reader = new FileReader();
|
|
|
|
|
|
|
|
|
|
reader.addEventListener('load', () => {
|
|
|
|
|
if (typeof reader.result === 'string') {
|
|
|
|
|
urlProfile.value = reader.result;
|
|
|
|
|
}
|
2024-06-27 08:32:31 +00:00
|
|
|
|
|
|
|
|
if (infoDrawerEdit.value) infoPersonCard.value[0].img = urlProfile.value;
|
2024-04-17 11:32:18 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(profileFile, () => {
|
|
|
|
|
if (profileFile.value) reader.readAsDataURL(profileFile.value);
|
|
|
|
|
});
|
|
|
|
|
|
2024-04-10 19:32:15 +07:00
|
|
|
inputFile.addEventListener('change', (e) => {
|
|
|
|
|
profileFile.value = (e.currentTarget as HTMLInputElement).files?.[0];
|
|
|
|
|
});
|
|
|
|
|
|
2024-04-17 17:06:32 +07:00
|
|
|
const selectorList = computed(() => [
|
|
|
|
|
{ label: 'USER', count: typeStats.value?.USER || 0 },
|
|
|
|
|
{ label: 'MESSENGER', count: typeStats.value?.MESSENGER || 0 },
|
|
|
|
|
{ label: 'DELEGATE', count: typeStats.value?.DELEGATE || 0 },
|
|
|
|
|
{ label: 'AGENCY', count: typeStats.value?.AGENCY || 0 },
|
|
|
|
|
]);
|
2024-04-10 14:00:55 +07:00
|
|
|
|
2024-06-25 16:26:46 +07:00
|
|
|
async function openDialog(
|
|
|
|
|
action?: 'FORM' | 'INFO',
|
|
|
|
|
idEdit?: string,
|
|
|
|
|
isPersonEdit: boolean = false,
|
|
|
|
|
) {
|
2024-04-22 14:04:06 +07:00
|
|
|
if (userStore.userOption.hqOpts.length === 0) {
|
|
|
|
|
await userStore.fetchHqOption();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (userStore.userOption.roleOpts.length === 0) {
|
|
|
|
|
await userStore.fetchRoleOption();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idEdit && userData.value) {
|
|
|
|
|
assignFormData(idEdit);
|
|
|
|
|
isEdit.value = true;
|
|
|
|
|
|
|
|
|
|
if (formData.value.userType === 'AGENCY') {
|
|
|
|
|
const result = await userStore.fetchAttachment(idEdit);
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
agencyFileList.value = result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
if (action === 'FORM') {
|
|
|
|
|
modal.value = true;
|
|
|
|
|
} else if (action === 'INFO') {
|
2024-04-22 14:04:06 +07:00
|
|
|
if (!userData.value) return;
|
2024-06-25 16:26:46 +07:00
|
|
|
|
|
|
|
|
infoDrawerEdit.value = isPersonEdit ? true : false;
|
2024-04-18 18:27:22 +07:00
|
|
|
infoDrawer.value = true;
|
|
|
|
|
const user = userData.value.result.find((x) => x.id === idEdit);
|
|
|
|
|
infoPersonCard.value = user
|
|
|
|
|
? [
|
|
|
|
|
{
|
|
|
|
|
id: user.id,
|
|
|
|
|
img: `${user.profileImageUrl}`,
|
|
|
|
|
name:
|
|
|
|
|
locale.value === 'en-US'
|
|
|
|
|
? `${user.firstNameEN} ${user.lastNameEN}`
|
|
|
|
|
: `${user.firstName} ${user.lastName}`,
|
|
|
|
|
male: user.gender === 'male',
|
|
|
|
|
female: user.gender === 'female',
|
|
|
|
|
badge: user.code,
|
|
|
|
|
disabled: user.status === 'INACTIVE',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
: [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
statusToggle.value = true;
|
2024-04-11 22:17:24 +07:00
|
|
|
userStore.userOption.brOpts = [];
|
2024-04-22 14:04:06 +07:00
|
|
|
hqId.value = userStore.userOption.hqOpts[0].value;
|
2024-04-05 19:05:51 +07:00
|
|
|
}
|
2024-04-10 14:00:55 +07:00
|
|
|
|
2024-04-19 09:06:38 +07:00
|
|
|
function undo() {
|
2024-04-19 14:19:08 +07:00
|
|
|
if (!infoPersonId.value) return;
|
2024-04-25 04:07:12 +00:00
|
|
|
infoDrawerEdit.value = false;
|
2024-04-19 09:06:38 +07:00
|
|
|
assignFormData(infoPersonId.value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-10 14:00:55 +07:00
|
|
|
function onClose() {
|
|
|
|
|
hqId.value = '';
|
|
|
|
|
brId.value = '';
|
|
|
|
|
userId.value = '';
|
2024-04-22 14:04:06 +07:00
|
|
|
userCode.value = '';
|
2024-06-27 08:32:31 +00:00
|
|
|
urlProfile.value = undefined;
|
|
|
|
|
profileFile.value = undefined;
|
2024-04-19 13:54:57 +07:00
|
|
|
agencyFile.value = [];
|
2024-04-11 22:17:24 +07:00
|
|
|
modal.value = false;
|
|
|
|
|
isEdit.value = false;
|
2024-04-22 14:04:06 +07:00
|
|
|
infoDrawer.value = false;
|
|
|
|
|
profileSubmit.value = false;
|
2024-04-18 18:27:22 +07:00
|
|
|
statusToggle.value = true;
|
2024-04-11 22:17:24 +07:00
|
|
|
Object.assign(formData.value, defaultFormData);
|
2024-04-18 09:06:21 +07:00
|
|
|
mapUserType(selectorLabel.value);
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-10 17:00:28 +07:00
|
|
|
async function onSubmit() {
|
2024-04-19 14:19:08 +07:00
|
|
|
if (profileSubmit.value) {
|
|
|
|
|
formData.value.profileImage = profileFile.value as File;
|
|
|
|
|
} else {
|
|
|
|
|
formData.value.profileImage = null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 10:54:32 +07:00
|
|
|
if (isEdit.value && userId.value) {
|
2024-06-27 08:32:31 +00:00
|
|
|
if (!userId.value) return;
|
|
|
|
|
|
|
|
|
|
const formDataEdit = {
|
|
|
|
|
...formData.value,
|
|
|
|
|
status: !statusToggle.value ? 'INACTIVE' : 'ACTIVE',
|
|
|
|
|
} as const;
|
|
|
|
|
await userStore.editById(userId.value, formDataEdit);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
hqId.value &&
|
|
|
|
|
currentUser.value?.branch[0] &&
|
|
|
|
|
hqId.value !== currentUser.value.branch[0].id &&
|
|
|
|
|
brId.value !== currentUser.value.branch[0].id
|
|
|
|
|
) {
|
|
|
|
|
await branchStore.removeUser(
|
|
|
|
|
currentUser.value.branch[0].id,
|
|
|
|
|
userId.value,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await branchStore.addUser(
|
|
|
|
|
!!brId.value ? brId.value : hqId.value,
|
|
|
|
|
userId.value,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!currentUser.value?.branch[0]) {
|
|
|
|
|
if (brId.value || hqId.value) {
|
|
|
|
|
await branchStore.addUser(
|
|
|
|
|
(!!brId.value ? brId.value : hqId.value)!,
|
|
|
|
|
userId.value,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (userId.value && formDataEdit.userType === 'AGENCY') {
|
|
|
|
|
if (!agencyFile.value) return;
|
|
|
|
|
const payload: UserAttachmentCreate = {
|
|
|
|
|
file: agencyFile.value,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (payload?.file) {
|
|
|
|
|
await userStore.addAttachment(userId.value, payload);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
userStore.fetchList({
|
|
|
|
|
includeBranch: true,
|
|
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
|
|
|
|
userType: selectorLabel.value ?? undefined,
|
2024-04-11 00:37:07 +07:00
|
|
|
});
|
2024-06-27 08:32:31 +00:00
|
|
|
typeStats.value = await userStore.typeStats();
|
|
|
|
|
const res = await branchStore.userStats(formData.value.userType);
|
|
|
|
|
if (res) {
|
|
|
|
|
userStats.value = res;
|
|
|
|
|
}
|
|
|
|
|
onClose();
|
2024-04-10 19:10:13 +07:00
|
|
|
} else {
|
2024-06-27 08:32:31 +00:00
|
|
|
if (!hqId.value) return;
|
|
|
|
|
|
|
|
|
|
statusToggle.value
|
|
|
|
|
? (formData.value.status = 'CREATED')
|
|
|
|
|
: (formData.value.status = 'INACTIVE');
|
|
|
|
|
|
|
|
|
|
const result = await userStore.create(formData.value);
|
|
|
|
|
if (result) {
|
|
|
|
|
await branchStore.addUser(
|
|
|
|
|
!!brId.value ? brId.value : hqId.value,
|
|
|
|
|
result.id,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result && formData.value.userType === 'AGENCY') {
|
|
|
|
|
if (!agencyFile.value) return;
|
|
|
|
|
|
|
|
|
|
const payload: UserAttachmentCreate = {
|
|
|
|
|
file: agencyFile.value,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (payload?.file) {
|
|
|
|
|
await userStore.addAttachment(result.id, payload);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectorLabel.value = formData.value.userType;
|
|
|
|
|
userStore.fetchList({
|
|
|
|
|
includeBranch: true,
|
|
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
|
|
|
|
userType: selectorLabel.value ?? undefined,
|
2024-04-11 00:37:07 +07:00
|
|
|
});
|
2024-06-27 08:32:31 +00:00
|
|
|
typeStats.value = await userStore.typeStats();
|
|
|
|
|
const res = await branchStore.userStats(formData.value.userType);
|
|
|
|
|
if (res) {
|
|
|
|
|
userStats.value = res;
|
|
|
|
|
}
|
|
|
|
|
onClose();
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function onDelete(id: string) {
|
2024-04-11 00:37:07 +07:00
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-trash-can-outline',
|
|
|
|
|
title: 'ยืนยันการลบข้อมูล',
|
|
|
|
|
actionText: 'ตกลง',
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: 'คุณต้องการลบข้อมูล ใช่หรือไม่',
|
|
|
|
|
action: async () => {
|
|
|
|
|
await userStore.deleteById(id);
|
2024-04-18 18:27:22 +07:00
|
|
|
await userStore.fetchList({
|
|
|
|
|
includeBranch: true,
|
2024-04-19 11:45:51 +07:00
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
2024-04-18 18:27:22 +07:00
|
|
|
userType: selectorLabel.value ?? undefined,
|
|
|
|
|
});
|
|
|
|
|
typeStats.value = await userStore.typeStats();
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-04-11 00:37:07 +07:00
|
|
|
},
|
|
|
|
|
});
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mapUserType(label: string) {
|
2024-04-18 09:06:21 +07:00
|
|
|
const userTypeMap: { [key: string]: string } = {
|
|
|
|
|
USER: 'USER',
|
|
|
|
|
MESSENGER: 'MESSENGER',
|
|
|
|
|
DELEGATE: 'DELEGATE',
|
|
|
|
|
AGENCY: 'AGENCY',
|
|
|
|
|
};
|
|
|
|
|
formData.value.userType = userTypeMap[label];
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-18 16:35:47 +07:00
|
|
|
async function toggleStatus(id: string) {
|
|
|
|
|
const record = userData.value?.result.find((v) => v.id === id);
|
|
|
|
|
|
|
|
|
|
if (!record) return;
|
|
|
|
|
|
|
|
|
|
const res = await userStore.editById(record.id, {
|
|
|
|
|
status: record.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE',
|
|
|
|
|
});
|
|
|
|
|
if (res) record.status = res.status;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
async function assignFormData(idEdit: string) {
|
|
|
|
|
if (!userData.value) return;
|
|
|
|
|
const foundUser = userData.value.result.find((user) => user.id === idEdit);
|
2024-04-22 14:04:06 +07:00
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
if (foundUser) {
|
|
|
|
|
currentUser.value = foundUser;
|
2024-04-19 09:06:38 +07:00
|
|
|
infoPersonId.value = currentUser.value.id;
|
2024-04-18 18:27:22 +07:00
|
|
|
|
|
|
|
|
formData.value = {
|
|
|
|
|
provinceId: foundUser.provinceId,
|
|
|
|
|
districtId: foundUser.districtId,
|
|
|
|
|
subDistrictId: foundUser.subDistrictId,
|
|
|
|
|
telephoneNo: foundUser.telephoneNo,
|
|
|
|
|
email: foundUser.email,
|
|
|
|
|
zipCode: foundUser.zipCode,
|
|
|
|
|
gender: foundUser.gender,
|
|
|
|
|
addressEN: foundUser.addressEN,
|
|
|
|
|
address: foundUser.address,
|
|
|
|
|
trainingPlace: foundUser.trainingPlace,
|
|
|
|
|
importNationality: foundUser.importNationality,
|
|
|
|
|
sourceNationality: foundUser.sourceNationality,
|
|
|
|
|
licenseNo: foundUser.licenseNo,
|
|
|
|
|
discountCondition: foundUser.discountCondition,
|
|
|
|
|
registrationNo: foundUser.registrationNo,
|
|
|
|
|
lastNameEN: foundUser.lastNameEN,
|
|
|
|
|
lastName: foundUser.lastName,
|
|
|
|
|
firstNameEN: foundUser.firstNameEN,
|
|
|
|
|
firstName: foundUser.firstName,
|
|
|
|
|
userRole: foundUser.userRole,
|
|
|
|
|
userType: foundUser.userType,
|
|
|
|
|
username: foundUser.username,
|
2024-04-19 13:54:57 +07:00
|
|
|
checkpoint: foundUser.checkpoint,
|
|
|
|
|
checkpointEN: foundUser.checkpointEN,
|
2024-04-18 18:27:22 +07:00
|
|
|
responsibleArea: foundUser.responsibleArea,
|
|
|
|
|
status: foundUser.status,
|
|
|
|
|
licenseExpireDate:
|
|
|
|
|
(foundUser.licenseExpireDate &&
|
|
|
|
|
new Date(foundUser.licenseExpireDate)) ||
|
|
|
|
|
null,
|
|
|
|
|
licenseIssueDate:
|
|
|
|
|
(foundUser.licenseIssueDate && new Date(foundUser.licenseIssueDate)) ||
|
|
|
|
|
null,
|
|
|
|
|
retireDate:
|
|
|
|
|
(foundUser.retireDate && new Date(foundUser.retireDate)) || null,
|
|
|
|
|
startDate: (foundUser.startDate && new Date(foundUser.startDate)) || null,
|
|
|
|
|
birthDate: (foundUser.birthDate && new Date(foundUser.birthDate)) || null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
formData.value.status === 'ACTIVE' || 'CREATED'
|
|
|
|
|
? (statusToggle.value = true)
|
|
|
|
|
: (statusToggle.value = false);
|
|
|
|
|
userId.value = foundUser.id;
|
2024-04-22 10:54:32 +07:00
|
|
|
|
|
|
|
|
if (foundUser.branch[0]) {
|
|
|
|
|
if (foundUser.branch[0].isHeadOffice) {
|
|
|
|
|
hqId.value = foundUser.branch[0].id as string;
|
|
|
|
|
} else {
|
|
|
|
|
hqId.value = foundUser.branch[0].headOfficeId as string;
|
|
|
|
|
brId.value = foundUser.branch[0].id;
|
|
|
|
|
}
|
2024-04-18 18:27:22 +07:00
|
|
|
}
|
2024-04-22 10:54:32 +07:00
|
|
|
|
2024-04-22 14:04:06 +07:00
|
|
|
userCode.value = foundUser.code;
|
2024-04-18 18:27:22 +07:00
|
|
|
urlProfile.value = foundUser.profileImageUrl;
|
2024-06-27 08:32:31 +00:00
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
isEdit.value = true;
|
|
|
|
|
profileSubmit.value = true;
|
2024-04-22 10:54:32 +07:00
|
|
|
hqId.value && (await userStore.fetchBrOption(hqId.value));
|
2024-06-27 08:32:31 +00:00
|
|
|
if (infoPersonCard.value) {
|
|
|
|
|
infoPersonCard.value[0].img = foundUser.profileImageUrl;
|
|
|
|
|
}
|
2024-04-18 18:27:22 +07:00
|
|
|
if (formData.value.districtId) {
|
|
|
|
|
await adrressStore.fetchSubDistrictByProvinceId(
|
|
|
|
|
formData.value.districtId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-10 14:00:55 +07:00
|
|
|
onMounted(async () => {
|
2024-04-18 18:27:22 +07:00
|
|
|
await userStore.fetchList({
|
|
|
|
|
includeBranch: true,
|
2024-04-19 11:45:51 +07:00
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
2024-04-18 18:27:22 +07:00
|
|
|
userType: selectorLabel.value ?? undefined,
|
|
|
|
|
});
|
2024-04-11 22:17:24 +07:00
|
|
|
userStore.userOption.roleOpts.length === 0
|
|
|
|
|
? await userStore.fetchRoleOption()
|
|
|
|
|
: '';
|
2024-04-10 14:00:55 +07:00
|
|
|
typeStats.value = await userStore.typeStats();
|
2024-04-17 17:19:58 +07:00
|
|
|
|
|
|
|
|
const firstTypeIncludeUser = Object.entries(typeStats.value || {}).find(
|
|
|
|
|
(v) => v[1] > 0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
firstTypeIncludeUser && (selectorLabel.value = firstTypeIncludeUser[0]);
|
|
|
|
|
|
2024-04-10 19:10:13 +07:00
|
|
|
const res = await branchStore.userStats(formData.value.userType);
|
|
|
|
|
if (res) {
|
|
|
|
|
userStats.value = res;
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-04-10 14:00:55 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => selectorLabel.value,
|
|
|
|
|
async (label) => {
|
|
|
|
|
mapUserType(label);
|
2024-04-17 17:19:58 +07:00
|
|
|
await userStore.fetchList({
|
|
|
|
|
includeBranch: true,
|
2024-04-19 11:45:51 +07:00
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
2024-04-17 17:19:58 +07:00
|
|
|
userType: selectorLabel.value ?? undefined,
|
|
|
|
|
});
|
2024-04-10 19:10:13 +07:00
|
|
|
const res = await branchStore.userStats(label);
|
|
|
|
|
if (res) {
|
|
|
|
|
userStats.value = res;
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-04-19 11:45:51 +07:00
|
|
|
|
|
|
|
|
watch(inputSearch, async () => {
|
|
|
|
|
await userStore.fetchList({
|
|
|
|
|
pageSize: 9999,
|
|
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
|
|
|
|
});
|
|
|
|
|
});
|
2024-04-19 14:54:07 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => formData.value.userType,
|
|
|
|
|
async () => {
|
|
|
|
|
formData.value.registrationNo = null;
|
|
|
|
|
formData.value.startDate = null;
|
|
|
|
|
formData.value.retireDate = null;
|
|
|
|
|
formData.value.responsibleArea = null;
|
|
|
|
|
formData.value.discountCondition = null;
|
|
|
|
|
formData.value.sourceNationality = null;
|
|
|
|
|
formData.value.importNationality = null;
|
|
|
|
|
formData.value.trainingPlace = null;
|
|
|
|
|
formData.value.checkpoint = null;
|
|
|
|
|
formData.value.checkpointEN = null;
|
|
|
|
|
agencyFile.value = [];
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-04-03 18:28:59 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-13 17:13:09 +07:00
|
|
|
<ButtonAddComponent style="z-index: 999">
|
|
|
|
|
<q-fab-action
|
2024-06-14 13:37:11 +07:00
|
|
|
id="btn-add-personne"
|
2024-06-13 17:13:09 +07:00
|
|
|
:label="$t('personnelAdd')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
@click="openDialog('FORM')"
|
|
|
|
|
color="primary"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-account-plus"
|
|
|
|
|
></q-fab-action>
|
|
|
|
|
</ButtonAddComponent>
|
|
|
|
|
|
2024-04-04 15:03:39 +07:00
|
|
|
<div class="column q-pb-lg">
|
2024-04-04 16:39:50 +07:00
|
|
|
<div class="text-h6 text-weight-bold q-mb-md">
|
|
|
|
|
{{ $t('personnelManagement') }}
|
|
|
|
|
</div>
|
2024-04-04 15:03:39 +07:00
|
|
|
|
|
|
|
|
<div class="row full-width q-mb-md no-wrap">
|
|
|
|
|
<!-- selector -->
|
2024-04-04 16:39:50 +07:00
|
|
|
<SelectorList
|
|
|
|
|
:list="selectorList"
|
|
|
|
|
v-model:selector="selectorLabel"
|
2024-06-12 15:35:05 +07:00
|
|
|
class="q-mr-md col-3"
|
2024-04-04 16:39:50 +07:00
|
|
|
/>
|
2024-04-04 15:03:39 +07:00
|
|
|
|
|
|
|
|
<!-- stat -->
|
2024-04-05 10:37:57 +07:00
|
|
|
<AppBox bordered class="column full-width">
|
2024-04-18 16:13:01 +07:00
|
|
|
<div class="row q-pb-sm justify-between items-center">
|
2024-04-05 19:05:51 +07:00
|
|
|
<div class="text-weight-bold text-subtitle1">
|
2024-04-10 19:10:13 +07:00
|
|
|
{{ $t('personnelStatTitle') }}
|
|
|
|
|
{{ selectorLabel === '' ? '' : $t(selectorLabel) }}
|
2024-04-05 19:05:51 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-12 15:35:05 +07:00
|
|
|
<div class="row full-width" style="overflow-x: auto">
|
2024-04-10 14:00:55 +07:00
|
|
|
<StatCardComponent
|
2024-04-22 17:52:37 +07:00
|
|
|
v-if="sortedUserStats"
|
2024-04-10 14:00:55 +07:00
|
|
|
:branch="
|
2024-04-22 17:52:37 +07:00
|
|
|
sortedUserStats.map((v) => ({
|
2024-04-16 18:34:01 +07:00
|
|
|
count: v.count,
|
2024-04-10 14:00:55 +07:00
|
|
|
label: $i18n.locale === 'en-US' ? v.nameEN : v.name,
|
2024-04-22 17:52:37 +07:00
|
|
|
color: v.isHeadOffice ? 'pink' : 'purple',
|
2024-04-10 14:00:55 +07:00
|
|
|
}))
|
|
|
|
|
"
|
2024-04-11 11:46:26 +07:00
|
|
|
:dark="$q.dark.isActive"
|
2024-04-10 14:00:55 +07:00
|
|
|
class="no-wrap"
|
|
|
|
|
/>
|
2024-04-04 16:39:50 +07:00
|
|
|
</div>
|
2024-04-04 15:03:39 +07:00
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
2024-04-03 18:28:59 +07:00
|
|
|
|
2024-04-04 15:03:39 +07:00
|
|
|
<!-- main -->
|
2024-04-19 14:36:53 +07:00
|
|
|
<AppBox bordered class="column" style="width: 100%; min-height: 70vh">
|
2024-04-18 16:35:47 +07:00
|
|
|
<div class="row q-mb-md justify-between">
|
|
|
|
|
<q-btn
|
2024-04-22 10:54:32 +07:00
|
|
|
id="btn-filter"
|
2024-04-18 16:35:47 +07:00
|
|
|
icon="mdi-tune-vertical-variant"
|
2024-04-19 11:07:19 +07:00
|
|
|
size="sm"
|
2024-04-18 16:35:47 +07:00
|
|
|
class="bordered rounded"
|
|
|
|
|
:class="{ 'app-text-info': statusFilter !== 'all' }"
|
|
|
|
|
unelevated
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup dense>
|
|
|
|
|
<q-item
|
2024-06-14 15:55:23 +07:00
|
|
|
id="btn-filter-all"
|
2024-04-18 16:35:47 +07:00
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
:class="{ 'app-text-info': statusFilter === 'all' }"
|
|
|
|
|
@click="statusFilter = 'all'"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('all') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
2024-06-14 15:55:23 +07:00
|
|
|
id="btn-filter-active"
|
2024-04-18 16:35:47 +07:00
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-info': statusFilter === 'statusACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
@click="statusFilter = 'statusACTIVE'"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
2024-06-14 15:55:23 +07:00
|
|
|
id="btn-filter-inactive"
|
2024-04-18 16:35:47 +07:00
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-info': statusFilter === 'statusINACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
@click="statusFilter = 'statusINACTIVE'"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusINACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
<q-input
|
2024-06-14 15:55:23 +07:00
|
|
|
for="input-search"
|
2024-04-18 16:35:47 +07:00
|
|
|
style="width: 250px"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
2024-04-22 10:54:32 +07:00
|
|
|
:label="$t('search')"
|
2024-04-19 11:45:51 +07:00
|
|
|
debounce="500"
|
2024-04-18 16:35:47 +07:00
|
|
|
v-model="inputSearch"
|
|
|
|
|
></q-input>
|
|
|
|
|
</div>
|
2024-04-05 17:26:40 +07:00
|
|
|
<PersonCard
|
|
|
|
|
:list="
|
2024-04-18 16:35:47 +07:00
|
|
|
userData?.result
|
|
|
|
|
.filter((v) => {
|
|
|
|
|
if (statusFilter === 'statusACTIVE' && v.status === 'INACTIVE') {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
statusFilter === 'statusINACTIVE' &&
|
|
|
|
|
v.status !== 'INACTIVE'
|
|
|
|
|
) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
})
|
|
|
|
|
.map((v) => ({
|
|
|
|
|
id: v.id,
|
|
|
|
|
img: `${v.profileImageUrl}`,
|
|
|
|
|
name:
|
|
|
|
|
$i18n.locale === 'en-US'
|
|
|
|
|
? `${v.firstNameEN} ${v.lastNameEN}`
|
|
|
|
|
: `${v.firstName} ${v.lastName}`,
|
|
|
|
|
male: v.gender === 'male',
|
|
|
|
|
female: v.gender === 'female',
|
|
|
|
|
detail: [
|
2024-04-22 10:54:32 +07:00
|
|
|
{ label: $t('personnelCardUserType'), value: $t(v.userType) },
|
|
|
|
|
{ label: $t('personnelCardTelephone'), value: v.telephoneNo },
|
2024-04-18 16:35:47 +07:00
|
|
|
{
|
2024-04-22 10:54:32 +07:00
|
|
|
label: $t('personnelCardAge'),
|
2024-06-12 15:35:05 +07:00
|
|
|
value: userStore.calculateAge(v.birthDate as Date) || '',
|
2024-04-18 16:35:47 +07:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
badge: v.code,
|
|
|
|
|
disabled: v.status === 'INACTIVE',
|
|
|
|
|
})) || []
|
2024-04-05 17:26:40 +07:00
|
|
|
"
|
2024-04-18 16:35:47 +07:00
|
|
|
@update-card="openDialog"
|
|
|
|
|
@delete-card="onDelete"
|
2024-04-18 18:27:22 +07:00
|
|
|
@enter-card="openDialog"
|
2024-04-18 16:35:47 +07:00
|
|
|
@toggle-status="toggleStatus"
|
2024-04-05 17:26:40 +07:00
|
|
|
/>
|
2024-04-19 14:36:53 +07:00
|
|
|
<template v-if="userData && userData.total === 0">
|
2024-04-04 16:39:50 +07:00
|
|
|
<div class="col-1 self-end">
|
|
|
|
|
<div class="row">
|
2024-04-05 17:43:16 +07:00
|
|
|
<TooltipComponent
|
2024-04-04 16:39:50 +07:00
|
|
|
title="personnelTooltipTitle"
|
|
|
|
|
caption="personnelTooltipCaption"
|
|
|
|
|
imgSrc="personnel-table-"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-04-19 14:36:53 +07:00
|
|
|
<div
|
|
|
|
|
class="col self-center"
|
|
|
|
|
style="display: flex; flex-grow: 1; align-items: center"
|
|
|
|
|
>
|
2024-04-10 20:26:32 +07:00
|
|
|
<AddButton
|
2024-04-04 18:08:37 +07:00
|
|
|
:label="'personnelAdd'"
|
2024-04-05 09:24:10 +07:00
|
|
|
:cyanOn="true"
|
2024-04-18 18:27:22 +07:00
|
|
|
@trigger="openDialog('FORM')"
|
2024-04-04 16:39:50 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
2024-04-19 14:36:53 +07:00
|
|
|
</template>
|
2024-04-03 18:28:59 +07:00
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
2024-04-05 19:05:51 +07:00
|
|
|
|
2024-04-18 18:27:22 +07:00
|
|
|
<DrawerInfo
|
2024-04-19 09:06:38 +07:00
|
|
|
v-if="currentUser"
|
2024-04-22 17:52:37 +07:00
|
|
|
:category="$t('personnelTitle')"
|
2024-04-19 10:49:14 +07:00
|
|
|
bg-on
|
2024-06-27 08:32:31 +00:00
|
|
|
:badgeClass="
|
|
|
|
|
formData.gender === 'male'
|
|
|
|
|
? 'app-bg-male text-white'
|
|
|
|
|
: 'app-bg-female text-white'
|
|
|
|
|
"
|
2024-04-22 14:04:06 +07:00
|
|
|
:badgeLabel="userCode"
|
2024-04-25 04:07:12 +00:00
|
|
|
:isEdit="infoDrawerEdit"
|
2024-04-18 18:27:22 +07:00
|
|
|
:title="
|
|
|
|
|
$i18n.locale === 'en-US'
|
2024-04-19 09:06:38 +07:00
|
|
|
? `${currentUser.firstNameEN} ${currentUser.lastNameEN}`
|
|
|
|
|
: `${currentUser.firstName} ${currentUser.lastName}`
|
2024-04-18 18:27:22 +07:00
|
|
|
"
|
|
|
|
|
v-model:drawerOpen="infoDrawer"
|
2024-04-19 09:06:38 +07:00
|
|
|
:deleteData="() => onDelete(infoPersonId)"
|
|
|
|
|
:submit="() => onSubmit()"
|
2024-04-18 18:27:22 +07:00
|
|
|
:close="() => onClose()"
|
2024-04-19 09:06:38 +07:00
|
|
|
:undo="() => undo()"
|
2024-04-25 04:07:12 +00:00
|
|
|
:editData="() => (infoDrawerEdit = true)"
|
2024-04-18 18:27:22 +07:00
|
|
|
>
|
|
|
|
|
<template #info>
|
2024-04-19 13:54:57 +07:00
|
|
|
<InfoForm
|
2024-04-25 04:07:12 +00:00
|
|
|
:readonly="!infoDrawerEdit"
|
2024-04-18 18:27:22 +07:00
|
|
|
v-model:address="formData.address"
|
|
|
|
|
v-model:addressEN="formData.addressEN"
|
|
|
|
|
v-model:provinceId="formData.provinceId"
|
|
|
|
|
v-model:districtId="formData.districtId"
|
|
|
|
|
v-model:subDistrictId="formData.subDistrictId"
|
|
|
|
|
v-model:zipCode="formData.zipCode"
|
|
|
|
|
>
|
|
|
|
|
<template #person-card>
|
|
|
|
|
<div class="q-ma-md">
|
|
|
|
|
<AppBox class="surface-1" style="padding: 0">
|
|
|
|
|
<PersonCard
|
2024-06-27 08:32:31 +00:00
|
|
|
:can-edit-profile="infoDrawerEdit"
|
2024-04-23 11:13:57 +00:00
|
|
|
no-hover
|
|
|
|
|
no-action
|
|
|
|
|
no-detail
|
2024-04-18 18:27:22 +07:00
|
|
|
no-bg
|
|
|
|
|
:list="infoPersonCard"
|
|
|
|
|
:gridColumns="1"
|
2024-06-27 08:32:31 +00:00
|
|
|
@edit-profile="
|
|
|
|
|
() => {
|
|
|
|
|
inputFile.click();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-04-18 18:27:22 +07:00
|
|
|
/>
|
|
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #information>
|
|
|
|
|
<FormInformation
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
2024-04-25 04:07:12 +00:00
|
|
|
:readonly="!infoDrawerEdit"
|
2024-04-18 18:27:22 +07:00
|
|
|
:usernameReadonly="isEdit"
|
|
|
|
|
v-model:hqId="hqId"
|
|
|
|
|
v-model:brId="brId"
|
|
|
|
|
v-model:userType="formData.userType"
|
|
|
|
|
v-model:userRole="formData.userRole"
|
|
|
|
|
v-model:username="formData.username"
|
2024-04-22 14:04:06 +07:00
|
|
|
v-model:userCode="userCode"
|
2024-04-18 18:27:22 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template #person>
|
|
|
|
|
<FormPerson
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
2024-04-25 04:07:12 +00:00
|
|
|
:readonly="!infoDrawerEdit"
|
2024-04-18 18:27:22 +07:00
|
|
|
v-model:firstName="formData.firstName"
|
|
|
|
|
v-model:lastName="formData.lastName"
|
|
|
|
|
v-model:firstNameEN="formData.firstNameEN"
|
|
|
|
|
v-model:lastNameEN="formData.lastNameEN"
|
|
|
|
|
v-model:telephoneNo="formData.telephoneNo"
|
|
|
|
|
v-model:email="formData.email"
|
|
|
|
|
v-model:gender="formData.gender"
|
|
|
|
|
v-model:birthDate="formData.birthDate"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template #by-type>
|
|
|
|
|
<FormByType
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
2024-04-25 04:07:12 +00:00
|
|
|
:readonly="!infoDrawerEdit"
|
2024-04-18 18:27:22 +07:00
|
|
|
v-model:userType="formData.userType"
|
|
|
|
|
v-model:registrationNo="formData.registrationNo"
|
|
|
|
|
v-model:startDate="formData.startDate"
|
|
|
|
|
v-model:retireDate="formData.retireDate"
|
|
|
|
|
v-model:responsibleArea="formData.responsibleArea"
|
|
|
|
|
v-model:discountCondition="formData.discountCondition"
|
|
|
|
|
v-model:sourceNationality="formData.sourceNationality"
|
|
|
|
|
v-model:importNationality="formData.importNationality"
|
|
|
|
|
v-model:trainingPlace="formData.trainingPlace"
|
2024-04-19 13:54:57 +07:00
|
|
|
v-model:checkpoint="formData.checkpoint"
|
|
|
|
|
v-model:checkpointEN="formData.checkpointEN"
|
|
|
|
|
v-model:agencyFile="agencyFile"
|
|
|
|
|
v-model:agencyFileList="agencyFileList"
|
|
|
|
|
v-model:userId="userId"
|
2024-04-18 18:27:22 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
2024-04-19 13:54:57 +07:00
|
|
|
</InfoForm>
|
2024-04-18 18:27:22 +07:00
|
|
|
</template>
|
|
|
|
|
</DrawerInfo>
|
|
|
|
|
|
2024-04-10 14:00:55 +07:00
|
|
|
<!-- form -->
|
2024-04-05 19:05:51 +07:00
|
|
|
<FormDialog
|
2024-04-18 18:27:22 +07:00
|
|
|
removeDialog
|
2024-04-10 23:17:39 +07:00
|
|
|
ref="formDialogRef"
|
2024-04-22 14:04:06 +07:00
|
|
|
:badgeClass="formData.gender === 'male' ? 'app-bg-male' : 'app-bg-female'"
|
|
|
|
|
:badgeLabel="userCode"
|
2024-04-22 10:54:32 +07:00
|
|
|
:title="$t('personnelAdd')"
|
2024-04-18 09:06:21 +07:00
|
|
|
v-model:modal="modal"
|
|
|
|
|
v-model:address="formData.address"
|
|
|
|
|
v-model:addressEN="formData.addressEN"
|
|
|
|
|
v-model:provinceId="formData.provinceId"
|
|
|
|
|
v-model:districtId="formData.districtId"
|
|
|
|
|
v-model:subDistrictId="formData.subDistrictId"
|
|
|
|
|
v-model:zipCode="formData.zipCode"
|
|
|
|
|
:addressSeparator="formData.userType !== ''"
|
2024-04-10 17:00:28 +07:00
|
|
|
:submit="() => onSubmit()"
|
2024-04-10 14:00:55 +07:00
|
|
|
:close="() => onClose()"
|
2024-04-05 19:05:51 +07:00
|
|
|
>
|
|
|
|
|
<template #prepend>
|
2024-06-27 08:32:31 +00:00
|
|
|
<ProfileUpload
|
|
|
|
|
v-model:url-profile="urlProfile"
|
|
|
|
|
v-model:status-toggle="statusToggle"
|
|
|
|
|
v-model:profile-submit="profileSubmit"
|
|
|
|
|
@input-file="inputFile.click()"
|
|
|
|
|
/>
|
2024-04-05 19:05:51 +07:00
|
|
|
</template>
|
|
|
|
|
|
2024-04-17 15:44:13 +07:00
|
|
|
<template #information>
|
|
|
|
|
<FormInformation
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
2024-04-18 09:06:21 +07:00
|
|
|
:usernameReadonly="isEdit"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model:hqId="hqId"
|
|
|
|
|
v-model:brId="brId"
|
|
|
|
|
v-model:userType="formData.userType"
|
|
|
|
|
v-model:userRole="formData.userRole"
|
2024-04-18 09:06:21 +07:00
|
|
|
v-model:username="formData.username"
|
2024-04-22 14:04:06 +07:00
|
|
|
v-model:userCode="userCode"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template #person>
|
|
|
|
|
<FormPerson
|
2024-04-10 14:00:55 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
separator
|
2024-04-11 22:17:24 +07:00
|
|
|
v-model:firstName="formData.firstName"
|
|
|
|
|
v-model:lastName="formData.lastName"
|
|
|
|
|
v-model:firstNameEN="formData.firstNameEN"
|
|
|
|
|
v-model:lastNameEN="formData.lastNameEN"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model:telephoneNo="formData.telephoneNo"
|
|
|
|
|
v-model:email="formData.email"
|
|
|
|
|
v-model:gender="formData.gender"
|
|
|
|
|
v-model:birthDate="formData.birthDate"
|
2024-04-10 14:00:55 +07:00
|
|
|
/>
|
2024-04-05 19:05:51 +07:00
|
|
|
</template>
|
2024-04-17 15:44:13 +07:00
|
|
|
<template #by-type>
|
2024-04-11 22:17:24 +07:00
|
|
|
<FormByType
|
2024-04-05 19:05:51 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
separator
|
2024-04-11 22:17:24 +07:00
|
|
|
v-model:userType="formData.userType"
|
|
|
|
|
v-model:registrationNo="formData.registrationNo"
|
|
|
|
|
v-model:startDate="formData.startDate"
|
|
|
|
|
v-model:retireDate="formData.retireDate"
|
|
|
|
|
v-model:responsibleArea="formData.responsibleArea"
|
|
|
|
|
v-model:discountCondition="formData.discountCondition"
|
|
|
|
|
v-model:sourceNationality="formData.sourceNationality"
|
|
|
|
|
v-model:importNationality="formData.importNationality"
|
|
|
|
|
v-model:trainingPlace="formData.trainingPlace"
|
2024-04-19 13:54:57 +07:00
|
|
|
v-model:checkpoint="formData.checkpoint"
|
|
|
|
|
v-model:checkpointEN="formData.checkpointEN"
|
|
|
|
|
v-model:agencyFile="agencyFile"
|
2024-04-05 19:05:51 +07:00
|
|
|
/>
|
2024-04-10 14:00:55 +07:00
|
|
|
</template>
|
2024-04-05 19:05:51 +07:00
|
|
|
</FormDialog>
|
2024-04-03 18:28:59 +07:00
|
|
|
</template>
|
2024-04-05 19:05:51 +07:00
|
|
|
<style>
|
2024-04-10 14:00:55 +07:00
|
|
|
.upload-img-preview {
|
|
|
|
|
border: 1px solid var(--border-color);
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
height: 12vw;
|
2024-04-18 09:06:21 +07:00
|
|
|
background-color: var(--surface-1);
|
2024-04-10 14:00:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.upload-img-btn {
|
|
|
|
|
color: hsl(var(--info-bg));
|
|
|
|
|
border: 1px solid hsl(var(--info-bg));
|
|
|
|
|
background-color: hsla(var(--info-bg) / 0.1);
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
|
|
|
|
|
&.dark {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-10 23:17:39 +07:00
|
|
|
|
|
|
|
|
.edit-img-btn {
|
|
|
|
|
color: hsl(var(--info-bg));
|
|
|
|
|
border: 1px solid hsl(var(--info-bg));
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
}
|
2024-04-18 09:06:21 +07:00
|
|
|
|
|
|
|
|
.cancel-img-btn {
|
|
|
|
|
color: hsl(var(--negative-bg));
|
|
|
|
|
border: 1px solid hsl(var(--negative-bg));
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.submit-img-btn {
|
|
|
|
|
color: var(--surface-1);
|
|
|
|
|
border: 1px solid hsl(var(--positive-bg));
|
|
|
|
|
background-color: hsl(var(--positive-bg));
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
}
|
2024-04-05 19:05:51 +07:00
|
|
|
</style>
|