refactor: edit name value filName -> nameField

This commit is contained in:
Thanaphon Frappet 2024-10-24 10:27:03 +07:00
parent 6284b399bc
commit fbc47c7d86
4 changed files with 39 additions and 38 deletions

View file

@ -6,8 +6,8 @@ import { ref } from 'vue';
const props = defineProps<{ const props = defineProps<{
action: (...args: unknown[]) => void; action: (...args: unknown[]) => void;
checkData: (...args: unknown[]) => { checkData: (...args: unknown[]) => {
oldData: { filName: string; value: string }[]; oldData: { nameField: string; value: string }[];
newData: { filName: string; value: string }[]; newData: { nameField: string; value: string }[];
}; };
cancel?: (...args: unknown[]) => void; cancel?: (...args: unknown[]) => void;
}>(); }>();
@ -81,7 +81,7 @@ onMounted(() => {
<div v-for="v in checkData().oldData"> <div v-for="v in checkData().oldData">
<span class="text-regular app-text-muted"> <span class="text-regular app-text-muted">
{{ v.filName }} {{ v.nameField }}
</span> </span>
: {{ v.value }} : {{ v.value }}
</div> </div>
@ -118,7 +118,7 @@ onMounted(() => {
<div v-for="v in checkData().newData"> <div v-for="v in checkData().newData">
<span class="text-regular app-text-muted"> <span class="text-regular app-text-muted">
{{ v.filName }} {{ v.nameField }}
</span> </span>
: {{ v.value }} : {{ v.value }}
</div> </div>

View file

@ -2665,8 +2665,8 @@ const emptyCreateDialog = ref(false);
if (group === 'passport') { if (group === 'passport') {
const fullName = allMeta['full_name'].split(' '); const fullName = allMeta['full_name'].split(' ');
let tempValue: { let tempValue: {
oldData: { filName: string; value: string }[]; oldData: { nameField: string; value: string }[];
newData: { filName: string; value: string }[]; newData: { nameField: string; value: string }[];
} = { oldData: [], newData: [] }; } = { oldData: [], newData: [] };
if ( if (
@ -2674,46 +2674,46 @@ const emptyCreateDialog = ref(false);
currentFromDataEmployee.gender !== allMeta['sex'] currentFromDataEmployee.gender !== allMeta['sex']
) { ) {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t( value: $t(
`general.${currentFromDataEmployee.gender}`, `general.${currentFromDataEmployee.gender}`,
), ),
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t(`general.${allMeta['sex']}`), value: $t(`general.${allMeta['sex']}`),
}); });
} }
if (currentFromDataEmployee.firstName !== '') { if (currentFromDataEmployee.firstName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: currentFromDataEmployee.firstName, value: currentFromDataEmployee.firstName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: fullName[0], value: fullName[0],
}); });
} }
if (currentFromDataEmployee.lastName !== '') { if (currentFromDataEmployee.lastName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: currentFromDataEmployee.lastName, value: currentFromDataEmployee.lastName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: fullName[1], value: fullName[1],
}); });
} }
if (currentFromDataEmployee.nationality !== '') { if (currentFromDataEmployee.nationality !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: currentFromDataEmployee.nationality || '', value: currentFromDataEmployee.nationality || '',
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: allMeta['nationality'], value: allMeta['nationality'],
}); });
} }
@ -4198,8 +4198,8 @@ const emptyCreateDialog = ref(false);
if (group === 'passport') { if (group === 'passport') {
const fullName = allMeta['full_name'].split(' '); const fullName = allMeta['full_name'].split(' ');
let tempValue: { let tempValue: {
oldData: { filName: string; value: string }[]; oldData: { nameField: string; value: string }[];
newData: { filName: string; value: string }[]; newData: { nameField: string; value: string }[];
} = { oldData: [], newData: [] }; } = { oldData: [], newData: [] };
if ( if (
@ -4207,46 +4207,46 @@ const emptyCreateDialog = ref(false);
currentFromDataEmployee.gender !== allMeta['sex'] currentFromDataEmployee.gender !== allMeta['sex']
) { ) {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t( value: $t(
`general.${currentFromDataEmployee.gender}`, `general.${currentFromDataEmployee.gender}`,
), ),
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t(`general.${allMeta['sex']}`), value: $t(`general.${allMeta['sex']}`),
}); });
} }
if (currentFromDataEmployee.firstName !== '') { if (currentFromDataEmployee.firstName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: currentFromDataEmployee.firstName, value: currentFromDataEmployee.firstName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: fullName[0], value: fullName[0],
}); });
} }
if (currentFromDataEmployee.lastName !== '') { if (currentFromDataEmployee.lastName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: currentFromDataEmployee.lastName, value: currentFromDataEmployee.lastName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: fullName[1], value: fullName[1],
}); });
} }
if (currentFromDataEmployee.nationality !== '') { if (currentFromDataEmployee.nationality !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: currentFromDataEmployee.nationality || '', value: currentFromDataEmployee.nationality || '',
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: allMeta['nationality'], value: allMeta['nationality'],
}); });
} }

View file

@ -1113,6 +1113,7 @@ function storeDataLocal() {
</DialogForm> </DialogForm>
<!-- add product service --> <!-- add product service -->
<ProductServiceForm <ProductServiceForm
v-model="pageState.productServiceModal" v-model="pageState.productServiceModal"
v-model:nodes="productServiceNodes" v-model:nodes="productServiceNodes"
@ -1314,8 +1315,8 @@ function storeDataLocal() {
if (group === 'passport') { if (group === 'passport') {
const fullName = allMeta['full_name'].split(' '); const fullName = allMeta['full_name'].split(' ');
let tempValue: { let tempValue: {
oldData: { filName: string; value: string }[]; oldData: { nameField: string; value: string }[];
newData: { filName: string; value: string }[]; newData: { nameField: string; value: string }[];
} = { oldData: [], newData: [] }; } = { oldData: [], newData: [] };
if ( if (
@ -1323,55 +1324,55 @@ function storeDataLocal() {
formDataEmployee.gender !== allMeta['sex'] formDataEmployee.gender !== allMeta['sex']
) { ) {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t(`general.${formDataEmployee.gender}`), value: $t(`general.${formDataEmployee.gender}`),
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('form.gender'), nameField: $t('form.gender'),
value: $t(`general.${allMeta['sex']}`), value: $t(`general.${allMeta['sex']}`),
}); });
} }
if (formDataEmployee.firstName !== '') { if (formDataEmployee.firstName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: formDataEmployee.firstName, value: formDataEmployee.firstName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.firstName'), nameField: $t('personnel.form.firstName'),
value: fullName[0], value: fullName[0],
}); });
} }
if (formDataEmployee.lastName !== '') { if (formDataEmployee.lastName !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: formDataEmployee.lastName, value: formDataEmployee.lastName,
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('personnel.form.lastName'), nameField: $t('personnel.form.lastName'),
value: fullName[1], value: fullName[1],
}); });
} }
if (formDataEmployee.passportNo !== '') { if (formDataEmployee.passportNo !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('customerEmployee.form.passportNo'), nameField: $t('customerEmployee.form.passportNo'),
value: formDataEmployee.passportNo || '', value: formDataEmployee.passportNo || '',
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('customerEmployee.form.passportNo'), nameField: $t('customerEmployee.form.passportNo'),
value: allMeta['doc_number'], value: allMeta['doc_number'],
}); });
} }
if (formDataEmployee.nationality !== '') { if (formDataEmployee.nationality !== '') {
tempValue.oldData.push({ tempValue.oldData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: formDataEmployee.nationality || '', value: formDataEmployee.nationality || '',
}); });
tempValue.newData.push({ tempValue.newData.push({
filName: $t('general.nationality'), nameField: $t('general.nationality'),
value: allMeta['nationality'], value: allMeta['nationality'],
}); });
} }

View file

@ -29,8 +29,8 @@ export function dialog(opts: {
export function dialogCheckData(opts: { export function dialogCheckData(opts: {
checkData: (...args: unknown[]) => { checkData: (...args: unknown[]) => {
oldData: { filName: string; value: string }[]; oldData: { nameField: string; value: string }[];
newData: { filName: string; value: string }[]; newData: { nameField: string; value: string }[];
}; };
action?: (...args: unknown[]) => unknown; action?: (...args: unknown[]) => unknown;
cancel?: (...args: unknown[]) => unknown; cancel?: (...args: unknown[]) => unknown;