fix: i18n and form in branch page

This commit is contained in:
Methapon Metanipat 2024-08-30 09:36:28 +07:00
parent 400f36719e
commit 989ce577de
3 changed files with 44 additions and 38 deletions

View file

@ -337,6 +337,7 @@ export default {
workPlace: 'Workplace', workPlace: 'Workplace',
contactName: 'Contact Name', contactName: 'Contact Name',
contactPhone: 'Contact Phone', contactPhone: 'Contact Phone',
totalEmployee: 'Total Employee',
}, },
}, },

View file

@ -337,6 +337,7 @@ export default {
workPlace: 'สถานที่ทํางาน', workPlace: 'สถานที่ทํางาน',
contactName: 'ชื่อผู้ติดต่อ', contactName: 'ชื่อผู้ติดต่อ',
contactPhone: 'โทรศัพท์ผู้ติดต่อ', contactPhone: 'โทรศัพท์ผู้ติดต่อ',
totalEmployee: 'ลูกจ้างทั้งหมด',
}, },
}, },

View file

@ -10,7 +10,7 @@ import useOptionStore from 'stores/options';
import { dialog } from 'stores/utils'; import { dialog } from 'stores/utils';
import { Status } from 'stores/types'; import { Status } from 'stores/types';
import { Employee, EmployeeHistory } from 'stores/employee/types'; import { Employee } from 'stores/employee/types';
import { CustomerBranch, CustomerType } from 'stores/customer/types'; import { CustomerBranch, CustomerType } from 'stores/customer/types';
import { columnsEmployee } from './constant'; import { columnsEmployee } from './constant';
@ -70,6 +70,7 @@ const pageSizeBranch = ref<number>(30);
const prop = withDefaults( const prop = withDefaults(
defineProps<{ defineProps<{
index?: string | number;
color?: 'purple' | 'green'; color?: 'purple' | 'green';
currentCustomerName?: string; currentCustomerName?: string;
customerType: CustomerType; customerType: CustomerType;
@ -103,47 +104,48 @@ onMounted(async () => {
const columns = [ const columns = [
{ {
name: 'branchLabelName', name: 'branchName',
align: 'left', align: 'left',
label: 'office', label: 'general.name',
field: 'name', field: 'name',
sortable: true,
}, },
{ {
name: 'branchLabelAddress', name: 'address',
align: 'left', align: 'left',
label: 'address', label: 'general.address',
field: 'address', field: 'name',
sortable: true,
}, },
{ {
name: 'branchLabelTel', name: 'telephone',
align: 'left', align: 'left',
label: 'formDialogInputTelephone', label: 'general.telephone',
field: 'telephoneNo', field: 'name',
},
{
name: 'businessType',
align: 'left',
label: 'customer.form.businessType',
field: 'name',
},
{
name: 'totalEmployee',
align: 'left',
label: 'customer.table.totalEmployee',
field: 'name',
}, },
] satisfies QTableProps['columns']; ] satisfies QTableProps['columns'];
const fieldDisplay = ref< const fieldDisplay = ref<
( (
| 'branchName' | 'branchName'
| 'customerBranchFormTab'
| 'address' | 'address'
| 'telephone' | 'telephone'
| 'businessTypePure' | 'businessTypePure'
| 'totalEmployee' | 'totalEmployee'
)[] )[]
>([ >(['branchName', 'address', 'telephone', 'businessTypePure', 'totalEmployee']);
'branchName',
'customerBranchFormTab',
'address',
'telephone',
'businessTypePure',
'totalEmployee',
]);
const branchFieldSelected = ref< const branchFieldSelected = ref<
( (
| 'customerBranchFormTab'
| 'branchName' | 'branchName'
| 'address' | 'address'
| 'telephone' | 'telephone'
@ -376,16 +378,15 @@ watch([customerId, inputSearch, currentStatus], async () => {
card-container-class="row q-col-gutter-md" card-container-class="row q-col-gutter-md"
row-key="name" row-key="name"
hide-pagination hide-pagination
:visible-columns="branchFieldSelected"
> >
<template #header> <template #header="{ cols }">
<q-tr style="background-color: hsla(var(--info-bg) / 0.07)"> <q-tr style="background-color: hsla(var(--info-bg) / 0.07)">
<q-th <q-th
v-for="(v, i) in fieldDisplay" v-for="(v, i) in cols"
:key="v" :key="v"
:class="{ 'text-left': i === 0 }" :class="{ 'text-left': i === 0 }"
> >
{{ $t(v) }} {{ $t(v.label) }}
</q-th> </q-th>
<q-th auto-width /> <q-th auto-width />
</q-tr> </q-tr>
@ -433,12 +434,9 @@ watch([customerId, inputSearch, currentStatus], async () => {
</div> </div>
</q-td> </q-td>
<q-td <q-td
v-if="branchFieldSelected.includes('customerBranchFormTab')" v-if="branchFieldSelected.includes('address')"
class="text-center" class="text-center"
> >
{{ props.row.branchNo || '-' }}
</q-td>
<q-td v-if="branchFieldSelected.includes('address')">
{{ {{
$i18n.locale === 'eng' $i18n.locale === 'eng'
? `${props.row.addressEN || ''} ${props.row.subDistrict?.nameEN || ''} ${props.row.district?.nameEN || ''} ${props.row.province?.nameEN || ''}` ? `${props.row.addressEN || ''} ${props.row.subDistrict?.nameEN || ''} ${props.row.district?.nameEN || ''} ${props.row.province?.nameEN || ''}`
@ -709,16 +707,22 @@ watch([customerId, inputSearch, currentStatus], async () => {
</div> </div>
</div> </div>
<EmployerFormAbout <EmployerFormAbout
:index="customerBranchFormData.code?.slice(-2) || '00'"
class="q-mb-xl" class="q-mb-xl"
:customer-type="customerType"
:customer-name="currentCustomerName"
:readonly="customerBranchFormState.dialogType === 'info'" :readonly="customerBranchFormState.dialogType === 'info'"
v-model:citizen-id="customerBranchFormData.citizenId"
v-model:id="customerBranchFormData.id" v-model:id="customerBranchFormData.id"
v-model:branch-no="customerBranchFormData.branchNo" v-model:legal-person-no="customerBranchFormData.legalPersonNo"
v-model:tax-no="customerBranchFormData.taxNo" v-model:branch-code="customerBranchFormData.code"
v-model:code="customerBranchFormData.code" v-model:customer-code="customerBranchFormData.code"
v-model:name="customerBranchFormData.name" v-model:register-company-name="
v-model:name-en="customerBranchFormData.nameEN" customerBranchFormData.registerCompanyName
v-model:registered-name="customerBranchFormData.registerName" "
v-model:registered-date="customerBranchFormData.registerDate" v-model:register-name="customerBranchFormData.registerName"
v-model:register-name-en="customerBranchFormData.registerNameEN"
v-model:register-date="customerBranchFormData.registerDate"
v-model:authorized-capital=" v-model:authorized-capital="
customerBranchFormData.authorizedCapital customerBranchFormData.authorizedCapital
" "
@ -775,8 +779,8 @@ watch([customerId, inputSearch, currentStatus], async () => {
prefix-id="employer-branch" prefix-id="employer-branch"
:readonly="customerBranchFormState.dialogType === 'info'" :readonly="customerBranchFormState.dialogType === 'info'"
v-model:employment-office="customerBranchFormData.employmentOffice" v-model:employment-office="customerBranchFormData.employmentOffice"
v-model:bussiness-type="customerBranchFormData.bussinessType" v-model:bussiness-type="customerBranchFormData.businessType"
v-model:bussiness-type-en="customerBranchFormData.bussinessTypeEN" v-model:bussiness-type-en="customerBranchFormData.businessTypeEN"
v-model:job-position="customerBranchFormData.jobPosition" v-model:job-position="customerBranchFormData.jobPosition"
v-model:job-position-en="customerBranchFormData.jobPositionEN" v-model:job-position-en="customerBranchFormData.jobPositionEN"
v-model:job-description="customerBranchFormData.jobDescription" v-model:job-description="customerBranchFormData.jobDescription"