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

@ -96,32 +96,32 @@ const modeView = ref(false);
const fieldSelectedOption = ref<{ label: string; value: string }[]>([
{
label: 'orderNumber',
label: 'general.order',
value: 'orderNumber',
},
{
label: 'fullname',
label: 'general.fullName',
value: 'name',
},
{
label: 'type',
label: 'general.type',
value: 'type',
},
{
label: 'telephone',
label: 'general.telephone',
value: 'telephoneNo',
},
{
label: 'personnelCardAge',
label: 'personnel.age',
value: 'birthDate',
},
{
label: 'formDialogInputEmail',
label: 'form.email',
value: 'email',
},
{
label: 'userRole',
label: 'personnel.form.userRole',
value: 'userRole',
},
]);
@ -247,45 +247,45 @@ const columns = [
{
name: 'orderNumber',
align: 'center',
label: 'orderNumber',
label: 'general.order',
field: 'branchNo',
},
{
name: 'name',
align: 'left',
label: 'fullname',
label: 'general.fullName',
field: 'firstName',
},
{
name: 'type',
align: 'left',
label: 'type',
label: 'general.type',
field: 'type',
},
{
name: 'telephoneNo',
align: 'left',
label: 'telephone',
label: 'general.telephone',
field: 'telephoneNo',
},
{
name: 'birthDate',
align: 'left',
label: 'personnelCardAge',
label: 'personnel.age',
field: 'birthDate',
},
{
name: 'email',
align: 'left',
label: 'formDialogInputEmail',
label: 'form.email',
field: 'email',
},
{
name: 'userRole',
align: 'left',
label: 'userRole',
label: 'personnel.form.userRole',
field: 'userRole',
},
] satisfies QTableProps['columns'];
@ -367,7 +367,7 @@ async function openDialog(
id: user.id,
img: `${user.profileImageUrl}`,
name:
locale.value === 'en-US'
locale.value === 'eng'
? `${user.firstNameEN} ${user.lastNameEN}`
: `${user.firstName} ${user.lastName}`,
male: user.gender === 'male',
@ -542,13 +542,13 @@ async function triggerChangeStatus(id: string, status: string) {
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 () => {
await toggleStatus(id).then(resolve).catch(reject);
},
@ -563,8 +563,10 @@ async function assignFormData(idEdit: string) {
if (foundUser) {
currentUser.value = foundUser;
infoPersonId.value = currentUser.value.id;
imageUrl.value = currentUser.value.profileImageUrl;
if (currentUser.value) {
infoPersonId.value = currentUser.value.id;
imageUrl.value = currentUser.value.profileImageUrl;
}
formData.value = {
branchId: foundUser.branch[0]?.id,
provinceId: foundUser.provinceId,
@ -645,10 +647,8 @@ function openImageDialog() {
}
onMounted(async () => {
utilsStore.currentTitle.title = 'personnelManagement';
utilsStore.currentTitle.path = [
{ text: 'personnelManagementCaption', i18n: true },
];
utilsStore.currentTitle.title = 'personnel.title';
utilsStore.currentTitle.path = [{ text: 'personnel.caption', i18n: true }];
modeView.value = $q.screen.lt.md ? true : false;
await fetchUserList();
@ -747,7 +747,7 @@ watch(
<ButtonAddComponent style="z-index: 999">
<q-fab-action
id="btn-add-personne"
:label="$t('personnelAdd')"
:label="$t('personnel.addTitle')"
external-label
label-position="left"
@click="openDialog('FORM')"
@ -760,7 +760,7 @@ watch(
<!-- stat -->
<div class="column full-height no-wrap">
<div class="text-body-2 q-mb-xs flex items-center">
{{ $t('personnelStatTitle') }}
{{ $t('general.dataSum') }}
<q-badge
v-if="typeStats"
rounded
@ -800,7 +800,7 @@ watch(
selectorLabel === 'ALL'
? Object.entries(typeStats).map(([key, val]) => ({
count: val,
label: key,
label: `personnel.${key}`,
icon: 'mdi-account-outline',
color:
(
@ -814,7 +814,7 @@ watch(
}))
: [
{
label: selectorLabel,
label: `personnel.${selectorLabel}`,
count: typeStats[selectorLabel],
icon: 'mdi-account-outline',
color:
@ -850,7 +850,7 @@ watch(
for="input-search"
outlined
dense
:label="$t('search')"
:label="$t('general.search')"
class="q-mr-md col-12 col-md-3"
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
v-model="inputSearch"
@ -880,9 +880,9 @@ watch(
:for="'field-select-status'"
:hide-dropdown-icon="$q.screen.lt.sm"
:options="[
{ label: $t('all'), value: 'all' },
{ label: $t('statusACTIVE'), value: 'statusACTIVE' },
{ label: $t('statusINACTIVE'), value: 'statusINACTIVE' },
{ label: $t('general.all'), value: 'all' },
{ label: $t('general.active'), value: 'statusACTIVE' },
{ label: $t('general.inactive'), value: 'statusINACTIVE' },
]"
></q-select>
@ -898,7 +898,7 @@ watch(
label: $t(v.label),
}))
"
:display-value="$t('displayField')"
:display-value="$t('general.displayField')"
:hide-dropdown-icon="$q.screen.lt.sm"
v-model="fieldSelected"
option-label="label"
@ -982,12 +982,12 @@ watch(
"
>
<div
class="row"
class="row text-capitalize"
:class="
selectorLabel === 'ALL' ? 'text-bold' : 'app-text-muted'
"
>
{{ $t('all') }}
{{ $t('general.all') }}
</div>
</q-tab>
<q-tab
@ -1003,12 +1003,12 @@ watch(
"
>
<div
class="row"
class="row text-capitalize"
:class="
selectorLabel === 'USER' ? 'text-bold' : 'app-text-muted'
"
>
{{ $t('USER') }}
{{ $t('personnel.USER') }}
</div>
</q-tab>
<q-tab
@ -1024,12 +1024,12 @@ watch(
"
>
<div
class="row"
class="row text-capitalize"
:class="
selectorLabel === 'MESSENGER' ? 'text-bold' : 'app-text-muted'
"
>
{{ $t('MESSENGER') }}
{{ $t('personnel.MESSENGER') }}
</div>
</q-tab>
<q-tab
@ -1045,12 +1045,12 @@ watch(
"
>
<div
class="row"
class="row text-capitalize"
:class="
selectorLabel === 'DELEGATE' ? 'text-bold' : 'app-text-muted'
"
>
{{ $t('DELEGATE') }}
{{ $t('personnel.DELEGATE') }}
</div>
</q-tab>
<q-tab
@ -1066,12 +1066,12 @@ watch(
"
>
<div
class="row"
class="row text-capitalize"
:class="
selectorLabel === 'AGENCY' ? 'text-bold' : 'app-text-muted'
"
>
{{ $t('AGENCY') }}
{{ $t('personnel.AGENCY') }}
</div>
</q-tab>
</q-tabs>
@ -1180,7 +1180,7 @@ watch(
<div class="column">
<div class="col ellipsis" style="max-width: 20vw">
{{
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim()
: `${props.row.firstName} ${props.row.lastName}`.trim()
}}
@ -1190,7 +1190,7 @@ watch(
:delay="300"
>
{{
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim()
: `${props.row.firstName} ${props.row.lastName}`.trim()
}}
@ -1231,12 +1231,14 @@ watch(
>
{{
$t(
{
USER: 'USER',
MESSENGER: 'MESSENGER',
DELEGATE: 'DELEGATE',
AGENCY: 'AGENCY',
}[props.row.userType as string] || 'USER',
`personnel.${
{
USER: 'USER',
MESSENGER: 'MESSENGER',
DELEGATE: 'DELEGATE',
AGENCY: 'AGENCY',
}[props.row.userType as string] || 'USER'
}`,
)
}}
</span>
@ -1307,7 +1309,7 @@ watch(
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>
@ -1331,7 +1333,7 @@ watch(
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
@ -1357,7 +1359,7 @@ watch(
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
{{ $t('general.delete') }}
</span>
</q-item>
@ -1382,8 +1384,8 @@ watch(
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('switchOnLabel')
: $t('switchOffLabel')
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
@ -1404,7 +1406,7 @@ watch(
code: props.row.code,
name:
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? `${props.row.firstNameEN} ${props.row.lastNameEN}`.trim()
: `${props.row.firstName} ${props.row.lastName}`.trim(),
img: props.row.profileImageUrl
@ -1439,7 +1441,7 @@ watch(
DELEGATE: 'red',
AGENCY: 'magenta',
}[props.row.userType as string] || 'pink',
value: $t(props.row.userType),
value: $t(`personnel.${props.row.userType}`),
},
]"
:disabled="props.row.status === 'INACTIVE'"
@ -1503,15 +1505,15 @@ watch(
>
<div class="flex justify-end">
<TooltipComponent
title="personnelTooltipTitle"
caption="personnelTooltipCaption"
title="personnel.tooltipTitle"
caption="personnel.tooltipCaption"
imgSrc="personnel-table-"
/>
</div>
<div class="col items-center flex justify-center">
<AddButton
:label="'personnelAdd'"
:label="'personnel.addTitle'"
:cyanOn="true"
@trigger="openDialog('FORM')"
/>
@ -1533,12 +1535,8 @@ watch(
>
<div class="col-4">
<div class="row items-center no-wrap">
<div
class="app-text-muted"
style="width: 80px"
v-if="$q.screen.gt.sm"
>
{{ $t('showing') }}
<div class="app-text-muted q-mr-sm" v-if="$q.screen.gt.sm">
{{ $t('general.recordPerPage') }}
</div>
<div>
<q-btn-dropdown
@ -1572,7 +1570,7 @@ watch(
<div class="col-4 row justify-center app-text-muted">
{{
$t('recordsPage', {
$t('general.recordsPage', {
resultcurrentPage: userData?.result.length,
total: userData?.total,
})
@ -1591,12 +1589,12 @@ watch(
<DrawerInfo
v-if="currentUser"
:category="$t('personnelTitle')"
:category="$t('personnel.personnel')"
bg-on
hide-action
:isEdit="infoDrawerEdit"
:title="
$i18n.locale === 'en-US'
$i18n.locale === 'eng'
? `${currentUser.firstNameEN} ${currentUser.lastNameEN}`
: `${currentUser.firstName} ${currentUser.lastName}`
"
@ -1620,8 +1618,8 @@ watch(
hideFade
:menu="formMenuIcon"
:readonly="!infoDrawerEdit"
:toggleTitle="$t('formDialogTitleUserStatus')"
:title="`${$i18n.locale === 'en-US' ? `${formData.firstNameEN} ${formData.lastNameEN}` : `${formData.firstName} ${formData.lastName}`}`"
:toggleTitle="$t('status.title')"
:title="`${$i18n.locale === 'eng' ? `${formData.firstNameEN} ${formData.lastNameEN}` : `${formData.firstName} ${formData.lastName}`}`"
:caption="userCode"
:img="
urlProfile ||
@ -1706,22 +1704,22 @@ watch(
:menu="
[
{
name: $t('formDialogTitleInformation'),
name: $t('form.field.basicInformation'),
anchor: 'info-information',
},
{
name: $t('formDialogTitlePersonal'),
name: $t('personnel.form.personalInformation'),
anchor: 'info-personal',
},
{
name: $t('formDialogTitleAddressPersonnel'),
name: $t('personnel.form.addressInformation'),
anchor: 'info-address',
},
].concat(
!!formData.userType
? [
{
name: $t('formDialogTitleByType'),
name: $t('personnel.form.workInformation'),
anchor: 'info-work',
},
]
@ -1754,7 +1752,7 @@ watch(
dense
outlined
separator
:title="'formDialogTitleInformation'"
:title="'form.field.basicInformation'"
:readonly="!infoDrawerEdit"
:usernameReadonly="isEdit"
class="q-mb-xl"
@ -1774,7 +1772,7 @@ watch(
v-model:email="formData.email"
v-model:gender="formData.gender"
v-model:birth-date="formData.birthDate"
:title="'formDialogTitlePersonal'"
:title="'personnel.form.personalInformation'"
prefix-id="drawer-info-personnel"
dense
outlined
@ -1793,6 +1791,7 @@ watch(
v-model:zipCode="formData.zipCode"
:readonly="!infoDrawerEdit"
prefix-id="drawer-info-personnel"
:title="'personnel.form.addressInformation'"
dense
class="q-mb-xl"
/>
@ -1831,7 +1830,7 @@ watch(
ref="formDialogRef"
:badgeClass="formData.gender === 'male' ? 'app-bg-male' : 'app-bg-female'"
:badgeLabel="userCode"
:title="$t('personnelAdd')"
:title="$t('personnel.addTitle')"
v-model:modal="modal"
:addressSeparator="formData.userType !== ''"
:submit="() => onSubmit()"
@ -1855,8 +1854,8 @@ watch(
female: '/no-img-female.png',
}[formData.gender]
"
:toggleTitle="$t('formDialogTitleUserStatus')"
:title="`${$i18n.locale === 'en-US' ? `${formData.firstNameEN} ${formData.lastNameEN}` : `${formData.firstName} ${formData.lastName}`}`"
:toggleTitle="$t('status.title')"
:title="`${$i18n.locale === 'eng' ? `${formData.firstNameEN} ${formData.lastNameEN}` : `${formData.firstName} ${formData.lastName}`}`"
:fallbackImg="
{
male: '/no-img-man.png',
@ -1885,28 +1884,28 @@ watch(
>
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
</div>
<div class="col full-height scroll">
<div class="col full-height scroll" v-if="$q.screen.gt.sm">
<div style="position: sticky; top: 0" class="q-pa-sm">
<SideMenu
:menu="
[
{
name: $t('formDialogTitleInformation'),
name: $t('form.field.basicInformation'),
anchor: 'dialog-form-information',
},
{
name: $t('formDialogTitlePersonal'),
name: $t('personnel.form.personalInformation'),
anchor: 'dialog-form-personal',
},
{
name: $t('formDialogTitleAddressPersonnel'),
name: $t('personnel.form.addressInformation'),
anchor: 'dialog-form-address',
},
].concat(
!!formData.userType
? [
{
name: $t('formDialogTitleByType'),
name: $t('personnel.form.workInformation'),
anchor: 'dialog-info-work',
},
]
@ -1922,13 +1921,13 @@ watch(
/>
</div>
</div>
<div class="col-10 q-pa-md full-height scroll">
<div class="col-md-10 col-12 q-pa-md full-height scroll">
<FormInformation
id="dialog-form-information"
dense
outlined
separator
:title="'formDialogTitleInformation'"
:title="'form.field.basicInformation'"
:usernameReadonly="isEdit"
v-model:hqId="hqId"
v-model:brId="brId"
@ -1944,7 +1943,7 @@ watch(
dense
outlined
separator
:title="'formDialogTitlePersonal'"
:title="'personnel.form.personalInformation'"
v-model:first-name="formData.firstName"
v-model:last-name="formData.lastName"
v-model:mid-name="formData.middleName"