feat: initialize dashboard structure with auth, feed management, and activity feed filtering components
This commit is contained in:
@@ -7,17 +7,45 @@ export const activityFeedsService = {
|
||||
},
|
||||
|
||||
getHistoryDates: async (isRectificationEnabled: boolean) => {
|
||||
// Requires dbName and siteIds, which should be handled by axios interceptors or passed in
|
||||
const params = new URLSearchParams({
|
||||
isRectificationEnabled: String(isRectificationEnabled)
|
||||
const response = await axiosClient.get('/api/audit/anomaly/get_history_dates', {
|
||||
params: { isRectificationEnabled }
|
||||
});
|
||||
const response = await axiosClient.get(`/api/audit/anomaly/get_history_dates?${params.toString()}`);
|
||||
return response;
|
||||
},
|
||||
|
||||
getHistory: async (params: any) => {
|
||||
const queryParams = new URLSearchParams(params);
|
||||
const response = await axiosClient.get(`/api/audit/anomaly/history?${queryParams.toString()}`);
|
||||
if (params.isRectificationEnabled) {
|
||||
const cleanParams = { ...params };
|
||||
delete cleanParams.auditStatus;
|
||||
const response = await axiosClient.get('/api/audit/anomaly/history', { params: cleanParams });
|
||||
return response;
|
||||
}
|
||||
|
||||
if (params.auditStatus === 'False Audits' || params.isTrueFalse === 'true') {
|
||||
const pageIndex = params.pageSize ? Math.floor(params.pageNo / params.pageSize) + 1 : 1;
|
||||
const falseParams: any = {
|
||||
fromDate: params.fromDate || '',
|
||||
toDate: params.tillDate || '',
|
||||
asset_id: params.assetsIds || '',
|
||||
page: pageIndex,
|
||||
limit: params.pageSize || 20,
|
||||
site_id: params.siteIds || ''
|
||||
};
|
||||
if (params.dbName) {
|
||||
falseParams.dbName = params.dbName;
|
||||
}
|
||||
|
||||
const response: any = await activityFeedsService.getFalseAnomaly(falseParams);
|
||||
const resultObj = response?.result || response;
|
||||
return {
|
||||
anomalies: resultObj?.data || [],
|
||||
count: resultObj?.totalCount || 0
|
||||
};
|
||||
}
|
||||
|
||||
const cleanParams = { ...params };
|
||||
delete cleanParams.auditStatus;
|
||||
const response = await axiosClient.get('/api/audit/anomaly/history', { params: cleanParams });
|
||||
return response;
|
||||
},
|
||||
|
||||
@@ -27,9 +55,27 @@ export const activityFeedsService = {
|
||||
return response;
|
||||
},
|
||||
|
||||
updateAnomaly: async (anomalies: any[], isRectificationEnabled: boolean) => {
|
||||
const response = await axiosClient.post('/api/audit/anomaly', anomalies, {
|
||||
params: { isRectificationEnabled }
|
||||
});
|
||||
return response;
|
||||
},
|
||||
|
||||
updateAnomalyInDashboard: async (payload: { site_id: string, anomaly_id: number[] }) => {
|
||||
const response = await axiosClient.post(`/api/audit/auditor/anomaly/update`, payload);
|
||||
return response;
|
||||
},
|
||||
|
||||
getOrganizationSites: async (org_id: string) => {
|
||||
const params = new URLSearchParams({ org_id });
|
||||
const response = await axiosClient.get(`/api/dashboard/Master/site?${params.toString()}`);
|
||||
const response = await axiosClient.get('/api/dashboard/Master/site', {
|
||||
params: { org_id }
|
||||
});
|
||||
return response;
|
||||
},
|
||||
|
||||
getFalseAnomaly: async (params: any) => {
|
||||
const response = await axiosClient.get('/api/audit/asset/get-false-Anomaly', { params });
|
||||
return response;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user