Merge refactor/i18n into develop

This commit is contained in:
Methapon Metanipat 2024-08-26 16:24:08 +07:00
parent 3da5bf9079
commit c681b19e39
99 changed files with 2192 additions and 2987 deletions

View file

@ -54,34 +54,34 @@ const columns = [
{
name: 'orderNumber',
align: 'center',
label: 'orderNumber',
label: 'general.orderNumber',
field: 'branchNo',
},
{
name: 'branchLabelName',
align: 'left',
label: 'office',
label: 'branch.office',
field: 'name',
sortable: true,
},
{
name: 'branchLabelAddress',
align: 'left',
label: 'address',
label: 'general.address',
field: 'address',
sortable: true,
},
{
name: 'branchLabelTel',
align: 'left',
label: 'formDialogInputTelephone',
label: 'general.telephone',
field: 'telephoneNo',
},
{
name: 'branchLabelType',
align: 'left',
label: 'type',
label: 'general.type',
field: 'isHeadOffice',
},
] satisfies QTableProps['columns'];
@ -182,13 +182,13 @@ async function calculateStats() {
{
icon: 'mdi-office-building-outline',
count: _stats.hq,
label: 'branchHQLabel',
label: 'branch.card.branchHQLabel',
color: 'pink',
},
{
icon: 'mdi-home-group',
count: _stats.br,
label: 'branchLabel',
label: 'branch.card.branchLabel',
color: 'purple',
},
];
@ -196,10 +196,10 @@ async function calculateStats() {
}
onMounted(async () => {
utilsStore.currentTitle.title = 'branchManagement';
utilsStore.currentTitle.title = 'menu.branch';
utilsStore.currentTitle.path = [
{
text: 'branchManagementCaption',
text: 'branch.page.captionManage',
i18n: true,
handler: () => {
fieldSelectedBranch.value.value = 'branchHQLabel';
@ -257,7 +257,7 @@ const fieldSelectedBranch = ref<{
label: string;
value: string;
}>({
label: t('branchHQLabel'),
label: t('branch.form.title.branchHQLabel'),
value: 'branchHQLabel',
});
@ -516,13 +516,13 @@ async function triggerChangeStatus(
color: status !== 'INACTIVE' ? 'warning' : 'info',
icon:
status !== 'INACTIVE' ? 'mdi-alert' : 'mdi-message-processing-outline',
title: t('confirmChangeStatusTitle'),
title: t('dialog.title.confirmChangeStatus'),
actionText:
status !== 'INACTIVE' ? t('switchOffLabel') : t('switchOnLabel'),
status !== 'INACTIVE' ? t('general.close') : t('general.open'),
message:
status !== 'INACTIVE'
? t('confirmChangeStatusOffMessage')
: t('confirmChangeStatusOnMessage'),
? t('dialog.message.confirmChangeStatusOff')
: t('dialog.message.confirmChangeStatusOn'),
action: async () => {
const res = await branchStore.editById(id, {
status: status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE',
@ -623,21 +623,16 @@ function changeTitle(
formType: 'edit' | 'create' | 'delete' | 'view',
typeBranch: 'headOffice' | 'subBranch',
) {
if (typeBranch === 'headOffice') {
return formType === 'create'
? t('formDialogTitleCreateHeadOffice')
: formType === 'view'
? t('formDialogTitleViewHeadOffice')
: t('formDialogTitleEditHeadOffice');
}
if (typeBranch === 'subBranch') {
return formType === 'create'
? t('formDialogTitleCreateSubBranch')
: formType === 'view'
? t('formDialogTitleViewSubBranch')
: t('formDialogTitleEditSubBranch');
}
return '';
const _type =
typeBranch === 'headOffice'
? 'branch.card.branchHQLabel'
: 'branch.card.branchHQLabel';
return formType === 'create'
? t('form.title.create', { name: t(_type) })
: formType === 'view'
? t(_type)
: t('general.edit');
}
function handleHold(node: BranchWithChildren) {
@ -672,7 +667,7 @@ watch(
watch(currentHq, () => {
const tmp: typeof utilsStore.currentTitle.path = [
{
text: 'branchManagementCaption',
text: 'branch.page.captionManage',
i18n: true,
handler: () => {
expandedTree.value = expandedTree.value.filter(
@ -701,7 +696,7 @@ watch(currentHq, () => {
<template>
<div class="column full-height no-wrap">
<div class="text-body-2 q-mb-xs flex items-center">
{{ $t('branchStatTitle') }}
{{ $t('general.dataSum') }}
<q-btn
class="q-ml-xs"
icon="mdi-pin-outline"
@ -745,15 +740,16 @@ watch(currentHq, () => {
<div class="self-end q-ma-md">
<TooltipComponent
class="self-end"
title="branchNoMainOfficeYet"
caption="branchClickToCreateMainOffice"
title="general.noData"
caption="general.clickToCreate"
imgSrc="personnel-table-"
/>
</div>
<div class="col flex items-center justify-center">
<EmptyAddButton
label="branchAdd"
label="general.add"
:i18nArgs="{ text: $t('branch.form.title.branchLabel') }"
@trigger="() => triggerCreate('headOffice')"
/>
</div>
@ -901,7 +897,7 @@ watch(currentHq, () => {
for="input-search"
outlined
dense
:label="$t('search')"
:label="$t('general.search')"
class="q-mr-md col-12 col-md-4"
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
v-model="inputSearch"
@ -929,10 +925,10 @@ watch(currentHq, () => {
:for="'field-select-status'"
emit-value
:options="[
{ label: $t('all'), value: 'all' },
{ label: $t('statusACTIVE'), value: 'statusACTIVE' },
{ label: $t('general.all'), value: 'all' },
{ label: $t('status.ACTIVE'), value: 'statusACTIVE' },
{
label: $t('statusINACTIVE'),
label: $t('status.INACTIVE'),
value: 'statusINACTIVE',
},
]"
@ -943,9 +939,12 @@ watch(currentHq, () => {
id="select-field"
for="select-field"
:options="
fieldDisplay.map((v) => ({ label: $t(v), value: v }))
fieldDisplay.map((v) => ({
label: $t(`branch.card.${v}`),
value: v,
}))
"
:display-value="$t('displayField')"
:display-value="$t('general.displayField')"
:hide-dropdown-icon="$q.screen.lt.sm"
class="col q-mx-sm"
v-model="fieldSelected"
@ -1018,7 +1017,7 @@ watch(currentHq, () => {
.filter((v) => {
if (
statusFilter === 'statusACTIVE' &&
v.status === 'INACTIVE'
v.status !== 'ACTIVE'
) {
return false;
}
@ -1029,7 +1028,7 @@ watch(currentHq, () => {
return false;
}
const terms = `${v.code} ${$i18n.locale === 'en-US' ? v.nameEN : v.name} ${v.telephoneNo}`;
const terms = `${v.code} ${$i18n.locale === 'eng' ? v.nameEN : v.name} ${v.telephoneNo}`;
if (inputSearch && !terms.includes(inputSearch)) {
return false;
}
@ -1185,8 +1184,8 @@ watch(currentHq, () => {
<q-td v-if="fieldSelected.includes('branchLabelType')">
{{
props.row.isHeadOffice
? $t('branchHQLabel')
: $t('branchLabel')
? $t('branch.card.branchHQLabel')
: $t('branch.card.branchLabel')
}}
</q-td>
<q-td>
@ -1232,7 +1231,7 @@ watch(currentHq, () => {
style="color: hsl(var(--green-6-hsl))"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('viewDetail') }}
{{ $t('general.viewDetail') }}
</span>
</q-item>
@ -1270,7 +1269,7 @@ watch(currentHq, () => {
style="color: hsl(var(--cyan-6-hsl))"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('edit') }}
{{ $t('general.edit') }}
</span>
</q-item>
<q-item
@ -1297,7 +1296,7 @@ watch(currentHq, () => {
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
{{ $t('general.delete') }}
</span>
</q-item>
@ -1329,8 +1328,8 @@ watch(currentHq, () => {
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('switchOnLabel')
: $t('switchOffLabel')
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
@ -1378,20 +1377,20 @@ watch(currentHq, () => {
:data="{
branchLabelCode: props.row.code,
branchLabelName:
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? props.row.nameEN
: props.row.name,
branchLabelTel: props.row.contact
.map((c: BranchContact) => c.telephoneNo)
.join(','),
branchLabelAddress:
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? `${props.row.addressEN || ''} ${props.row.subDistrict?.nameEN || ''} ${props.row.district?.nameEN || ''} ${props.row.province?.nameEN || ''}`
: `${props.row.address || ''} ${props.row.subDistrict?.name || ''} ${props.row.district?.name || ''} ${props.row.province?.name || ''}`,
branchLabelType: $t(
props.row.isHeadOffice
? 'branchHQLabel'
: 'branchLabel',
? 'branch.branchHQLabel'
: 'branch.branchLabel',
),
branchImgUrl: `/branch/${props.row.id}/branch-image`,
}"
@ -1443,7 +1442,7 @@ watch(currentHq, () => {
style="color: hsl(var(--green-6-hsl))"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('viewDetail') }}
{{ $t('general.viewDetail') }}
</span>
</q-item>
@ -1481,7 +1480,7 @@ watch(currentHq, () => {
style="color: hsl(var(--cyan-6-hsl))"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('edit') }}
{{ $t('general.edit') }}
</span>
</q-item>
<q-item
@ -1508,7 +1507,7 @@ watch(currentHq, () => {
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
{{ $t('generaldelete') }}
</span>
</q-item>
@ -1540,8 +1539,8 @@ watch(currentHq, () => {
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('switchOnLabel')
: $t('switchOffLabel')
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
@ -1628,19 +1627,19 @@ watch(currentHq, () => {
<SideMenu
:menu="[
{
name: $t('formDialogTitleInformation'),
name: $t('form.field.basicInformation'),
anchor: 'form-information',
},
{
name: $t('formDialogTitleContact'),
name: $t('branch.form.group.contact'),
anchor: 'form-contact',
},
{
name: $t('formDialogTitleAddress'),
name: $t('form.address'),
anchor: 'form-address',
},
{
name: $t('formDialogTitleLocation'),
name: $t('branch.form.group.location'),
anchor: 'form-location',
},
{
@ -1648,7 +1647,7 @@ watch(currentHq, () => {
anchor: 'form-qr',
},
{
name: $t('bankBook'),
name: $t('branch.form.group.bankAccount'),
anchor: 'form-bank',
},
]"
@ -1676,7 +1675,7 @@ watch(currentHq, () => {
:outlined="true"
:readonly="formType === 'view'"
:view="isSubCreate"
title="formDialogTitleInformation"
title="form.field.basicInformation"
/>
<FormBranchContact
id="form-contact"
@ -1687,7 +1686,7 @@ watch(currentHq, () => {
v-model:contact-name="formData.contactName"
v-model:line-id="formData.lineId"
:separator="true"
title="formDialogTitleContact"
title="branch.form.group.contact"
:dense="true"
:outlined="true"
/>
@ -1698,11 +1697,7 @@ watch(currentHq, () => {
outlined
separator
prefix-id="default"
:title="
$t(
`${!formData.codeHeadOffice ? 'formDialogTitleAddress' : 'branchLabelAddress'}`,
)
"
:title="$t('form.address')"
v-model:address="formData.address"
v-model:addressEN="formData.addressEN"
v-model:province-id="formData.provinceId"
@ -1716,7 +1711,7 @@ watch(currentHq, () => {
:separator="true"
v-model:latitude="formData.latitude"
v-model:longitude="formData.longitude"
title="formDialogTitleLocation"
title="branch.form.group.location"
/>
<FormQr
id="form-qr"
@ -1732,7 +1727,7 @@ watch(currentHq, () => {
/>
<FormBank
id="form-bank"
title="bankBook"
title="branch.form.group.bankAccount"
dense
v-model:bank-book-list="formBankBook"
/>
@ -1754,8 +1749,7 @@ watch(currentHq, () => {
ref="formDialogRef"
v-model:drawerOpen="modalDrawer"
:category="changeTitle(formType, formTypeBranch)"
:title="$i18n.locale === 'en-US' ? formData.nameEN : formData.name"
:titleFormAddress="$t('formDialogTitleAddress')"
:title="$i18n.locale === 'eng' ? formData.nameEN : formData.name"
:addressSeparator="true"
:undo="() => undo()"
:isEdit="formType === 'edit'"
@ -1853,19 +1847,19 @@ watch(currentHq, () => {
<SideMenu
:menu="[
{
name: $t('formDialogTitleInformation'),
name: $t('form.field.basicInformation'),
anchor: 'info-information',
},
{
name: $t('formDialogTitleContact'),
name: $t('branch.form.group.contact'),
anchor: 'info-contact',
},
{
name: $t('formDialogTitleAddress'),
name: $t('form.address'),
anchor: 'info-address',
},
{
name: $t('formDialogTitleLocation'),
name: $t('branch.form.group.location'),
anchor: 'info-location',
},
{
@ -1873,7 +1867,7 @@ watch(currentHq, () => {
anchor: 'info-qr',
},
{
name: $t('bankBook'),
name: $t('branch.form.group.bankAccount'),
anchor: 'info-bank',
},
]"
@ -1904,12 +1898,12 @@ watch(currentHq, () => {
:outlined="true"
:readonly="formType === 'view'"
view
title="formDialogTitleInformation"
title="form.field.basicInformation"
class="q-mb-xl"
/>
<FormBranchContact
id="info-contact"
title="formDialogTitleContact"
title="branch.form.group.contact"
v-model:telephone-no="formData.telephoneNo"
v-model:contact="formData.contact"
v-model:email="formData.email"
@ -1928,11 +1922,7 @@ watch(currentHq, () => {
outlined
separator
prefix-id="default"
:title="
$t(
`${!formData.headOfficeId ? 'formDialogTitleAddress' : 'branchLabelAddress'}`,
)
"
:title="$t('form.address')"
:readonly="formType === 'view'"
v-model:address="formData.address"
v-model:addressEN="formData.addressEN"
@ -1944,7 +1934,7 @@ watch(currentHq, () => {
/>
<FormLocation
id="info-location"
title="formDialogTitleLocation"
title="branch.form.group.location"
v-model:latitude="formData.latitude"
v-model:longitude="formData.longitude"
:readonly="formType === 'view'"
@ -1966,7 +1956,7 @@ watch(currentHq, () => {
<FormBank
id="info-bank"
:readonly="formType === 'view'"
title="bankBook"
title="branch.form.group.bankAccount"
dense
v-model:bank-book-list="formBankBook"
class="q-mb-xl"
@ -2103,8 +2093,8 @@ watch(currentHq, () => {
<q-item-section>
{{
currentNode.status !== 'INACTIVE'
? $t('switchOnLabel')
: $t('switchOffLabel')
? $t('general.open')
: $t('general.close')
}}
</q-item-section>
</q-item>