Modified how template list is generated to be a function to allow checking whether the templates can be printed.
This commit is contained in:
@@ -11,7 +11,8 @@ import {
|
||||
} from "../../redux/user/user.selectors";
|
||||
import PrintCenterItem from "../print-center-item/print-center-item.component";
|
||||
import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component";
|
||||
import JobsReports from "./print-center-jobs.list";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -27,8 +28,13 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
const colSpan = { md: { span: 24 }, lg: { span: 12 } };
|
||||
|
||||
export function PrintCenterJobsComponent({ bodyshop, printCenterModal }) {
|
||||
const { t } = useTranslation();
|
||||
const { id: jobId } = printCenterModal.context;
|
||||
const JobsReportsList = JobsReports(null);
|
||||
const tempList = TemplateList();
|
||||
const JobsReportsList = Object.keys(tempList).map((key) => {
|
||||
return tempList[key];
|
||||
});
|
||||
console.log("PrintCenterJobsComponent -> JobsReportsList", JobsReportsList);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -38,20 +44,20 @@ export function PrintCenterJobsComponent({ bodyshop, printCenterModal }) {
|
||||
</Col>
|
||||
<Col {...colSpan}>
|
||||
<Collapse accordion>
|
||||
{JobsReportsList.map((section) => (
|
||||
<Collapse.Panel key={section.key} header={section.title}>
|
||||
<ul style={{ columns: "2 auto" }}>
|
||||
{section.items.map((item) => (
|
||||
<Collapse.Panel header={t("printcenter.labels.repairorder")}>
|
||||
<ul style={{ columns: "2 auto" }}>
|
||||
{JobsReportsList.filter((t) => t.drivingId === "job").map(
|
||||
(item) => (
|
||||
<PrintCenterItem
|
||||
key={item.key}
|
||||
item={item}
|
||||
id={jobId}
|
||||
disabled={item.disabled}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</Collapse.Panel>
|
||||
))}
|
||||
)
|
||||
)}{" "}
|
||||
</ul>{" "}
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import i18n from "i18next";
|
||||
|
||||
export default function JobsReports(job) {
|
||||
return [
|
||||
{
|
||||
title: i18n.t("printcenter.labels.repairorder"),
|
||||
key: "printcenter.jobs.repairorder",
|
||||
disabled: false,
|
||||
items: [
|
||||
{
|
||||
key: "appointment_reminder",
|
||||
title: i18n.t("printcenter.jobs.appointment_reminder"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "estimate_detail",
|
||||
title: i18n.t("printcenter.jobs.estimate_detail"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "job_totals",
|
||||
title: i18n.t("printcenter.jobs.job_totals"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "work_authorization",
|
||||
title: i18n.t("printcenter.jobs.work_authorization"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "fippa_work_authorization",
|
||||
title: i18n.t("printcenter.jobs.fippa_work_authorization"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "casl_work_authorization",
|
||||
title: i18n.t("printcenter.jobs.casl_work_authorization"),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
key: "coversheet",
|
||||
title: i18n.t("printcenter.jobs.coversheet"),
|
||||
disabled: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: i18n.t("printcenter.labels.misc"),
|
||||
key: "printcenter.jobs.misc",
|
||||
disabled: false,
|
||||
items: [
|
||||
{
|
||||
key: "iou",
|
||||
title: i18n.t("printcenter.jobs.iou"),
|
||||
disabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user