From d0d4ceb270d12e666857d5412a9687f6f196b2c8 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 27 Jun 2022 12:46:29 -0700 Subject: [PATCH 01/20] IO-1958 IO-1884 Vehicle card updates. --- .../jobs-detail-header.component.jsx | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index 763246908..2fb735827 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -217,21 +217,24 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) { {job.vehicle && job.vehicle.notes && ( - - {job.vehicle.notes} + + {job.vehicle.notes} + + )} + {job.vehicle && job.vehicle.v_paint_codes && ( + + + {Object.keys(job.vehicle.v_paint_codes).map((key, idx) => ( + {job.vehicle.v_paint_codes[key]} + ))} + )} - { - // job.vehicle && job.vehicle.v_paint_codes && ( - // - // - // {Object.keys(job.vehicle.v_paint_codes).map((key, idx) => ( - // {job.vehicle.v_paint_codes[key]} - // ))} - // - // - // ) - } From acf99584ea2c28df5bdc59ac65ac7269c58fdb76 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 27 Jun 2022 13:06:14 -0700 Subject: [PATCH 02/20] IO-1947 Remember parts queue filter status. --- .../parts-queue.page.component.jsx | 5 ++- client/src/utils/useLocalStorage.js | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 client/src/utils/useLocalStorage.js diff --git a/client/src/pages/parts-queue/parts-queue.page.component.jsx b/client/src/pages/parts-queue/parts-queue.page.component.jsx index 492ee1955..7f0bbf23c 100644 --- a/client/src/pages/parts-queue/parts-queue.page.component.jsx +++ b/client/src/pages/parts-queue/parts-queue.page.component.jsx @@ -17,6 +17,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import { onlyUnique } from "../../utils/arrayHelper"; import { DateTimeFormatter, TimeAgoFormatter } from "../../utils/DateFormatter"; import { alphaSort, dateSort } from "../../utils/sorters"; +import useLocalStorage from "../../utils/useLocalStorage"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -31,6 +32,7 @@ export function PartsQueuePageComponent({ bodyshop }) { statusFilters, } = searchParams; const history = useHistory(); + const [filter, setFilter] = useLocalStorage("filter_parts_queue", null); const { loading, error, data, refetch } = useQuery(QUERY_PARTS_QUEUE, { fetchPolicy: "network-only", @@ -92,7 +94,7 @@ export function PartsQueuePageComponent({ bodyshop }) { // searchParams.page = pagination.current; searchParams.sortcolumn = sorter.columnKey; searchParams.sortorder = sorter.order; - + setFilter(filters); history.push({ search: queryString.stringify(searchParams) }); }; @@ -247,6 +249,7 @@ export function PartsQueuePageComponent({ bodyshop }) { key: "queued_for_parts", sorter: (a, b) => a.queued_for_parts - b.queued_for_parts, sortOrder: sortcolumn === "queued_for_parts" && sortorder, + filteredValue: filter.queued_for_parts || null, filters: [ { text: "Queued", diff --git a/client/src/utils/useLocalStorage.js b/client/src/utils/useLocalStorage.js new file mode 100644 index 000000000..f56121d3b --- /dev/null +++ b/client/src/utils/useLocalStorage.js @@ -0,0 +1,40 @@ +import { useState } from "react"; + +export default function useLocalStorage(key, initialValue) { + // State to store our value + // Pass initial state function to useState so logic is only executed once + const [storedValue, setStoredValue] = useState(() => { + if (typeof window === "undefined") { + return initialValue; + } + try { + // Get from local storage by key + const item = window.localStorage.getItem(key); + // Parse stored json or if none return initialValue + return item ? JSON.parse(item) : initialValue; + } catch (error) { + // If error also return initialValue + console.log(error); + return initialValue; + } + }); + // Return a wrapped version of useState's setter function that ... + // ... persists the new value to localStorage. + const setValue = (value) => { + try { + // Allow value to be a function so we have same API as useState + const valueToStore = + value instanceof Function ? value(storedValue) : value; + // Save state + setStoredValue(valueToStore); + // Save to local storage + if (typeof window !== "undefined") { + window.localStorage.setItem(key, JSON.stringify(valueToStore)); + } + } catch (error) { + // A more advanced implementation would handle the error case + console.log(error); + } + }; + return [storedValue, setValue]; +} From 974a0ec1f17dfc31ef60dc2fcf13b9a63db44e06 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 27 Jun 2022 13:42:48 -0700 Subject: [PATCH 03/20] IO-1951 Added quote for OEC orders. --- bodyshop_translations.babel | 44 ++++++++++- .../parts-order-modal.component.jsx | 46 +++++++++--- .../parts-order-modal.container.jsx | 74 ++++++++++--------- .../shop-info.orderstatus.component.jsx | 37 +++++++++- client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + 7 files changed, 160 insertions(+), 47 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 1193d038a..67e97ec5a 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1,4 +1,4 @@ - +