- Fix alert in table view
- (modify some docs) Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -31,3 +31,11 @@
|
|||||||
|
|
||||||
These allow users to turn fields on or off, turning them all off will show the card in the most minimal form
|
These allow users to turn fields on or off, turning them all off will show the card in the most minimal form
|
||||||
|
|
||||||
|
|
||||||
|
### Statistics
|
||||||
|
|
||||||
|
- The statistics section allows users to see accumulations of both jobs on the board, and jobs in production.
|
||||||
|
- you can click a statistic to turn it on and off, and drag and drop the statistics to rearrange them
|
||||||
|
|
||||||
|
### Filters
|
||||||
|
- Allows you to set, and persist filters for estimators and insurance companies
|
||||||
|
|||||||
@@ -343,14 +343,7 @@ export default function ProductionBoardCard({ technician, card, bodyshop, cardSe
|
|||||||
const headerContent = (
|
const headerContent = (
|
||||||
<div className="header-content-container">
|
<div className="header-content-container">
|
||||||
<div className="inner-container">
|
<div className="inner-container">
|
||||||
<ProductionAlert
|
<ProductionAlert id={card.id} productionVars={metadata?.production_vars} refetch={card?.refetch} key="alert" />
|
||||||
record={{
|
|
||||||
id: card.id,
|
|
||||||
production_vars: card?.metadata.production_vars,
|
|
||||||
refetch: card?.refetch
|
|
||||||
}}
|
|
||||||
key="alert"
|
|
||||||
/>
|
|
||||||
{metadata?.suspended && <PauseCircleOutlined className="circle-outline" key="suspended" />}
|
{metadata?.suspended && <PauseCircleOutlined className="circle-outline" key="suspended" />}
|
||||||
{metadata?.iouparent && (
|
{metadata?.iouparent && (
|
||||||
<EllipsesToolTip
|
<EllipsesToolTip
|
||||||
|
|||||||
@@ -22,22 +22,23 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
const ProductionListColumnAlert = ({ record, insertAuditTrail }) => {
|
const ProductionListColumnAlert = ({ id, productionVars, refetch, insertAuditTrail }) => {
|
||||||
const [updateAlert] = useMutation(UPDATE_JOB);
|
const [updateAlert] = useMutation(UPDATE_JOB);
|
||||||
|
|
||||||
const handleAlertToggle = useCallback(() => {
|
const handleAlertToggle = useCallback(() => {
|
||||||
logImEXEvent("production_toggle_alert");
|
logImEXEvent("production_toggle_alert");
|
||||||
|
|
||||||
const newAlertState = !!record.production_vars?.alert ? !record.production_vars.alert : true;
|
const newAlertState = !!productionVars?.alert ? !productionVars?.alert : true;
|
||||||
|
const finalProductionVars = {
|
||||||
|
...productionVars,
|
||||||
|
alert: newAlertState
|
||||||
|
};
|
||||||
|
|
||||||
updateAlert({
|
updateAlert({
|
||||||
variables: {
|
variables: {
|
||||||
jobId: record.id,
|
jobId: id,
|
||||||
job: {
|
job: {
|
||||||
production_vars: {
|
production_vars: finalProductionVars
|
||||||
...record.production_vars,
|
|
||||||
alert: newAlertState
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -45,17 +46,17 @@ const ProductionListColumnAlert = ({ record, insertAuditTrail }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: record.id,
|
jobid: id,
|
||||||
operation: AuditTrailMapping.alertToggle(newAlertState),
|
operation: AuditTrailMapping.alertToggle(newAlertState),
|
||||||
type: "alertToggle"
|
type: "alertToggle"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (record.refetch) record.refetch();
|
if (refetch) refetch();
|
||||||
}, [updateAlert, insertAuditTrail, record]);
|
}, [updateAlert, insertAuditTrail, id, productionVars, refetch]);
|
||||||
|
|
||||||
if (!record.production_vars?.alert) return null;
|
return productionVars?.alert ? (
|
||||||
|
<Button className="production-alert" icon={<ExclamationCircleFilled />} onClick={handleAlertToggle} />
|
||||||
return <Button className="production-alert" icon={<ExclamationCircleFilled />} onClick={handleAlertToggle} />;
|
) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ProductionListColumnAlert);
|
export default connect(mapStateToProps, mapDispatchToProps)(ProductionListColumnAlert);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import ProductionListColumnPartsReceived from "./production-list-columns.partsre
|
|||||||
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
||||||
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionListColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
import { store } from "../../redux/store";
|
import { store } from "../../redux/store";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
@@ -349,7 +349,9 @@ const r = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatme
|
|||||||
key: "alert",
|
key: "alert",
|
||||||
sorter: (a, b) => Number(a.production_vars?.alert || false) - Number(b.production_vars?.alert || false),
|
sorter: (a, b) => Number(a.production_vars?.alert || false) - Number(b.production_vars?.alert || false),
|
||||||
sortOrder: state.sortedInfo.columnKey === "alert" && state.sortedInfo.order,
|
sortOrder: state.sortedInfo.columnKey === "alert" && state.sortedInfo.order,
|
||||||
render: (text, record) => <ProductionListColumnAlert record={{ record }} />
|
render: (text, record) => (
|
||||||
|
<ProductionListColumnAlert id={record.id} productionVars={record?.production_vars} refetch={refetch} />
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.note"),
|
title: i18n.t("production.labels.note"),
|
||||||
@@ -370,7 +372,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatme
|
|||||||
dataIndex: "tt",
|
dataIndex: "tt",
|
||||||
key: "tt",
|
key: "tt",
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return <ProductionlistColumnTouchTime job={record} />;
|
return <ProductionListColumnTouchTime job={record} />;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user