updates for company effects
This commit is contained in:
parent
98ec082394
commit
7710a7c8fe
22 changed files with 941 additions and 186 deletions
|
|
@ -29,10 +29,12 @@ import { useFiltersStore } from "../../stores/filters";
|
|||
import { useModalStore } from "../../stores/modal";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useNotificationStore } from "../../stores/notifications-primevue";
|
||||
import { useCompanyStore } from "../../stores/company";
|
||||
import TodoChart from "../common/TodoChart.vue";
|
||||
import { Calendar, Community, Hammer, PathArrowSolid, Clock, Shield, ShieldSearch,
|
||||
ClipboardCheck, DoubleCheck, CreditCard, CardNoAccess, ChatBubbleQuestion, Edit,
|
||||
WateringSoil, Soil, Truck, SoilAlt } from "@iconoir/vue";
|
||||
WateringSoil, Soil, Truck, SoilAlt,
|
||||
Filter} from "@iconoir/vue";
|
||||
|
||||
const notifications = useNotificationStore();
|
||||
const loadingStore = useLoadingStore();
|
||||
|
|
@ -41,6 +43,7 @@ const filtersStore = useFiltersStore();
|
|||
const modalStore = useModalStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const companyStore = useCompanyStore();
|
||||
|
||||
const tableData = ref([]);
|
||||
const totalRecords = ref(0);
|
||||
|
|
@ -50,10 +53,26 @@ const currentWeekParams = ref({});
|
|||
const chartLoading = ref(true); // Start with loading state
|
||||
|
||||
const lookup = route.query.lookup;
|
||||
const lastLazyLoadEvent = ref(null);
|
||||
|
||||
// Watch for company changes to reload data
|
||||
watch(
|
||||
() => companyStore.currentCompany,
|
||||
async () => {
|
||||
console.log("Company changed, reloading client data...");
|
||||
if (lastLazyLoadEvent.value) {
|
||||
await handleLazyLoad(lastLazyLoadEvent.value);
|
||||
}
|
||||
// Also refresh status counts
|
||||
await refreshStatusCounts();
|
||||
}
|
||||
);
|
||||
|
||||
// Computed property to get current filters for the chart
|
||||
const currentFilters = computed(() => {
|
||||
return filtersStore.getTableFilters("clients");
|
||||
filters = { ...filtersStore.getTableFilters("clients"),
|
||||
company: { value: companyStore.currentCompany, matchMode: FilterMatchMode.CONTAINS}
|
||||
};
|
||||
});
|
||||
|
||||
// Handle week change from chart
|
||||
|
|
@ -220,6 +239,7 @@ const tableActions = [
|
|||
// Handle lazy loading events from DataTable
|
||||
const handleLazyLoad = async (event) => {
|
||||
console.log("Clients page - handling lazy load:", event);
|
||||
lastLazyLoadEvent.value = event;
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
|
@ -263,8 +283,9 @@ const handleLazyLoad = async (event) => {
|
|||
filters,
|
||||
sortingArray,
|
||||
});
|
||||
filters["company"] = { value: companyStore.currentCompany, matchMode: FilterMatchMode.CONTAINS};
|
||||
|
||||
const result = await Api.getPaginatedClientDetails(
|
||||
const result = await Api.getPaginatedClientDetailsV2(
|
||||
paginationParams,
|
||||
filters,
|
||||
sortingArray,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue