refactor(04): hide q-fab btn if group inactive

This commit is contained in:
puriphatt 2024-09-05 17:01:58 +07:00
parent 9e540bf6d3
commit 26feb2bf1d

View file

@ -731,8 +731,6 @@ async function triggerChangeStatus(
.then(resolve)
.catch(reject);
}
currentNoAction.value = handleStatus();
},
cancel: () => {},
});
@ -1280,7 +1278,6 @@ function cloneData() {
});
}
const currentStatusList = ref<Status[]>([]);
async function enterGroup(
id: string,
name: string,
@ -1293,7 +1290,7 @@ async function enterGroup(
pathGroupName.value = name;
currentIdType.value = '';
currentIdGrop.value = id;
currentStatusList.value.push(status);
currentNoAction.value = status === 'INACTIVE';
pathTypeName.value = name;
await fetchListOfService();
await fetchListOfProduct();
@ -1336,18 +1333,6 @@ async function enterNext(type: 'service' | 'product') {
flowStore.rotate();
}
function handleStatus() {
let tempValue = false;
currentStatusList.value.forEach((item) => {
if (item === 'INACTIVE') {
tempValue = true;
}
});
return tempValue;
}
function handleHold(node: ProductGroup & { type: string }) {
if ($q.screen.gt.xs) return;
holdDialog.value = true;
@ -1391,7 +1376,6 @@ watch(
currentIdGrop.value = '';
currentIdType.value = '';
filterStat.value = [];
currentStatusList.value = [];
},
},
];
@ -1413,8 +1397,6 @@ watch(
currentIdType.value = '';
filterStat.value = [];
productMode.value = 'group';
currentStatusList.value.splice(1);
expandedTree.value.pop();
utilsStore.currentTitle.path.pop();
}
@ -1471,8 +1453,7 @@ watch(
},
);
watch([currentStatusList, productMode], async () => {
currentNoAction.value = handleStatus();
watch(productMode, async () => {
if (productMode.value === 'group') {
await calculateStats();
}
@ -1621,7 +1602,6 @@ watch([currentStatusList, productMode], async () => {
expandedTree = expandedTree.filter((i) => v.id !== i);
currentIdGrop = '';
currentIdType = '';
currentStatusList = [];
productMode = 'group';
return;
}
@ -1693,9 +1673,6 @@ watch([currentStatusList, productMode], async () => {
async (v: (typeof treeProductTypeAndGroup)[number]) => {
if (v.type === 'group') {
await triggerChangeStatus(v.id, v.status, v.type);
currentStatusList[0] =
v.status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE';
}
}
"
@ -2079,7 +2056,6 @@ watch([currentStatusList, productMode], async () => {
:id="`enter-${props.row.name}`"
:for="`enter-${props.row.name}`"
:is-disabled="props.row.status === 'INACTIVE'"
:no-action="handleStatus()"
:color="
{
type: $q.dark.isActive