fix: 02 option & watch usertype

This commit is contained in:
puriphatt 2024-07-23 10:33:34 +00:00
parent acb3ef8a6d
commit d290777e5e
2 changed files with 15 additions and 37 deletions

View file

@ -32,10 +32,12 @@ import InfoForm from 'components/02_personnel-management/InfoForm.vue';
import NoData from 'components/NoData.vue';
import ProfileUpload from 'components/ProfileUpload.vue';
import PaginationComponent from 'src/components/PaginationComponent.vue';
import useOptionStore from 'src/stores/options';
const { locale, t } = useI18n();
const $q = useQuasar();
const optionStore = useOptionStore();
const utilsStore = useUtilsStore();
const flowStore = useFlowStore();
const userStore = useUserStore();
@ -257,8 +259,8 @@ async function openDialog(
}
if (id && userData.value) {
assignFormData(id);
isEdit.value = true;
await assignFormData(id);
if (formData.value.userType === 'AGENCY') {
const result = await userStore.fetchAttachment(id);
@ -330,6 +332,7 @@ function onClose() {
userCode.value = '';
urlProfile.value = undefined;
profileFile.value = undefined;
infoDrawerEdit.value = false;
agencyFile.value = [];
modal.value = false;
isEdit.value = false;
@ -550,6 +553,13 @@ onMounted(async () => {
userStore.userOption.roleOpts.length === 0
? await userStore.fetchRoleOption()
: '';
if (optionStore.globalOption) {
userStore.userOption.genderOpts = optionStore.globalOption.gender;
userStore.userOption.responsibleAreaOpts = optionStore.globalOption.area;
userStore.userOption.nationalityOpts = optionStore.globalOption.nationality;
userStore.userOption.trainingPlaceOpts = optionStore.globalOption.training;
}
typeStats.value = await userStore.typeStats();
// const firstTypeIncludeUser = Object.entries(typeStats.value || {}).find(