BOD-34 Added jobs items and conditional rendering for print center.

This commit is contained in:
Patrick Fic
2020-04-28 10:42:47 -07:00
parent b47767e86c
commit 113bf3f0fb
13 changed files with 297 additions and 28 deletions

View File

@@ -0,0 +1,51 @@
import { Collapse } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setEmailOptions } from "../../redux/email/email.actions";
import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectPrintCenter } from "../../redux/modals/modals.selectors";
import {
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
import JobsReports from "./print-center-jobs.list";
import PrintCenterItem from "../print-center-item/print-center-item.component";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
bodyshop: selectBodyshop,
printCenterModal: selectPrintCenter,
});
const mapDispatchToProps = (dispatch) => ({
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
toggleModalVisible: () => dispatch(toggleModalVisible("printCenter")),
});
export function PrintCenterJobsComponent({ printCenterModal }) {
const { t } = useTranslation();
const { id: jobid } = printCenterModal.context;
const JobsReportsList = JobsReports(null);
return (
<div>
Print Center Jobs COmponetn
<Collapse accordion>
{JobsReportsList.map((section) => (
<Collapse.Panel key={section.key} header={section.title}>
<ul style={{ columns: "2 auto" }}>
{section.items.map((item) => (
<PrintCenterItem key={item.key} item={item} />
))}
</ul>
</Collapse.Panel>
))}
</Collapse>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(PrintCenterJobsComponent);

View File

@@ -0,0 +1,50 @@
import i18n from "i18next";
export default function JobsReports(job) {
return [
{
title: i18n.t("printcenter.jobs.repairorder"),
key: "printcenter.jobs.repairorder",
disabled: false,
items: [
{
key: "appointment_reminder",
title: "Appointment Reminder",
disabled: false,
},
{
key: "appointment_reminder2",
title: "Appointment Reminder2",
disabled: false,
},
{
key: "appointment_reminder3",
title: "Appointment Reminder3",
disabled: false,
},
{
key: "appointment_reminder4",
title: "Appointment Reminder4",
disabled: false,
},
{
key: "appointment_reminder5",
title: "Appointment Reminder5",
disabled: false,
},
],
},
{
title: "Section 2",
key: "Section2",
disabled: false,
items: [
{
key: "appointment_reminder12",
title: "Appointment Reminder12",
disabled: false,
},
],
},
];
}