IO-1366 Additional Audit Trail Functionality
This commit is contained in:
@@ -1369,6 +1369,69 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>jobnoteadded</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>jobnotedeleted</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>jobnoteupdated</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>jobspartsorder</name>
|
<name>jobspartsorder</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -10,8 +10,21 @@ import {
|
|||||||
QUERY_NOTES_BY_JOB_PK,
|
QUERY_NOTES_BY_JOB_PK,
|
||||||
} from "../../graphql/notes.queries";
|
} from "../../graphql/notes.queries";
|
||||||
import JobNotesComponent from "./jobs.notes.component";
|
import JobNotesComponent from "./jobs.notes.component";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
export default function JobNotesContainer({ jobId }) {
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(JobNotesContainer);
|
||||||
|
|
||||||
|
export function JobNotesContainer({ jobId, insertAuditTrail }) {
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_NOTES_BY_JOB_PK, {
|
const { loading, error, data, refetch } = useQuery(QUERY_NOTES_BY_JOB_PK, {
|
||||||
variables: { id: jobId },
|
variables: { id: jobId },
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
@@ -32,6 +45,10 @@ export default function JobNotesContainer({ jobId }) {
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("notes.successes.deleted"),
|
message: t("notes.successes.deleted"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: AuditTrailMapping.jobnotedeleted(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
setDeleteLoading(false);
|
setDeleteLoading(false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { selectNoteUpsert } from "../../redux/modals/modals.selectors";
|
|||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
import NoteUpsertModalComponent from "./note-upsert-modal.component";
|
import NoteUpsertModalComponent from "./note-upsert-modal.component";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -17,12 +19,15 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("noteUpsert")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("noteUpsert")),
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function NoteUpsertModalContainer({
|
export function NoteUpsertModalContainer({
|
||||||
currentUser,
|
currentUser,
|
||||||
noteUpsertModal,
|
noteUpsertModal,
|
||||||
toggleModalVisible,
|
toggleModalVisible,
|
||||||
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [insertNote] = useMutation(INSERT_NEW_NOTE);
|
const [insertNote] = useMutation(INSERT_NEW_NOTE);
|
||||||
@@ -56,6 +61,10 @@ export function NoteUpsertModalContainer({
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("notes.successes.updated"),
|
message: t("notes.successes.updated"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: context.jobId,
|
||||||
|
operation: AuditTrailMapping.jobnoteupdated(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
if (refetch) refetch();
|
if (refetch) refetch();
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
@@ -75,6 +84,10 @@ export function NoteUpsertModalContainer({
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("notes.successes.create"),
|
message: t("notes.successes.create"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: context.jobId,
|
||||||
|
operation: AuditTrailMapping.jobnoteadded(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,6 +96,9 @@
|
|||||||
"jobimported": "Job imported.",
|
"jobimported": "Job imported.",
|
||||||
"jobinproductionchange": "Job production status set to {{inproduction}}",
|
"jobinproductionchange": "Job production status set to {{inproduction}}",
|
||||||
"jobmodifylbradj": "Labor adjustments modified.",
|
"jobmodifylbradj": "Labor adjustments modified.",
|
||||||
|
"jobnoteadded": "Note added to job.",
|
||||||
|
"jobnotedeleted": "Note deleted from job.",
|
||||||
|
"jobnoteupdated": "Note updated on job.",
|
||||||
"jobspartsorder": "Parts order {{order_number}} added to job.",
|
"jobspartsorder": "Parts order {{order_number}} added to job.",
|
||||||
"jobspartsreturn": "Parts return {{order_number}} added to job.",
|
"jobspartsreturn": "Parts return {{order_number}} added to job.",
|
||||||
"jobstatuschange": "Job status changed to {{status}}.",
|
"jobstatuschange": "Job status changed to {{status}}.",
|
||||||
|
|||||||
@@ -96,6 +96,9 @@
|
|||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
"jobinproductionchange": "",
|
"jobinproductionchange": "",
|
||||||
"jobmodifylbradj": "",
|
"jobmodifylbradj": "",
|
||||||
|
"jobnoteadded": "",
|
||||||
|
"jobnotedeleted": "",
|
||||||
|
"jobnoteupdated": "",
|
||||||
"jobspartsorder": "",
|
"jobspartsorder": "",
|
||||||
"jobspartsreturn": "",
|
"jobspartsreturn": "",
|
||||||
"jobstatuschange": "",
|
"jobstatuschange": "",
|
||||||
|
|||||||
@@ -96,6 +96,9 @@
|
|||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
"jobinproductionchange": "",
|
"jobinproductionchange": "",
|
||||||
"jobmodifylbradj": "",
|
"jobmodifylbradj": "",
|
||||||
|
"jobnoteadded": "",
|
||||||
|
"jobnotedeleted": "",
|
||||||
|
"jobnoteupdated": "",
|
||||||
"jobspartsorder": "",
|
"jobspartsorder": "",
|
||||||
"jobspartsreturn": "",
|
"jobspartsreturn": "",
|
||||||
"jobstatuschange": "",
|
"jobstatuschange": "",
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ const AuditTrailMapping = {
|
|||||||
i18n.t("audit_trail.messages.jobinproductionchange", { inproduction }),
|
i18n.t("audit_trail.messages.jobinproductionchange", { inproduction }),
|
||||||
jobchecklist: (type, inproduction, status) =>
|
jobchecklist: (type, inproduction, status) =>
|
||||||
i18n.t("audit_trail.messages.jobchecklist", { type, inproduction, status }),
|
i18n.t("audit_trail.messages.jobchecklist", { type, inproduction, status }),
|
||||||
|
jobnoteadded: () => i18n.t("audit_trail.messages.jobnoteadded"),
|
||||||
|
jobnoteupdated: () => i18n.t("audit_trail.messages.jobnoteupdated"),
|
||||||
|
jobnotedeleted: () => i18n.t("audit_trail.messages.jobnotedeleted"),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AuditTrailMapping;
|
export default AuditTrailMapping;
|
||||||
|
|||||||
Reference in New Issue
Block a user