refactor: permission product service

This commit is contained in:
Methapon Metanipat 2024-09-10 14:36:36 +07:00
parent 67d360c92b
commit ed692c823d
5 changed files with 48 additions and 372 deletions

View file

@ -94,7 +94,7 @@ watch(
hide-bottom-space
input-debounce="0"
:disable="!readonly && disableCode"
class="col-md-3 col-6"
class="col-md-4 col-12"
v-model="code"
id="select-br-id"
option-label="label"
@ -123,7 +123,7 @@ watch(
:readonly="readonly"
:borderless="readonly"
hide-bottom-space
class="col-6"
class="col-md-8 col-12"
:label="$t('productService.product.name')"
v-model="name"
:rules="[(val: string) => !!val || $t('form.error.required')]"

View file

@ -167,58 +167,12 @@ watch(
outlined
:readonly="readonly"
hide-bottom-space
class="col-md-3 col-4"
class="col-md-4 col-12"
:label="$t('productService.service.code')"
v-model="serviceCode"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-select
outlined
clearable
use-input
fill-input
emit-value
map-options
hide-selected
hide-bottom-space
class="col-md-3 col-8"
option-value="id"
option-label="name"
v-model="registeredBranchId"
id="input-source-nationality"
for="input-source-nationality"
:dense="dense"
:readonly="readonly"
:options="branchOptions"
:hide-dropdown-icon="readonly"
: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 ||
$t('form.error.selectField', {
field: $t('productService.service.registeredBranch'),
})
);
},
]"
@filter="branchFilter"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('general.noData') }}
</q-item-section>
</q-item>
</template>
</q-select>
<q-input
id="input-service-name"
for="input-service-name"
@ -226,11 +180,12 @@ watch(
outlined
:readonly="readonly"
hide-bottom-space
class="col-md-6 col"
class="col-md-8 col-12"
:label="$t('productService.service.name')"
v-model="serviceName"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
id="input-service-description"
for="input-service-description"