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<{
action: (...args: unknown[]) => void;
checkData: (...args: unknown[]) => {
oldData: { filName: string; value: string }[];
newData: { filName: string; value: string }[];
oldData: { nameField: string; value: string }[];
newData: { nameField: string; value: string }[];
};
cancel?: (...args: unknown[]) => void;
}>();
@ -81,7 +81,7 @@ onMounted(() => {
<div v-for="v in checkData().oldData">
<span class="text-regular app-text-muted">
{{ v.filName }}
{{ v.nameField }}
</span>
: {{ v.value }}
</div>
@ -118,7 +118,7 @@ onMounted(() => {
<div v-for="v in checkData().newData">
<span class="text-regular app-text-muted">
{{ v.filName }}
{{ v.nameField }}
</span>
: {{ v.value }}
</div>

View file

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

View file

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

View file

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