refactor: handle status
This commit is contained in:
parent
fa9b59680f
commit
ed6a0cee3d
6 changed files with 23 additions and 15 deletions
|
|
@ -364,4 +364,15 @@ defineEmits<{
|
||||||
--_fg: var(--gender-female);
|
--_fg: var(--gender-female);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-active {
|
||||||
|
--_branch-status-color: var(--green-6-hsl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-inactive {
|
||||||
|
--_branch-status-color: var(--stone-5-hsl);
|
||||||
|
--_branch-badge-bg: var(--stone-5-hsl);
|
||||||
|
filter: grayscale(0.5);
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1811,7 +1811,7 @@ watch(currentHq, () => {
|
||||||
style="position: absolute; z-index: 99999; top: 0; right: 0"
|
style="position: absolute; z-index: 99999; top: 0; right: 0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="formData.status !== 'INACTIVE'"
|
v-if="formData.status !== 'INACTIVE' || !currentId"
|
||||||
class="surface-1 row rounded"
|
class="surface-1 row rounded"
|
||||||
>
|
>
|
||||||
<UndoButton
|
<UndoButton
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,7 @@ function onClose(excludeDialog?: boolean) {
|
||||||
infoDrawer.value = excludeDialog || false;
|
infoDrawer.value = excludeDialog || false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
modal.value = false;
|
||||||
hqId.value = '';
|
hqId.value = '';
|
||||||
brId.value = '';
|
brId.value = '';
|
||||||
userCode.value = '';
|
userCode.value = '';
|
||||||
|
|
@ -325,7 +326,6 @@ function onClose(excludeDialog?: boolean) {
|
||||||
profileFileImg.value = null;
|
profileFileImg.value = null;
|
||||||
infoDrawerEdit.value = false;
|
infoDrawerEdit.value = false;
|
||||||
agencyFile.value = [];
|
agencyFile.value = [];
|
||||||
modal.value = false;
|
|
||||||
isEdit.value = false;
|
isEdit.value = false;
|
||||||
statusToggle.value = true;
|
statusToggle.value = true;
|
||||||
isImageEdit.value = false;
|
isImageEdit.value = false;
|
||||||
|
|
@ -443,12 +443,6 @@ async function onSubmit(excludeDialog?: boolean) {
|
||||||
} else {
|
} else {
|
||||||
if (!hqId.value) return;
|
if (!hqId.value) return;
|
||||||
|
|
||||||
if (statusToggle.value) {
|
|
||||||
formData.value.status = 'CREATED';
|
|
||||||
} else {
|
|
||||||
formData.value.status = 'INACTIVE';
|
|
||||||
}
|
|
||||||
|
|
||||||
formData.value.branchId = brId.value
|
formData.value.branchId = brId.value
|
||||||
? brId.value
|
? brId.value
|
||||||
: hqId.value
|
: hqId.value
|
||||||
|
|
@ -1798,10 +1792,7 @@ watch(
|
||||||
'q-py-sm q-px-lg': !$q.screen.gt.sm,
|
'q-py-sm q-px-lg': !$q.screen.gt.sm,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div class="surface-1 row rounded">
|
||||||
v-if="formData.status !== 'INACTIVE'"
|
|
||||||
class="surface-1 row rounded"
|
|
||||||
>
|
|
||||||
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
|
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1118,6 +1118,7 @@ async function submitService(notClose = false) {
|
||||||
const res = await createService(
|
const res = await createService(
|
||||||
{
|
{
|
||||||
...formDataProductService.value,
|
...formDataProductService.value,
|
||||||
|
|
||||||
workflowId: currWorkflow.value?.id || '',
|
workflowId: currWorkflow.value?.id || '',
|
||||||
},
|
},
|
||||||
onCreateImageList.value,
|
onCreateImageList.value,
|
||||||
|
|
@ -1197,7 +1198,11 @@ async function submitGroup() {
|
||||||
await editProductGroup(currentIdGroupTree.value, formDataGroup.value);
|
await editProductGroup(currentIdGroupTree.value, formDataGroup.value);
|
||||||
else await editProductGroup(currentIdGroup.value, formDataGroup.value);
|
else await editProductGroup(currentIdGroup.value, formDataGroup.value);
|
||||||
} else {
|
} else {
|
||||||
const res = await createProductGroup(formDataGroup.value);
|
const res = await createProductGroup({
|
||||||
|
...formDataGroup.value,
|
||||||
|
status:
|
||||||
|
currentStatusGroupType.value === 'CREATED' ? undefined : 'INACTIVE',
|
||||||
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
allStat.value[0].count = allStat.value[0].count + 1;
|
allStat.value[0].count = allStat.value[0].count + 1;
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
list: { url: string; imgFile: File | null; name: string }[];
|
list: { url: string; imgFile: File | null; name: string }[];
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const { image, status, ...payload } = data;
|
const { image, ...payload } = data;
|
||||||
|
|
||||||
const res = await api.post<ProductCreate>('/product', {
|
const res = await api.post<ProductCreate>('/product', {
|
||||||
...payload,
|
...payload,
|
||||||
|
|
@ -271,7 +271,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
list: { url: string; imgFile: File | null; name: string }[];
|
list: { url: string; imgFile: File | null; name: string }[];
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const { image, status, ...payload } = data;
|
const { image, ...payload } = data;
|
||||||
|
|
||||||
const res = await api.post<ServiceCreate & { imageUploadUrl: string }>(
|
const res = await api.post<ServiceCreate & { imageUploadUrl: string }>(
|
||||||
'/service',
|
'/service',
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,7 @@ export interface ProductGroupCreate {
|
||||||
code: string;
|
code: string;
|
||||||
shared?: boolean;
|
shared?: boolean;
|
||||||
registeredBranchId: string;
|
registeredBranchId: string;
|
||||||
|
status?: Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductGroupUpdate {
|
export interface ProductGroupUpdate {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue