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) : '')"
/>

View file

@ -57,7 +57,7 @@ const serviceCodeFilter = selectFilterOptionRefMod(
name="mdi-office-building-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`formDialogTitleInformation`) }}
{{ $t(`form.field.basicInformation`) }}
</div>
<div v-if="!service" class="col-12 row q-col-gutter-sm">
<q-input
@ -69,9 +69,7 @@ const serviceCodeFilter = selectFilterOptionRefMod(
hide-bottom-space
class="col-6"
:label="
$t(
isType ? 'productAndServiceTypeCode' : 'productAndServiceGroupCode',
)
$t(isType ? 'productService.type.code' : 'productService.group.code')
"
v-model="code"
/>
@ -83,12 +81,10 @@ const serviceCodeFilter = selectFilterOptionRefMod(
hide-bottom-space
class="col-6"
:label="
$t(
isType ? 'productAndServiceTypeName' : 'productAndServiceGroupName',
)
$t(isType ? 'productService.type.name' : 'productService.group.name')
"
v-model="name"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
lazy-rules="ondemand"
@ -98,7 +94,7 @@ const serviceCodeFilter = selectFilterOptionRefMod(
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('detail')"
:label="$t('general.detail')"
:model-value="readonly ? detail || '-' : detail"
@update:model-value="(v) => (typeof v === 'string' ? (detail = v) : '')"
:for="`input-detail`"
@ -111,7 +107,7 @@ const serviceCodeFilter = 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) : '')"
:for="`input-remark`"
@ -147,7 +143,7 @@ const serviceCodeFilter = 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>
@ -161,10 +157,10 @@ const serviceCodeFilter = selectFilterOptionRefMod(
outlined
:readonly="readonly"
hide-bottom-space
class="col-3"
:label="$t('serviceCode')"
class="col-md-3 col-4"
:label="$t('productService.service.code')"
v-model="serviceCode"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-select
@ -176,7 +172,7 @@ const serviceCodeFilter = selectFilterOptionRefMod(
map-options
hide-selected
hide-bottom-space
class="col-3"
class="col-md-3 col-8"
option-value="id"
option-label="name"
lazy-rules="ondemand"
@ -187,14 +183,20 @@ const serviceCodeFilter = selectFilterOptionRefMod(
:readonly="readonly"
:options="branchOptions"
:hide-dropdown-icon="readonly"
:label="$t('registeredBranch')"
:label="$t('productService.service.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.service.registeredBranch'),
})
);
},
]"
@filter="branchFilter"
@ -202,7 +204,7 @@ const serviceCodeFilter = 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>
@ -216,10 +218,10 @@ const serviceCodeFilter = selectFilterOptionRefMod(
outlined
:readonly="readonly"
hide-bottom-space
class="col-6"
:label="$t('serviceName')"
class="col-md-6 col"
:label="$t('productService.service.name')"
v-model="serviceName"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
lazy-rules="ondemand"
@ -231,7 +233,7 @@ const serviceCodeFilter = selectFilterOptionRefMod(
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('detail')"
:label="$t('general.detail')"
:model-value="readonly ? serviceDescription || '-' : serviceDescription"
@update:model-value="
(v) => (typeof v === 'string' ? (serviceDescription = v) : '')

View file

@ -23,7 +23,7 @@ defineEmits<{
class="text-weight-bold text-body1 flex items-center justify-between q-px-md q-py-sm"
style="background: hsla(var(--info-bg) / 0.1); min-height: 50px"
>
{{ $t(`serviceProperties`) }}
{{ $t(`productService.service.serviceProperties`) }}
<q-btn
v-if="!readonly"
@ -31,7 +31,7 @@ defineEmits<{
dense
flat
unelevated
class="q-px-sm"
class="q-px-sm text-capitalize"
color="info"
@click="$emit('serviceProperties')"
>
@ -41,7 +41,9 @@ defineEmits<{
class="q-mr-sm"
style="color: hsl(var(--info-bg))"
/>
{{ $t('serviceProperties') }}
<span v-if="$q.screen.gt.xs">
{{ $t('productService.service.serviceProperties') }}
</span>
</q-btn>
</div>
@ -61,7 +63,7 @@ defineEmits<{
</div>
<div v-else class="col flex items-center app-text-muted">
{{ $t('noProperties') }}
{{ $t('productService.service.noProperties') }}
</div>
</div>
</div>

View file

@ -43,9 +43,9 @@ function confirmDelete(items: unknown[], index: number) {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('delete'),
message: t('deleteConfirmMessage'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
message: t('dialog.message.confirmDelete'),
action: async () => {
deleteItem(items, index);
},
@ -65,7 +65,7 @@ function confirmDelete(items: unknown[], index: number) {
name="mdi-briefcase-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`workInformation`) }}
{{ $t(`productService.service.workInformation`) }}
<AddButton
v-if="!readonly"
id="btn-add-work"

View file

@ -37,7 +37,7 @@ withDefaults(
name="mdi-cash"
style="background-color: var(--surface-3)"
/>
{{ $t('priceInformation') }}
{{ $t('productService.product.priceInformation') }}
</div>
<div class="col-12 row q-col-gutter-sm">
<q-input
@ -50,7 +50,7 @@ withDefaults(
hide-bottom-space
class="col-4"
type="number"
:label="$t('salePrice')"
:label="$t('productService.product.salePrice')"
v-model="price"
/>
@ -64,7 +64,7 @@ withDefaults(
hide-bottom-space
class="col-4"
type="number"
:label="$t('agentPrice')"
:label="$t('productService.product.agentPrice')"
v-model="agentPrice"
/>
@ -78,7 +78,7 @@ withDefaults(
hide-bottom-space
class="col-4"
type="number"
:label="$t('processingPrice')"
:label="$t('productService.product.processingPrice')"
v-model="serviceCharge"
/>
</div>

View file

@ -83,7 +83,7 @@ withDefaults(
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>
<q-item
@ -106,7 +106,7 @@ withDefaults(
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
@ -126,7 +126,7 @@ withDefaults(
class="col-3 app-text-negative"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
@ -139,7 +139,7 @@ withDefaults(
/>
<span class="q-pl-md">
{{
!isDisabled ? $t('switchOnLabel') : $t('switchOffLabel')
!isDisabled ? $t('general.open') : $t('general.close')
}}
</span>
</div>
@ -199,8 +199,8 @@ withDefaults(
}
"
unelevated
class="q-px-sm"
:label="$t('detail')"
class="q-px-sm text-capitalize"
:label="$t('general.detail')"
style="
background-color: hsla(var(--blue-5-hsl) / 0.1);
color: var(--blue-5);

View file

@ -209,9 +209,9 @@ function confirmDelete(items: unknown[], index: number) {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('delete'),
message: t('deleteConfirmMessage'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
message: t('dialog.message.confirmDelete'),
action: async () => {
deleteItem(items, index);
},
@ -227,8 +227,8 @@ function confirmDelete(items: unknown[], index: number) {
dense
unelevated
color="primary"
:label="$t('properties')"
class="q-px-sm q-mb-lg"
:label="$t('productService.service.properties')"
class="q-px-sm q-mb-lg text-capitalize"
menu-anchor="bottom end"
>
<q-list dense v-if="formServiceProperties && propertiesOption">
@ -251,7 +251,7 @@ function confirmDelete(items: unknown[], index: number) {
class="q-mr-sm"
style="color: hsl(var(--text-mute))"
/>
{{ $t('selectAll') }}
{{ $t('general.selectAll') }}
</div>
</q-item>
<q-separator />
@ -310,7 +310,7 @@ function confirmDelete(items: unknown[], index: number) {
index === formServiceProperties.additional.length - 1 && 'q-mb-lg'
"
>
<div class="col row items-center">
<div class="col-md col-12 row items-center">
<q-btn
id="btn-move-up-product"
icon="mdi-arrow-up"
@ -318,6 +318,7 @@ function confirmDelete(items: unknown[], index: number) {
flat
round
:disable="index === 0"
:size="$q.screen.xs ? 'xs' : ''"
style="color: hsl(var(--text-mute-2))"
@click="moveItemUp(formServiceProperties.additional, index)"
/>
@ -327,13 +328,14 @@ function confirmDelete(items: unknown[], index: number) {
dense
flat
round
:size="$q.screen.xs ? 'xs' : ''"
:disable="index === formServiceProperties.additional.length - 1"
style="color: hsl(var(--text-mute-2))"
@click="moveItemDown(formServiceProperties.additional, index)"
/>
<q-avatar
size="md"
:size="$q.screen.xs ? 'sm' : 'md'"
class="q-mx-lg"
style="background-color: var(--surface-3)"
>
@ -348,8 +350,9 @@ function confirmDelete(items: unknown[], index: number) {
emit-value
map-options
hide-bottom-space
class="col q-mr-md"
:label="$t('propertiesName')"
class="col-md col-12 q-mr-md"
:class="{ 'q-my-sm': $q.screen.lt.md }"
:label="$t('productService.service.propertiesName')"
option-label="label"
option-value="value"
:options="propertiesOption"
@ -369,7 +372,7 @@ function confirmDelete(items: unknown[], index: number) {
</div>
<!-- type -->
<div class="col">
<div class="col-md col-12">
<q-select
lazy-rules="ondemand"
dense
@ -377,7 +380,7 @@ function confirmDelete(items: unknown[], index: number) {
emit-value
map-options
hide-bottom-space
:label="$t('type')"
:label="$t('general.type')"
option-value="value"
@update:model-value="
(t: 'string' | 'number' | 'date' | 'array') => {
@ -461,8 +464,13 @@ function confirmDelete(items: unknown[], index: number) {
<div v-if="p.type !== 'date' && p.type">
<q-item class="no-padding" style="font-size: 11px">
<q-item-section class="column q-py-sm" style="padding-left: 12px">
<span class="app-text-muted-2">{{ $t('additional') }}</span>
<q-item-section
class="column q-py-sm"
:style="{ 'padding-left: 12px': $q.screen.gt.xs }"
>
<span class="app-text-muted-2">
{{ $t('general.additional') }}
</span>
<div v-if="p.type === 'string'" class="q-gutter-y-sm">
<div class="row items-center">
@ -472,7 +480,7 @@ function confirmDelete(items: unknown[], index: number) {
v-model="p.isPhoneNumber"
size="xs"
/>
{{ $t('telephone') }}
{{ $t('general.telephone') }}
</div>
<q-input
lazy-rules="ondemand"
@ -482,7 +490,7 @@ function confirmDelete(items: unknown[], index: number) {
class="col additional-label"
dense
outlined
:label="$t('telMaxLength')"
:label="$t('form.maxLength')"
/>
</div>
</div>
@ -491,7 +499,7 @@ function confirmDelete(items: unknown[], index: number) {
<div class="row items-center">
<div class="col-md-4 col-12 surface-3 rounded">
<q-checkbox v-model="p.comma" size="xs" class="q-py-xs" />
{{ $t('useComma') }}
{{ $t('form.useComma') }}
</div>
<div
class="col-md-4 col-7 surface-3 rounded"
@ -505,7 +513,7 @@ function confirmDelete(items: unknown[], index: number) {
size="xs"
class="q-py-xs"
/>
{{ $t('decimal') }}
{{ $t('form.decimal') }}
</div>
<q-input
lazy-rules="ondemand"
@ -515,7 +523,7 @@ function confirmDelete(items: unknown[], index: number) {
input-class="text-caption"
dense
outlined
:label="$t('decimalPlace')"
:label="$t('form.decimalPlace')"
/>
</div>
</div>
@ -534,8 +542,8 @@ function confirmDelete(items: unknown[], index: number) {
dense
outlined
input-class="text-caption"
:label="$t('selection')"
:rules="[(val) => !!val || $t('pleaseInformation')]"
:label="$t('form.selection')"
:rules="[(val) => !!val || $t('form.error.required')]"
hide-bottom-space
/>
</div>

View file

@ -92,7 +92,7 @@ withDefaults(
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>
@ -112,7 +112,7 @@ withDefaults(
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>
@ -126,7 +126,7 @@ withDefaults(
/>
<span class="q-pl-md">
{{
!isDisabled ? $t('switchOnLabel') : $t('switchOffLabel')
!isDisabled ? $t('general.open') : $t('general.close')
}}
</span>
</div>
@ -155,7 +155,9 @@ withDefaults(
class="bordered q-pa-xs row surface-0"
style="font-size: 12px; border-radius: 5px; width: 80px"
>
<div class="col ellipsis-2-lines">งาน</div>
<div class="col ellipsis-2-lines">
{{ $t('productService.service.work') }}
</div>
<q-space />
<div class="col text-center">{{ data?.work.length }}</div>
</div>
@ -166,10 +168,14 @@ withDefaults(
class="row full-width text-right"
style="font-size: 10px; color: hsl(var(--stone-4-hsl))"
>
<div class="col" v-if="priceDisplay?.price">ราคาขาย</div>
<div class="col" v-if="priceDisplay?.agentPrice">ราคาตัวแทน</div>
<div class="col" v-if="priceDisplay?.price">
{{ $t('productService.product.salePrice') }}
</div>
<div class="col" v-if="priceDisplay?.agentPrice">
{{ $t('productService.product.agentPrice') }}
</div>
<div class="col" v-if="priceDisplay?.serviceCharge">
ราคาดำเนนการ
{{ $t('productService.product.processingPrice') }}
</div>
</div>
@ -249,7 +255,7 @@ withDefaults(
class="surface-0 rounded q-pa-xs app-text-muted"
size="20px"
/>
{{ data?.process }}
{{ data?.process }} {{ $t('general.day') }}
</div>
</div>
</div>

View file

@ -102,20 +102,22 @@ defineEmits<{
@click="() => (readonly ? '' : fetchListOfWork())"
>
<span class="text-body2" style="color: var(--foreground)">
{{ $t('workNo') }} {{ index + 1 }} :
{{ $t('productService.service.work') }} {{ index + 1 }} :
<span class="app-text-muted-2">
{{ workName ? workName : $t('workName') }}
{{
workName ? workName : $t('productService.service.workName')
}}
</span>
</span>
<q-menu v-if="!readonly" fit anchor="bottom left" self="top left">
<q-item>
<div class="full-width flex items-center justify-between">
{{ $t('workName') }}
{{ $t('productService.service.workName') }}
<q-btn
dense
unelevated
class="bordered q-px-sm"
class="bordered q-px-sm text-capitalize"
style="
border-radius: var(--radius-2);
color: hsl(var(--info-bg));
@ -165,7 +167,7 @@ defineEmits<{
color="negative"
@click.stop="$emit('deleteWork')"
>
<q-tooltip>{{ $t('delete') }}</q-tooltip>
<q-tooltip>{{ $t('general.delete') }}</q-tooltip>
</q-btn>
</div>
</div>
@ -178,10 +180,14 @@ defineEmits<{
class="q-py-xs text-weight-medium row justify-between items-center q-px-md"
style="background-color: hsla(var(--info-bg) / 0.1)"
>
<span>{{ $t('propertiesInWork') }} {{ workIndex + 1 }}</span>
<span>
{{ $t('productService.service.propertiesInWork') }}
{{ workIndex + 1 }}
</span>
<q-btn
v-if="!readonly"
id="btn-add-work-product"
class="text-capitalize"
flat
dense
padding="0"
@ -194,14 +200,17 @@ defineEmits<{
class="q-mr-sm"
style="color: hsl(var(--info-bg))"
/>
{{ $t('properties') }}
<span v-if="$q.screen.gt.xs">
{{ $t('productService.service.properties') }}
</span>
</q-btn>
</div>
<div class="q-py-md q-px-md full-width">
<div
v-if="attributes.additional.length > 0"
class="row items-center full-width surface-1 q-pb-md q-pt-sm q-px-sm q-gutter-sm"
class="row items-center full-width surface-1 q-pb-md q-pt-sm q-px-sm q-gutter-sm scroll"
:style="$q.screen.xs ? 'max-height: 100px' : ''"
>
<div
v-for="(p, index) in attributes.additional"
@ -213,7 +222,7 @@ defineEmits<{
</div>
</div>
<div v-else class="app-text-muted">
{{ $t('noProperties') }}
{{ $t('productService.service.noProperties') }}
</div>
</div>
</div>
@ -225,11 +234,12 @@ defineEmits<{
style="background-color: hsla(var(--info-bg) / 0.1)"
>
<span>
{{ $t('productInWork') }} {{ workIndex + 1 }}
{{ $t('productService.service.productInWork') }}
{{ workIndex + 1 }}
<q-checkbox
size="xs"
class="q-pl-lg"
:class="$q.screen.gt.xs ? 'q-pl-lg' : 'q-pl-sm'"
v-model="attributes.showTotalPrice"
:label="$t('productService.service.showTotalPrice')"
style="color: hsl(var(--text-mute-2))"
@ -242,7 +252,10 @@ defineEmits<{
flat
dense
icon="mdi-plus"
:label="$t('serviceAddProduct')"
class="text-capitalize"
:label="
$q.screen.gt.xs ? $t('productService.product.addTitle') : ''
"
padding="0"
style="color: hsl(var(--info-bg))"
@click.stop="$emit('addProduct')"
@ -261,9 +274,12 @@ defineEmits<{
<div
class="row col items-center justify-between full-width surface-1 q-py-md q-px-sm"
>
<div class="row items-center col no-wrap" v-if="productItems">
<div
class="row items-center col-md col-12 no-wrap"
v-if="productItems"
>
<q-btn
v-if="!readonly"
v-if="!readonly && $q.screen.gt.xs"
id="btn-product-up"
icon="mdi-arrow-up"
dense
@ -274,7 +290,7 @@ defineEmits<{
@click.stop="$emit('moveProductUp', productItems, index)"
/>
<q-btn
v-if="!readonly"
v-if="!readonly && $q.screen.gt.xs"
id="btn-product-down"
icon="mdi-arrow-down"
dense
@ -295,7 +311,10 @@ defineEmits<{
</q-avatar>
<div class="row no-wrap">
<div class="bordered q-mx-md col-3 image-box">
<div
v-if="$q.screen.gt.xs"
class="bordered q-mx-md col-3 image-box"
>
<q-img
:src="`${baseUrl}/product/${product?.id}/image`"
style="object-fit: cover; width: 100%; height: 100%"
@ -314,17 +333,9 @@ defineEmits<{
class="text-weight-bold ellipsis-2-lines"
:style="`max-width: ${$q.screen.gt.sm ? '25vw' : '20vw'}`"
>
{{
$i18n.locale === 'en-US'
? product.nameEn
: product.name
}}
{{ product.name }}
<q-tooltip>
{{
$i18n.locale === 'en-US'
? product.nameEn
: product.name
}}
{{ product.name }}
</q-tooltip>
</span>
<div
@ -337,7 +348,7 @@ defineEmits<{
</div>
</div>
<div class="row justify-end text-right col-5 q-pr-sm">
<div class="row justify-end text-right col-md-6 col-12 q-pr-sm">
<span
class="col-12 q-col-gutter-md row"
style="color: var(--teal-9)"
@ -347,7 +358,7 @@ defineEmits<{
class="col ellipsis price-orange text-weight-bold"
>
<div class="text-caption app-text-muted-2">
{{ $t('salePrice') }}
{{ $t('productService.product.salePrice') }}
</div>
฿{{ formatNumberDecimal(product.price, 2) }}
<q-tooltip
@ -363,7 +374,7 @@ defineEmits<{
class="col ellipsis price-purple text-weight-bold"
>
<div class="text-caption app-text-muted-2">
{{ $t('agentPrice') }}
{{ $t('productService.product.agentPrice') }}
</div>
฿{{ formatNumberDecimal(product.agentPrice, 2) }}
<q-tooltip
@ -379,7 +390,7 @@ defineEmits<{
class="col ellipsis price-pink column"
>
<div class="text-caption app-text-muted-2">
{{ $t('processingPrice') }}
{{ $t('productService.product.processingPrice') }}
</div>
฿{{ formatNumberDecimal(product.serviceCharge, 2) }}
<q-tooltip
@ -393,10 +404,10 @@ defineEmits<{
</span>
<span class="col-9 q-mt-sm text-caption app-text-muted-2">
{{ $t('processTime') }}
{{ $t('productService.product.processingTime') }}
</span>
<span class="col-3 q-mt-sm text-caption app-text-muted-2">
{{ product.process }} {{ $t('day') }}
{{ product.process }} {{ $t('general.day') }}
</span>
</div>
</div>
@ -413,24 +424,26 @@ defineEmits<{
color="negative"
@click.stop="$emit('deleteProduct', productItems, index)"
>
<q-tooltip>{{ $t('delete') }}</q-tooltip>
<q-tooltip>{{ $t('general.delete') }}</q-tooltip>
</q-btn>
</div>
</div>
<div v-else class="app-text-muted q-py-md q-px-lg">
{{ $t('noProduct') }}
{{ $t('productService.product.noProduct') }}
</div>
</div>
</div>
</q-expansion-item>
<div class="q-py-sm q-px-md bordered-t row items-center justify-between">
<div>
{{ $t('totalProductWork') }}
{{ $t('productService.service.totalProductWork') }}
<span class="app-text-muted-2">
{{ workName }}
</span>
</div>
<div>{{ productItems?.length ?? 0 }} {{ $t('list') }}</div>
<div>
{{ productItems?.length ?? 0 }} {{ $t('productService.service.list') }}
</div>
</div>
</div>
</template>

View file

@ -1,5 +1,6 @@
<script lang="ts" setup>
import { onMounted, ref, watch } from 'vue';
import { DeleteButton, EditButton, SaveButton, UndoButton } from '../button';
// import { useI18n } from 'vue-i18n';
// import { storeToRefs } from 'pinia';
@ -72,63 +73,37 @@ watch(
:readonly="!item.isEdit"
:outlined="item.isEdit"
></q-input>
<q-btn
<EditButton
v-if="!item.isEdit"
icon-only
id="btn-edit-work-name"
icon="mdi-pencil-outline"
:disable="isWorkNameEdit()"
dense
flat
round
color="primary"
:disabled="isWorkNameEdit()"
@click="item.isEdit = true"
>
<q-tooltip>{{ $t('edit') }}</q-tooltip>
</q-btn>
<q-btn
/>
<SaveButton
v-else
id="btn-edit-work-name"
icon="mdi-check"
dense
flat
round
color="primary"
icon-only
id="btn-save-work-name"
@click="
() => {
$emit('edit', item.id, { name: item.name }),
(item.isEdit = false);
}
"
>
<q-tooltip>{{ $t('save') }}</q-tooltip>
</q-btn>
<q-btn
/>
<DeleteButton
v-if="!item.isEdit"
icon-only
id="btn-delete-work-name"
:disable="isWorkNameEdit()"
icon="mdi-trash-can-outline"
dense
flat
round
class="q-ml-md"
color="negative"
:disabled="isWorkNameEdit()"
@click="$emit('delete', item.id)"
>
<q-tooltip>{{ $t('delete') }}</q-tooltip>
</q-btn>
<q-btn
/>
<UndoButton
v-else
id="btn-edit-work-name"
icon="mdi-undo"
dense
flat
round
class="q-ml-md"
color="negative"
icon-only
id="btn-undo-work-name"
@click="assignClone"
>
<q-tooltip>{{ $t('cancel') }}</q-tooltip>
</q-btn>
/>
</q-item>
</q-list>
<div v-else class="flex col justify-center items-center">
@ -148,7 +123,7 @@ watch(
>
<span class="q-px-lg flex items-center app-text-muted-2">
<q-icon name="mdi-plus" class="q-mr-md" />
{{ $t('addWork') }}
{{ $t('productService.service.addWork') }}
</span>
</q-item>
</div>