Merged in feature/IO-1366-Audit-Logging (pull request #1114)
IO-1366 Invoice Job Audit Trail Approved-by: Dave Richer
This commit is contained in:
@@ -36,14 +36,22 @@ import JobsCloseLines from "../../components/jobs-close-lines/jobs-close-lines.c
|
|||||||
import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component";
|
||||||
import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.queries";
|
import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.queries";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@@ -110,6 +118,10 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("jobs.successes.closed"),
|
message: t("jobs.successes.closed"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobinvoiced(),
|
||||||
|
});
|
||||||
// history.push(`/manage/jobs/${job.id}`);
|
// history.push(`/manage/jobs/${job.id}`);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -527,4 +539,4 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, null)(JobsCloseComponent);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsCloseComponent);
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
"jobassignmentchange": "Employee {{name}} assigned to {{operation}}",
|
"jobassignmentchange": "Employee {{name}} assigned to {{operation}}",
|
||||||
"jobassignmentremoved": "Employee assignment removed for {{operation}}",
|
"jobassignmentremoved": "Employee assignment removed for {{operation}}",
|
||||||
"jobchecklist": "Checklist type \"{{type}}\" completed. In production set to {{inproduction}}. Status set to {{status}}.",
|
"jobchecklist": "Checklist type \"{{type}}\" completed. In production set to {{inproduction}}. Status set to {{status}}.",
|
||||||
|
"jobinvoiced": "Job has been invoiced.",
|
||||||
"jobconverted": "Job converted and assigned number {{ro_number}}.",
|
"jobconverted": "Job converted and assigned number {{ro_number}}.",
|
||||||
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
||||||
"jobimported": "Job imported.",
|
"jobimported": "Job imported.",
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
"jobassignmentchange": "",
|
"jobassignmentchange": "",
|
||||||
"jobassignmentremoved": "",
|
"jobassignmentremoved": "",
|
||||||
"jobchecklist": "",
|
"jobchecklist": "",
|
||||||
|
"jobinvoiced": "",
|
||||||
"jobconverted": "",
|
"jobconverted": "",
|
||||||
"jobfieldchanged": "",
|
"jobfieldchanged": "",
|
||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
"jobassignmentchange": "",
|
"jobassignmentchange": "",
|
||||||
"jobassignmentremoved": "",
|
"jobassignmentremoved": "",
|
||||||
"jobchecklist": "",
|
"jobchecklist": "",
|
||||||
|
"jobinvoiced": "",
|
||||||
"jobconverted": "",
|
"jobconverted": "",
|
||||||
"jobfieldchanged": "",
|
"jobfieldchanged": "",
|
||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const AuditTrailMapping = {
|
|||||||
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||||
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
||||||
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
||||||
|
jobinvoiced: () =>
|
||||||
|
i18n.t("audit_trail.messages.jobinvoiced"),
|
||||||
jobconverted: (ro_number) =>
|
jobconverted: (ro_number) =>
|
||||||
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
||||||
jobfieldchange: (field, value) =>
|
jobfieldchange: (field, value) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user