fix(04): type & change status

This commit is contained in:
puriphatt 2024-08-07 11:13:42 +00:00
parent 8fa11e8ec3
commit 455e193867
3 changed files with 56 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

View file

@ -59,7 +59,11 @@ const branchFilter = selectFilterOptionRefMod(
:disable="!readonly" :disable="!readonly"
hide-bottom-space hide-bottom-space
class="col-6" class="col-6"
:label="$t('productAndServiceGroupCode')" :label="
$t(
isType ? 'productAndServiceTypeCode' : 'productAndServiceGroupCode',
)
"
v-model="code" v-model="code"
/> />
<q-input <q-input

View file

@ -419,8 +419,8 @@ const currentIdType = ref<string>('');
const currentIdService = ref<string>(''); const currentIdService = ref<string>('');
const currentIdProduct = ref<string>(''); const currentIdProduct = ref<string>('');
const currentStatusGroup = ref<Status>('CREATED'); const currentStatusGroupType = ref<Status>('CREATED');
const currentStatusType = ref<Status>('CREATED'); const currentIdGroupType = ref('');
const branchOption = ref<{ id: string; name: string }[]>([]); const branchOption = ref<{ id: string; name: string }[]>([]);
@ -685,9 +685,10 @@ async function toggleStatusService(id: string, status: Status) {
flowStore.rotate(); flowStore.rotate();
} }
async function toggleStatusType(id: string, status: Status) { async function toggleStatusType(id: string, status: Status) {
await editProductServiceType(id, { const res = await editProductServiceType(id, {
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE', status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
}); });
if (res) currentStatusGroupType.value = res.status;
await fetchListType(); await fetchListType();
flowStore.rotate(); flowStore.rotate();
@ -697,7 +698,7 @@ async function toggleStatusGroup(id: string, status: Status) {
const res = await editProductService(id, { const res = await editProductService(id, {
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE', status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
}); });
if (res) currentStatusGroup.value = res.status; if (res) currentStatusGroupType.value = res.status;
await fetchListGroups(); await fetchListGroups();
flowStore.rotate(); flowStore.rotate();
@ -865,8 +866,8 @@ function undoProductGroup() {
function assignFormDataGroup(data: ProductGroup) { function assignFormDataGroup(data: ProductGroup) {
previousValue.value = data; previousValue.value = data;
currentStatusGroup.value = data.status; currentStatusGroupType.value = data.status;
currentIdGrop.value = data.id; currentIdGroupType.value = data.id;
formDataGroup.value = { formDataGroup.value = {
remark: data.remark, remark: data.remark,
@ -984,7 +985,7 @@ function clearFormGroup() {
name: '', name: '',
code: '', code: '',
}; };
currentStatusGroup.value = 'CREATED'; currentStatusGroupType.value = 'CREATED';
dialogInputForm.value = false; dialogInputForm.value = false;
} }
@ -3332,7 +3333,7 @@ watch(
active active
hideFade hideFade
useToggle useToggle
icon="mdi-folder-plus" :icon="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'"
:title="formDataGroup.name" :title="formDataGroup.name"
:caption="formDataGroup.code" :caption="formDataGroup.code"
:menu="[ :menu="[
@ -3342,14 +3343,26 @@ watch(
bgColor: 'var(--surface-1)', bgColor: 'var(--surface-1)',
}, },
]" ]"
fallbackCover="/images/product-service-group-banner.png" :fallbackCover="`/images/product-service-${productMode}-banner.png`"
color="hsla(var(--pink-6-hsl)/1)" :color="`hsla(var(${
bg-color="hsla(var(--pink-6-hsl)/0.1)" productMode === 'group'
v-model:toggle-status="currentStatusGroup" ? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/1)`"
:bg-color="`hsla(var(${
productMode === 'group'
? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/0.1)`"
v-model:toggle-status="currentStatusGroupType"
@update:toggle-status=" @update:toggle-status="
() => { () => {
currentStatusGroup = currentStatusGroupType =
currentStatusGroup === 'CREATED' ? 'INACTIVE' : 'CREATED'; currentStatusGroupType === 'CREATED' ? 'INACTIVE' : 'CREATED';
} }
" "
/> />
@ -3439,19 +3452,35 @@ watch(
} }
" "
:delete-data="() => deleteProductById()" :delete-data="() => deleteProductById()"
:close="() => (drawerInfo = false)" :close="
() => {
(drawerInfo = false), (currentIdGroupType = '');
}
"
> >
<InfoForm> <InfoForm>
<div class="q-mx-lg q-mt-lg"> <div class="q-mx-lg q-mt-lg">
<ProfileBanner <ProfileBanner
:active="currentStatusGroup !== 'INACTIVE'" :active="currentStatusGroupType !== 'INACTIVE'"
hideFade hideFade
useToggle useToggle
icon="mdi-folder-plus" :icon="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'"
fallbackCover="/images/product-service-group-banner.png" :fallbackCover="`/images/product-service-${productMode}-banner.png`"
v-model:toggle-status="currentStatusGroup" v-model:toggle-status="currentStatusGroupType"
color="hsla(var(--pink-6-hsl)/1)" :color="`hsla(var(${
bg-color="hsla(var(--pink-6-hsl)/0.1)" productMode === 'group'
? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/1)`"
:bg-color="`hsla(var(${
productMode === 'group'
? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/0.1)`"
:title="formDataGroup.name" :title="formDataGroup.name"
:caption="formDataGroup.code" :caption="formDataGroup.code"
:toggleTitle="$t('formDialogTitleUserStatus')" :toggleTitle="$t('formDialogTitleUserStatus')"
@ -3464,7 +3493,7 @@ watch(
]" ]"
@update:toggle-status=" @update:toggle-status="
async (v) => { async (v) => {
await triggerChangeStatus(currentIdGrop, v, 'group'); await triggerChangeStatus(currentIdGroupType, v, productMode);
} }
" "
/> />