IO-992 WIP Job Audits
This commit is contained in:
@@ -16,16 +16,20 @@ import {
|
||||
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
||||
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
||||
import moment from "moment-business-days";
|
||||
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
||||
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
insertAuditTrail: ({ jobid, operation }) =>
|
||||
dispatch(insertAuditTrail({ jobid, operation })),
|
||||
});
|
||||
|
||||
export function JobChecklistForm({
|
||||
insertAuditTrail,
|
||||
formItems,
|
||||
bodyshop,
|
||||
currentUser,
|
||||
@@ -60,10 +64,11 @@ export function JobChecklistForm({
|
||||
...job.production_vars,
|
||||
...values.production_vars,
|
||||
note:
|
||||
values.production_vars &&
|
||||
values.production_vars.note &&
|
||||
values.production_vars.note !== ""
|
||||
? values.production_vars.note
|
||||
: job.production_vars.note,
|
||||
? job.production_vars && values.production_vars.note
|
||||
: job.production_vars && job.production_vars.note,
|
||||
},
|
||||
}),
|
||||
...(type === "intake" && {
|
||||
@@ -114,6 +119,17 @@ export function JobChecklistForm({
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("checklist.successes.completed") });
|
||||
history.push(`/manage/jobs/${jobId}`);
|
||||
|
||||
insertAuditTrail({
|
||||
jobid: jobId,
|
||||
operation: AuditTrailMapping.jobchecklist(
|
||||
type,
|
||||
(type === "deliver" && values.removeFromProduction && false) ||
|
||||
(type === "intake" && values.addToProduction),
|
||||
(type === "intake" && bodyshop.md_ro_statuses.default_arrived) ||
|
||||
(type === "deliver" && bodyshop.md_ro_statuses.default_delivered)
|
||||
),
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("checklist.errors.complete", {
|
||||
|
||||
Reference in New Issue
Block a user