Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
4efa01edd3 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>
2026-01-23 22:26:22 -08:00
8 changed files with 66 additions and 61 deletions

View File

@@ -50,8 +50,7 @@ export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines, tec
config: {
status: bodyshop.md_ro_statuses.default_open,
bodyshopid: bodyshop.id,
useremail: currentUser.email,
timezone: bodyshop.timezone
useremail: currentUser.email
},
currentUser
});

View File

@@ -264,7 +264,7 @@ export function JobsDetailHeaderActions({
DuplicateJob({
apolloClient: client,
jobId: job.id,
config: { defaultOpenStatus: bodyshop.md_ro_statuses.default_imported, timezone: bodyshop.timezone },
config: { defaultOpenStatus: bodyshop.md_ro_statuses.default_imported },
completionCallback: (newJobId) => {
history(`/manage/jobs/${newJobId}`);
notification.success({
@@ -279,7 +279,7 @@ export function JobsDetailHeaderActions({
DuplicateJob({
apolloClient: client,
jobId: job.id,
config: { defaultOpenStatus: bodyshop.md_ro_statuses.default_imported, timezone: bodyshop.timezone },
config: { defaultOpenStatus: bodyshop.md_ro_statuses.default_imported },
completionCallback: (newJobId) => {
history(`/manage/jobs/${newJobId}`);
notification.success({

View File

@@ -15,7 +15,7 @@ export default async function DuplicateJob({
}) {
logImEXEvent("job_duplicate");
const { defaultOpenStatus, timezone } = config;
const { defaultOpenStatus } = config;
//get a list of all fields on the job
const res = await apolloClient.query({
query: QUERY_JOB_FOR_DUPE,
@@ -31,12 +31,9 @@ export default async function DuplicateJob({
delete existingJob.updatedat;
delete existingJob.cieca_stl;
delete existingJob.cieca_ttl;
!keepJobLines && delete existingJob.clm_total;
const newJob = {
...existingJob,
date_estimated: dayjs().tz(timezone, false).format("YYYY-MM-DD"),
date_open: dayjs(),
status: defaultOpenStatus
};
@@ -73,7 +70,7 @@ export default async function DuplicateJob({
export async function CreateIouForJob({ apolloClient, jobId, config, jobLinesToKeep, currentUser }) {
logImEXEvent("job_create_iou");
const { status, timezone } = config;
const { status } = config;
//get a list of all fields on the job
const res = await apolloClient.query({
query: QUERY_JOB_FOR_DUPE,
@@ -91,10 +88,10 @@ export async function CreateIouForJob({ apolloClient, jobId, config, jobLinesToK
const newJob = {
...existingJob,
converted: true,
status: status,
iouparent: jobId,
date_estimated: dayjs().tz(timezone, false).format("YYYY-MM-DD"),
date_open: dayjs(),
audit_trails: {
data: [

View File

@@ -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)

View File

@@ -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>
}
>

View File

@@ -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

View File

@@ -47,14 +47,14 @@ exports.totalsSsu = async function (req, res) {
throw new Error("Failed to update job totals");
}
res.status(200).json({ success: true });
res.status(200).send();
} catch (error) {
logger.log("job-totals-ssu-USA-error", "error", req?.user?.email, id, {
jobid: id,
error: error.message,
stack: error.stack
});
res.status(503).json({ error: "Failed to calculate totals" });
res.status(503).send();
}
};

View File

@@ -47,14 +47,14 @@ exports.totalsSsu = async function (req, res) {
throw new Error("Failed to update job totals");
}
res.status(200).json({ success: true });
res.status(200).send();
} catch (error) {
logger.log("job-totals-ssu-error", "error", req.user.email, id, {
jobid: id,
error: error.message,
stack: error.stack
});
res.status(503).json({ error: "Failed to calculate totals" });
res.status(503).send();
}
};