history debug
This commit is contained in:
@@ -99,6 +99,15 @@ const History = () => {
|
|||||||
const archivedPlans = archivedResponse.data.data.plans || [];
|
const archivedPlans = archivedResponse.data.data.plans || [];
|
||||||
const allHistoryApplications = [...completedPlans, ...archivedPlans];
|
const allHistoryApplications = [...completedPlans, ...archivedPlans];
|
||||||
|
|
||||||
|
// Debug: Log the structure of applications
|
||||||
|
console.log('fetchHistoryData - completedPlans:', completedPlans);
|
||||||
|
console.log('fetchHistoryData - first application:', completedPlans[0]);
|
||||||
|
if (completedPlans[0]) {
|
||||||
|
console.log('fetchHistoryData - application fields:', Object.keys(completedPlans[0]));
|
||||||
|
console.log('fetchHistoryData - application products:', completedPlans[0].products);
|
||||||
|
console.log('fetchHistoryData - application applicationType:', completedPlans[0].applicationType);
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch application logs for additional details
|
// Fetch application logs for additional details
|
||||||
const logsResponse = await applicationsAPI.getLogs();
|
const logsResponse = await applicationsAPI.getLogs();
|
||||||
const logs = logsResponse.data.data.logs || [];
|
const logs = logsResponse.data.data.logs || [];
|
||||||
@@ -168,15 +177,34 @@ const History = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filteredForOptions = getFilteredApplicationsForOptions();
|
const filteredForOptions = getFilteredApplicationsForOptions();
|
||||||
|
|
||||||
|
// Debug logging
|
||||||
|
console.log('Debug History filters:');
|
||||||
|
console.log('completedApplications:', completedApplications.length);
|
||||||
|
console.log('sample application:', completedApplications[0]);
|
||||||
|
console.log('filteredForOptions:', filteredForOptions.length);
|
||||||
|
console.log('dateFilter:', dateFilter, 'dateRangeStart:', dateRangeStart, 'dateRangeEnd:', dateRangeEnd);
|
||||||
|
console.log('applicationTypeFilter:', applicationTypeFilter);
|
||||||
|
|
||||||
const uniqueProperties = [...new Set(completedApplications.map(app => app.propertyName))].filter(Boolean);
|
const uniqueProperties = [...new Set(completedApplications.map(app => app.propertyName))].filter(Boolean);
|
||||||
const uniqueProducts = [...new Set(
|
const uniqueProducts = [...new Set(
|
||||||
filteredForOptions.flatMap(app =>
|
filteredForOptions.flatMap(app =>
|
||||||
app.products ? app.products.map(p => p.productName) : []
|
app.products ? app.products.map(p => p.productName) : []
|
||||||
)
|
)
|
||||||
)].filter(Boolean).sort();
|
)].filter(Boolean).sort();
|
||||||
|
|
||||||
|
console.log('uniqueProducts found:', uniqueProducts);
|
||||||
|
|
||||||
// Filter applications based on all filters
|
// Filter applications based on all filters
|
||||||
const filteredApplications = completedApplications.filter(app => {
|
const filteredApplications = completedApplications.filter(app => {
|
||||||
|
// Debug logging for first app
|
||||||
|
if (completedApplications.indexOf(app) === 0) {
|
||||||
|
console.log('Filtering first app:', app);
|
||||||
|
console.log('App planned date:', app.plannedDate);
|
||||||
|
console.log('App application type:', app.applicationType);
|
||||||
|
console.log('App products:', app.products);
|
||||||
|
}
|
||||||
|
|
||||||
// Date filter
|
// Date filter
|
||||||
if (dateFilter !== 'all') {
|
if (dateFilter !== 'all') {
|
||||||
const appDate = new Date(app.plannedDate);
|
const appDate = new Date(app.plannedDate);
|
||||||
|
|||||||
Reference in New Issue
Block a user