@@ -22,9 +22,9 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) {
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["OpenSearch"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
splitKey: bodyshop?.imexshopid
|
||||
});
|
||||
// TODO - Client Update - Technically key is not doing anything here
|
||||
|
||||
return (
|
||||
<Row className="breadcrumb-container">
|
||||
<Col xs={24} sm={24} md={16}>
|
||||
@@ -35,7 +35,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) {
|
||||
key: "home",
|
||||
title: (
|
||||
<Link to={isPartsEntry ? `/parts/` : `/manage/`}>
|
||||
<HomeFilled /> {(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) || ""}
|
||||
<HomeFilled /> {(bodyshop?.shopname && `(${bodyshop.shopname})`) || ""}
|
||||
</Link>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -4,13 +4,8 @@ import parsePhoneNumber from "libphonenumber-js";
|
||||
import { forwardRef } from "react";
|
||||
import "./phone-form-item.styles.scss";
|
||||
|
||||
function FormItemPhone(props) {
|
||||
return (
|
||||
<Input
|
||||
// country="ca" ref={ref} className="ant-input"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
function FormItemPhone(props, ref) {
|
||||
return <Input ref={ref} {...props} />;
|
||||
}
|
||||
|
||||
export default forwardRef(FormItemPhone);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AlertOutlined, BulbOutlined } from "@ant-design/icons";
|
||||
import { Button, Layout, Space } from "antd";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -17,18 +16,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
|
||||
export function GlobalFooter({ isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
// Canny Not Required on Parts Entry
|
||||
if (isPartsEntry) return;
|
||||
window.Canny("initChangelog", {
|
||||
appID: "680bd2c7ee501290377f6686",
|
||||
position: "top",
|
||||
align: "left",
|
||||
theme: "light" // options: light [default], dark, auto
|
||||
});
|
||||
}, [isPartsEntry]);
|
||||
|
||||
|
||||
if (isPartsEntry) {
|
||||
return (
|
||||
<Footer>
|
||||
|
||||
@@ -8,19 +8,20 @@ import { createStructuredSelector } from "reselect";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly
|
||||
jobRO: selectJobReadOnly,
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type }))
|
||||
});
|
||||
|
||||
export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [availableStatuses, setAvailableStatuses] = useState([]);
|
||||
@@ -45,25 +46,43 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||
});
|
||||
};
|
||||
|
||||
// Updates available statuses based on job and bodyshop context
|
||||
useEffect(() => {
|
||||
//Figure out what scenario were in, populate accodingly
|
||||
if (job && bodyshop) {
|
||||
if (bodyshop.md_ro_statuses.pre_production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.pre_production_statuses);
|
||||
} else if (bodyshop.md_ro_statuses.production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.production_statuses);
|
||||
} else if (bodyshop.md_ro_statuses.post_production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(
|
||||
bodyshop.md_ro_statuses.post_production_statuses.filter(
|
||||
(s) => s !== bodyshop.md_ro_statuses.default_invoiced && s !== bodyshop.md_ro_statuses.default_exported
|
||||
)
|
||||
);
|
||||
} else {
|
||||
console.log("Status didn't match any restrictions. Allowing all status changes.");
|
||||
setAvailableStatuses(bodyshop.md_ro_statuses.statuses);
|
||||
}
|
||||
if (!job || !bodyshop) return;
|
||||
|
||||
const { md_ro_statuses } = bodyshop;
|
||||
const {
|
||||
parts_statuses,
|
||||
pre_production_statuses,
|
||||
production_statuses,
|
||||
post_production_statuses,
|
||||
statuses,
|
||||
default_invoiced,
|
||||
default_exported
|
||||
} = md_ro_statuses;
|
||||
|
||||
if (isPartsEntry) {
|
||||
// Set parts-specific statuses for parts entry scenario
|
||||
setAvailableStatuses(parts_statuses);
|
||||
return;
|
||||
}
|
||||
}, [job, setAvailableStatuses, bodyshop]);
|
||||
|
||||
// Handle non-parts entry scenarios based on job status
|
||||
if (pre_production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(pre_production_statuses);
|
||||
} else if (production_statuses.includes(job.status)) {
|
||||
setAvailableStatuses(production_statuses);
|
||||
} else if (post_production_statuses.includes(job.status)) {
|
||||
// Filter out invoiced and exported statuses for post-production
|
||||
setAvailableStatuses(
|
||||
post_production_statuses.filter((status) => status !== default_invoiced && status !== default_exported)
|
||||
);
|
||||
} else {
|
||||
// Default to all statuses if no specific restrictions apply
|
||||
console.log("Status didn't match any restrictions. Allowing all status changes.");
|
||||
setAvailableStatuses(statuses);
|
||||
}
|
||||
}, [job, bodyshop, isPartsEntry, setAvailableStatuses]);
|
||||
|
||||
const statusMenu = {
|
||||
items: [
|
||||
|
||||
@@ -37,7 +37,7 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech
|
||||
.filter(
|
||||
(temp) =>
|
||||
(!temp.regions ||
|
||||
(temp.regions && temp.regions[bodyshop.region_config]) ||
|
||||
temp.regions?.[bodyshop.region_config] ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) &&
|
||||
(!temp.dms || temp.dms === false)
|
||||
)
|
||||
@@ -46,7 +46,7 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech
|
||||
.filter(
|
||||
(temp) =>
|
||||
!temp.regions ||
|
||||
(temp.regions && temp.regions[bodyshop.region_config]) ||
|
||||
temp.regions?.[bodyshop.region_config] ||
|
||||
(temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)
|
||||
);
|
||||
|
||||
@@ -82,7 +82,7 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech
|
||||
variables: { id: jobId }
|
||||
},
|
||||
{
|
||||
to: job && job.ownr_ea,
|
||||
to: job?.ownr_ea,
|
||||
subject: cards.find((c) => c.key === key)?.subject
|
||||
},
|
||||
"e",
|
||||
@@ -129,7 +129,7 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech
|
||||
const columns = `repeat(${actions.length}, 1fr)`;
|
||||
|
||||
return (
|
||||
<Col key={item.key} xs={24} sm={12}>
|
||||
<Col key={item.key} xs={24} sm={24} md={24} lg={24} xl={24}>
|
||||
<Card hoverable style={{ minHeight: 100 }}>
|
||||
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
||||
<div style={{ flex: "1 1 70%", minWidth: 0 }}>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function ShopInfoContainer() {
|
||||
onFinish={handleFinish}
|
||||
initialValues={
|
||||
data
|
||||
? data.bodyshops[0].accountingconfig.ClosingPeriod
|
||||
? data?.bodyshops?.[0]?.accountingconfig?.ClosingPeriod
|
||||
? {
|
||||
...data.bodyshops[0],
|
||||
accountingconfig: {
|
||||
|
||||
@@ -96,13 +96,15 @@ export function SimplifiedPartsJobsListComponent({
|
||||
key: "status",
|
||||
|
||||
ellipsis: true,
|
||||
sorter: search?.search ? (a, b) => statusSort(a.status, b.status, bodyshop.md_ro_statuses.active_statuses) : true,
|
||||
sorter: search?.search
|
||||
? (a, b) => statusSort(a.status, b.status, bodyshop.md_ro_statuses.parts_active_statuses)
|
||||
: true,
|
||||
sortOrder: sortcolumn === "status" && sortorder,
|
||||
render: (text, record) => {
|
||||
return record.status || t("general.labels.na");
|
||||
},
|
||||
filteredValue: filter?.status || null,
|
||||
filters: bodyshop.md_ro_statuses.statuses.map((s) => {
|
||||
filters: bodyshop.md_ro_statuses.parts_statuses.map((s) => {
|
||||
return { text: s, value: [s] };
|
||||
}),
|
||||
onFilter: (value, record) => value.includes(record.status)
|
||||
|
||||
Reference in New Issue
Block a user