fix(04): group form & info + change status

This commit is contained in:
puriphatt 2024-08-07 10:11:53 +00:00
parent ba66eaf959
commit 9193a6a810
3 changed files with 288 additions and 147 deletions

View file

@ -7,6 +7,7 @@ import { ref } from 'vue';
const remark = defineModel<string>('remark');
const detail = defineModel<string>('detail');
const name = defineModel<string>('name');
const code = defineModel<string>('code');
const serviceCode = defineModel<string>('serviceCode');
const serviceName = defineModel<string>('serviceNameTh');
@ -37,130 +38,153 @@ const branchFilter = selectFilterOptionRefMod(
</script>
<template>
<div class="col-3 app-text-muted">
{{ $t(`formDialogTitleInformation`) }}
</div>
<div v-if="!service" class="col-9 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-12"
:label="
$t(isType ? 'productAndServiceTypeName' : 'productAndServiceGroupName')
"
v-model="name"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
/>
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('detail')"
v-model="detail"
:for="`input-detail`"
/>
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('formDialogInputRemark')"
v-model="remark"
:for="`input-remark`"
/>
</div>
<div class="row col-12">
<div class="col-12 q-pb-sm text-weight-bold text-body1">
<q-icon
flat
size="xs"
class="q-pa-sm rounded q-mr-xs"
color="info"
name="mdi-office-building-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`formDialogTitleInformation`) }}
</div>
<div v-if="!service" class="col-12 row q-col-gutter-sm">
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
readonly
:disable="!readonly"
hide-bottom-space
class="col-6"
:label="$t('productAndServiceGroupCode')"
v-model="code"
/>
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-6"
:label="
$t(
isType ? 'productAndServiceTypeName' : 'productAndServiceGroupName',
)
"
v-model="name"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
/>
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('detail')"
v-model="detail"
:for="`input-detail`"
/>
<q-input
lazy-rules="ondemand"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('formDialogInputRemark')"
v-model="remark"
:for="`input-remark`"
/>
</div>
<div v-if="service" class="col-9 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
id="input-service-code"
for="input-service-code"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-3"
:label="$t('serviceCode')"
v-model="serviceCode"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
/>
<div v-if="service" class="col-9 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
id="input-service-code"
for="input-service-code"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-3"
:label="$t('serviceCode')"
v-model="serviceCode"
:rules="[(val: string) => !!val || $t('pleaseInformation')]"
/>
<q-select
outlined
clearable
use-input
fill-input
emit-value
map-options
hide-selected
hide-bottom-space
class="col-3"
option-value="id"
option-label="name"
lazy-rules="ondemand"
v-model="registeredBranchId"
id="input-source-nationality"
for="input-source-nationality"
:dense="dense"
:readonly="readonly"
:options="branchOptions"
:hide-dropdown-icon="readonly"
:label="$t('registeredBranch')"
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(
(role) => roles.includes(role),
);
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
},
]"
@filter="branchFilter"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('noResults') }}
</q-item-section>
</q-item>
</template>
</q-select>
<q-select
outlined
clearable
use-input
fill-input
emit-value
map-options
hide-selected
hide-bottom-space
class="col-3"
option-value="id"
option-label="name"
lazy-rules="ondemand"
v-model="registeredBranchId"
id="input-source-nationality"
for="input-source-nationality"
:dense="dense"
:readonly="readonly"
:options="branchOptions"
:hide-dropdown-icon="readonly"
:label="$t('registeredBranch')"
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(
(role) => roles.includes(role),
);
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
},
]"
@filter="branchFilter"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('noResults') }}
</q-item-section>
</q-item>
</template>
</q-select>
<q-input
lazy-rules="ondemand"
id="input-service-name"
for="input-service-name"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-6"
:label="$t('serviceName')"
v-model="serviceName"
/>
<q-input
lazy-rules="ondemand"
id="input-service-description"
for="input-service-description"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('serviceDetail')"
v-model="serviceDescription"
/>
<q-input
lazy-rules="ondemand"
id="input-service-name"
for="input-service-name"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-6"
:label="$t('serviceName')"
v-model="serviceName"
/>
<q-input
lazy-rules="ondemand"
id="input-service-description"
for="input-service-description"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
type="textarea"
class="col-12"
:label="$t('serviceDetail')"
v-model="serviceDescription"
/>
</div>
</div>
</template>