diff --git a/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue b/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue index b84a7780..92fb2721 100644 --- a/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue +++ b/src/pages/03_customer-management/components/employer/EmployerFormBusiness.vue @@ -5,7 +5,7 @@ import { formatNumberDecimal, } from 'stores/utils'; import { onMounted, watch } from 'vue'; -import { ref } from 'vue'; +import { ref, computed } from 'vue'; import { useI18n } from 'vue-i18n'; import ThaiBahtText from 'thai-baht-text'; @@ -18,9 +18,11 @@ const jobPosition = defineModel('jobPosition'); const jobDescription = defineModel('jobDescription'); const payDate = defineModel('payDate'); const payDateEN = defineModel('payDateEn'); -const wageRate = defineModel('wageRate'); +const wageRate = defineModel('wageRate'); const wageRateText = defineModel('wageRateText', { default: '0' }); +const rate = ref(wageRate.value?.toString() || '0'); + const wageRate4Show = ref(''); const typeBusinessOption = ref([]); const typeBusinessENOption = ref([]); @@ -37,7 +39,6 @@ defineProps<{ }>(); onMounted(async () => { - const resultOption = await fetch('/option/option.json'); rawOption.value = await resultOption.json(); typeBusinessENOption.value = rawOption.value.eng.businessType; @@ -67,13 +68,12 @@ watch([typeBusinessOption, typeBusinessENOption], () => { }); watch( - () => wageRate.value, + () => rate.value, (newValue) => { - console.log(newValue); - if (newValue !== undefined) { + if (newValue !== undefined && typeof newValue === 'string') { const numericValue = newValue.replace(/,/g, ''); - wageRateText.value = ThaiBahtText(numericValue); + wageRate.value = parseFloat(numericValue); } }, ); @@ -317,11 +317,12 @@ let jobPositionENFilter = selectFilterOptionRefMod( hide-bottom-space class="col-md-3 col-6" :label="$t('customer.form.payRate')" - :model-value="wageRate?.toString()" + :model-value="rate?.toString()" @update:model-value=" (v) => { if (typeof v === 'string') { - wageRate = commaInput(v, 'string'); + console.log(v); + rate = commaInput(v, 'string'); } } "