feature/IO-3255-simplified-parts-management - dumb down print center
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import PrintCenterJobs from "../print-center-jobs/print-center-jobs.component";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import PrintCenterJobsParts from "../print-center-jobs/print-center-jobs-parts.component";
|
||||
|
||||
export default function PrintCenterModalComponent({ context }) {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
export function PrintCenterModalComponent({ context, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const { type } = context;
|
||||
|
||||
@@ -9,10 +17,12 @@ export default function PrintCenterModalComponent({ context }) {
|
||||
|
||||
switch (type) {
|
||||
case "job":
|
||||
ModalContent = PrintCenterJobs;
|
||||
ModalContent = isPartsEntry ? PrintCenterJobsParts : PrintCenterJobs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return <div>{ModalContent ? <ModalContent /> : t("printcenter.errors.nocontexttype")}</div>;
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(PrintCenterModalComponent);
|
||||
|
||||
Reference in New Issue
Block a user