refactor: add registered branch to product group
This commit is contained in:
parent
01c5592f7d
commit
67d360c92b
5 changed files with 92 additions and 144 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { QSelect } from 'quasar';
|
import { QSelect } from 'quasar';
|
||||||
import { getRole } from 'src/services/keycloak';
|
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
import { selectFilterOptionRefMod } from 'stores/utils';
|
import { selectFilterOptionRefMod } from 'stores/utils';
|
||||||
import { ref, onMounted, watch } from 'vue';
|
import { ref, onMounted, watch } from 'vue';
|
||||||
|
|
@ -15,13 +14,8 @@ const process = defineModel<number>('process');
|
||||||
const name = defineModel<string>('name');
|
const name = defineModel<string>('name');
|
||||||
const code = defineModel<string>('code');
|
const code = defineModel<string>('code');
|
||||||
const expenseType = defineModel<string>('expenseType');
|
const expenseType = defineModel<string>('expenseType');
|
||||||
const registeredBranchId = defineModel<string>('registeredBranchId');
|
|
||||||
|
|
||||||
const codeOption = ref<{ id: string; name: string }[]>([]);
|
const codeOption = ref<{ id: string; name: string }[]>([]);
|
||||||
const optionsBranch = defineModel<{ id: string; name: string }[]>(
|
|
||||||
'optionsBranch',
|
|
||||||
{ default: [] },
|
|
||||||
);
|
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
dense?: boolean;
|
dense?: boolean;
|
||||||
|
|
@ -46,13 +40,6 @@ onMounted(async () => {
|
||||||
const codeOptions = ref<Record<string, unknown>[]>([]);
|
const codeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
const codeFilter = selectFilterOptionRefMod(codeOption, codeOptions, 'label');
|
const codeFilter = selectFilterOptionRefMod(codeOption, codeOptions, 'label');
|
||||||
|
|
||||||
const branchOptions = ref<Record<string, unknown>[]>([]);
|
|
||||||
const branchFilter = selectFilterOptionRefMod(
|
|
||||||
optionsBranch,
|
|
||||||
branchOptions,
|
|
||||||
'name',
|
|
||||||
);
|
|
||||||
|
|
||||||
const expenseTypeOptions = ref<Record<string, unknown>[]>([]);
|
const expenseTypeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
let expenseTypeFilter: (
|
let expenseTypeFilter: (
|
||||||
value: string,
|
value: string,
|
||||||
|
|
@ -128,51 +115,6 @@ watch(
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
<q-select
|
|
||||||
outlined
|
|
||||||
clearable
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
hide-bottom-space
|
|
||||||
input-debounce="0"
|
|
||||||
class="col-md-3 col-6"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
id="input-source-nationality"
|
|
||||||
v-model="registeredBranchId"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
:options="branchOptions"
|
|
||||||
:hide-dropdown-icon="readonly"
|
|
||||||
: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 ||
|
|
||||||
$t('form.error.selectField', {
|
|
||||||
field: $t('productService.product.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
|
<q-input
|
||||||
for="input-name"
|
for="input-name"
|
||||||
|
|
@ -207,19 +149,6 @@ watch(
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
<!-- <q-input
|
|
||||||
|
|
||||||
for="input-detail"
|
|
||||||
:dense="dense"
|
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
|
||||||
:borderless="readonly"
|
|
||||||
hide-bottom-space
|
|
||||||
type="textarea"
|
|
||||||
class="col-12"
|
|
||||||
:label="$t('serviceDetail')"
|
|
||||||
v-model="detail"
|
|
||||||
/> -->
|
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
clearable
|
clearable
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import { QSelect } from 'quasar';
|
import { QSelect } from 'quasar';
|
||||||
import { getRole } from 'src/services/keycloak';
|
import { getRole } from 'src/services/keycloak';
|
||||||
import { selectFilterOptionRefMod } from 'stores/utils';
|
import { selectFilterOptionRefMod } from 'stores/utils';
|
||||||
|
import { watch } from 'vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const remark = defineModel<string>('remark');
|
const remark = defineModel<string>('remark');
|
||||||
|
|
@ -12,8 +13,7 @@ const code = defineModel<string>('code');
|
||||||
const serviceCode = defineModel<string>('serviceCode');
|
const serviceCode = defineModel<string>('serviceCode');
|
||||||
const serviceName = defineModel<string>('serviceNameTh');
|
const serviceName = defineModel<string>('serviceNameTh');
|
||||||
const serviceDescription = defineModel<string>('serviceDescription');
|
const serviceDescription = defineModel<string>('serviceDescription');
|
||||||
|
const registeredBranchId = defineModel<string>('registeredBranchId');
|
||||||
const registeredBranchId = defineModel<string | null>('registeredBranchId');
|
|
||||||
|
|
||||||
const optionsBranch = defineModel<{ id: string; name: string }[]>(
|
const optionsBranch = defineModel<{ id: string; name: string }[]>(
|
||||||
'optionsBranch',
|
'optionsBranch',
|
||||||
|
|
@ -31,18 +31,21 @@ defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const branchOptions = ref<Record<string, unknown>[]>([]);
|
const branchOptions = ref<Record<string, unknown>[]>([]);
|
||||||
const branchFilter = selectFilterOptionRefMod(
|
let branchFilter = selectFilterOptionRefMod(
|
||||||
optionsBranch,
|
optionsBranch,
|
||||||
branchOptions,
|
branchOptions,
|
||||||
'name',
|
'name',
|
||||||
);
|
);
|
||||||
|
|
||||||
const serviceCodeOpts = ref([{ label: 'mou', value: 'mou' }]);
|
watch(
|
||||||
const serviceCodeOptions = ref<Record<string, unknown>[]>([]);
|
() => optionsBranch.value,
|
||||||
const serviceCodeFilter = selectFilterOptionRefMod(
|
() => {
|
||||||
serviceCodeOpts,
|
branchFilter = selectFilterOptionRefMod(
|
||||||
serviceCodeOptions,
|
optionsBranch,
|
||||||
'label',
|
branchOptions,
|
||||||
|
'name',
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -60,6 +63,51 @@ const serviceCodeFilter = selectFilterOptionRefMod(
|
||||||
{{ $t(`form.field.basicInformation`) }}
|
{{ $t(`form.field.basicInformation`) }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!service" class="col-12 row q-col-gutter-sm">
|
<div v-if="!service" class="col-12 row q-col-gutter-sm">
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-md-12 col-12"
|
||||||
|
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
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
outlined
|
outlined
|
||||||
|
|
@ -111,39 +159,6 @@ const serviceCodeFilter = selectFilterOptionRefMod(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="service" class="col-12 row q-col-gutter-sm">
|
<div v-if="service" class="col-12 row q-col-gutter-sm">
|
||||||
<!-- <q-select
|
|
||||||
outlined
|
|
||||||
clearable
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
hide-bottom-space
|
|
||||||
input-debounce="0"
|
|
||||||
:disable="!readonly && disableCode"
|
|
||||||
class="col-3"
|
|
||||||
v-model="serviceCode"
|
|
||||||
id="select-br-id"
|
|
||||||
option-label="label"
|
|
||||||
option-value="value"
|
|
||||||
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
:options="serviceCodeOptions"
|
|
||||||
:label="$t('serviceCode')"
|
|
||||||
:hide-dropdown-icon="readonly || disableCode"
|
|
||||||
:rules="[(val: string) => !!val]"
|
|
||||||
@filter="serviceCodeFilter"
|
|
||||||
>
|
|
||||||
<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
|
<q-input
|
||||||
id="input-service-code"
|
id="input-service-code"
|
||||||
for="input-service-code"
|
for="input-service-code"
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ const formDataGroup = ref<ProductGroupCreate>({
|
||||||
detail: '',
|
detail: '',
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
registeredBranchId: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const formDataProduct = ref<ProductCreate>({
|
const formDataProduct = ref<ProductCreate>({
|
||||||
|
|
@ -719,7 +720,7 @@ async function triggerChangeStatus(
|
||||||
: t('dialog.message.confirmChangeStatusOn'),
|
: t('dialog.message.confirmChangeStatusOn'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (type === 'group' || productMode.value === 'group') {
|
if (type === 'group' || productMode.value === 'group') {
|
||||||
const res = await toggleStatusGroup(id, status as Status)
|
await toggleStatusGroup(id, status as Status)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
} else if (type === 'service') {
|
} else if (type === 'service') {
|
||||||
|
|
@ -847,21 +848,24 @@ function undoProductGroup() {
|
||||||
detail: previousValue.value.detail,
|
detail: previousValue.value.detail,
|
||||||
name: previousValue.value.name,
|
name: previousValue.value.name,
|
||||||
code: previousValue.value.code,
|
code: previousValue.value.code,
|
||||||
|
registeredBranchId: previousValue.value.registeredBranchId,
|
||||||
};
|
};
|
||||||
isEdit.value = false;
|
isEdit.value = false;
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function assignFormDataGroup(data: ProductGroup) {
|
async function assignFormDataGroup(data: ProductGroup) {
|
||||||
previousValue.value = data;
|
previousValue.value = data;
|
||||||
currentStatusGroupType.value = data.status;
|
currentStatusGroupType.value = data.status;
|
||||||
currentIdGroupType.value = data.id;
|
currentIdGroupType.value = data.id;
|
||||||
|
await fetchListOfOptionBranch();
|
||||||
|
|
||||||
formDataGroup.value = {
|
formDataGroup.value = {
|
||||||
remark: data.remark,
|
remark: data.remark,
|
||||||
detail: data.detail,
|
detail: data.detail,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
code: data.code,
|
code: data.code,
|
||||||
|
registeredBranchId: data.registeredBranchId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -981,6 +985,7 @@ function clearFormGroup() {
|
||||||
detail: '',
|
detail: '',
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
registeredBranchId: '',
|
||||||
};
|
};
|
||||||
currentStatusGroupType.value = 'CREATED';
|
currentStatusGroupType.value = 'CREATED';
|
||||||
dialogInputForm.value = false;
|
dialogInputForm.value = false;
|
||||||
|
|
@ -1481,8 +1486,9 @@ watch(productMode, async () => {
|
||||||
external-label
|
external-label
|
||||||
label-position="left"
|
label-position="left"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
async () => {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
|
await fetchListOfOptionBranch();
|
||||||
dialogInputForm = true;
|
dialogInputForm = true;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
@ -1640,12 +1646,12 @@ watch(productMode, async () => {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@view="
|
@view="
|
||||||
(v: (typeof treeProductTypeAndGroup)[number]) => {
|
async (v: (typeof treeProductTypeAndGroup)[number]) => {
|
||||||
if (v.type === 'group') {
|
if (v.type === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
currentStatusProduct = v.status === 'INACTIVE';
|
currentStatusProduct = v.status === 'INACTIVE';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(v);
|
await assignFormDataGroup(v);
|
||||||
isEdit = false;
|
isEdit = false;
|
||||||
currentIdGropTree = v.id;
|
currentIdGropTree = v.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -1653,11 +1659,11 @@ watch(productMode, async () => {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@edit="
|
@edit="
|
||||||
(v: (typeof treeProductTypeAndGroup)[number]) => {
|
async (v: (typeof treeProductTypeAndGroup)[number]) => {
|
||||||
editByTree = v.type as typeof editByTree;
|
editByTree = v.type as typeof editByTree;
|
||||||
if (v.type === 'group') {
|
if (v.type === 'group') {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(v);
|
await assignFormDataGroup(v);
|
||||||
isEdit = true;
|
isEdit = true;
|
||||||
currentIdGropTree = v.id;
|
currentIdGropTree = v.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -1980,13 +1986,13 @@ watch(productMode, async () => {
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
@click.stop="
|
@click.stop="
|
||||||
() => {
|
async () => {
|
||||||
if (productMode === 'group') {
|
if (productMode === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
currentStatusProduct =
|
currentStatusProduct =
|
||||||
props.row.status === 'INACTIVE';
|
props.row.status === 'INACTIVE';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(props.row);
|
await assignFormDataGroup(props.row);
|
||||||
isEdit = false;
|
isEdit = false;
|
||||||
currentIdGrop = props.row.id;
|
currentIdGrop = props.row.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -2000,13 +2006,13 @@ watch(productMode, async () => {
|
||||||
:status="props.row.status"
|
:status="props.row.status"
|
||||||
:idName="props.row.name"
|
:idName="props.row.name"
|
||||||
@view="
|
@view="
|
||||||
() => {
|
async () => {
|
||||||
if (productMode === 'group') {
|
if (productMode === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
currentStatusProduct =
|
currentStatusProduct =
|
||||||
props.row.status === 'INACTIVE';
|
props.row.status === 'INACTIVE';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(props.row);
|
await assignFormDataGroup(props.row);
|
||||||
isEdit = false;
|
isEdit = false;
|
||||||
currentIdGrop = props.row.id;
|
currentIdGrop = props.row.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -2014,11 +2020,11 @@ watch(productMode, async () => {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@edit="
|
@edit="
|
||||||
() => {
|
async () => {
|
||||||
if (productMode === 'group') {
|
if (productMode === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(props.row);
|
await assignFormDataGroup(props.row);
|
||||||
isEdit = true;
|
isEdit = true;
|
||||||
currentIdGrop = props.row.id;
|
currentIdGrop = props.row.id;
|
||||||
|
|
||||||
|
|
@ -2072,13 +2078,13 @@ watch(productMode, async () => {
|
||||||
triggerChangeStatus(props.row.id, props.row.status)
|
triggerChangeStatus(props.row.id, props.row.status)
|
||||||
"
|
"
|
||||||
@viewCard="
|
@viewCard="
|
||||||
() => {
|
async () => {
|
||||||
if (productMode === 'group') {
|
if (productMode === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
currentStatusProduct =
|
currentStatusProduct =
|
||||||
props.row.status === 'INACTIVE';
|
props.row.status === 'INACTIVE';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(props.row);
|
await assignFormDataGroup(props.row);
|
||||||
isEdit = false;
|
isEdit = false;
|
||||||
currentIdGrop = props.row.id;
|
currentIdGrop = props.row.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -2086,10 +2092,10 @@ watch(productMode, async () => {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@updateCard="
|
@updateCard="
|
||||||
() => {
|
async () => {
|
||||||
if (productMode === 'group') {
|
if (productMode === 'group') {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(props.row);
|
await assignFormDataGroup(props.row);
|
||||||
isEdit = true;
|
isEdit = true;
|
||||||
currentIdGrop = props.row.id;
|
currentIdGrop = props.row.id;
|
||||||
|
|
||||||
|
|
@ -2971,9 +2977,11 @@ watch(productMode, async () => {
|
||||||
<BasicInformation
|
<BasicInformation
|
||||||
ide="form-group"
|
ide="form-group"
|
||||||
dense
|
dense
|
||||||
|
v-model:options-branch="branchOption"
|
||||||
v-model:remark="formDataGroup.remark"
|
v-model:remark="formDataGroup.remark"
|
||||||
v-model:name="formDataGroup.name"
|
v-model:name="formDataGroup.name"
|
||||||
v-model:detail="formDataGroup.detail"
|
v-model:detail="formDataGroup.detail"
|
||||||
|
v-model:registered-branch-id="formDataGroup.registeredBranchId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -3140,6 +3148,8 @@ watch(productMode, async () => {
|
||||||
id="info-group"
|
id="info-group"
|
||||||
dense
|
dense
|
||||||
:readonly="!isEdit"
|
:readonly="!isEdit"
|
||||||
|
v-model:options-branch="branchOption"
|
||||||
|
v-model:registered-branch-id="formDataGroup.registeredBranchId"
|
||||||
v-model:remark="formDataGroup.remark"
|
v-model:remark="formDataGroup.remark"
|
||||||
v-model:name="formDataGroup.name"
|
v-model:name="formDataGroup.name"
|
||||||
v-model:code="formDataGroup.code"
|
v-model:code="formDataGroup.code"
|
||||||
|
|
@ -3755,10 +3765,6 @@ watch(productMode, async () => {
|
||||||
v-if="serviceTab === 1"
|
v-if="serviceTab === 1"
|
||||||
dense
|
dense
|
||||||
service
|
service
|
||||||
v-model:options-branch="branchOption"
|
|
||||||
v-model:registered-branch-id="
|
|
||||||
formDataProductService.registeredBranchId
|
|
||||||
"
|
|
||||||
v-model:service-code="formDataProductService.code"
|
v-model:service-code="formDataProductService.code"
|
||||||
v-model:service-description="formDataProductService.detail"
|
v-model:service-description="formDataProductService.detail"
|
||||||
v-model:service-name-th="formDataProductService.name"
|
v-model:service-name-th="formDataProductService.name"
|
||||||
|
|
@ -4057,10 +4063,6 @@ watch(productMode, async () => {
|
||||||
dense
|
dense
|
||||||
service
|
service
|
||||||
disableCode
|
disableCode
|
||||||
v-model:options-branch="branchOption"
|
|
||||||
v-model:registered-branch-id="
|
|
||||||
formDataProductService.registeredBranchId
|
|
||||||
"
|
|
||||||
v-model:service-code="formDataProductService.code"
|
v-model:service-code="formDataProductService.code"
|
||||||
v-model:service-description="formDataProductService.detail"
|
v-model:service-description="formDataProductService.detail"
|
||||||
v-model:service-name-th="formDataProductService.name"
|
v-model:service-name-th="formDataProductService.name"
|
||||||
|
|
@ -4141,12 +4143,11 @@ watch(productMode, async () => {
|
||||||
async () => {
|
async () => {
|
||||||
if (!currentNode) return;
|
if (!currentNode) return;
|
||||||
|
|
||||||
await fetchListOfOptionBranch();
|
|
||||||
if (currentNode.type === 'group') {
|
if (currentNode.type === 'group') {
|
||||||
editByTree = 'group';
|
editByTree = 'group';
|
||||||
currentStatusProduct = currentNode.status === 'INACTIVE';
|
currentStatusProduct = currentNode.status === 'INACTIVE';
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(currentNode);
|
await assignFormDataGroup(currentNode);
|
||||||
isEdit = false;
|
isEdit = false;
|
||||||
currentIdGrop = currentNode.id;
|
currentIdGrop = currentNode.id;
|
||||||
drawerInfo = true;
|
drawerInfo = true;
|
||||||
|
|
@ -4168,12 +4169,12 @@ watch(productMode, async () => {
|
||||||
v-ripple
|
v-ripple
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click.stop="
|
@click.stop="
|
||||||
() => {
|
async () => {
|
||||||
if (!currentNode) return;
|
if (!currentNode) return;
|
||||||
editByTree = currentNode.type as 'type' | 'group';
|
editByTree = currentNode.type as 'type' | 'group';
|
||||||
if (currentNode.type === 'group') {
|
if (currentNode.type === 'group') {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
assignFormDataGroup(currentNode);
|
await assignFormDataGroup(currentNode);
|
||||||
isEdit = true;
|
isEdit = true;
|
||||||
currentIdGrop = currentNode.id;
|
currentIdGrop = currentNode.id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ const useMyBranch = defineStore('useMyBranchStore', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListMyBranch(userId: string) {
|
async function fetchListMyBranch(userId: string) {
|
||||||
const res = await api.get<Pagination<Branch[]>>(`/user/${userId}/branch`, {
|
const res = await api.get<Pagination<Branch[]>>(`/branch`, {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Rtid': flowStore.rtid,
|
'X-Rtid': flowStore.rtid,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -195,11 +195,12 @@ export type ProductGroup = {
|
||||||
detail: string;
|
detail: string;
|
||||||
remark: string;
|
remark: string;
|
||||||
status: Status;
|
status: Status;
|
||||||
|
registeredBranchId: string;
|
||||||
createdBy: CreatedBy;
|
createdBy: CreatedBy;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedBy: UpdatedBy;
|
updatedBy: UpdatedBy;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
_count: { product: number; type: number; service: number };
|
_count: { product: number; service: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface ProductGroupCreate {
|
export interface ProductGroupCreate {
|
||||||
|
|
@ -207,6 +208,7 @@ export interface ProductGroupCreate {
|
||||||
detail: string;
|
detail: string;
|
||||||
name: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
registeredBranchId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductGroupUpdate {
|
export interface ProductGroupUpdate {
|
||||||
|
|
@ -215,4 +217,5 @@ export interface ProductGroupUpdate {
|
||||||
name: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
status: Status;
|
status: Status;
|
||||||
|
registeredBranchId?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue