diff --git a/src/components/01_branch-management/FormBranchInformation.vue b/src/components/01_branch-management/FormBranchInformation.vue index 5a90d3f7..a4041333 100644 --- a/src/components/01_branch-management/FormBranchInformation.vue +++ b/src/components/01_branch-management/FormBranchInformation.vue @@ -159,42 +159,6 @@ function formatCode(input: string | undefined, type: 'code' | 'number') { ]" for="input-name-en" /> - - - -
diff --git a/src/components/02_personnel-management/FormByType.vue b/src/components/02_personnel-management/FormByType.vue index ec3619a1..d1709858 100644 --- a/src/components/02_personnel-management/FormByType.vue +++ b/src/components/02_personnel-management/FormByType.vue @@ -262,7 +262,7 @@ function deleteFile(name: string) {
(); defineEmits<{ @@ -117,12 +118,16 @@ defineEmits<{
+import { ref } from 'vue'; +import { useI18n } from 'vue-i18n'; import SelectInput from '../shared/SelectInput.vue'; import useOptionStore from 'src/stores/options'; +import { Icon } from '@iconify/vue/dist/iconify.js'; +import { useInstitution } from 'src/stores/institution'; const optionStore = useOptionStore(); @@ -10,6 +14,11 @@ defineProps<{ readonly?: boolean; onDrawer?: boolean; }>(); +const emit = defineEmits<{ + (e: 'deleteAttachment', name: string): void; +}>(); + +const attachmentRef = ref(); const group = defineModel('group', { default: '' }); const name = defineModel('name', { default: '' }); @@ -17,8 +26,19 @@ const nameEn = defineModel('nameEn', { default: '' }); const contactName = defineModel('contactName', { default: '' }); const email = defineModel('email', { default: '' }); const contactTel = defineModel('contactTel', { default: '' }); +const attachment = defineModel('attachment'); +const attachmentList = + defineModel<{ name: string; url: string }[]>('attachmentList'); type Options = { label: string; value: string }; + +function openNewTab(url: string) { + window.open(url, '_blank'); +} + +function deleteAttachment(name: string) { + emit('deleteAttachment', name); +} + + + + + + +
+ + + +
+
+ {{ item.name }} +
+ +
+
+
+
+
diff --git a/src/components/form/AddressForm.vue b/src/components/form/AddressForm.vue index cbdb0819..83440005 100644 --- a/src/components/form/AddressForm.vue +++ b/src/components/form/AddressForm.vue @@ -12,7 +12,7 @@ import { formatAddress } from 'src/utils/address'; import useOptionStore from 'stores/options'; const optionStore = useOptionStore(); -defineProps<{ +const props = defineProps<{ title?: string; addressTitle?: string; addressTitleEN?: string; @@ -30,6 +30,7 @@ defineProps<{ useEmployment?: boolean; useWorkPlace?: boolean; + useForeignAddress?: boolean; }>(); const addressStore = useAddressStore(); @@ -57,6 +58,25 @@ const subDistrictId = defineModel('subDistrictId'); const zipCode = defineModel('zipCode'); const sameWithEmployer = defineModel('sameWithEmployer'); +const provinceTextEN = defineModel( + 'provinceTextEn', + { + default: '', + }, +); +const districtTextEN = defineModel( + 'districtTextEn', + { + default: '', + }, +); +const subDistrictTextEN = defineModel( + 'subDistrictTextEn', + { + default: '', + }, +); + const homeCode = defineModel('homeCode'); const employmentOffice = defineModel( 'employmentOffice', @@ -64,6 +84,7 @@ const employmentOffice = defineModel( const employmentOfficeEN = defineModel( 'employmentOfficeEn', ); +const addressForeign = defineModel('addressForeign'); const addrOptions = reactive<{ provinceOps: Province[]; @@ -78,14 +99,18 @@ const addrOptions = reactive<{ const area = ref([]); const fullAddress = computed(() => { - const province = provinceOptions.value.find((v) => v.id === provinceId.value); - const district = districtOptions.value.find((v) => v.id === districtId.value); - const sDistrict = subDistrictOptions.value.find( - (v) => v.id === subDistrictId.value, - ); + const province = addressForeign.value + ? { id: '1', name: provinceId.value } + : provinceOptions.value.find((v) => v.id === provinceId.value); + const district = addressForeign.value + ? { id: '1', name: districtId.value } + : districtOptions.value.find((v) => v.id === districtId.value); + const sDistrict = addressForeign.value + ? { id: '1', name: subDistrictId.value } + : subDistrictOptions.value.find((v) => v.id === subDistrictId.value); - if (province && district && sDistrict) { - const fullAddress = formatAddress({ + if (province?.name && district?.name && sDistrict?.name) { + const fullAddressText = formatAddress({ address: address.value, addressEN: addressEN.value, moo: moo.value ? moo.value : '', @@ -97,21 +122,26 @@ const fullAddress = computed(() => { province: province as unknown as Province, district: district as unknown as District, subDistrict: sDistrict as unknown as SubDistrict, + zipCode: addressForeign.value ? zipCode.value || ' ' : undefined, }); - return fullAddress; + return fullAddressText; } return '-'; }); const fullAddressEN = computed(() => { - const province = provinceOptions.value.find((v) => v.id === provinceId.value); - const district = districtOptions.value.find((v) => v.id === districtId.value); - const sDistrict = subDistrictOptions.value.find( - (v) => v.id === subDistrictId.value, - ); + const province = addressForeign.value + ? { nameEN: provinceTextEN.value } + : provinceOptions.value.find((v) => v.id === provinceId.value); + const district = addressForeign.value + ? { nameEN: districtTextEN.value } + : districtOptions.value.find((v) => v.id === districtId.value); + const sDistrict = addressForeign.value + ? { nameEN: subDistrictTextEN.value } + : subDistrictOptions.value.find((v) => v.id === subDistrictId.value); - if (province && district && sDistrict) { - const fullAddress = formatAddress({ + if (province?.nameEN && district?.nameEN && sDistrict?.nameEN) { + const fullAddressText = formatAddress({ address: address.value, addressEN: addressEN.value, moo: moo.value ? moo.value : '', @@ -124,8 +154,9 @@ const fullAddressEN = computed(() => { district: district as unknown as District, subDistrict: sDistrict as unknown as SubDistrict, en: true, + zipCode: addressForeign.value ? zipCode.value || ' ' : undefined, }); - return fullAddress; + return fullAddressText; } return '-'; }); @@ -149,7 +180,7 @@ async function fetchProvince() { } async function fetchDistrict() { - if (!provinceId.value) return; + if (!provinceId.value || addressForeign.value) return; const result = await addressStore.fetchDistrictByProvinceId(provinceId.value); if (result) addrOptions.districtOps = result; @@ -168,7 +199,7 @@ async function fetchDistrict() { } async function fetchSubDistrict() { - if (!districtId.value) return; + if (!districtId.value || addressForeign.value) return; const result = await addressStore.fetchSubDistrictByProvinceId( districtId.value, ); @@ -255,6 +286,16 @@ onMounted(async () => { await fetchSubDistrict(); }); +function clearAddress() { + provinceId.value = null; + districtId.value = null; + subDistrictId.value = null; + provinceTextEN.value = null; + districtTextEN.value = null; + subDistrictTextEN.value = null; + zipCode.value = null; +} + watch(provinceId, fetchDistrict); watch(districtId, fetchSubDistrict); @@ -313,6 +354,15 @@ watchEffect(async () => { {{ $t('customerEmployee.form.addressCustom') }} + +
+ + {{ $t('personnel.form.addressForeign') }} +
@@ -449,7 +499,24 @@ watchEffect(async () => { (v) => (typeof v === 'string' ? (street = v) : '') " /> + { + { + + { { (v) => (typeof v === 'string' ? (streetEN = v) : '') " /> + { + + { + + {