From cd29a0f61360b9a4f3581331dc799ffa854f2b4d Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 20 Jul 2022 14:39:06 -0700 Subject: [PATCH] IO-1983 Add filter to job notes table for audit. --- bodyshop_translations.babel | 42 +++++++++++++++++++ .../jobs-notes/jobs.notes.component.jsx | 20 +++++++++ client/src/translations/en_us/common.json | 4 +- client/src/translations/es/common.json | 4 +- client/src/translations/fr/common.json | 4 +- 5 files changed, 71 insertions(+), 3 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 45256e2f5..98c5c1288 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -32606,6 +32606,48 @@ + + systemnotes + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + usernotes + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/jobs-notes/jobs.notes.component.jsx b/client/src/components/jobs-notes/jobs.notes.component.jsx index 8f60e879d..4aaf95caf 100644 --- a/client/src/components/jobs-notes/jobs.notes.component.jsx +++ b/client/src/components/jobs-notes/jobs.notes.component.jsx @@ -14,6 +14,7 @@ import { selectJobReadOnly } from "../../redux/application/application.selectors import { setModalContext } from "../../redux/modals/modals.actions"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { TemplateList } from "../../utils/TemplateConstants"; +import useLocalStorage from "../../utils/useLocalStorage"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import NoteUpsertModal from "../note-upsert-modal/note-upsert-modal.container"; import PrintWrapperComponent from "../print-wrapper/print-wrapper.component"; @@ -40,6 +41,8 @@ export function JobNotesComponent({ relatedRos, }) { const { t } = useTranslation(); + const [filter, setFilter] = useLocalStorage("filter_job_notes_icons", null); + const Templates = TemplateList("job_special", { ro_number, }); @@ -50,6 +53,18 @@ export function JobNotesComponent({ dataIndex: "icons", key: "icons", width: 80, + filteredValue: filter?.icons || null, + filters: [ + { + text: t("notes.labels.usernotes"), + value: false, + }, + { + text: t("notes.labels.systemnotes"), + value: true, + }, + ], + onFilter: (value, record) => record.audit === value, render: (text, record) => ( {record.critical ? ( @@ -131,6 +146,10 @@ export function JobNotesComponent({ }, ]; + const handleTableChange = (pagination, filters, sorter) => { + setFilter(filters); + }; + return (
@@ -166,6 +185,7 @@ export function JobNotesComponent({ columns={columns} rowKey="id" dataSource={data} + onChange={handleTableChange} />
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index e639faaff..e0406f16c 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1919,7 +1919,9 @@ "labels": { "addtorelatedro": "Add to Related ROs", "newnoteplaceholder": "Add a note...", - "notetoadd": "Note to Add" + "notetoadd": "Note to Add", + "systemnotes": "System Notes", + "usernotes": "User Notes" }, "successes": { "create": "Note created successfully.", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index d0de45bf3..1d2a79972 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1919,7 +1919,9 @@ "labels": { "addtorelatedro": "", "newnoteplaceholder": "Agrega una nota...", - "notetoadd": "" + "notetoadd": "", + "systemnotes": "", + "usernotes": "" }, "successes": { "create": "Nota creada con éxito.", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index b1dfc0c2d..39b59c5ba 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1919,7 +1919,9 @@ "labels": { "addtorelatedro": "", "newnoteplaceholder": "Ajouter une note...", - "notetoadd": "" + "notetoadd": "", + "systemnotes": "", + "usernotes": "" }, "successes": { "create": "Remarque créée avec succès.",