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

@ -31,10 +31,10 @@ onMounted(async () => {
const resultOption = await fetch('/option/option.json');
const option = await resultOption.json();
if (locale.value === 'en-US') {
if (locale.value === 'eng') {
codeOption.value = option.eng.typeProduct;
}
if (locale.value === 'th-th') {
if (locale.value === 'tha') {
codeOption.value = option.tha.typeProduct;
}
});
@ -61,7 +61,7 @@ const branchFilter = selectFilterOptionRefMod(
name="mdi-office-building-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`formDialogTitleInformation`) }}
{{ $t(`form.field.basicInformation`) }}
</div>
<div class="col-12 row q-col-gutter-sm">
@ -76,7 +76,7 @@ const branchFilter = selectFilterOptionRefMod(
hide-bottom-space
input-debounce="0"
:disable="!readonly && disableCode"
class="col-3"
class="col-md-3 col-6"
v-model="code"
id="select-br-id"
option-label="label"
@ -85,15 +85,15 @@ const branchFilter = selectFilterOptionRefMod(
:dense="dense"
:readonly="readonly"
:options="codeOptions"
:label="$t('productCode')"
:label="$t('productService.product.code')"
:hide-dropdown-icon="readonly || disableCode"
:rules="[(val: string) => !!val]"
:rules="[(val: string) => !!val || $t('form.error.required')]"
@filter="codeFilter"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('noResults') }}
{{ $t('general.noData') }}
</q-item-section>
</q-item>
</template>
@ -108,7 +108,7 @@ const branchFilter = selectFilterOptionRefMod(
hide-selected
hide-bottom-space
input-debounce="0"
class="col-3"
class="col-md-3 col-6"
option-value="id"
option-label="name"
lazy-rules="ondemand"
@ -118,14 +118,20 @@ const branchFilter = selectFilterOptionRefMod(
:readonly="readonly"
:options="branchOptions"
:hide-dropdown-icon="readonly"
:label="$t('registeredBranch')"
:label="$t('productService.product.registeredBranch')"
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(
(role) => roles.includes(role),
);
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
return (
isSpecialRole ||
!!val ||
$t('form.error.selectField', {
field: $t('productService.product.registeredBranch'),
})
);
},
]"
@filter="branchFilter"
@ -133,7 +139,7 @@ const branchFilter = selectFilterOptionRefMod(
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('noResults') }}
{{ $t('general.noData') }}
</q-item-section>
</q-item>
</template>
@ -148,9 +154,9 @@ const branchFilter = selectFilterOptionRefMod(
:borderless="readonly"
hide-bottom-space
class="col-6"
:label="$t('productName')"
:label="$t('productService.product.name')"
v-model="name"
:rules="[(val: string) => !!val]"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
lazy-rules="ondemand"
@ -160,8 +166,8 @@ const branchFilter = selectFilterOptionRefMod(
:readonly="readonly"
:borderless="readonly"
hide-bottom-space
class="col-3"
:label="$t('productProcessingTime')"
class="col-md-3 col-6"
:label="$t('productService.product.processingTime')"
v-model="process"
type="number"
/>
@ -185,7 +191,7 @@ const branchFilter = selectFilterOptionRefMod(
outlined
:readonly="readonly"
:borderless="readonly"
:label="$t('detail')"
:label="$t('general.detail')"
stack-label
dense
>
@ -196,7 +202,7 @@ const branchFilter = selectFilterOptionRefMod(
(v) => (typeof v === 'string' ? (detail = v) : '')
"
min-height="5rem"
class="full-width q-mt-sm q-mb-xs"
class="q-mt-sm q-mb-xs"
:flat="!readonly"
:readonly="readonly"
:toolbar-color="
@ -208,6 +214,7 @@ const branchFilter = selectFilterOptionRefMod(
color: var(--foreground);
border-color: var(--surface-3);
"
:style="`width: ${$q.screen.gt.xs ? '100%' : '63vw'}`"
/>
</q-field>
</div>
@ -221,7 +228,7 @@ const branchFilter = selectFilterOptionRefMod(
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('formDialogInputRemark')"
:label="$t('general.remark')"
:model-value="readonly ? remark || '-' : remark"
@update:model-value="(v) => (typeof v === 'string' ? (remark = v) : '')"
/>