IO-3514 Print Center Restrict Financial Group on Tech Station and Fix Drawer Close on Tech Console
Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
@@ -9,6 +9,7 @@ import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
import { HistoryOutlined, MailOutlined, PrinterOutlined, UnorderedListOutlined } from "@ant-design/icons";
|
||||
import { bodyshopHasDmsKey } from "../../utils/dmsUtils.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
printCenterModal: selectPrintCenter,
|
||||
@@ -29,27 +30,29 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech
|
||||
names: ["Enhanced_Payroll"],
|
||||
splitKey: bodyshop.imexshopid
|
||||
});
|
||||
|
||||
const Templates =
|
||||
bodyshop.cdk_dealerid === null && bodyshop.pbs_serialnumber === null
|
||||
? Object.keys(tempList)
|
||||
.map((key) => tempList[key])
|
||||
.filter(
|
||||
(temp) =>
|
||||
(!temp.regions ||
|
||||
temp.regions?.[bodyshop.region_config] ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) &&
|
||||
(!temp.dms || temp.dms === false)
|
||||
)
|
||||
: Object.keys(tempList)
|
||||
.map((key) => tempList[key])
|
||||
.filter(
|
||||
(temp) =>
|
||||
!temp.regions ||
|
||||
const hasDMSKey = bodyshopHasDmsKey(bodyshop);
|
||||
|
||||
const Templates = !hasDMSKey
|
||||
? Object.keys(tempList)
|
||||
.map((key) => tempList[key])
|
||||
.filter(
|
||||
(temp) =>
|
||||
(!temp.regions ||
|
||||
temp.regions?.[bodyshop.region_config] ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)
|
||||
);
|
||||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) &&
|
||||
(!temp.dms || temp.dms === false)
|
||||
)
|
||||
.filter((temp) => !technician || temp.group !== "financial")
|
||||
: Object.keys(tempList)
|
||||
.map((key) => tempList[key])
|
||||
.filter(
|
||||
(temp) =>
|
||||
!temp.regions ||
|
||||
temp.regions?.[bodyshop.region_config] ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)
|
||||
)
|
||||
.filter((temp) => !technician || temp.group !== "financial");
|
||||
|
||||
const JobsReportsList =
|
||||
Enhanced_Payroll.treatment === "on"
|
||||
? Object.keys(Templates)
|
||||
|
||||
@@ -12,15 +12,18 @@ import Jobd3RdPartyModal from "../job-3rd-party-modal/job-3rd-party-modal.compon
|
||||
import PrintCenterItem from "../print-center-item/print-center-item.component";
|
||||
import PrintCenterJobsLabels from "../print-center-jobs-labels/print-center-jobs-labels.component";
|
||||
import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component";
|
||||
import { bodyshopHasDmsKey } from "../../utils/dmsUtils";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
printCenterModal: selectPrintCenter,
|
||||
bodyshop: selectBodyshop
|
||||
bodyshop: selectBodyshop,
|
||||
technician: selectTechnician
|
||||
});
|
||||
|
||||
const mapDispatchToProps = () => ({});
|
||||
|
||||
export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) {
|
||||
export function PrintCenterJobsComponent({ printCenterModal, bodyshop, technician }) {
|
||||
const [search, setSearch] = useState("");
|
||||
const { id: jobId, job } = printCenterModal.context;
|
||||
const tempList = TemplateList("job", {});
|
||||
@@ -32,30 +35,33 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) {
|
||||
names: ["Enhanced_Payroll"],
|
||||
splitKey: bodyshop.imexshopid
|
||||
});
|
||||
const hasDMSKey = bodyshopHasDmsKey(bodyshop);
|
||||
|
||||
const Templates =
|
||||
bodyshop.cdk_dealerid === null && bodyshop.pbs_serialnumber === null
|
||||
? Object.keys(tempList)
|
||||
.map((key) => {
|
||||
return tempList[key];
|
||||
})
|
||||
.filter(
|
||||
(temp) =>
|
||||
(!temp.regions ||
|
||||
(temp.regions && temp.regions[bodyshop.region_config]) ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) &&
|
||||
(!temp.dms || temp.dms === false)
|
||||
)
|
||||
: Object.keys(tempList)
|
||||
.map((key) => {
|
||||
return tempList[key];
|
||||
})
|
||||
.filter(
|
||||
(temp) =>
|
||||
!temp.regions ||
|
||||
const Templates = !hasDMSKey
|
||||
? Object.keys(tempList)
|
||||
.map((key) => {
|
||||
return tempList[key];
|
||||
})
|
||||
.filter(
|
||||
(temp) =>
|
||||
(!temp.regions ||
|
||||
(temp.regions && temp.regions[bodyshop.region_config]) ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)
|
||||
);
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) &&
|
||||
(!temp.dms || temp.dms === false)
|
||||
)
|
||||
.filter((temp) => !technician || temp.group !== "financial")
|
||||
: Object.keys(tempList)
|
||||
.map((key) => {
|
||||
return tempList[key];
|
||||
})
|
||||
.filter(
|
||||
(temp) =>
|
||||
!temp.regions ||
|
||||
(temp.regions && temp.regions[bodyshop.region_config]) ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)
|
||||
)
|
||||
.filter((temp) => !technician || temp.group !== "financial");
|
||||
|
||||
const JobsReportsList =
|
||||
Enhanced_Payroll.treatment === "on"
|
||||
? Object.keys(Templates)
|
||||
@@ -89,7 +95,7 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) {
|
||||
<Space wrap>
|
||||
<PrintCenterJobsLabels jobId={jobId} />
|
||||
<Jobd3RdPartyModal jobId={jobId} job={job} />
|
||||
<Input.Search onChange={(e) => setSearch(e.target.value)} value={search} />
|
||||
<Input.Search onChange={(e) => setSearch(e.target.value)} value={search} enterButton />
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -59,7 +59,8 @@ export function TechLookupJobsDrawer({ bodyshop, setPrintCenterContext }) {
|
||||
|
||||
const handleDrawerClose = () => {
|
||||
// Immutable omit (no delete/mutation)
|
||||
const { ...rest } = searchParams || {};
|
||||
const { selected, ...rest } = searchParams || {};
|
||||
void selected;
|
||||
history({
|
||||
search: queryString.stringify(rest)
|
||||
});
|
||||
@@ -72,7 +73,6 @@ export function TechLookupJobsDrawer({ bodyshop, setPrintCenterContext }) {
|
||||
|
||||
{data ? (
|
||||
<PageHeader
|
||||
onBack={() => window.history.back()}
|
||||
title={data.jobs_by_pk.ro_number || t("general.labels.na")}
|
||||
extra={
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user