pre mission reports page
This commit is contained in:
@@ -41,10 +41,12 @@ const ReportPage = () => {
|
||||
{ value: `${data.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||
{ value: `${data.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||
]);
|
||||
if (data.province_id === "-1") {
|
||||
// if (data.province_id === "-1") {
|
||||
try {
|
||||
params.set("province_id", `${data.province_id}`);
|
||||
const response = await requestServer(`${GET_CITY_ACTIVITY_REPORT}?${params}`);
|
||||
const result = response.data.data;
|
||||
console.log(result);
|
||||
const nationalReportForItem = result.activities.find((report) => report.province_id === -1);
|
||||
const nationalReport = {
|
||||
edare_name: "کل کشور",
|
||||
@@ -67,31 +69,31 @@ const ReportPage = () => {
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
try {
|
||||
params.set("province_id", `${data.province_id}`);
|
||||
const response = await requestServer(`${GET_MISSION_CITY_ACTIVITY_REPORT}?${params}`);
|
||||
const result = response.data.data;
|
||||
const nationalReportForItem = result.activities.find((report) => report.edare_id === "-1");
|
||||
const nationalReport = {
|
||||
...nationalReportForItem,
|
||||
edare_name: "کل استان",
|
||||
};
|
||||
setData({
|
||||
data: [
|
||||
nationalReport,
|
||||
...result.edarateShahri.map((edare) => {
|
||||
const filteredReports = result.activities.find((report) => report.edare_id == edare.id);
|
||||
return {
|
||||
edare_name: edare.name_fa,
|
||||
...filteredReports,
|
||||
};
|
||||
}),
|
||||
],
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
// } else {
|
||||
// try {
|
||||
// params.set("province_id", `${data.province_id}`);
|
||||
// const response = await requestServer(`${GET_MISSION_CITY_ACTIVITY_REPORT}?${params}`);
|
||||
// const result = response.data.data;
|
||||
// const nationalReportForItem = result.activities.find((report) => report.edare_id === "-1");
|
||||
// const nationalReport = {
|
||||
// ...nationalReportForItem,
|
||||
// edare_name: "کل استان",
|
||||
// };
|
||||
// setData({
|
||||
// data: [
|
||||
// nationalReport,
|
||||
// ...result.edarateShahri.map((edare) => {
|
||||
// const filteredReports = result.activities.find((report) => report.edare_id == edare.id);
|
||||
// return {
|
||||
// edare_name: edare.name_fa,
|
||||
// ...filteredReports,
|
||||
// };
|
||||
// }),
|
||||
// ],
|
||||
// filters: data,
|
||||
// });
|
||||
// } catch (e) {}
|
||||
// }
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -148,15 +148,15 @@ export const pageMenu = [
|
||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "roadMissionsReports",
|
||||
label: "گزارشات",
|
||||
type: "page",
|
||||
route: "/dashboard/road-missions/reports",
|
||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
permissions: ["all"],
|
||||
},
|
||||
// {
|
||||
// id: "roadMissionsReports",
|
||||
// label: "گزارشات",
|
||||
// type: "page",
|
||||
// route: "/dashboard/road-missions/reports",
|
||||
// icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// // badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
// permissions: ["all"],
|
||||
// },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -147,15 +147,15 @@ export const pageMenuDev = [
|
||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "roadMissionsReports",
|
||||
label: "گزارشات",
|
||||
type: "page",
|
||||
route: "/dashboard/road-missions/reports",
|
||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
permissions: ["all"],
|
||||
},
|
||||
// {
|
||||
// id: "roadMissionsReports",
|
||||
// label: "گزارشات",
|
||||
// type: "page",
|
||||
// route: "/dashboard/road-missions/reports",
|
||||
// icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// // badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||
// permissions: ["all"],
|
||||
// },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user