From 44572ee2d01a52f90bd6c1146c59ffc47e4ee7e2 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 5 Oct 2020 10:16:07 -0700 Subject: [PATCH] Changed job searching function BOD-311 --- .../jira-support-widget.component.jsx | 29 ++++++++++++++ .../job-reconciliation-totals.component.jsx | 4 +- client/src/graphql/jobs.queries.js | 7 +++- .../src/pages/jobs-all/jobs-all.container.jsx | 2 +- .../pages/manage/manage.page.component.jsx | 7 +++- .../1601917532118_run_sql_migration/down.yaml | 1 + .../1601917532118_run_sql_migration/up.yaml | 40 +++++++++++++++++++ 7 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 client/src/components/jira-support-widget/jira-support-widget.component.jsx create mode 100644 hasura/migrations/1601917532118_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1601917532118_run_sql_migration/up.yaml diff --git a/client/src/components/jira-support-widget/jira-support-widget.component.jsx b/client/src/components/jira-support-widget/jira-support-widget.component.jsx new file mode 100644 index 000000000..d10be3447 --- /dev/null +++ b/client/src/components/jira-support-widget/jira-support-widget.component.jsx @@ -0,0 +1,29 @@ +import React, { useEffect } from "react"; + +export default function JiraSupportComponent() { + useEffect(() => { + const script = document.createElement("script"); + + script.src = "https://jsd-widget.atlassian.com/assets/embed.js"; + // script.attributes.setNamedItem({ "data-jsd-embedded": true }); + // script.attributes.setNamedItem({ + // "data-key": "d69bb65c-1dd3-483f-b109-66a970d03f44", + // }); + // script.attributes.setNamedItem({ + // "data-base-url": "https://jsd-widget.atlassian.com", + // }); + + // script["data-jsd-embedded"] = true; + // script["data-key"] = "d69bb65c-1dd3-483f-b109-66a970d03f44"; + // script["data-base-url"] = "https://jsd-widget.atlassian.com"; + script.async = true; + + document.body.appendChild(script); + + return () => { + document.body.removeChild(script); + }; + }, []); + + return
JIra
; +} diff --git a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx index 0604591d7..c4e290837 100644 --- a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx +++ b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx @@ -16,8 +16,8 @@ export default function JobReconciliationTotals({ }) { const [errors, setErrors] = useState([]); const { t } = useTranslation(); - const [selectedBillLines, setSelectedBillLines] = billLineState; - const [selectedJobLines, setSelectedJobLines] = jobLineState; + const selectedBillLines = billLineState[0]; + const selectedJobLines = jobLineState[0]; const totals = useMemo(() => { const jlLookup = _.keyBy(selectedJobLines, (i) => i); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index ba29433f3..17e653bfc 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -2,7 +2,10 @@ import gql from "graphql-tag"; export const QUERY_ALL_ACTIVE_JOBS = gql` query QUERY_ALL_ACTIVE_JOBS($statuses: [String!]!) { - jobs(where: { status: { _in: $statuses } }) { + jobs( + where: { status: { _in: $statuses } } + order_by: { est_number: desc } + ) { ownr_fn ownr_ln ownr_ph1 @@ -1108,7 +1111,7 @@ export const QUERY_ALL_JOBS_PAGINATED = gql` $search: String $offset: Int $limit: Int - $order: [jobs_order_by!]! + $order: [jobs_order_by!] ) { search_jobs( args: { search: $search } diff --git a/client/src/pages/jobs-all/jobs-all.container.jsx b/client/src/pages/jobs-all/jobs-all.container.jsx index adede96b4..9cd387f0b 100644 --- a/client/src/pages/jobs-all/jobs-all.container.jsx +++ b/client/src/pages/jobs-all/jobs-all.container.jsx @@ -32,7 +32,7 @@ export function AllJobs({ setBreadcrumbs, setSelectedHeader }) { search: search || "", offset: page ? (page - 1) * 25 : 0, limit: 25, - order: [ + order: sortcolumn && [ { [sortcolumn || "est_number"]: sortorder ? sortorder === "descend" diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 9d8b11dd0..8239e793d 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -15,12 +15,13 @@ import FcmNotification from "../../components/fcm-notification/fcm-notification. //import FooterComponent from "../../components/footer/footer.component"; //Component Imports import HeaderContainer from "../../components/header/header.container"; +import JiraSupportComponent from "../../components/jira-support-widget/jira-support-widget.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container"; +import TestComponent from "../../components/_test/test.component"; import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries"; import { selectInstanceConflict } from "../../redux/user/user.selectors"; import "./manage.page.styles.scss"; -import TestComponent from "../../components/_test/test.component"; const ManageRootPage = lazy(() => import("../manage-root/manage-root.page.container") @@ -365,12 +366,14 @@ export function Manage({ match, conflict }) { )} +
{`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}
- © 2019 - {new Date().getFullYear()} Snapt Software Inc.{" "} + © 2019 - {new Date().getFullYear()} Snapt Software Inc.
+
diff --git a/hasura/migrations/1601917532118_run_sql_migration/down.yaml b/hasura/migrations/1601917532118_run_sql_migration/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1601917532118_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1601917532118_run_sql_migration/up.yaml b/hasura/migrations/1601917532118_run_sql_migration/up.yaml new file mode 100644 index 000000000..2bc705db9 --- /dev/null +++ b/hasura/migrations/1601917532118_run_sql_migration/up.yaml @@ -0,0 +1,40 @@ +- args: + cascade: true + read_only: false + sql: |- + CREATE OR REPLACE FUNCTION public.search_jobs(search text) RETURNS SETOF jobs LANGUAGE plpgsql STABLE AS $function$ BEGIN if search = '' then return query + select * + from jobs j; + else return query + SELECT * + FROM jobs j2 + WHERE ro_number ILIKE '%' || search || '%' + OR (cast(est_number as text)) ILIKE '%' || search || '%' + or ownr_fn ILIKE '%' || search || '%' + or ownr_ln ILIKE '%' || search || '%' + or ownr_co_nm ILIKE '%' || search || '%' + or clm_no ILIKE '%' || search || '%' + or v_make_desc ILIKE '%' || search || '%' + or v_model_desc ILIKE '%' || search || '%' + OR plate_no ILIKE '%' || search || '%' + ORDER BY ro_number ILIKE '%' || search || '%' + OR NULL, + (cast(est_number as text)) ILIKE '%' || search || '%' + OR NULL, + ownr_ln ILIKE '%' || search || '%' + OR null, + ownr_co_nm ILIKE '%' || search || '%' + OR NULL, + ownr_fn ILIKE '%' || search || '%' + OR NULL, + clm_no ILIKE '%' || search || '%' + OR NULL, + v_make_desc ILIKE '%' || search || '%' + OR NULL, + v_model_desc ILIKE '%' || search || '%' + OR NULL, + plate_no ILIKE '%' || search || '%' + OR NULL; + end if; + END $function$; + type: run_sql