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) { function triggerDelete(id: string) {
fetchBranchById(id);
if (id) { if (id) {
dialog({ dialog({
color: 'negative', color: 'negative',
@ -306,6 +305,7 @@ function triggerDelete(id: string) {
await branchStore.deleteById(id); await branchStore.deleteById(id);
await branchStore.fetchList({ pageSize: 99999 }); await branchStore.fetchList({ pageSize: 99999 });
modalDrawer.value = false; modalDrawer.value = false;
flowStore.rotate();
}, },
cancel: () => {}, cancel: () => {},
}); });
@ -954,7 +954,7 @@ watch(locale, () => {
:editData="() => drawerEdit()" :editData="() => drawerEdit()"
:submit="() => onSubmit()" :submit="() => onSubmit()"
:delete-data="() => triggerDelete(currentEdit.id)" :delete-data="() => triggerDelete(currentEdit.id)"
:close="() => (modalDrawer = false)" :close="() => ((modalDrawer = false), flowStore.rotate())"
:statusBranch="formData.status" :statusBranch="formData.status"
> >
<template #info> <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 InfoForm from 'src/components/02_personnel-management/InfoForm.vue';
import { computed } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import useFlowStore from 'src/stores/flow';
const { locale } = useI18n(); const { locale } = useI18n();
const flowStore = useFlowStore();
const userStore = useUserStore(); const userStore = useUserStore();
const branchStore = useBranchStore(); const branchStore = useBranchStore();
const adrressStore = useAddressStore(); const adrressStore = useAddressStore();
@ -235,6 +238,7 @@ function onClose() {
statusToggle.value = true; statusToggle.value = true;
Object.assign(formData.value, defaultFormData); Object.assign(formData.value, defaultFormData);
mapUserType(selectorLabel.value); mapUserType(selectorLabel.value);
flowStore.rotate();
} }
async function onSubmit() { async function onSubmit() {
@ -361,6 +365,7 @@ async function onSubmit() {
}, },
}); });
} }
flowStore.rotate();
} }
async function onDelete(id: string) { async function onDelete(id: string) {
@ -379,6 +384,7 @@ async function onDelete(id: string) {
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
typeStats.value = await userStore.typeStats(); typeStats.value = await userStore.typeStats();
flowStore.rotate();
}, },
}); });
} }
@ -500,6 +506,7 @@ onMounted(async () => {
if (res) { if (res) {
userStats.value = res; userStats.value = res;
} }
flowStore.rotate();
}); });
watch( watch(

View file

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