feat: rotate log id

This commit is contained in:
Methapon2001 2024-06-26 17:03:49 +07:00
parent f46b7868fa
commit 83831988dd
3 changed files with 29 additions and 2 deletions

View file

@ -293,7 +293,6 @@ async function triggerEdit(
}
function triggerDelete(id: string) {
fetchBranchById(id);
if (id) {
dialog({
color: 'negative',
@ -306,6 +305,7 @@ function triggerDelete(id: string) {
await branchStore.deleteById(id);
await branchStore.fetchList({ pageSize: 99999 });
modalDrawer.value = false;
flowStore.rotate();
},
cancel: () => {},
});
@ -954,7 +954,7 @@ watch(locale, () => {
:editData="() => drawerEdit()"
:submit="() => onSubmit()"
:delete-data="() => triggerDelete(currentEdit.id)"
:close="() => (modalDrawer = false)"
:close="() => ((modalDrawer = false), flowStore.rotate())"
:statusBranch="formData.status"
>
<template #info>

View file

@ -28,8 +28,11 @@ import DrawerInfo from 'src/components/DrawerInfo.vue';
import InfoForm from 'src/components/02_personnel-management/InfoForm.vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import useFlowStore from 'src/stores/flow';
const { locale } = useI18n();
const flowStore = useFlowStore();
const userStore = useUserStore();
const branchStore = useBranchStore();
const adrressStore = useAddressStore();
@ -235,6 +238,7 @@ function onClose() {
statusToggle.value = true;
Object.assign(formData.value, defaultFormData);
mapUserType(selectorLabel.value);
flowStore.rotate();
}
async function onSubmit() {
@ -361,6 +365,7 @@ async function onSubmit() {
},
});
}
flowStore.rotate();
}
async function onDelete(id: string) {
@ -379,6 +384,7 @@ async function onDelete(id: string) {
userType: selectorLabel.value ?? undefined,
});
typeStats.value = await userStore.typeStats();
flowStore.rotate();
},
});
}
@ -500,6 +506,7 @@ onMounted(async () => {
if (res) {
userStats.value = res;
}
flowStore.rotate();
});
watch(

View file

@ -59,8 +59,10 @@ import FormEmployeeVisa from 'src/components/03_customer-management/FormEmployee
import { Icon } from '@iconify/vue';
import { dialog, calculateAge } from 'src/stores/utils';
import { useI18n } from 'vue-i18n';
import useFlowStore from 'src/stores/flow';
const { t, locale } = useI18n();
const userCustomer = useCustomerStore();
const {
create,
@ -74,6 +76,7 @@ const {
fetchListBranch,
fetchListBranchById,
} = userCustomer;
const flowStore = useFlowStore();
const employeeStore = useEmployeeStore();
const optionStore = useOptionStore();
const formData = ref<CustomerCreate>({
@ -431,6 +434,7 @@ function onClose() {
infoDrawer.value = false;
infoDrawerEdit.value = false;
dialogInputForm.value = false;
flowStore.rotate();
clearForm();
}
@ -438,6 +442,7 @@ function onCloseBranch() {
infoDrawerBranch.value = false;
infoDrawerEdit.value = false;
dialogInputForm.value = false;
flowStore.rotate();
clearForm();
}
@ -607,6 +612,7 @@ function deleteBranchId(id: string) {
if (result) branch.value = result.branch;
infoDrawerBranch.value = false;
flowStore.rotate();
},
cancel: () => {},
});
@ -641,6 +647,7 @@ async function onSubmit() {
clearFormEmployee();
}
}
flowStore.rotate();
}
async function onSubmitCustomerBranch() {
@ -660,6 +667,7 @@ async function onSubmitCustomerBranch() {
currentCustomerUrlImage.value = result.imageUrl;
branch.value = result.branch;
}
flowStore.rotate();
}
const resultSearch = ref<(Customer & { branch: CustomerBranch[] })[]>();
@ -674,6 +682,7 @@ async function searchCustomer() {
if (resultList) {
resultSearch.value = resultList.result;
}
flowStore.rotate();
}
async function searchEmployee() {
@ -684,6 +693,7 @@ async function searchEmployee() {
if (resultList) {
resultSearchEmployee.value = resultList.result;
}
flowStore.rotate();
}
async function fetchListCustomer() {
@ -727,12 +737,14 @@ async function toggleStatusEmployee(id: string, status: boolean) {
await employeeStore.editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
await fetchListEmployee();
flowStore.rotate();
}
async function toggleStatusCustomer(id: string, status: boolean) {
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
await fetchListCustomer();
flowStore.rotate();
}
async function onSubmitEdit(id: string) {
@ -771,6 +783,7 @@ async function onSubmitEdit(id: string) {
clearFormEmployee();
}
}
flowStore.rotate();
}
async function onDelete(id: string) {
@ -787,6 +800,7 @@ async function onDelete(id: string) {
const resultList = await employeeStore.fetchList();
if (resultList) listEmployee.value = resultList.result;
clearFormEmployee();
flowStore.rotate();
},
cancel: () => {},
});
@ -813,6 +827,7 @@ async function submitBranch() {
}
infoDrawerBranch.value = false;
flowStore.rotate();
clearForm();
}
@ -1028,6 +1043,7 @@ async function assignFormDataEmployee(id: string) {
formDataEmployeeSameAddr.value = false;
}
}
flowStore.rotate();
}
async function checkEmployeeForm() {
@ -1115,6 +1131,7 @@ onMounted(async () => {
);
listEmployee.value = resultListEmployee.result;
}
flowStore.rotate();
});
watch(locale, () => {
@ -1150,6 +1167,7 @@ watch(fieldSelectedCustomer, async () => {
if (resultList) {
listCustomer.value = resultList.result;
}
flowStore.rotate();
});
watch(
@ -1189,6 +1207,7 @@ watch(
watch(genderselector, async (gender) => {
await fetchListEmployee({ gender: gender });
flowStore.rotate();
});
watch(currentStatus, async () => {
@ -1204,6 +1223,7 @@ watch(currentStatus, async () => {
: 'INACTIVE',
});
}
flowStore.rotate();
});
watch(selectorLabel, async () => {