chore(04): clean unuse

This commit is contained in:
puriphatt 2024-09-05 09:26:34 +07:00
parent 00e2d516b3
commit 07c989d4e6

View file

@ -562,28 +562,6 @@ async function fetchListOfOptionBranch() {
currentMyBranch.value?.id || '';
}
// async function fetchListType() {
// const res = await fetchListProductServiceType({
// page: currentPageType.value,
// pageSize: pageSizeType.value,
// query: !!inputSearch.value ? inputSearch.value : undefined,
// productGroupId: currentIdGrop.value,
// status:
// currentStatus.value === 'All'
// ? undefined
// : currentStatus.value === 'ACTIVE'
// ? 'ACTIVE'
// : 'INACTIVE',
// });
// if (res) {
// currentPageType.value = res.page;
// totalType.value = res.total;
// maxPageType.value = Math.ceil(res.total / pageSizeType.value);
// productType.value = res.result;
// }
// }
async function fetchListGroups() {
const res = await fetchListProductService({
page: currentPageGroup.value,
@ -691,28 +669,6 @@ async function fetchListOfService() {
}
}
// async function submitType() {
// if (drawerInfo.value) {
// await editProductServiceType(currentIdType.value, {
// ...formDataGroup.value,
// productGroupId: currentIdGrop.value,
// });
// drawerInfo.value = false;
// } else {
// dialogInputForm.value = false;
// const res = await createProductServiceType(
// currentIdGrop.value,
// formDataGroup.value,
// );
// if (res) {
// stat.value[1].count = stat.value[1].count + 1;
// }
// }
// await fetchListType();
// }
async function toggleStatusProduct(id: string, status: Status) {
const res = await editProduct(id, {
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
@ -732,15 +688,6 @@ async function toggleStatusService(id: string, status: Status) {
await alternativeFetch();
flowStore.rotate();
}
// async function toggleStatusType(id: string, status: Status) {
// const res = await editProductServiceType(id, {
// status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
// });
// if (res) currentStatusGroupType.value = res.status;
// await fetchListType();
// flowStore.rotate();
// }
async function toggleStatusGroup(id: string, status: Status) {
const res = await editProductService(id, {
@ -861,11 +808,6 @@ async function deleteProductById(productId?: string) {
message: t('dialog.message.confirmDelete'),
action: async () => {
if (editByTree.value !== undefined) {
// if (editByTree.value === 'type') {
// // Product Type
// await deleteProductServiceType(productId ?? currentIdType.value);
// await fetchListType();
// }
if (editByTree.value === 'group') {
// Product Group
const res = await deleteProductService(
@ -881,11 +823,6 @@ async function deleteProductById(productId?: string) {
editByTree.value = undefined;
drawerInfo.value = false;
} else {
// if (productMode.value === 'type') {
// // Product Type
// await deleteProductServiceType(productId ?? currentIdType.value);
// await fetchListType();
// }
if (productMode.value === 'group') {
// Product Group
const res = await deleteProductService(
@ -1160,7 +1097,6 @@ async function submitProduct() {
formDataProduct.value.productGroupId = currentIdGrop.value;
if (profileFileImg.value) {
formDataProduct.value.image = profileFileImg.value;
// formDataProduct.value.image = imageProduct.value;
}
if (dialogProduct.value) {
@ -1352,25 +1288,6 @@ async function enterGroup(
if (toService) await enterNext('service');
else productMode.value = 'group';
// await fetchListType();
// productMode.value = 'type';
// flowStore.rotate();
// if (
// expandedTree.value.length > 1 &&
// expandedTree.value[expandedTree.value.length - 1] !== id
// ) {
// console.log(1);
// expandedTree.value.pop();
// expandedTree.value.push(id);
// } else {
// console.log(2);
// expandedTree.value.push(id);
// }
// currentIdType.value = id;
// productMode.value = 'service';
// productAndServiceTab.value = 'service';
// currentStatusList.value.push(status);
flowStore.rotate();
}
@ -1388,7 +1305,6 @@ async function enterNext(type: 'service' | 'product') {
}
if (type === 'service') {
console.log('service');
productMode.value = 'service';
productAndServiceTab.value = 'service';
currentIdType.value = 'type';
@ -1408,28 +1324,6 @@ async function enterNext(type: 'service' | 'product') {
flowStore.rotate();
}
// async function enterType(id: string, name: string, status: Status) {
// if (
// expandedTree.value.length > 1 &&
// expandedTree.value[expandedTree.value.length - 1] !== id
// ) {
// expandedTree.value.pop();
// expandedTree.value.push(id);
// } else {
// expandedTree.value.push(id);
// }
// pathTypeName.value = name;
// currentIdType.value = id;
// productMode.value = 'service';
// productAndServiceTab.value = 'service';
// currentStatusList.value.push(status);
// await fetchListOfProduct();
// await fetchListOfService();
// flowStore.rotate();
// }
function handleStatus() {
let tempValue = false;
@ -1446,8 +1340,6 @@ function handleHold(node: ProductGroup & { type: string }) {
if ($q.screen.gt.xs) return;
holdDialog.value = true;
currentNode.value = node;
// return function (props: unknown) {
// };
}
onMounted(async () => {
@ -1546,9 +1438,6 @@ watch(currentStatus, async () => {
if (productMode.value === 'group') {
await fetchListGroups();
}
// else {
// await fetchListType();
// }
flowStore.rotate();
});
@ -1557,11 +1446,6 @@ watch(inputSearch, async () => {
await fetchListGroups();
flowStore.rotate();
}
// if (productMode.value === 'type') {
// await fetchListType();
// flowStore.rotate();
// }
});
watch(inputSearchProductAndService, async () => {
@ -1610,22 +1494,6 @@ watch([currentStatusList, productMode], async () => {
}
"
/>
<!-- <q-fab-action
v-if="productMode === 'type'"
id="btn-add-product-type"
:label="$t('productService.type.addTitle')"
external-label
label-position="left"
style="color: white; background-color: hsla(var(--purple-11-hsl))"
padding="xs"
icon="mdi-folder-multiple-plus-outline"
@click="
() => {
clearFormGroup();
dialogInputForm = true;
}
"
></q-fab-action> -->
<q-fab-action
v-if="productMode === 'product'"
:label="$t('productService.product.addTitle')"
@ -1730,8 +1598,6 @@ watch([currentStatusList, productMode], async () => {
async (v: (typeof treeProductTypeAndGroup)[number]) => {
if (v.type === 'group') {
if (currentIdGrop !== v.id) {
// filterStat.push('group');
// currentStatusList = [];
await enterGroup(v.id, v.name, v.status);
return;
@ -2015,13 +1881,6 @@ watch([currentStatusList, productMode], async () => {
@click="
async () => {
filterStat.push(productMode);
// if (productMode === 'type') {
// await enterType(
// props.row.id,
// props.row.name,
// props.row.status,
// );
// }
if (productMode === 'group') {
await enterGroup(
props.row.id,
@ -2130,16 +1989,6 @@ watch([currentStatusList, productMode], async () => {
flat
@click.stop="
() => {
// if (productMode === 'type') {
// editByTree = 'type';
// currentStatusProduct =
// props.row.status === 'INACTIVE';
// clearFormGroup();
// currentIdType = props.row.id;
// assignFormDataGroup(props.row);
// isEdit = false;
// drawerInfo = true;
// }
if (productMode === 'group') {
editByTree = 'group';
currentStatusProduct =
@ -2160,16 +2009,6 @@ watch([currentStatusList, productMode], async () => {
:idName="props.row.name"
@view="
() => {
// if (productMode === 'type') {
// editByTree = 'type';
// currentStatusProduct =
// props.row.status === 'INACTIVE';
// clearFormGroup();
// currentIdType = props.row.id;
// assignFormDataGroup(props.row);
// isEdit = false;
// drawerInfo = true;
// }
if (productMode === 'group') {
editByTree = 'group';
currentStatusProduct =
@ -2184,14 +2023,6 @@ watch([currentStatusList, productMode], async () => {
"
@edit="
() => {
// if (productMode === 'type') {
// editByTree = 'type';
// clearFormGroup();
// currentIdType = props.row.id;
// assignFormDataGroup(props.row);
// isEdit = true;
// drawerInfo = true;
// }
if (productMode === 'group') {
editByTree = 'group';
clearFormGroup();
@ -2205,9 +2036,6 @@ watch([currentStatusList, productMode], async () => {
"
@delete="
() => {
// if (productMode === 'type') {
// deleteProductById(props.row.id);
// }
if (productMode === 'group') {
deleteProductById(props.row.id);
}
@ -2228,7 +2056,6 @@ watch([currentStatusList, productMode], async () => {
<template v-slot:item="props">
<div class="col-12 col-md-6 col-lg-4">
<!-- :isType="productMode === 'type'" -->
<ProductCardComponent
:count-product="props.row._count.product"
:count-type="props.row._count.type"
@ -2255,16 +2082,6 @@ watch([currentStatusList, productMode], async () => {
"
@viewCard="
() => {
// if (productMode === 'type') {
// editByTree = 'type';
// currentStatusProduct =
// props.row.status === 'INACTIVE';
// clearFormGroup();
// currentIdType = props.row.id;
// assignFormDataGroup(props.row);
// isEdit = false;
// drawerInfo = true;
// }
if (productMode === 'group') {
editByTree = 'group';
currentStatusProduct =
@ -2279,13 +2096,6 @@ watch([currentStatusList, productMode], async () => {
"
@updateCard="
() => {
// if (productMode === 'type') {
// clearFormGroup();
// currentIdType = props.row.id;
// assignFormDataGroup(props.row);
// isEdit = true;
// drawerInfo = true;
// }
if (productMode === 'group') {
clearFormGroup();
assignFormDataGroup(props.row);
@ -2298,9 +2108,6 @@ watch([currentStatusList, productMode], async () => {
"
@deleteCard="
() => {
// if (productMode === 'type') {
// deleteProductById(props.row.id);
// }
if (productMode === 'group') {
deleteProductById(props.row.id);
}
@ -2309,13 +2116,6 @@ watch([currentStatusList, productMode], async () => {
@on-click="
async () => {
filterStat.push(productMode);
// if (productMode === 'type') {
// await enterType(
// props.row.id,
// props.row.name,
// props.row.status,
// );
// }
if (productMode === 'group') {
await enterGroup(
props.row.id,
@ -2396,70 +2196,6 @@ watch([currentStatusList, productMode], async () => {
/>
</div>
</div>
<!-- <div
v-if="productMode === 'type'"
class="row justify-between items-center q-px-md q-py-sm full-width"
>
<div class="col-4">
<div class="row items-center">
<div
class="app-text-muted q-mr-sm"
v-if="$q.screen.gt.sm"
>
{{ $t('general.recordPerPage') }}
</div>
<div>
<q-btn-dropdown
dense
unelevated
:label="pageSizeType"
class="bordered q-pl-md"
>
<q-list>
<q-item
v-for="v in [10, 30, 50, 100, 500, 1000]"
:key="v"
clickable
v-close-popup
@click="
async () => {
pageSizeType = v;
await fetchListType();
}
"
>
<q-item-section>
<q-item-label>{{ v }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</div>
</div>
<div class="col-4 row justify-center app-text-muted">
{{
$t('general.recordsPage', {
resultcurrentPage: productType?.length,
total: totalType,
})
}}
</div>
<div class="col-4 row justify-end">
<PaginationComponent
v-model:current-page="currentPageType"
v-model:max-page="maxPageType"
:fetch-data="
async () => {
await fetchListType();
flowStore.rotate();
}
"
/>
</div>
</div> -->
</template>
</div>
@ -2598,66 +2334,6 @@ watch([currentStatusList, productMode], async () => {
</div>
</div>
<!-- <div class="surface-2 bordered-b q-px-md">
<q-tabs
dense
v-model="productAndServiceTab"
active-color="info"
align="left"
>
<q-tab
id="tab-service"
name="service"
class="text-capitalize"
@click="
async () => {
currentPageServiceAndProduct = 1;
inputSearchProductAndService = '';
currentStatus = 'All';
// await fetchListOfService();
flowStore.rotate();
}
"
>
<div
class="row"
:class="
productAndServiceTab === 'service'
? 'text-bold'
: 'app-text-muted'
"
>
{{ $t('productService.service.title') }}
</div>
</q-tab>
<q-tab
id="tab-product"
name="product"
class="text-capitalize"
@click="
async () => {
currentPageServiceAndProduct = 1;
inputSearchProductAndService = '';
currentStatus = 'All';
// await fetchListOfProduct();
flowStore.rotate();
}
"
>
<div
class="row"
:class="
productAndServiceTab === 'product'
? 'text-bold'
: 'app-text-muted'
"
>
{{ $t('productService.product.title') }}
</div>
</q-tab>
</q-tabs>
</div> -->
<div
v-if="
(productAndServiceTab === 'product' &&
@ -3337,17 +3013,11 @@ watch([currentStatusList, productMode], async () => {
if (editByTree === 'group') {
submitGroup();
}
// if (editByTree === 'type') {
// submitType();
// }
editByTree = undefined;
} else {
if (productMode === 'group') {
submitGroup();
}
// if (productMode === 'type') {
// submitType();
// }
}
}
"
@ -4468,15 +4138,6 @@ watch([currentStatusList, productMode], async () => {
if (!currentNode) return;
await fetchListOfOptionBranch();
// if (currentNode.type === 'type') {
// editByTree = 'type';
// currentStatusProduct = currentNode.status === 'INACTIVE';
// clearFormGroup();
// currentIdType = currentNode.id;
// assignFormDataGroup(currentNode);
// isEdit = false;
// drawerInfo = true;
// }
if (currentNode.type === 'group') {
editByTree = 'group';
currentStatusProduct = currentNode.status === 'INACTIVE';
@ -4506,13 +4167,6 @@ watch([currentStatusList, productMode], async () => {
() => {
if (!currentNode) return;
editByTree = currentNode.type as 'type' | 'group';
// if (currentNode.type === 'type') {
// clearFormGroup();
// currentIdType = currentNode.id;
// assignFormDataGroup(currentNode);
// isEdit = true;
// drawerInfo = true;
// }
if (currentNode.type === 'group') {
clearFormGroup();
assignFormDataGroup(currentNode);
@ -4566,16 +4220,6 @@ watch([currentStatusList, productMode], async () => {
@click="
async () => {
if (!currentNode) return;
// if (currentNode.type === 'type') {
// triggerChangeStatus(
// currentNode.id,
// currentNode.status,
// currentNode.type,
// );
// currentNode.status === 'ACTIVE'
// ? (currentNode.status = 'INACTIVE')
// : (currentNode.status = 'ACTIVE');
// }
if (currentNode.type === 'group') {
triggerChangeStatus(
currentNode.id,