From 1cdedac0a88e34f7e0181a89bc4d2e3aae0484f3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 28 Jan 2020 14:01:18 -0800 Subject: [PATCH 1/8] Added jobs available screens for new and supplement jobs. --- README.MD | 2 +- bodyshop_translations.babel | 147 ++++++++++++++ .../components/header/header.container.jsx | 53 +++-- .../jobs-available-new.component.jsx | 180 ++++++++++++++++ .../jobs-available-new.container.jsx | 28 +++ .../jobs-available-supplement.component.jsx | 192 ++++++++++++++++++ .../jobs-available-supplement.container.jsx | 31 +++ client/src/graphql/available-jobs.queries.js | 72 +++++++ .../jobs-available.page.component.jsx | 16 +- client/src/translations/en_us/common.json | 7 + client/src/translations/es/common.json | 7 + client/src/translations/fr/common.json | 7 + client/src/utils/DateFormatter.jsx | 10 + .../down.yaml | 3 + .../up.yaml | 25 +++ .../down.yaml | 24 +++ .../up.yaml | 40 ++++ .../down.yaml | 6 + .../up.yaml | 37 ++++ .../down.yaml | 6 + .../up.yaml | 34 ++++ .../down.yaml | 6 + .../up.yaml | 21 ++ .../down.yaml | 6 + .../up.yaml | 16 ++ 25 files changed, 942 insertions(+), 34 deletions(-) create mode 100644 client/src/components/jobs-available-new/jobs-available-new.component.jsx create mode 100644 client/src/components/jobs-available-new/jobs-available-new.container.jsx create mode 100644 client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx create mode 100644 client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx create mode 100644 client/src/graphql/available-jobs.queries.js create mode 100644 client/src/utils/DateFormatter.jsx create mode 100644 hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml create mode 100644 hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml create mode 100644 hasura/migrations/1580237346108_track_all_relationships/down.yaml create mode 100644 hasura/migrations/1580237346108_track_all_relationships/up.yaml create mode 100644 hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml create mode 100644 hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml create mode 100644 hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml create mode 100644 hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml create mode 100644 hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml create mode 100644 hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml create mode 100644 hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml create mode 100644 hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml diff --git a/README.MD b/README.MD index 560bb2d4b..6e060741a 100644 --- a/README.MD +++ b/README.MD @@ -9,4 +9,4 @@ To Start Hasura CLI: npx hasura console --admin-secret Dev-BodyShopAppBySnaptSoftware! Migrating to Staging: -npx hasura migrate apply --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware! \ No newline at end of file +npx hasura migrate apply --up 10 --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware! \ No newline at end of file diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index a8e589448..e34457cbc 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -217,6 +217,27 @@ labels + + actions + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + in false @@ -557,6 +578,27 @@ errors + + deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + noaccess false @@ -814,6 +856,27 @@ + + cieca_id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + claim_total false @@ -2074,6 +2137,48 @@ + + updated_at + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + uploaded_by + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + vehicle false @@ -2488,6 +2593,27 @@ successes + + all_deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + converted false @@ -2509,6 +2635,27 @@ + + deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + save false diff --git a/client/src/components/header/header.container.jsx b/client/src/components/header/header.container.jsx index d2081292c..db3d0e9f2 100644 --- a/client/src/components/header/header.container.jsx +++ b/client/src/components/header/header.container.jsx @@ -1,46 +1,45 @@ import React from "react"; import "./header.styles.scss"; import { useQuery } from "react-apollo"; -import { - GET_LANDING_NAV_ITEMS, - GET_NAV_ITEMS -} from "../../graphql/metadata.queries"; +// //import { +// GET_LANDING_NAV_ITEMS, +// GET_NAV_ITEMS +// } from "../../graphql/metadata.queries"; import { GET_CURRENT_SELECTED_NAV_ITEM } from "../../graphql/local.queries"; -import LoadingSpinner from "../loading-spinner/loading-spinner.component"; -import AlertComponent from "../alert/alert.component"; +//import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +//import AlertComponent from "../alert/alert.component"; import HeaderComponent from "./header.component"; export default ({ landingHeader, signedIn }) => { const hookSelectedNavItem = useQuery(GET_CURRENT_SELECTED_NAV_ITEM); - let hookNavItems; - if (landingHeader) { - hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, { - fetchPolicy: "network-only" - }); - } else { - hookNavItems = useQuery(GET_NAV_ITEMS, { - fetchPolicy: "network-only" - }); - } + // let hookNavItems; + // if (landingHeader) { + // hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, { + // fetchPolicy: "network-only" + // }); + // } else { + // hookNavItems = useQuery(GET_NAV_ITEMS, { + // fetchPolicy: "network-only" + // }); + // } - if (hookNavItems.loading || hookSelectedNavItem.loading) - return ; - if (hookNavItems.error) - return ; - if (hookSelectedNavItem.error) - return console.log( - "Unable to load Selected Navigation Item.", - hookSelectedNavItem.error - ); + // if (hookNavItems.loading || hookSelectedNavItem.loading) + // return ; + // if (hookNavItems.error) + // return ; + // if (hookSelectedNavItem.error) + // return console.log( + // "Unable to load Selected Navigation Item.", + // hookSelectedNavItem.error + // ); const { selectedNavItem } = hookSelectedNavItem.data; - const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value); + // const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value); return ( ); diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx new file mode 100644 index 000000000..76db9474e --- /dev/null +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -0,0 +1,180 @@ +import { Input, Table, Button, Icon, notification } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { alphaSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +export default function JobsAvailableComponent({ + loading, + data, + refetch, + deleteJob, + deleteAllNewJobs +}) { + const { t } = useTranslation(); + + const [state, setState] = useState({ + sortedInfo: {}, + filteredInfo: { text: "" } + }); + + const handleTableChange = (pagination, filters, sorter) => { + setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); + }; + + const columns = [ + { + title: t("jobs.fields.cieca_id"), + dataIndex: "cieca_id", + key: "cieca_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + }, + { + title: t("jobs.fields.owner"), + dataIndex: "ownr_name", + key: "ownr_name", + ellipsis: true, + sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), + //width: "25%", + sortOrder: + state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + }, + { + title: t("jobs.fields.vehicle"), + dataIndex: "vehicle_info", + key: "vehicle_info", + sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), + sortOrder: + state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + //ellipsis: true + }, + { + title: t("jobs.fields.clm_no"), + dataIndex: "clm_no", + key: "clm_no", + sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + sortOrder: + state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.clm_total"), + dataIndex: "clm_amt", + key: "clm_amt", + sorter: (a, b) => a.clm_amt - b.clm_amt, + sortOrder: + state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.uploaded_by"), + dataIndex: "uploaded_by", + key: "uploaded_by", + sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), + sortOrder: + state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.updated_at"), + dataIndex: "updated_at", + key: "updated_at", + sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at), + sortOrder: + state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order, + render: (text, record) => ( + {record.updated_at} + ) + //width: "12%", + //ellipsis: true + }, + { + title: t("general.labels.actions"), + key: "actions", + render: (text, record) => ( + + + + + ) + //width: "12%", + //ellipsis: true + } + ]; + + return ( + { + return ( +
+ { + console.log(value); + }} + enterButton + /> + + +
+ ); + }} + size="small" + pagination={{ position: "top" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={data && data.available_jobs} + onChange={handleTableChange} + /> + ); +} diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx new file mode 100644 index 000000000..7f0de5e68 --- /dev/null +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -0,0 +1,28 @@ +import React from "react"; +import { useQuery, useMutation } from "react-apollo"; +import { + QUERY_AVAILABLE_NEW_JOBS, + DELETE_AVAILABLE_JOB, + DELETE_ALL_AVAILABLE_NEW_JOBS +} from "../../graphql/available-jobs.queries"; +import AlertComponent from "../alert/alert.component"; +import JobsAvailableComponent from "./jobs-available-new.component"; + +export default function JobsAvailableContainer() { + const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_NEW_JOBS, { + fetchPolicy: "network-only" + }); + const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_NEW_JOBS); + + if (error) return ; + return ( + + ); +} diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx new file mode 100644 index 000000000..f5e5d9793 --- /dev/null +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx @@ -0,0 +1,192 @@ +import { Input, Table, Button, Icon, notification } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { alphaSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +export default function JobsAvailableSupplementComponent({ + loading, + data, + refetch, + deleteJob, + deleteAllNewJobs +}) { + const { t } = useTranslation(); + + const [state, setState] = useState({ + sortedInfo: {}, + filteredInfo: { text: "" } + }); + + const handleTableChange = (pagination, filters, sorter) => { + setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); + }; + + const columns = [ + { + title: t("jobs.fields.cieca_id"), + dataIndex: "cieca_id", + key: "cieca_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + }, + { + title: t("jobs.fields.ro_number"), + dataIndex: "job_id", + key: "job_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order, + render: (text, record) =>
{record.job && record.job.ro_number}
+ }, + { + title: t("jobs.fields.owner"), + dataIndex: "ownr_name", + key: "ownr_name", + ellipsis: true, + sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), + //width: "25%", + sortOrder: + state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + }, + { + title: t("jobs.fields.vehicle"), + dataIndex: "vehicle_info", + key: "vehicle_info", + sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), + sortOrder: + state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + //ellipsis: true + }, + { + title: t("jobs.fields.clm_no"), + dataIndex: "clm_no", + key: "clm_no", + sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + sortOrder: + state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.clm_total"), + dataIndex: "clm_amt", + key: "clm_amt", + sorter: (a, b) => a.clm_amt - b.clm_amt, + sortOrder: + state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.uploaded_by"), + dataIndex: "uploaded_by", + key: "uploaded_by", + sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), + sortOrder: + state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.updated_at"), + dataIndex: "updated_at", + key: "updated_at", + sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at), + sortOrder: + state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order, + render: (text, record) => ( + {record.updated_at} + ) + //width: "12%", + //ellipsis: true + }, + { + title: t("general.labels.actions"), + key: "actions", + render: (text, record) => ( + + + + + ) + //width: "12%", + //ellipsis: true + } + ]; + + return ( +
{ + return ( +
+ { + console.log(value); + }} + enterButton + /> + + +
+ ); + }} + size="small" + pagination={{ position: "top" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={data && data.available_jobs} + onChange={handleTableChange} + /> + ); +} diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx new file mode 100644 index 000000000..661edbfb0 --- /dev/null +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx @@ -0,0 +1,31 @@ +import React from "react"; +import { useQuery, useMutation } from "react-apollo"; +import { + QUERY_AVAILABLE_SUPPLEMENT_JOBS, + DELETE_AVAILABLE_JOB, + DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS +} from "../../graphql/available-jobs.queries"; +import AlertComponent from "../alert/alert.component"; +import JobsAvailableSupplementComponent from "./jobs-available-supplement.component"; + +export default function JobsAvailableSupplementContainer() { + const { loading, error, data, refetch } = useQuery( + QUERY_AVAILABLE_SUPPLEMENT_JOBS, + { + fetchPolicy: "network-only" + } + ); + const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS); + + if (error) return ; + return ( + + ); +} diff --git a/client/src/graphql/available-jobs.queries.js b/client/src/graphql/available-jobs.queries.js new file mode 100644 index 000000000..de5c5469c --- /dev/null +++ b/client/src/graphql/available-jobs.queries.js @@ -0,0 +1,72 @@ +import { gql } from "apollo-boost"; + +export const QUERY_AVAILABLE_NEW_JOBS = gql` + query QUERY_AVAILABLE_NEW_JOBS { + available_jobs( + where: { issupplement: { _eq: false } } + order_by: { updated_at: desc } + ) { + cieca_id + clm_amt + clm_no + created_at + id + issupplement + ownr_name + source_system + supplement_number + updated_at + uploaded_by + vehicle_info + } + } +`; + +export const QUERY_AVAILABLE_SUPPLEMENT_JOBS = gql` + query QUERY_AVAILABLE_SUPPLEMENT_JOBS { + available_jobs( + where: { issupplement: { _eq: true } } + order_by: { updated_at: desc } + ) { + cieca_id + clm_amt + clm_no + created_at + id + issupplement + ownr_name + source_system + supplement_number + updated_at + uploaded_by + vehicle_info + job { + ro_number + } + } + } +`; + +export const DELETE_AVAILABLE_JOB = gql` + mutation DELETE_AVAILABLE_JOB($id: uuid) { + delete_available_jobs(where: { id: { _eq: $id } }) { + affected_rows + } + } +`; + +export const DELETE_ALL_AVAILABLE_NEW_JOBS = gql` + mutation DELETE_ALL_AVAILABLE_NEW_JOBS { + delete_available_jobs(where: { issupplement: { _eq: false } }) { + affected_rows + } + } +`; + +export const DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS = gql` + mutation DELETE_ALL_AVAILABLE_NEW_JOBS { + delete_available_jobs(where: { issupplement: { _eq: true } }) { + affected_rows + } + } +`; diff --git a/client/src/pages/jobs-available/jobs-available.page.component.jsx b/client/src/pages/jobs-available/jobs-available.page.component.jsx index 9dc5b81fe..7afa216f4 100644 --- a/client/src/pages/jobs-available/jobs-available.page.component.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.component.jsx @@ -1,9 +1,13 @@ -import React from 'react' +import React from "react"; +import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container"; +import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container"; export default function JobsAvailablePageComponent() { - return ( -
- JobsAvailablePageComponent -
- ) + return ( +
+ + + +
+ ); } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 7684ebab6..345a74077 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -20,6 +20,7 @@ "reset": "Reset to original." }, "labels": { + "actions": "Actions", "in": "In", "loading": "Loading...", "na": "N/A", @@ -45,6 +46,7 @@ "printCenter": "Print Center" }, "errors": { + "deleted": "Error deleting job.", "noaccess": "This job does not exist or you do not have access to it.", "nodates": "No dates specified for this job.", "nojobselected": "No job is selected.", @@ -59,6 +61,7 @@ "actual_delivery": "Actual Delivery", "actual_in": "Actual In", "adjustment_bottom_line": "Adjustments", + "cieca_id": "CIECA ID", "claim_total": "Claim Total", "clm_no": "Claim #", "clm_total": "Claim Total", @@ -119,6 +122,8 @@ "storage_payable": "Storage/PVRT", "towing_payable": "Towing Payable", "unitnumber": "Unit #", + "updated_at": "Updated At", + "uploaded_by": "Uploaded By", "vehicle": "Vehicle" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Vehicle" }, "successes": { + "all_deleted": "{{count}} jobs deleted successfully.", "converted": "Job converted successfully.", + "deleted": "Job deleted successfully.", "save": "Record Saved", "savetitle": "Record saved successfully." } diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index a3583f1cc..2a5f5e741 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -20,6 +20,7 @@ "reset": "Restablecer a original." }, "labels": { + "actions": "Comportamiento", "in": "en", "loading": "Cargando...", "na": "N / A", @@ -45,6 +46,7 @@ "printCenter": "Centro de impresión" }, "errors": { + "deleted": "Error al eliminar el trabajo.", "noaccess": "Este trabajo no existe o no tiene acceso a él.", "nodates": "No hay fechas especificadas para este trabajo.", "nojobselected": "No hay trabajo seleccionado.", @@ -59,6 +61,7 @@ "actual_delivery": "Entrega real", "actual_in": "Real en", "adjustment_bottom_line": "Ajustes", + "cieca_id": "CIECA ID", "claim_total": "Reclamar total", "clm_no": "Reclamación #", "clm_total": "Reclamar total", @@ -119,6 +122,8 @@ "storage_payable": "Almacenamiento / PVRT", "towing_payable": "Remolque a pagar", "unitnumber": "Unidad #", + "updated_at": "Actualizado en", + "uploaded_by": "Subido por", "vehicle": "Vehículo" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Vehículo" }, "successes": { + "all_deleted": "{{count}} trabajos eliminados con éxito.", "converted": "Trabajo convertido con éxito.", + "deleted": "Trabajo eliminado con éxito.", "save": "Registro guardado", "savetitle": "Registro guardado con éxito." } diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1dc6386ef..48558307f 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -20,6 +20,7 @@ "reset": "Rétablir l'original." }, "labels": { + "actions": "actes", "in": "dans", "loading": "Chargement...", "na": "N / A", @@ -45,6 +46,7 @@ "printCenter": "Centre d'impression" }, "errors": { + "deleted": "Erreur lors de la suppression du travail.", "noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.", "nodates": "Aucune date spécifiée pour ce travail.", "nojobselected": "Aucun travail n'est sélectionné.", @@ -59,6 +61,7 @@ "actual_delivery": "Livraison réelle", "actual_in": "En réel", "adjustment_bottom_line": "Ajustements", + "cieca_id": "CIECA ID", "claim_total": "Total réclamation", "clm_no": "Prétendre #", "clm_total": "Total réclamation", @@ -119,6 +122,8 @@ "storage_payable": "Stockage / PVRT", "towing_payable": "Remorquage à payer", "unitnumber": "Unité #", + "updated_at": "Mis à jour à", + "uploaded_by": "Telechargé par", "vehicle": "Véhicule" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Véhicule" }, "successes": { + "all_deleted": "{{count}} travaux supprimés avec succès.", "converted": "Travail converti avec succès.", + "deleted": "Le travail a bien été supprimé.", "save": "Enregistrement enregistré", "savetitle": "Enregistrement enregistré avec succès." } diff --git a/client/src/utils/DateFormatter.jsx b/client/src/utils/DateFormatter.jsx new file mode 100644 index 000000000..4d860662d --- /dev/null +++ b/client/src/utils/DateFormatter.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import Moment from "react-moment"; + +export function DateFormatter(props) { + return {props.children || ""}; +} + +export function DateTimeFormatter(props) { + return {props.children || ""}; +} diff --git a/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml b/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml new file mode 100644 index 000000000..06b5056e9 --- /dev/null +++ b/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: DROP TABLE "public"."available_jobs" + type: run_sql diff --git a/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml b/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml new file mode 100644 index 000000000..d75401021 --- /dev/null +++ b/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml @@ -0,0 +1,25 @@ +- args: + sql: CREATE EXTENSION IF NOT EXISTS pgcrypto; + type: run_sql +- args: + sql: "CREATE TABLE \"public\".\"available_jobs\"(\"id\" uuid NOT NULL DEFAULT + gen_random_uuid(), \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" + timestamptz NOT NULL DEFAULT now(), \"uploaded_by\" text NOT NULL, \"cieca_id\" + text NOT NULL, \"bodyshopid\" uuid NOT NULL, \"est_data\" jsonb NOT NULL, \"issupplement\" + boolean NOT NULL DEFAULT false, \"jobid\" uuid, \"supplement_number\" integer, + \"ownr_name\" text, \"vehicle_info\" text, \"clm_amt\" numeric, \"clm_no\" text, + \"source_system\" text, PRIMARY KEY (\"id\") , FOREIGN KEY (\"bodyshopid\") + REFERENCES \"public\".\"bodyshops\"(\"id\") ON UPDATE cascade ON DELETE cascade, + FOREIGN KEY (\"jobid\") REFERENCES \"public\".\"jobs\"(\"id\") ON UPDATE restrict + ON DELETE cascade);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS + TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\" + = NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_available_jobs_updated_at\"\nBEFORE + UPDATE ON \"public\".\"available_jobs\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT + ON TRIGGER \"set_public_available_jobs_updated_at\" ON \"public\".\"available_jobs\" + \nIS 'trigger to set value of column \"updated_at\" to current timestamp on + row update';\n" + type: run_sql +- args: + name: available_jobs + schema: public + type: add_existing_table_or_view diff --git a/hasura/migrations/1580237346108_track_all_relationships/down.yaml b/hasura/migrations/1580237346108_track_all_relationships/down.yaml new file mode 100644 index 000000000..d0e83782e --- /dev/null +++ b/hasura/migrations/1580237346108_track_all_relationships/down.yaml @@ -0,0 +1,24 @@ +- args: + relationship: bodyshop + table: + name: available_jobs + schema: public + type: drop_relationship +- args: + relationship: job + table: + name: available_jobs + schema: public + type: drop_relationship +- args: + relationship: available_jobs + table: + name: bodyshops + schema: public + type: drop_relationship +- args: + relationship: available_jobs + table: + name: jobs + schema: public + type: drop_relationship diff --git a/hasura/migrations/1580237346108_track_all_relationships/up.yaml b/hasura/migrations/1580237346108_track_all_relationships/up.yaml new file mode 100644 index 000000000..5f0bb6804 --- /dev/null +++ b/hasura/migrations/1580237346108_track_all_relationships/up.yaml @@ -0,0 +1,40 @@ +- args: + name: bodyshop + table: + name: available_jobs + schema: public + using: + foreign_key_constraint_on: bodyshopid + type: create_object_relationship +- args: + name: job + table: + name: available_jobs + schema: public + using: + foreign_key_constraint_on: jobid + type: create_object_relationship +- args: + name: available_jobs + table: + name: bodyshops + schema: public + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: available_jobs + schema: public + type: create_array_relationship +- args: + name: available_jobs + table: + name: jobs + schema: public + using: + foreign_key_constraint_on: + column: jobid + table: + name: available_jobs + schema: public + type: create_array_relationship diff --git a/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..5cdb25469 --- /dev/null +++ b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..6d55f1a31 --- /dev/null +++ b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,37 @@ +- args: + permission: + allow_upsert: true + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - uploaded_by + - cieca_id + - bodyshopid + - est_data + - issupplement + - jobid + - supplement_number + - ownr_name + - vehicle_info + - clm_amt + - clm_no + - source_system + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: available_jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..3a94b077d --- /dev/null +++ b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..d3b07cbf7 --- /dev/null +++ b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,34 @@ +- args: + permission: + allow_aggregations: false + columns: + - issupplement + - supplement_number + - est_data + - clm_amt + - cieca_id + - clm_no + - ownr_name + - source_system + - uploaded_by + - vehicle_info + - created_at + - updated_at + - bodyshopid + - id + - jobid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + limit: null + role: user + table: + name: available_jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..d0f2b05b4 --- /dev/null +++ b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..cf6c14ee3 --- /dev/null +++ b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,21 @@ +- args: + permission: + columns: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: available_jobs + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..610466236 --- /dev/null +++ b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..76e638642 --- /dev/null +++ b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,16 @@ +- args: + permission: + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: available_jobs + schema: public + type: create_delete_permission From 7d6969b186837ec2480ef376ab90d5646a2dfbe3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 09:52:02 -0800 Subject: [PATCH 2/8] Renamed some owner fields to follow CIECA standard. Work on Owner Select modal. --- bodyshop_translations.babel | 21 +++ client/package.json | 1 + client/src/App/App.container.jsx | 2 + client/src/App/App.test.js | 21 ++- .../components/alert/alert.component.test.js | 11 ++ .../jobs-available-new.component.jsx | 145 ++++++++++++------ .../jobs-available-new.container.jsx | 15 +- .../jobs-available-supplement.component.jsx | 3 +- .../jobs-available-supplement.container.jsx | 15 +- .../owner-find-modal.component.jsx | 4 + .../owner-find-modal.container.jsx | 23 +++ client/src/graphql/apollo-error-handling.js | 99 ++++++------ client/src/graphql/available-jobs.queries.js | 9 ++ client/src/graphql/jobs.queries.js | 10 ++ .../jobs-available.page.component.jsx | 18 ++- .../jobs-available.page.container.jsx | 30 +++- client/src/{setupTest.js => setupTests.js} | 3 +- client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + client/yarn.lock | 11 ++ .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 43 ++++++ .../up.yaml | 44 ++++++ .../down.yaml | 41 +++++ .../up.yaml | 42 +++++ .../down.yaml | 42 +++++ .../up.yaml | 44 ++++++ 49 files changed, 691 insertions(+), 135 deletions(-) create mode 100644 client/src/components/alert/alert.component.test.js create mode 100644 client/src/components/owner-find-modal/owner-find-modal.component.jsx create mode 100644 client/src/components/owner-find-modal/owner-find-modal.container.jsx rename client/src/{setupTest.js => setupTests.js} (67%) create mode 100644 hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/down.yaml create mode 100644 hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/up.yaml create mode 100644 hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/down.yaml create mode 100644 hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/up.yaml create mode 100644 hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/down.yaml create mode 100644 hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/up.yaml create mode 100644 hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/down.yaml create mode 100644 hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/up.yaml create mode 100644 hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/down.yaml create mode 100644 hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/up.yaml create mode 100644 hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/down.yaml create mode 100644 hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/up.yaml create mode 100644 hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/down.yaml create mode 100644 hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/up.yaml create mode 100644 hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/down.yaml create mode 100644 hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/up.yaml create mode 100644 hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/down.yaml create mode 100644 hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/up.yaml create mode 100644 hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/down.yaml create mode 100644 hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/up.yaml create mode 100644 hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/down.yaml create mode 100644 hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/up.yaml create mode 100644 hasura/migrations/1580319295873_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319295873_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580319301454_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319301454_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580319306963_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580319306963_update_permission_user_public_table_owners/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index e34457cbc..5ac9537b9 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -2635,6 +2635,27 @@ + + created + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + deleted false diff --git a/client/package.json b/client/package.json index 8223defa3..6485f4584 100644 --- a/client/package.json +++ b/client/package.json @@ -54,6 +54,7 @@ ] }, "devDependencies": { + "@apollo/react-testing": "^3.1.3", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.2" } diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index b9d91afa1..fa2168fce 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -126,6 +126,8 @@ class AppContainer extends Component { //Init local state. } + componentWillUnmount() {} + render() { const { client, loaded } = this.state; diff --git a/client/src/App/App.test.js b/client/src/App/App.test.js index a754b201b..945ec6f4a 100644 --- a/client/src/App/App.test.js +++ b/client/src/App/App.test.js @@ -1,9 +1,18 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App.container"; +import { MockedProvider } from "@apollo/react-testing"; +const div = document.createElement("div"); -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); +it("renders without crashing", () => { + ReactDOM.render( + + + , + div + ); +}); + +it("unmounts without crashing", () => { ReactDOM.unmountComponentAtNode(div); }); diff --git a/client/src/components/alert/alert.component.test.js b/client/src/components/alert/alert.component.test.js new file mode 100644 index 000000000..4e850158f --- /dev/null +++ b/client/src/components/alert/alert.component.test.js @@ -0,0 +1,11 @@ +import React from "react"; +import ReactDOM from "react-dom"; +import Alert from "./alert.component"; +import { MockedProvider } from "@apollo/react-testing"; +import { shallow } from "enzyme"; + +const div = document.createElement("div"); + +it("renders without crashing", () => { + shallow(); +}); diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx index 76db9474e..b34e6c5fa 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.component.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -1,22 +1,29 @@ -import { Input, Table, Button, Icon, notification } from "antd"; +import { Input, Table, Button, Icon, notification, Modal } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../utils/sorters"; import { DateTimeFormatter } from "../../utils/DateFormatter"; +import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.container"; export default function JobsAvailableComponent({ loading, data, refetch, deleteJob, - deleteAllNewJobs + deleteAllNewJobs, + insertNewJob, + setJobId, + estDataLazyLoad }) { const { t } = useTranslation(); + const [loadEstData, estData] = estDataLazyLoad; const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const [modalVisible, setModalVisible] = useState(false); + const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; @@ -114,7 +121,10 @@ export default function JobsAvailableComponent({
{ - return ( -
- { - console.log(value); - }} - enterButton - /> - -
{ + return ( +
+ { + console.log(value); + }} + enterButton + /> + + -
- ); - }} - size="small" - pagination={{ position: "top" }} - columns={columns.map(item => ({ ...item }))} - rowKey="id" - dataSource={data && data.available_jobs} - onChange={handleTableChange} - /> + }} + > + Delete All + + + ); + }} + size="small" + pagination={{ position: "top" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={data && data.available_jobs} + onChange={handleTableChange} + /> + ); } diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx index 7f0de5e68..371c486ee 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.container.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -1,19 +1,20 @@ import React from "react"; -import { useQuery, useMutation } from "react-apollo"; +import { useMutation, useQuery } from "react-apollo"; import { - QUERY_AVAILABLE_NEW_JOBS, - DELETE_AVAILABLE_JOB, - DELETE_ALL_AVAILABLE_NEW_JOBS + DELETE_ALL_AVAILABLE_NEW_JOBS, + QUERY_AVAILABLE_NEW_JOBS } from "../../graphql/available-jobs.queries"; +import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; import AlertComponent from "../alert/alert.component"; import JobsAvailableComponent from "./jobs-available-new.component"; -export default function JobsAvailableContainer() { +export default function JobsAvailableContainer({ deleteJob, estDataLazyLoad }) { const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_NEW_JOBS, { fetchPolicy: "network-only" }); - const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_NEW_JOBS); + const [insertNewJob] = useMutation(INSERT_NEW_JOB); if (error) return ; return ( @@ -23,6 +24,8 @@ export default function JobsAvailableContainer() { refetch={refetch} deleteJob={deleteJob} deleteAllNewJobs={deleteAllNewJobs} + insertNewJob={insertNewJob} + estDataLazyLoad={estDataLazyLoad} /> ); } diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx index f5e5d9793..a6c44f5df 100644 --- a/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx @@ -8,7 +8,8 @@ export default function JobsAvailableSupplementComponent({ data, refetch, deleteJob, - deleteAllNewJobs + deleteAllNewJobs, + estDataLazyLoad }) { const { t } = useTranslation(); diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx index 661edbfb0..306ba3a3d 100644 --- a/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx @@ -1,21 +1,19 @@ import React from "react"; -import { useQuery, useMutation } from "react-apollo"; -import { - QUERY_AVAILABLE_SUPPLEMENT_JOBS, - DELETE_AVAILABLE_JOB, - DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS -} from "../../graphql/available-jobs.queries"; +import { useMutation, useQuery } from "react-apollo"; +import { DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS, QUERY_AVAILABLE_SUPPLEMENT_JOBS } from "../../graphql/available-jobs.queries"; import AlertComponent from "../alert/alert.component"; import JobsAvailableSupplementComponent from "./jobs-available-supplement.component"; -export default function JobsAvailableSupplementContainer() { +export default function JobsAvailableSupplementContainer({ + deleteJob, + estDataLazyLoad +}) { const { loading, error, data, refetch } = useQuery( QUERY_AVAILABLE_SUPPLEMENT_JOBS, { fetchPolicy: "network-only" } ); - const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS); if (error) return ; @@ -26,6 +24,7 @@ export default function JobsAvailableSupplementContainer() { refetch={refetch} deleteJob={deleteJob} deleteAllNewJobs={deleteAllNewJobs} + estDataLazyLoad={estDataLazyLoad} /> ); } diff --git a/client/src/components/owner-find-modal/owner-find-modal.component.jsx b/client/src/components/owner-find-modal/owner-find-modal.component.jsx new file mode 100644 index 000000000..59b189772 --- /dev/null +++ b/client/src/components/owner-find-modal/owner-find-modal.component.jsx @@ -0,0 +1,4 @@ +import React from "react"; +export default function OwnerFindModalComponent() { + return
Modal Componnentasdasd
; +} diff --git a/client/src/components/owner-find-modal/owner-find-modal.container.jsx b/client/src/components/owner-find-modal/owner-find-modal.container.jsx new file mode 100644 index 000000000..60b7625c2 --- /dev/null +++ b/client/src/components/owner-find-modal/owner-find-modal.container.jsx @@ -0,0 +1,23 @@ +import React from "react"; +import { Modal } from "antd"; +import OwnerFindModalComponent from "./owner-find-modal.component"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import AlertComponent from "../alert/alert.component"; +import { json } from "body-parser"; + +export default function OwnerFindModalContainer({ + loading, + error, + owner, + ...modalProps +}) { + //use owner object to run query and find what possible owners there are. + return ( + + {loading ? : null} + {error ? : null} + {owner ? : null} + {owner ? JSON.stringify(owner) : null} + + ); +} diff --git a/client/src/graphql/apollo-error-handling.js b/client/src/graphql/apollo-error-handling.js index 6b5b74677..4c232958a 100644 --- a/client/src/graphql/apollo-error-handling.js +++ b/client/src/graphql/apollo-error-handling.js @@ -4,7 +4,6 @@ import { auth } from "../firebase/firebase.utils"; //https://stackoverflow.com/questions/57163454/refreshing-a-token-with-apollo-client-firebase-auth const errorLink = onError( ({ graphQLErrors, networkError, operation, forward }) => { - let access_token = window.localStorage.getItem("token"); // console.log("graphQLErrors", graphQLErrors); // console.log("networkError", networkError); // console.log("operation", operation); @@ -26,59 +25,59 @@ const errorLink = onError( //User access token has expired //props.history.push("/network-error"); console.log("We need a new token!"); - if (access_token && access_token !== "undefined") { - // Let's refresh token through async request + // Let's refresh token through async request - auth.currentUser.getIdToken(true).then(token => { - if (token) { - window.localStorage.setItem("token", token); - operation.setContext(({ headers = {} }) => ({ - headers: { - ...headers, - authorization: token ? `Bearer ${token}` : "" - } - })); - return forward(operation); - } - }); + auth.currentUser.getIdToken(true).then(token => { + if (token) { + console.log("Got the new token.", token); + window.localStorage.setItem("token", token); + operation.setContext(({ headers = {} }) => ({ + headers: { + ...headers, + authorization: token ? `Bearer ${token}` : "" + } + })); + console.log("Forwarding operation", operation); + return forward(operation); + } + }); - // return new Observable(observer => { - // auth.currentUser - // .getIdToken(true) - // .then(function(idToken) { - // if (!idToken) { - // window.localStorage.removeItem("token"); - // return console.log("Refresh token has expired"); - // } - // console.log("Got a new token", idToken); - // window.localStorage.setItem("token", idToken); + // return new Observable(observer => { + // auth.currentUser + // .getIdToken(true) + // .then(function(idToken) { + // if (!idToken) { + // window.localStorage.removeItem("token"); + // return console.log("Refresh token has expired"); + // } + // console.log("Got a new token", idToken); + // window.localStorage.setItem("token", idToken); - // // reset the headers - // operation.setContext(({ headers = {} }) => ({ - // headers: { - // // Re-add old headers - // ...headers, - // // Switch out old access token for new one - // authorization: idToken ? `Bearer ${idToken}` : "" - // } - // })); + // // reset the headers + // operation.setContext(({ headers = {} }) => ({ + // headers: { + // // Re-add old headers + // ...headers, + // // Switch out old access token for new one + // authorization: idToken ? `Bearer ${idToken}` : "" + // } + // })); - // const subscriber = { - // next: observer.next.bind(observer), - // error: observer.error.bind(observer), - // complete: observer.complete.bind(observer) - // }; - // console.log("About to resend the request."); - // // Retry last failed request - // forward(operation).subscribe(subscriber); - // }) - // .catch(error => { - // // No refresh or client token available, we force user to login - // console.log("Hit an error."); - // observer.error(error); - // }); - // }); - } + // const subscriber = { + // next: observer.next.bind(observer), + // error: observer.error.bind(observer), + // complete: observer.complete.bind(observer) + // }; + // console.log("About to resend the request."); + // // Retry last failed request + // forward(operation).subscribe(subscriber); + // }) + // .catch(error => { + // // No refresh or client token available, we force user to login + // console.log("Hit an error."); + // observer.error(error); + // }); + // }); } } ); diff --git a/client/src/graphql/available-jobs.queries.js b/client/src/graphql/available-jobs.queries.js index de5c5469c..cd23481fd 100644 --- a/client/src/graphql/available-jobs.queries.js +++ b/client/src/graphql/available-jobs.queries.js @@ -70,3 +70,12 @@ export const DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS = gql` } } `; + +export const QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK = gql` + query QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK($id: uuid!) { + available_jobs_by_pk(id: $id) { + id + est_data + } + } +`; diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 6fe497459..2a69f727d 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -250,3 +250,13 @@ export const CONVERT_JOB_TO_RO = gql` } } `; + +export const INSERT_NEW_JOB = gql` + mutation INSERT_JOB($job: [jobs_insert_input!]!) { + insert_jobs(objects: $job) { + returning { + id + } + } + } +`; diff --git a/client/src/pages/jobs-available/jobs-available.page.component.jsx b/client/src/pages/jobs-available/jobs-available.page.component.jsx index 7afa216f4..e52fedf55 100644 --- a/client/src/pages/jobs-available/jobs-available.page.component.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.component.jsx @@ -2,12 +2,22 @@ import React from "react"; import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container"; import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container"; -export default function JobsAvailablePageComponent() { +export default function JobsAvailablePageComponent({ + deleteJob, + estDataLazyLoad +}) { return (
- - - + Available New Jobs + + Available Supplements +
); } diff --git a/client/src/pages/jobs-available/jobs-available.page.container.jsx b/client/src/pages/jobs-available/jobs-available.page.container.jsx index 6a146ea6a..9dc54c321 100644 --- a/client/src/pages/jobs-available/jobs-available.page.container.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.container.jsx @@ -1,10 +1,26 @@ -import React from 'react' -import JobsAvailablePageComponent from './jobs-available.page.component' +import React from "react"; +import { useMutation, useLazyQuery } from "react-apollo"; +import { + DELETE_AVAILABLE_JOB, + QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK +} from "../../graphql/available-jobs.queries"; +import JobsAvailablePageComponent from "./jobs-available.page.component"; export default function JobsAvailablePageContainer() { - return ( -
- -
- ) + const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + + const estDataLazyLoad = useLazyQuery( + QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK, + { + fetchPolicy: "network-only" + } + ); + return ( +
+ +
+ ); } diff --git a/client/src/setupTest.js b/client/src/setupTests.js similarity index 67% rename from client/src/setupTest.js rename to client/src/setupTests.js index 82edfc9e5..de7049700 100644 --- a/client/src/setupTest.js +++ b/client/src/setupTests.js @@ -1,4 +1,3 @@ import { configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; - -configure({ adapter: new Adapter() }); +configure({ adapter: new Adapter() }); \ No newline at end of file diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 345a74077..ba488efd7 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -151,6 +151,7 @@ "successes": { "all_deleted": "{{count}} jobs deleted successfully.", "converted": "Job converted successfully.", + "created": "Job created successfully.", "deleted": "Job deleted successfully.", "save": "Record Saved", "savetitle": "Record saved successfully." diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 2a5f5e741..07906a589 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -151,6 +151,7 @@ "successes": { "all_deleted": "{{count}} trabajos eliminados con éxito.", "converted": "Trabajo convertido con éxito.", + "created": "Trabajo creado con éxito.", "deleted": "Trabajo eliminado con éxito.", "save": "Registro guardado", "savetitle": "Registro guardado con éxito." diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 48558307f..1654f2ad9 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -151,6 +151,7 @@ "successes": { "all_deleted": "{{count}} travaux supprimés avec succès.", "converted": "Travail converti avec succès.", + "created": "Le travail a été créé avec succès.", "deleted": "Le travail a bien été supprimé.", "save": "Enregistrement enregistré", "savetitle": "Enregistrement enregistré avec succès." diff --git a/client/yarn.lock b/client/yarn.lock index 87f7832b9..d73e081cd 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -79,6 +79,15 @@ "@apollo/react-hooks" "^3.1.3" tslib "^1.10.0" +"@apollo/react-testing@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@apollo/react-testing/-/react-testing-3.1.3.tgz#d8dd318f58fb6a404976bfa3f8a79e976a5c6562" + integrity sha512-58R7gROl4TZMHm5kS76Nof9FfZhD703AU3SmJTA2f7naiMqC9Qd8pZ4oNCBafcab0SYN//UtWvLcluK5O7V/9g== + dependencies: + "@apollo/react-common" "^3.1.3" + fast-json-stable-stringify "^2.0.0" + tslib "^1.10.0" + "@babel/code-frame@7.5.5", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" @@ -11051,6 +11060,8 @@ rxjs@^6.4.0, rxjs@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== + dependencies: + tslib "^1.9.0" safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" diff --git a/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/down.yaml b/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/down.yaml new file mode 100644 index 000000000..87a64b81f --- /dev/null +++ b/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."first_name" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_fn" to "first_name"; + type: run_sql diff --git a/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/up.yaml b/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/up.yaml new file mode 100644 index 000000000..c593c078b --- /dev/null +++ b/hasura/migrations/1580319118370_alter_table_public_owners_alter_column_first_name/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."first_name" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "first_name" to "ownr_fn"; + type: run_sql diff --git a/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/down.yaml b/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/down.yaml new file mode 100644 index 000000000..40b47b5cb --- /dev/null +++ b/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."last_name" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_ln" to "last_name"; + type: run_sql diff --git a/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/up.yaml b/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/up.yaml new file mode 100644 index 000000000..c32e1b096 --- /dev/null +++ b/hasura/migrations/1580319128633_alter_table_public_owners_alter_column_last_name/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."last_name" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "last_name" to "ownr_ln"; + type: run_sql diff --git a/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/down.yaml b/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/down.yaml new file mode 100644 index 000000000..91f18eab1 --- /dev/null +++ b/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."address1" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_addr1" to "address1"; + type: run_sql diff --git a/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/up.yaml b/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/up.yaml new file mode 100644 index 000000000..0224619e8 --- /dev/null +++ b/hasura/migrations/1580319140706_alter_table_public_owners_alter_column_address1/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."address1" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "address1" to "ownr_addr1"; + type: run_sql diff --git a/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/down.yaml b/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/down.yaml new file mode 100644 index 000000000..a25f8b213 --- /dev/null +++ b/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."address2" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_addr2" to "address2"; + type: run_sql diff --git a/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/up.yaml b/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/up.yaml new file mode 100644 index 000000000..fc5367abd --- /dev/null +++ b/hasura/migrations/1580319150628_alter_table_public_owners_alter_column_address2/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."address2" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "address2" to "ownr_addr2"; + type: run_sql diff --git a/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/down.yaml b/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/down.yaml new file mode 100644 index 000000000..410b346dd --- /dev/null +++ b/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."city" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_city" to "city"; + type: run_sql diff --git a/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/up.yaml b/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/up.yaml new file mode 100644 index 000000000..81bf2fdcf --- /dev/null +++ b/hasura/migrations/1580319161723_alter_table_public_owners_alter_column_city/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."city" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "city" to "ownr_city"; + type: run_sql diff --git a/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/down.yaml b/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/down.yaml new file mode 100644 index 000000000..5c2d9fe32 --- /dev/null +++ b/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."state" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_st" to "state"; + type: run_sql diff --git a/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/up.yaml b/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/up.yaml new file mode 100644 index 000000000..c3499e5e1 --- /dev/null +++ b/hasura/migrations/1580319174013_alter_table_public_owners_alter_column_state/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."state" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "state" to "ownr_st"; + type: run_sql diff --git a/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/down.yaml b/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/down.yaml new file mode 100644 index 000000000..55aeb38f1 --- /dev/null +++ b/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."zip" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_zip" to "zip"; + type: run_sql diff --git a/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/up.yaml b/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/up.yaml new file mode 100644 index 000000000..c2f32b926 --- /dev/null +++ b/hasura/migrations/1580319185312_alter_table_public_owners_alter_column_zip/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."zip" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "zip" to "ownr_zip"; + type: run_sql diff --git a/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/down.yaml b/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/down.yaml new file mode 100644 index 000000000..a36da5733 --- /dev/null +++ b/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."country" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_ctry" to "country"; + type: run_sql diff --git a/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/up.yaml b/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/up.yaml new file mode 100644 index 000000000..17ba0867f --- /dev/null +++ b/hasura/migrations/1580319194956_alter_table_public_owners_alter_column_country/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."country" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "country" to "ownr_ctry"; + type: run_sql diff --git a/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/down.yaml b/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/down.yaml new file mode 100644 index 000000000..dc998c0d2 --- /dev/null +++ b/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."email" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_ea" to "email"; + type: run_sql diff --git a/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/up.yaml b/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/up.yaml new file mode 100644 index 000000000..045b0b101 --- /dev/null +++ b/hasura/migrations/1580319215835_alter_table_public_owners_alter_column_email/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."email" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "email" to "ownr_ea"; + type: run_sql diff --git a/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/down.yaml b/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/down.yaml new file mode 100644 index 000000000..4e4b328cc --- /dev/null +++ b/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."phone" IS E'null' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "ownr_ph1" to "phone"; + type: run_sql diff --git a/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/up.yaml b/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/up.yaml new file mode 100644 index 000000000..28ad46d6e --- /dev/null +++ b/hasura/migrations/1580319231505_alter_table_public_owners_alter_column_phone/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."owners"."phone" IS E'' + type: run_sql +- args: + sql: alter table "public"."owners" rename column "phone" to "ownr_ph1"; + type: run_sql diff --git a/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/down.yaml b/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/down.yaml new file mode 100644 index 000000000..323204856 --- /dev/null +++ b/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" DROP COLUMN "ownr_ph2"; + type: run_sql diff --git a/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/up.yaml b/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/up.yaml new file mode 100644 index 000000000..41e34c325 --- /dev/null +++ b/hasura/migrations/1580319283586_alter_table_public_owners_add_column_ownr_ph2/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" ADD COLUMN "ownr_ph2" text NULL; + type: run_sql diff --git a/hasura/migrations/1580319295873_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580319295873_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..f2f87a705 --- /dev/null +++ b/hasura/migrations/1580319295873_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,43 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - preferred_contact + - ownr_st + - ownr_zip + - created_at + - updated_at + - id + - shopid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580319295873_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580319295873_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..699ba86d6 --- /dev/null +++ b/hasura/migrations/1580319295873_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,44 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + - ownr_ph2 + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580319301454_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580319301454_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..e37bbfa01 --- /dev/null +++ b/hasura/migrations/1580319301454_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,41 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580319301454_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580319301454_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..979378d18 --- /dev/null +++ b/hasura/migrations/1580319301454_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580319306963_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580319306963_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..d61f0c925 --- /dev/null +++ b/hasura/migrations/1580319306963_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - ownr_addr1 + - ownr_addr2 + - allow_text_message + - ownr_city + - ownr_ctry + - created_at + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - preferred_contact + - shopid + - ownr_st + - updated_at + - ownr_zip + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580319306963_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580319306963_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..8aa9459b9 --- /dev/null +++ b/hasura/migrations/1580319306963_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,44 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission From d7e195ff7f2116d377f9dbd53a8a50f9c351592c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 12:00:50 -0800 Subject: [PATCH 3/8] Added find owner modal and basic searching logic. --- bodyshop_translations.babel | 162 ++++++++++++++++++ .../jobs-available-new.component.jsx | 38 ++-- .../jobs-available-new.container.jsx | 27 ++- .../owner-find-modal.component.jsx | 124 +++++++++++++- .../owner-find-modal.container.jsx | 44 ++++- client/src/graphql/owners.queries.js | 20 +++ client/src/translations/en_us/common.json | 13 ++ client/src/translations/es/common.json | 13 ++ client/src/translations/fr/common.json | 13 ++ .../1580321100336_owner_gin_idx/down.yaml | 1 + .../1580321100336_owner_gin_idx/up.yaml | 6 + .../down.yaml | 1 + .../up.yaml | 14 ++ .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 44 +++++ .../up.yaml | 45 +++++ .../down.yaml | 42 +++++ .../up.yaml | 43 +++++ .../down.yaml | 44 +++++ .../up.yaml | 45 +++++ 21 files changed, 711 insertions(+), 34 deletions(-) create mode 100644 client/src/graphql/owners.queries.js create mode 100644 hasura/migrations/1580321100336_owner_gin_idx/down.yaml create mode 100644 hasura/migrations/1580321100336_owner_gin_idx/up.yaml create mode 100644 hasura/migrations/1580321202242_owner_search_function/down.yaml create mode 100644 hasura/migrations/1580321202242_owner_search_function/up.yaml create mode 100644 hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/down.yaml create mode 100644 hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/up.yaml create mode 100644 hasura/migrations/1580322221407_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580322221407_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580322225907_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580322225907_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580322230561_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580322230561_update_permission_user_public_table_owners/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 5ac9537b9..162ad5ab9 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -3361,6 +3361,168 @@ + + owners + + + fields + + + ownr_addr1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ownr_city + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ownr_ea + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ownr_fn + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ownr_ln + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ownr_ph1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + labels + + + existing_owners + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + profile diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx index b34e6c5fa..3638188d4 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.component.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -1,8 +1,8 @@ -import { Input, Table, Button, Icon, notification, Modal } from "antd"; +import { Button, Icon, Input, notification, Table } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { alphaSort } from "../../utils/sorters"; import { DateTimeFormatter } from "../../utils/DateFormatter"; +import { alphaSort } from "../../utils/sorters"; import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.container"; export default function JobsAvailableComponent({ loading, @@ -10,9 +10,12 @@ export default function JobsAvailableComponent({ refetch, deleteJob, deleteAllNewJobs, - insertNewJob, - setJobId, - estDataLazyLoad + estDataLazyLoad, + onModalOk, + onModalCancel, + modalVisible, + setModalVisible, + selectedOwner, setSelectedOwner }) { const { t } = useTranslation(); const [loadEstData, estData] = estDataLazyLoad; @@ -22,7 +25,7 @@ export default function JobsAvailableComponent({ filteredInfo: { text: "" } }); - const [modalVisible, setModalVisible] = useState(false); + const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); @@ -121,8 +124,6 @@ export default function JobsAvailableComponent({
{ + setModalVisible(false); + console.log("selectedOwner", selectedOwner); + // insertNewJob({ + // variables: { + // job: record.est_data + // } + // }).then(r => { + // notification["success"]({ + // message: t("jobs.successes.created") + // }); + // refetch(); + // }); + }; + + const onModalCancel = () => setModalVisible(false); + if (error) return ; return ( ); } diff --git a/client/src/components/owner-find-modal/owner-find-modal.component.jsx b/client/src/components/owner-find-modal/owner-find-modal.component.jsx index 59b189772..c06b10d09 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.component.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.component.jsx @@ -1,4 +1,124 @@ +import { Table, Checkbox, Divider } from "antd"; import React from "react"; -export default function OwnerFindModalComponent() { - return
Modal Componnentasdasd
; +import { useTranslation } from "react-i18next"; +import PhoneFormatter from "../../utils/PhoneFormatter"; + +export default function OwnerFindModalComponent({ + selectedOwner, + setSelectedOwner, + ownersListLoading, + ownersList +}) { + //setSelectedOwner is used to set the record id of the owner to use for adding the job. + const { t } = useTranslation(); + + const columns = [ + { + title: t("owners.fields.ownr_ln"), + dataIndex: "ownr_ln", + key: "ownr_ln" + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // // filteredValue: state.filteredInfo.text || null, + // sorter: (a, b) => alphaSort(a, b), + // sortOrder: + // state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + }, + { + title: t("owners.fields.ownr_fn"), + dataIndex: "ownr_fn", + key: "ownr_fn" + // ellipsis: true, + // sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), + // //width: "25%", + // sortOrder: + // state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + }, + { + title: t("owners.fields.ownr_addr1"), + dataIndex: "ownr_addr1", + key: "ownr_addr1" + // sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), + // sortOrder: + // state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + //ellipsis: true + }, + { + title: t("owners.fields.ownr_city"), + dataIndex: "ownr_city", + key: "ownr_city" + // sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + // sortOrder: + // state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("owners.fields.ownr_ea"), + dataIndex: "ownr_ea", + key: "ownr_ea" + // sorter: (a, b) => a.clm_amt - b.clm_amt, + // sortOrder: + // state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("owners.fields.ownr_ph1"), + dataIndex: "ownr_ph1", + key: "ownr_ph1", + render: (text, record) => ( + {record.ownr_ph1} + ) + // sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), + // sortOrder: + // state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + } + ]; + + const handleOnRowClick = record => { + if (record) { + if (record.id) { + setSelectedOwner(record.id); + return; + } + } + setSelectedOwner(null); + }; + + return ( +
+
t("owners.labels.existing_owners")} + size="small" + pagination={{ position: "bottom" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + loading={ownersListLoading} + dataSource={ownersList} + //onChange={handleTableChange} + rowSelection={{ selectedRowKeys: [selectedOwner] }} + onRow={(record, rowIndex) => { + return { + onClick: event => { + handleOnRowClick(record); + }, // click row + onDoubleClick: event => {}, // double click row + onContextMenu: event => {}, // right button click row + onMouseEnter: event => {}, // mouse enter row + onMouseLeave: event => {} // mouse leave row + }; + }} + /> + + setSelectedOwner(null)} + > + Create a new Owner record for this job. + + + ); } diff --git a/client/src/components/owner-find-modal/owner-find-modal.container.jsx b/client/src/components/owner-find-modal/owner-find-modal.container.jsx index 60b7625c2..8aa84c97e 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.container.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.container.jsx @@ -1,23 +1,53 @@ -import React from "react"; import { Modal } from "antd"; -import OwnerFindModalComponent from "./owner-find-modal.component"; -import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import React from "react"; import AlertComponent from "../alert/alert.component"; -import { json } from "body-parser"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import OwnerFindModalComponent from "./owner-find-modal.component"; +import { useQuery } from "react-apollo"; +import { QUERY_SEARCH_OWNER_BY_IDX } from "../../graphql/owners.queries"; +import { useTranslation } from "react-i18next"; export default function OwnerFindModalContainer({ loading, error, owner, + selectedOwner, + setSelectedOwner, ...modalProps }) { //use owner object to run query and find what possible owners there are. + const { t } = useTranslation(); + + const ownersList = useQuery(QUERY_SEARCH_OWNER_BY_IDX, { + variables: { + search: owner + ? `${owner.ownr_fn} ${owner.ownr_ln} ${owner.ownr_addr1} ${owner.ownr_city} ${owner.ownr_zip} ${owner.ownr_ea} ${owner.ownr_ph1} ${owner.ownr_ph2}` + : null + }, + skip: !owner, + fetchPolicy: "network-only" + }); + return ( - + {loading ? : null} {error ? : null} - {owner ? : null} - {owner ? JSON.stringify(owner) : null} + {owner ? ( + + ) : null} ); } diff --git a/client/src/graphql/owners.queries.js b/client/src/graphql/owners.queries.js new file mode 100644 index 000000000..0945e48b0 --- /dev/null +++ b/client/src/graphql/owners.queries.js @@ -0,0 +1,20 @@ +import { gql } from "apollo-boost"; + +export const QUERY_SEARCH_OWNER_BY_IDX = gql` + query QUERY_SEARCH_OWNER_BY_IDX($search: String!) { + search_owners(args: { search: $search }) { + ownr_fn + ownr_ln + ownr_ph1 + ownr_ph2 + ownr_addr1 + ownr_addr2 + ownr_city + ownr_ctry + ownr_ea + ownr_st + ownr_zip + id + } + } +`; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index ba488efd7..4a1dbf7ee 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -205,6 +205,19 @@ "updated": "Note updated successfully." } }, + "owners": { + "fields": { + "ownr_addr1": "Address", + "ownr_city": "City", + "ownr_ea": "Email", + "ownr_fn": "First Name", + "ownr_ln": "Last Name", + "ownr_ph1": "Phone 1" + }, + "labels": { + "existing_owners": "Existing Owners" + } + }, "profile": { "errors": { "state": "Error reading page state. Please refresh." diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 07906a589..f96467bc5 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -205,6 +205,19 @@ "updated": "Nota actualizada con éxito." } }, + "owners": { + "fields": { + "ownr_addr1": "Dirección", + "ownr_city": "ciudad", + "ownr_ea": "Email", + "ownr_fn": "Nombre de pila", + "ownr_ln": "Apellido", + "ownr_ph1": "" + }, + "labels": { + "existing_owners": "Propietarios existentes" + } + }, "profile": { "errors": { "state": "Error al leer el estado de la página. Porfavor refresca." diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1654f2ad9..685489712 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -205,6 +205,19 @@ "updated": "Remarque mise à jour avec succès." } }, + "owners": { + "fields": { + "ownr_addr1": "Adresse", + "ownr_city": "Ville", + "ownr_ea": "Email", + "ownr_fn": "Prénom", + "ownr_ln": "Nom de famille", + "ownr_ph1": "" + }, + "labels": { + "existing_owners": "Propriétaires existants" + } + }, "profile": { "errors": { "state": "Erreur lors de la lecture de l'état de la page. Rafraichissez, s'il vous plait." diff --git a/hasura/migrations/1580321100336_owner_gin_idx/down.yaml b/hasura/migrations/1580321100336_owner_gin_idx/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1580321100336_owner_gin_idx/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1580321100336_owner_gin_idx/up.yaml b/hasura/migrations/1580321100336_owner_gin_idx/up.yaml new file mode 100644 index 000000000..63a8fc27c --- /dev/null +++ b/hasura/migrations/1580321100336_owner_gin_idx/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: true + sql: "\r\nCREATE INDEX owner_gin_idx ON owners\r\nUSING GIN ((ownr_fn || ' ' + || ownr_ln || ' ' || ownr_addr1 || ' ' || ownr_city || ' ' || ownr_zip || + ' ' || ownr_ea || ' ' || ownr_ph1 || ' ' || ownr_ph2 ) gin_trgm_ops);\r\n" + type: run_sql diff --git a/hasura/migrations/1580321202242_owner_search_function/down.yaml b/hasura/migrations/1580321202242_owner_search_function/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1580321202242_owner_search_function/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1580321202242_owner_search_function/up.yaml b/hasura/migrations/1580321202242_owner_search_function/up.yaml new file mode 100644 index 000000000..a3b38952d --- /dev/null +++ b/hasura/migrations/1580321202242_owner_search_function/up.yaml @@ -0,0 +1,14 @@ +- args: + cascade: true + sql: "CREATE FUNCTION search_owners(search text)\r\nRETURNS SETOF owners AS $$\r\n + \ SELECT *\r\n FROM owners\r\n WHERE\r\n search <% (ownr_fn || + ' ' || ownr_ln || ' ' || ownr_addr1 || ' ' || ownr_city || ' ' || ownr_zip + \ || ' ' || ownr_ea || ' ' || ownr_ph1 || ' ' || ownr_ph2)\r\n ORDER BY\r\n + \ similarity(search, (ownr_fn || ' ' || ownr_ln || ' ' || ownr_addr1 || + ' ' || ownr_city || ' ' || ownr_zip || ' ' || ownr_ea || ' ' || ownr_ph1 || + ' ' || ownr_ph2)) DESC\r\n LIMIT 20;\r\n$$ LANGUAGE sql STABLE;" + type: run_sql +- args: + name: search_owners + schema: public + type: track_function diff --git a/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/down.yaml b/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/down.yaml new file mode 100644 index 000000000..eaea08f41 --- /dev/null +++ b/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" DROP COLUMN "ownr_co_nm"; + type: run_sql diff --git a/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/up.yaml b/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/up.yaml new file mode 100644 index 000000000..fea96b1a3 --- /dev/null +++ b/hasura/migrations/1580322212941_alter_table_public_owners_add_column_ownr_co_nm/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" ADD COLUMN "ownr_co_nm" text NULL; + type: run_sql diff --git a/hasura/migrations/1580322221407_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580322221407_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..699ba86d6 --- /dev/null +++ b/hasura/migrations/1580322221407_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,44 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + - ownr_ph2 + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580322221407_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580322221407_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..55880362e --- /dev/null +++ b/hasura/migrations/1580322221407_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,45 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + - ownr_ph2 + - ownr_co_nm + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580322225907_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580322225907_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..979378d18 --- /dev/null +++ b/hasura/migrations/1580322225907_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580322225907_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580322225907_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..1802dbbf4 --- /dev/null +++ b/hasura/migrations/1580322225907_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,43 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580322230561_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580322230561_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..8aa9459b9 --- /dev/null +++ b/hasura/migrations/1580322230561_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,44 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580322230561_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580322230561_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..26c35bd8f --- /dev/null +++ b/hasura/migrations/1580322230561_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,45 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission From 1040822a7cb6e020e49aa13d2a24d7aba9ba0bd5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 14:09:41 -0800 Subject: [PATCH 4/8] Added logic to insert job by selecting the owner first. Vehicle is already preselected using VIN from watcher. Added fields to owner table. --- bodyshop_translations.babel | 63 +++++++++ .../jobs-available-new.component.jsx | 9 +- .../jobs-available-new.container.jsx | 133 +++++++++++++----- .../jobs-detail-header.component.jsx | 64 ++++++--- .../loading-spinner.component.jsx | 14 +- .../owner-find-modal.component.jsx | 17 +-- .../owner-find-modal.container.jsx | 6 +- client/src/graphql/jobs.queries.js | 7 + client/src/translations/en_us/common.json | 5 +- client/src/translations/es/common.json | 5 +- client/src/translations/fr/common.json | 5 +- .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 45 ++++++ .../up.yaml | 46 ++++++ .../down.yaml | 43 ++++++ .../up.yaml | 44 ++++++ .../down.yaml | 45 ++++++ .../up.yaml | 46 ++++++ 19 files changed, 527 insertions(+), 76 deletions(-) create mode 100644 hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/down.yaml create mode 100644 hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/up.yaml create mode 100644 hasura/migrations/1580332923811_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580332923811_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580332931020_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580332931020_update_permission_user_public_table_owners/up.yaml create mode 100644 hasura/migrations/1580332936658_update_permission_user_public_table_owners/down.yaml create mode 100644 hasura/migrations/1580332936658_update_permission_user_public_table_owners/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 162ad5ab9..861135c34 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -578,6 +578,27 @@ errors + + creating + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + deleted false @@ -2205,6 +2226,27 @@ labels + + available_new_jobs + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + cards @@ -2462,6 +2504,27 @@ + + creating_new_job + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + documents false diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx index 3638188d4..b7dd1d880 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.component.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -10,23 +10,22 @@ export default function JobsAvailableComponent({ refetch, deleteJob, deleteAllNewJobs, - estDataLazyLoad, onModalOk, onModalCancel, modalVisible, setModalVisible, - selectedOwner, setSelectedOwner + selectedOwner, + setSelectedOwner, + loadEstData, + estData }) { const { t } = useTranslation(); - const [loadEstData, estData] = estDataLazyLoad; const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); - - const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx index 93afc1f68..7c1932d9d 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.container.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -1,56 +1,125 @@ +import { notification } from "antd"; import React, { useState } from "react"; import { useMutation, useQuery } from "react-apollo"; -import { - DELETE_ALL_AVAILABLE_NEW_JOBS, - QUERY_AVAILABLE_NEW_JOBS -} from "../../graphql/available-jobs.queries"; +import { useTranslation } from "react-i18next"; +import { withRouter } from "react-router-dom"; +import { DELETE_ALL_AVAILABLE_NEW_JOBS, QUERY_AVAILABLE_NEW_JOBS } from "../../graphql/available-jobs.queries"; import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; import AlertComponent from "../alert/alert.component"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import JobsAvailableComponent from "./jobs-available-new.component"; -export default function JobsAvailableContainer({ deleteJob, estDataLazyLoad }) { +export default withRouter(function JobsAvailableContainer({ + deleteJob, + estDataLazyLoad, + history +}) { const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_NEW_JOBS, { fetchPolicy: "network-only" }); + const { t } = useTranslation(); + const [modalVisible, setModalVisible] = useState(false); const [selectedOwner, setSelectedOwner] = useState(null); + const [insertLoading, setInsertLoading] = useState(false); const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_NEW_JOBS); const [insertNewJob] = useMutation(INSERT_NEW_JOB); + const [loadEstData, estData] = estDataLazyLoad; const onModalOk = () => { setModalVisible(false); console.log("selectedOwner", selectedOwner); - // insertNewJob({ - // variables: { - // job: record.est_data - // } - // }).then(r => { - // notification["success"]({ - // message: t("jobs.successes.created") - // }); - // refetch(); - // }); + setInsertLoading(true); + console.log( + "logitest", + estData.data && + estData.data.available_jobs_by_pk && + estData.data.available_jobs_by_pk.est_data + ); + + if ( + !( + estData.data && + estData.data.available_jobs_by_pk && + estData.data.available_jobs_by_pk.est_data + ) + ) { + //We don't have the right data. Error! + setInsertLoading(false); + notification["error"]({ + message: t("jobs.errors.creating", { error: "No job data present." }) + }); + } else { + insertNewJob({ + variables: { + job: selectedOwner + ? Object.assign( + {}, + estData.data.available_jobs_by_pk.est_data, + { owner: null }, + { ownerid: selectedOwner } + ) + : estData.data.available_jobs_by_pk.est_data + } + }) + .then(r => { + notification["success"]({ + message: t("jobs.successes.created"), + onClick: () => { + console.log("r", r); + history.push( + `/manage/jobs/${r.data.insert_jobs.returning[0].id}` + ); + } + }); + //Job has been inserted. Clean up the available jobs record. + deleteJob({ + variables: { id: estData.data.available_jobs_by_pk.id } + }).then(r => { + refetch(); + setInsertLoading(false); + }); + }) + .catch(r => { + //error while inserting + notification["error"]({ + message: t("jobs.errors.creating", { error: r.message }) + }); + refetch(); + setInsertLoading(false); + }); + } }; - const onModalCancel = () => setModalVisible(false); + const onModalCancel = () => { + setModalVisible(false); + setSelectedOwner(null); + }; if (error) return ; return ( - + + + ); -} +}); 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 4d8148ac6..b9da502d5 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 @@ -1,4 +1,12 @@ -import { Avatar, Button, Checkbox, Descriptions, notification, PageHeader, Tag } from "antd"; +import { + Avatar, + Button, + Checkbox, + Descriptions, + notification, + PageHeader, + Tag +} from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import Moment from "react-moment"; @@ -16,7 +24,7 @@ export default function JobsDetailHeader({ const tombstoneTitle = (
- + {`${t("jobs.fields.ro_number")} ${ job.ro_number ? job.ro_number : t("general.labels.na") }`} @@ -25,26 +33,34 @@ export default function JobsDetailHeader({ const tombstoneSubtitle = (
- {job.owner - ? (job.owner.first_name || "") + " " + (job.owner.last_name || "") - : t("jobs.errors.noowner")} + + {job.owner ? ( + + {`${job.ownr_co_nm || ""}${job.ownr_fn || ""} ${job.ownr_ln || ""}`} + + ) : ( + t("jobs.errors.noowner") + )} + - {job.vehicle ? ( - - {job.vehicle.v_model_yr || t("general.labels.na")}{" "} - {job.vehicle.v_make_desc || t("general.labels.na")}{" "} - {job.vehicle.v_model_desc || t("general.labels.na")} |{" "} - {job.vehicle.plate_no || t("general.labels.na")} |{" "} - {job.vehicle.v_vin || t("general.labels.na")} - - ) : null} + + {job.vehicle ? ( + + {job.vehicle.v_model_yr || t("general.labels.na")}{" "} + {job.vehicle.v_make_desc || t("general.labels.na")}{" "} + {job.vehicle.v_model_desc || t("general.labels.na")} |{" "} + {job.vehicle.plate_no || t("general.labels.na")} |{" "} + {job.vehicle.v_vin || t("general.labels.na")} + + ) : null} +
); const menuExtra = [ , - ]; @@ -72,14 +89,15 @@ export default function JobsDetailHeader({ title={tombstoneTitle} subTitle={tombstoneSubtitle} tags={ - + {job.job_status ? ( - {job.job_status.name} + {job.job_status.name} ) : null} } - extra={menuExtra}> - + extra={menuExtra} + > + {job.claim_total} @@ -94,7 +112,7 @@ export default function JobsDetailHeader({ {job.scheduled_completion ? ( - {job.scheduled_completion} + {job.scheduled_completion} ) : null} diff --git a/client/src/components/loading-spinner/loading-spinner.component.jsx b/client/src/components/loading-spinner/loading-spinner.component.jsx index 94c35d8b0..98ab9e422 100644 --- a/client/src/components/loading-spinner/loading-spinner.component.jsx +++ b/client/src/components/loading-spinner/loading-spinner.component.jsx @@ -2,6 +2,16 @@ import React from "react"; import { Spin } from "antd"; import "./loading-spinner.styles.scss"; -export default function LoadingSpinner() { - return ; +export default function LoadingSpinner({ loading = true, message, ...props }) { + return ( + + {props.children} + + ); } diff --git a/client/src/components/owner-find-modal/owner-find-modal.component.jsx b/client/src/components/owner-find-modal/owner-find-modal.component.jsx index c06b10d09..c9631e54b 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.component.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.component.jsx @@ -1,4 +1,4 @@ -import { Table, Checkbox, Divider } from "antd"; +import { Checkbox, Divider, Table } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import PhoneFormatter from "../../utils/PhoneFormatter"; @@ -98,17 +98,18 @@ export default function OwnerFindModalComponent({ rowKey="id" loading={ownersListLoading} dataSource={ownersList} - //onChange={handleTableChange} - rowSelection={{ selectedRowKeys: [selectedOwner] }} + rowSelection={{ + onSelect: props => { + setSelectedOwner(props.id); + }, + type: "radio", + selectedRowKeys: [selectedOwner] + }} onRow={(record, rowIndex) => { return { onClick: event => { handleOnRowClick(record); - }, // click row - onDoubleClick: event => {}, // double click row - onContextMenu: event => {}, // right button click row - onMouseEnter: event => {}, // mouse enter row - onMouseLeave: event => {} // mouse leave row + } }; }} /> diff --git a/client/src/components/owner-find-modal/owner-find-modal.container.jsx b/client/src/components/owner-find-modal/owner-find-modal.container.jsx index 8aa84c97e..bd12e1559 100644 --- a/client/src/components/owner-find-modal/owner-find-modal.container.jsx +++ b/client/src/components/owner-find-modal/owner-find-modal.container.jsx @@ -1,11 +1,11 @@ import { Modal } from "antd"; import React from "react"; +import { useQuery } from "react-apollo"; +import { useTranslation } from "react-i18next"; +import { QUERY_SEARCH_OWNER_BY_IDX } from "../../graphql/owners.queries"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import OwnerFindModalComponent from "./owner-find-modal.component"; -import { useQuery } from "react-apollo"; -import { QUERY_SEARCH_OWNER_BY_IDX } from "../../graphql/owners.queries"; -import { useTranslation } from "react-i18next"; export default function OwnerFindModalContainer({ loading, diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 2a69f727d..5bffe873d 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -152,6 +152,13 @@ export const GET_JOB_BY_PK = gql` towing_payable storage_payable adjustment_bottom_line + ownr_fn + ownr_ln + owner{ + id + ownr_fn + ownr_ln + } } } `; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 4a1dbf7ee..e7cd16153 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -46,6 +46,7 @@ "printCenter": "Print Center" }, "errors": { + "creating": "Error encountered while creating job. {{error}}", "deleted": "Error deleting job.", "noaccess": "This job does not exist or you do not have access to it.", "nodates": "No dates specified for this job.", @@ -127,6 +128,7 @@ "vehicle": "Vehicle" }, "labels": { + "available_new_jobs": "", "cards": { "appraiser": "Appraiser", "customer": "Customer Information", @@ -141,6 +143,7 @@ "totals": "Totals", "vehicle": "Vehicle" }, + "creating_new_job": "Creating new job...", "documents": "Documents", "lines": "Estimate Lines", "notes": "Notes", @@ -151,7 +154,7 @@ "successes": { "all_deleted": "{{count}} jobs deleted successfully.", "converted": "Job converted successfully.", - "created": "Job created successfully.", + "created": "Job created successfully. Click to view.", "deleted": "Job deleted successfully.", "save": "Record Saved", "savetitle": "Record saved successfully." diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index f96467bc5..b476ac6d5 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -46,6 +46,7 @@ "printCenter": "Centro de impresión" }, "errors": { + "creating": "", "deleted": "Error al eliminar el trabajo.", "noaccess": "Este trabajo no existe o no tiene acceso a él.", "nodates": "No hay fechas especificadas para este trabajo.", @@ -127,6 +128,7 @@ "vehicle": "Vehículo" }, "labels": { + "available_new_jobs": "", "cards": { "appraiser": "Tasador", "customer": "Información al cliente", @@ -141,6 +143,7 @@ "totals": "Totales", "vehicle": "Vehículo" }, + "creating_new_job": "Creando nuevo trabajo ...", "documents": "documentos", "lines": "Líneas estimadas", "notes": "Notas", @@ -151,7 +154,7 @@ "successes": { "all_deleted": "{{count}} trabajos eliminados con éxito.", "converted": "Trabajo convertido con éxito.", - "created": "Trabajo creado con éxito.", + "created": "Trabajo creado con éxito. Click para ver.", "deleted": "Trabajo eliminado con éxito.", "save": "Registro guardado", "savetitle": "Registro guardado con éxito." diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 685489712..98c79b11d 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -46,6 +46,7 @@ "printCenter": "Centre d'impression" }, "errors": { + "creating": "", "deleted": "Erreur lors de la suppression du travail.", "noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.", "nodates": "Aucune date spécifiée pour ce travail.", @@ -127,6 +128,7 @@ "vehicle": "Véhicule" }, "labels": { + "available_new_jobs": "", "cards": { "appraiser": "Expert", "customer": "Informations client", @@ -141,6 +143,7 @@ "totals": "Totaux", "vehicle": "Véhicule" }, + "creating_new_job": "Création d'un nouvel emploi ...", "documents": "Les documents", "lines": "Estimer les lignes", "notes": "Remarques", @@ -151,7 +154,7 @@ "successes": { "all_deleted": "{{count}} travaux supprimés avec succès.", "converted": "Travail converti avec succès.", - "created": "Le travail a été créé avec succès.", + "created": "Le travail a été créé avec succès. Clique pour voir.", "deleted": "Le travail a bien été supprimé.", "save": "Enregistrement enregistré", "savetitle": "Enregistrement enregistré avec succès." diff --git a/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/down.yaml b/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/down.yaml new file mode 100644 index 000000000..ca71eb499 --- /dev/null +++ b/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" DROP COLUMN "ownr_title"; + type: run_sql diff --git a/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/up.yaml b/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/up.yaml new file mode 100644 index 000000000..be8c2ce7b --- /dev/null +++ b/hasura/migrations/1580332913585_alter_table_public_owners_add_column_ownr_title/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."owners" ADD COLUMN "ownr_title" text NULL; + type: run_sql diff --git a/hasura/migrations/1580332923811_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580332923811_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..55880362e --- /dev/null +++ b/hasura/migrations/1580332923811_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,45 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + - ownr_ph2 + - ownr_co_nm + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580332923811_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580332923811_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..21addc58a --- /dev/null +++ b/hasura/migrations/1580332923811_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,46 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - ownr_fn + - ownr_ln + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ea + - ownr_ph1 + - preferred_contact + - allow_text_message + - shopid + - ownr_ph2 + - ownr_co_nm + - ownr_title + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580332931020_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580332931020_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..1802dbbf4 --- /dev/null +++ b/hasura/migrations/1580332931020_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,43 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580332931020_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580332931020_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..85ab7c994 --- /dev/null +++ b/hasura/migrations/1580332931020_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,44 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_title + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: owners + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580332936658_update_permission_user_public_table_owners/down.yaml b/hasura/migrations/1580332936658_update_permission_user_public_table_owners/down.yaml new file mode 100644 index 000000000..26c35bd8f --- /dev/null +++ b/hasura/migrations/1580332936658_update_permission_user_public_table_owners/down.yaml @@ -0,0 +1,45 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580332936658_update_permission_user_public_table_owners/up.yaml b/hasura/migrations/1580332936658_update_permission_user_public_table_owners/up.yaml new file mode 100644 index 000000000..9609517ec --- /dev/null +++ b/hasura/migrations/1580332936658_update_permission_user_public_table_owners/up.yaml @@ -0,0 +1,46 @@ +- args: + role: user + table: + name: owners + schema: public + type: drop_update_permission +- args: + permission: + columns: + - allow_text_message + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph2 + - ownr_st + - ownr_title + - ownr_zip + - preferred_contact + - created_at + - updated_at + - id + - shopid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: owners + schema: public + type: create_update_permission From f72308f91539747ac0b6b60ae4ce440be9a22fdf Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 16:57:19 -0800 Subject: [PATCH 5/8] Added new fields for EMS file upload + renamed fields for coherenace. Another attempt at fixing invalid token forwarding. Fixed date time formatting. --- .../job-detail-cards.insurance.component.jsx | 1 - client/src/graphql/apollo-error-handling.js | 16 +- .../jobs-available.page.component.jsx | 2 +- client/src/utils/DateFormatter.jsx | 2 +- .../1580338993317_run_sql_migration/down.yaml | 1 + .../1580338993317_run_sql_migration/up.yaml | 6 + .../1580339054130_run_sql_migration/down.yaml | 1 + .../1580339054130_run_sql_migration/up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 230 +++++++++++++++++ .../up.yaml | 233 ++++++++++++++++++ .../down.yaml | 228 +++++++++++++++++ .../up.yaml | 231 +++++++++++++++++ .../down.yaml | 230 +++++++++++++++++ .../up.yaml | 233 ++++++++++++++++++ 32 files changed, 1474 insertions(+), 6 deletions(-) create mode 100644 hasura/migrations/1580338993317_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1580338993317_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1580339054130_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1580339054130_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/down.yaml create mode 100644 hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/up.yaml create mode 100644 hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/down.yaml create mode 100644 hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/up.yaml create mode 100644 hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml create mode 100644 hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml create mode 100644 hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/down.yaml create mode 100644 hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/up.yaml create mode 100644 hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml create mode 100644 hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml create mode 100644 hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/down.yaml create mode 100644 hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/up.yaml create mode 100644 hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/down.yaml create mode 100644 hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/up.yaml create mode 100644 hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml create mode 100644 hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml create mode 100644 hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml create mode 100644 hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml create mode 100644 hasura/migrations/1580343246214_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580343246214_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580343251291_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580343251291_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580343257730_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580343257730_update_permission_user_public_table_jobs/up.yaml diff --git a/client/src/components/job-detail-cards/job-detail-cards.insurance.component.jsx b/client/src/components/job-detail-cards/job-detail-cards.insurance.component.jsx index 54602f2d8..0e4cf4935 100644 --- a/client/src/components/job-detail-cards/job-detail-cards.insurance.component.jsx +++ b/client/src/components/job-detail-cards/job-detail-cards.insurance.component.jsx @@ -27,7 +27,6 @@ export default function JobDetailCardsInsuranceComponent({ loading, data }) {
- TODO: {t("jobs.labels.cards.appraiser")} {data?.est_ea ? ( diff --git a/client/src/graphql/apollo-error-handling.js b/client/src/graphql/apollo-error-handling.js index 4c232958a..c38c13d78 100644 --- a/client/src/graphql/apollo-error-handling.js +++ b/client/src/graphql/apollo-error-handling.js @@ -1,7 +1,8 @@ import { onError } from "apollo-link-error"; -//import { Observable } from "apollo-link"; +import { Observable } from "apollo-link"; import { auth } from "../firebase/firebase.utils"; //https://stackoverflow.com/questions/57163454/refreshing-a-token-with-apollo-client-firebase-auth + const errorLink = onError( ({ graphQLErrors, networkError, operation, forward }) => { // console.log("graphQLErrors", graphQLErrors); @@ -37,8 +38,17 @@ const errorLink = onError( authorization: token ? `Bearer ${token}` : "" } })); - console.log("Forwarding operation", operation); - return forward(operation); + + return new Observable(observer => { + const subscriber = { + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer) + }; + console.log("About to resend the request."); + // Retry last failed request + forward(operation).subscribe(subscriber); + }); } }); diff --git a/client/src/pages/jobs-available/jobs-available.page.component.jsx b/client/src/pages/jobs-available/jobs-available.page.component.jsx index e52fedf55..b239bd1d3 100644 --- a/client/src/pages/jobs-available/jobs-available.page.component.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.component.jsx @@ -13,7 +13,7 @@ export default function JobsAvailablePageComponent({ deleteJob={deleteJob} estDataLazyLoad={estDataLazyLoad} /> - Available Supplements + Available Supplements (//TODO: LOGIC HAS NOT YET BEEN COPIED FROM OTHER COMPONENT) {props.children || ""}; + return {props.children || ""}; } diff --git a/hasura/migrations/1580338993317_run_sql_migration/down.yaml b/hasura/migrations/1580338993317_run_sql_migration/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1580338993317_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1580338993317_run_sql_migration/up.yaml b/hasura/migrations/1580338993317_run_sql_migration/up.yaml new file mode 100644 index 000000000..50d9e6d4d --- /dev/null +++ b/hasura/migrations/1580338993317_run_sql_migration/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: true + sql: "ALTER TABLE jobs ALTER COLUMN theft_ind DROP DEFAULT;\r\nALTER TABLE jobs + ALTER theft_ind TYPE bool USING CASE WHEN true THEN FALSE ELSE TRUE END;\r\nALTER + TABLE jobs ALTER COLUMN theft_ind SET DEFAULT FALSE;" + type: run_sql diff --git a/hasura/migrations/1580339054130_run_sql_migration/down.yaml b/hasura/migrations/1580339054130_run_sql_migration/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1580339054130_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1580339054130_run_sql_migration/up.yaml b/hasura/migrations/1580339054130_run_sql_migration/up.yaml new file mode 100644 index 000000000..377757ec8 --- /dev/null +++ b/hasura/migrations/1580339054130_run_sql_migration/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: true + sql: "ALTER TABLE jobs ALTER COLUMN tlos_ind DROP DEFAULT;\r\nALTER TABLE jobs + ALTER tlos_ind TYPE bool USING CASE WHEN true THEN FALSE ELSE TRUE END;\r\nALTER + TABLE jobs ALTER COLUMN tlos_ind SET DEFAULT FALSE;" + type: run_sql diff --git a/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/down.yaml b/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/down.yaml new file mode 100644 index 000000000..d5601bc2c --- /dev/null +++ b/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "parts_tax_rate"; + type: run_sql diff --git a/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/up.yaml b/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/up.yaml new file mode 100644 index 000000000..24910de15 --- /dev/null +++ b/hasura/migrations/1580342466510_alter_table_public_jobs_add_column_parts_tax_rate/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "parts_tax_rate" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/down.yaml b/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/down.yaml new file mode 100644 index 000000000..48652bba7 --- /dev/null +++ b/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."parts_tax_rate" IS E'null' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "tax_pstthr" to "parts_tax_rate"; + type: run_sql diff --git a/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/up.yaml b/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/up.yaml new file mode 100644 index 000000000..3a0211519 --- /dev/null +++ b/hasura/migrations/1580342506429_alter_table_public_jobs_alter_column_parts_tax_rate/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."parts_tax_rate" IS E'' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "parts_tax_rate" to "tax_pstthr"; + type: run_sql diff --git a/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml b/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml new file mode 100644 index 000000000..c27db234f --- /dev/null +++ b/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_pstthr" IS E'null' + type: run_sql diff --git a/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml b/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml new file mode 100644 index 000000000..94dea43fb --- /dev/null +++ b/hasura/migrations/1580342523444_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_pstthr" IS E'PST for Parts' + type: run_sql diff --git a/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/down.yaml b/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/down.yaml new file mode 100644 index 000000000..1fcc511d5 --- /dev/null +++ b/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "tax_tow_rt"; + type: run_sql diff --git a/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/up.yaml b/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/up.yaml new file mode 100644 index 000000000..865d7bbfb --- /dev/null +++ b/hasura/migrations/1580342644474_alter_table_public_jobs_add_column_tax_tow_rt/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "tax_tow_rt" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml b/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml new file mode 100644 index 000000000..c748246fa --- /dev/null +++ b/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_tow_rt" IS E'null' + type: run_sql diff --git a/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml b/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml new file mode 100644 index 000000000..050699106 --- /dev/null +++ b/hasura/migrations/1580342652067_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_tow_rt" IS E'Taxing tow Rate' + type: run_sql diff --git a/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/down.yaml b/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/down.yaml new file mode 100644 index 000000000..3c2faedff --- /dev/null +++ b/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "tax_sub_rt"; + type: run_sql diff --git a/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/up.yaml b/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/up.yaml new file mode 100644 index 000000000..b77cd85bd --- /dev/null +++ b/hasura/migrations/1580342697226_alter_table_public_jobs_add_column_tax_sub_rt/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "tax_sub_rt" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/down.yaml b/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/down.yaml new file mode 100644 index 000000000..a8957d602 --- /dev/null +++ b/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_sub_rt" IS E'null' + type: run_sql diff --git a/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/up.yaml b/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/up.yaml new file mode 100644 index 000000000..3796212ba --- /dev/null +++ b/hasura/migrations/1580342709854_alter_table_public_jobs_alter_column_tax_sub_rt/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_sub_rt" IS E'Sublet Tax Rate' + type: run_sql diff --git a/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml b/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml new file mode 100644 index 000000000..94dea43fb --- /dev/null +++ b/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_pstthr" IS E'PST for Parts' + type: run_sql diff --git a/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml b/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml new file mode 100644 index 000000000..94caad8e1 --- /dev/null +++ b/hasura/migrations/1580342722401_alter_table_public_jobs_alter_column_tax_pstthr/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_pstthr" IS E'Parts Tax Rate' + type: run_sql diff --git a/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml b/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml new file mode 100644 index 000000000..050699106 --- /dev/null +++ b/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_tow_rt" IS E'Taxing tow Rate' + type: run_sql diff --git a/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml b/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml new file mode 100644 index 000000000..ae024a852 --- /dev/null +++ b/hasura/migrations/1580342734703_alter_table_public_jobs_alter_column_tax_tow_rt/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_tow_rt" IS E'Towing Tax Rate' + type: run_sql diff --git a/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..a0210b669 --- /dev/null +++ b/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,230 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - shopid + - ro_number + - ownerid + - vehicleid + - labor_rate_id + - labor_rate_desc + - rate_lab + - rate_lad + - rate_lae + - rate_lar + - rate_las + - rate_laf + - rate_lam + - rate_lag + - rate_atp + - rate_lau + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_mapa + - rate_mash + - rate_mahw + - rate_ma2s + - rate_ma3s + - rate_ma2t + - rate_mabl + - rate_macs + - rate_matd + - federal_tax_rate + - state_tax_rate + - local_tax_rate + - est_co_nm + - est_addr1 + - est_addr2 + - est_city + - est_st + - est_zip + - est_ctry + - est_ph1 + - est_ea + - est_ct_ln + - est_ct_fn + - scheduled_in + - actual_in + - scheduled_completion + - actual_completion + - scheduled_delivery + - actual_delivery + - regie_number + - invoice_date + - claim_total + - deductible + - inproduction + - statusid + - ins_co_id + - ins_co_nm + - ins_addr1 + - ins_addr2 + - ins_city + - ins_st + - ins_zip + - ins_ctry + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_fax + - ins_faxx + - ins_ct_ln + - ins_ct_fn + - ins_title + - ins_ct_ph + - ins_ct_phx + - ins_ea + - ins_memo + - policy_no + - ded_amt + - ded_status + - asgn_no + - asgn_date + - asgn_type + - clm_no + - clm_ofc_id + - date_estimated + - date_open + - date_scheduled + - date_invoiced + - date_closed + - date_exported + - clm_total + - owner_owing + - converted + - ciecaid + - loss_date + - clm_ofc_nm + - clm_addr1 + - clm_addr2 + - clm_city + - clm_st + - clm_zip + - clm_ctry + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_fax + - clm_faxx + - clm_ct_ln + - clm_ct_fn + - clm_title + - clm_ct_ph + - clm_ct_phx + - clm_ea + - payee_nms + - pay_type + - pay_date + - pay_chknm + - pay_amt + - agt_co_id + - agt_co_nm + - agt_addr1 + - agt_addr2 + - agt_city + - agt_st + - agt_zip + - agt_ctry + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_fax + - agt_faxx + - agt_ct_ln + - agt_ct_fn + - agt_ct_ph + - agt_ct_phx + - agt_ea + - agt_lic_no + - loss_type + - loss_desc + - theft_ind + - cat_no + - tlos_ind + - cust_pr + - insd_ln + - insd_fn + - insd_title + - insd_co_nm + - insd_addr1 + - insd_addr2 + - insd_city + - insd_st + - insd_zip + - insd_ctry + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_fax + - insd_faxx + - insd_ea + - ownr_ln + - ownr_fn + - ownr_title + - ownr_co_nm + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_fax + - ownr_faxx + - ownr_ea + - area_of_damage + - loss_cat + - est_number + - service_car + - special_coverage_policy + - csr + - po_number + - unit_number + - kmin + - kmout + - referral_source + - selling_dealer + - servicing_dealer + - servicing_dealer_contact + - selling_dealer_contact + - depreciation_taxes + - federal_tax_payable + - other_amount_payable + - towing_payable + - storage_payable + - adjustment_bottom_line + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..5e96a692b --- /dev/null +++ b/hasura/migrations/1580343246214_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,233 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - shopid + - ro_number + - ownerid + - vehicleid + - labor_rate_id + - labor_rate_desc + - rate_lab + - rate_lad + - rate_lae + - rate_lar + - rate_las + - rate_laf + - rate_lam + - rate_lag + - rate_atp + - rate_lau + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_mapa + - rate_mash + - rate_mahw + - rate_ma2s + - rate_ma3s + - rate_ma2t + - rate_mabl + - rate_macs + - rate_matd + - federal_tax_rate + - state_tax_rate + - local_tax_rate + - est_co_nm + - est_addr1 + - est_addr2 + - est_city + - est_st + - est_zip + - est_ctry + - est_ph1 + - est_ea + - est_ct_ln + - est_ct_fn + - scheduled_in + - actual_in + - scheduled_completion + - actual_completion + - scheduled_delivery + - actual_delivery + - regie_number + - invoice_date + - claim_total + - deductible + - inproduction + - statusid + - ins_co_id + - ins_co_nm + - ins_addr1 + - ins_addr2 + - ins_city + - ins_st + - ins_zip + - ins_ctry + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_fax + - ins_faxx + - ins_ct_ln + - ins_ct_fn + - ins_title + - ins_ct_ph + - ins_ct_phx + - ins_ea + - ins_memo + - policy_no + - ded_amt + - ded_status + - asgn_no + - asgn_date + - asgn_type + - clm_no + - clm_ofc_id + - date_estimated + - date_open + - date_scheduled + - date_invoiced + - date_closed + - date_exported + - clm_total + - owner_owing + - converted + - ciecaid + - loss_date + - clm_ofc_nm + - clm_addr1 + - clm_addr2 + - clm_city + - clm_st + - clm_zip + - clm_ctry + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_fax + - clm_faxx + - clm_ct_ln + - clm_ct_fn + - clm_title + - clm_ct_ph + - clm_ct_phx + - clm_ea + - payee_nms + - pay_type + - pay_date + - pay_chknm + - pay_amt + - agt_co_id + - agt_co_nm + - agt_addr1 + - agt_addr2 + - agt_city + - agt_st + - agt_zip + - agt_ctry + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_fax + - agt_faxx + - agt_ct_ln + - agt_ct_fn + - agt_ct_ph + - agt_ct_phx + - agt_ea + - agt_lic_no + - loss_type + - loss_desc + - theft_ind + - cat_no + - tlos_ind + - cust_pr + - insd_ln + - insd_fn + - insd_title + - insd_co_nm + - insd_addr1 + - insd_addr2 + - insd_city + - insd_st + - insd_zip + - insd_ctry + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_fax + - insd_faxx + - insd_ea + - ownr_ln + - ownr_fn + - ownr_title + - ownr_co_nm + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_fax + - ownr_faxx + - ownr_ea + - area_of_damage + - loss_cat + - est_number + - service_car + - special_coverage_policy + - csr + - po_number + - unit_number + - kmin + - kmout + - referral_source + - selling_dealer + - servicing_dealer + - servicing_dealer_contact + - selling_dealer_contact + - depreciation_taxes + - federal_tax_payable + - other_amount_payable + - towing_payable + - storage_payable + - adjustment_bottom_line + - tax_pstthr + - tax_tow_rt + - tax_sub_rt + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..e18ccedb9 --- /dev/null +++ b/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,228 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - converted + - inproduction + - special_coverage_policy + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - theft_ind + - tlos_ind + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..e7684a905 --- /dev/null +++ b/hasura/migrations/1580343251291_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,231 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..56280c418 --- /dev/null +++ b/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,230 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - converted + - inproduction + - special_coverage_policy + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - theft_ind + - tlos_ind + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..8910ace88 --- /dev/null +++ b/hasura/migrations/1580343257730_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,233 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_update_permission From 7630547c6c25aca0968fad162e188394fd2ae97d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 17:36:29 -0800 Subject: [PATCH 6/8] Field migrations for job importing. --- .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 233 +++++++++++++++++ .../up.yaml | 235 ++++++++++++++++++ .../down.yaml | 231 +++++++++++++++++ .../up.yaml | 233 +++++++++++++++++ .../down.yaml | 233 +++++++++++++++++ .../up.yaml | 235 ++++++++++++++++++ 14 files changed, 1436 insertions(+) create mode 100644 hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/down.yaml create mode 100644 hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/up.yaml create mode 100644 hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/down.yaml create mode 100644 hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/up.yaml create mode 100644 hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/down.yaml create mode 100644 hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/up.yaml create mode 100644 hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/down.yaml create mode 100644 hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/up.yaml create mode 100644 hasura/migrations/1580346901283_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580346901283_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580346908847_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580346908847_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580346914307_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580346914307_update_permission_user_public_table_jobs/up.yaml diff --git a/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/down.yaml b/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/down.yaml new file mode 100644 index 000000000..389f605db --- /dev/null +++ b/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "tax_paint_mat"; + type: run_sql diff --git a/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/up.yaml b/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/up.yaml new file mode 100644 index 000000000..d3ad68e79 --- /dev/null +++ b/hasura/migrations/1580346541910_alter_table_public_jobs_add_column_tax_paint_mat/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "tax_paint_mat" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/down.yaml b/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/down.yaml new file mode 100644 index 000000000..6a972b65f --- /dev/null +++ b/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "tax_levies"; + type: run_sql diff --git a/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/up.yaml b/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/up.yaml new file mode 100644 index 000000000..13ffaa8ad --- /dev/null +++ b/hasura/migrations/1580346657585_alter_table_public_jobs_add_column_tax_levies/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "tax_levies" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/down.yaml b/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/down.yaml new file mode 100644 index 000000000..74c06e879 --- /dev/null +++ b/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_paint_mat" IS E'null' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "tax_paint_mat_rt" to "tax_paint_mat"; + type: run_sql diff --git a/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/up.yaml b/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/up.yaml new file mode 100644 index 000000000..46cacd480 --- /dev/null +++ b/hasura/migrations/1580346809511_alter_table_public_jobs_alter_column_tax_paint_mat/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_paint_mat" IS E'' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "tax_paint_mat" to "tax_paint_mat_rt"; + type: run_sql diff --git a/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/down.yaml b/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/down.yaml new file mode 100644 index 000000000..35a057441 --- /dev/null +++ b/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_levies" IS E'null' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "tax_levies_rt" to "tax_levies"; + type: run_sql diff --git a/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/up.yaml b/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/up.yaml new file mode 100644 index 000000000..5032d0a22 --- /dev/null +++ b/hasura/migrations/1580346822949_alter_table_public_jobs_alter_column_tax_levies/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."tax_levies" IS E'' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "tax_levies" to "tax_levies_rt"; + type: run_sql diff --git a/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..5e96a692b --- /dev/null +++ b/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,233 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - shopid + - ro_number + - ownerid + - vehicleid + - labor_rate_id + - labor_rate_desc + - rate_lab + - rate_lad + - rate_lae + - rate_lar + - rate_las + - rate_laf + - rate_lam + - rate_lag + - rate_atp + - rate_lau + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_mapa + - rate_mash + - rate_mahw + - rate_ma2s + - rate_ma3s + - rate_ma2t + - rate_mabl + - rate_macs + - rate_matd + - federal_tax_rate + - state_tax_rate + - local_tax_rate + - est_co_nm + - est_addr1 + - est_addr2 + - est_city + - est_st + - est_zip + - est_ctry + - est_ph1 + - est_ea + - est_ct_ln + - est_ct_fn + - scheduled_in + - actual_in + - scheduled_completion + - actual_completion + - scheduled_delivery + - actual_delivery + - regie_number + - invoice_date + - claim_total + - deductible + - inproduction + - statusid + - ins_co_id + - ins_co_nm + - ins_addr1 + - ins_addr2 + - ins_city + - ins_st + - ins_zip + - ins_ctry + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_fax + - ins_faxx + - ins_ct_ln + - ins_ct_fn + - ins_title + - ins_ct_ph + - ins_ct_phx + - ins_ea + - ins_memo + - policy_no + - ded_amt + - ded_status + - asgn_no + - asgn_date + - asgn_type + - clm_no + - clm_ofc_id + - date_estimated + - date_open + - date_scheduled + - date_invoiced + - date_closed + - date_exported + - clm_total + - owner_owing + - converted + - ciecaid + - loss_date + - clm_ofc_nm + - clm_addr1 + - clm_addr2 + - clm_city + - clm_st + - clm_zip + - clm_ctry + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_fax + - clm_faxx + - clm_ct_ln + - clm_ct_fn + - clm_title + - clm_ct_ph + - clm_ct_phx + - clm_ea + - payee_nms + - pay_type + - pay_date + - pay_chknm + - pay_amt + - agt_co_id + - agt_co_nm + - agt_addr1 + - agt_addr2 + - agt_city + - agt_st + - agt_zip + - agt_ctry + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_fax + - agt_faxx + - agt_ct_ln + - agt_ct_fn + - agt_ct_ph + - agt_ct_phx + - agt_ea + - agt_lic_no + - loss_type + - loss_desc + - theft_ind + - cat_no + - tlos_ind + - cust_pr + - insd_ln + - insd_fn + - insd_title + - insd_co_nm + - insd_addr1 + - insd_addr2 + - insd_city + - insd_st + - insd_zip + - insd_ctry + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_fax + - insd_faxx + - insd_ea + - ownr_ln + - ownr_fn + - ownr_title + - ownr_co_nm + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_fax + - ownr_faxx + - ownr_ea + - area_of_damage + - loss_cat + - est_number + - service_car + - special_coverage_policy + - csr + - po_number + - unit_number + - kmin + - kmout + - referral_source + - selling_dealer + - servicing_dealer + - servicing_dealer_contact + - selling_dealer_contact + - depreciation_taxes + - federal_tax_payable + - other_amount_payable + - towing_payable + - storage_payable + - adjustment_bottom_line + - tax_pstthr + - tax_tow_rt + - tax_sub_rt + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..c78859077 --- /dev/null +++ b/hasura/migrations/1580346901283_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,235 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - shopid + - ro_number + - ownerid + - vehicleid + - labor_rate_id + - labor_rate_desc + - rate_lab + - rate_lad + - rate_lae + - rate_lar + - rate_las + - rate_laf + - rate_lam + - rate_lag + - rate_atp + - rate_lau + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_mapa + - rate_mash + - rate_mahw + - rate_ma2s + - rate_ma3s + - rate_ma2t + - rate_mabl + - rate_macs + - rate_matd + - federal_tax_rate + - state_tax_rate + - local_tax_rate + - est_co_nm + - est_addr1 + - est_addr2 + - est_city + - est_st + - est_zip + - est_ctry + - est_ph1 + - est_ea + - est_ct_ln + - est_ct_fn + - scheduled_in + - actual_in + - scheduled_completion + - actual_completion + - scheduled_delivery + - actual_delivery + - regie_number + - invoice_date + - claim_total + - deductible + - inproduction + - statusid + - ins_co_id + - ins_co_nm + - ins_addr1 + - ins_addr2 + - ins_city + - ins_st + - ins_zip + - ins_ctry + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_fax + - ins_faxx + - ins_ct_ln + - ins_ct_fn + - ins_title + - ins_ct_ph + - ins_ct_phx + - ins_ea + - ins_memo + - policy_no + - ded_amt + - ded_status + - asgn_no + - asgn_date + - asgn_type + - clm_no + - clm_ofc_id + - date_estimated + - date_open + - date_scheduled + - date_invoiced + - date_closed + - date_exported + - clm_total + - owner_owing + - converted + - ciecaid + - loss_date + - clm_ofc_nm + - clm_addr1 + - clm_addr2 + - clm_city + - clm_st + - clm_zip + - clm_ctry + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_fax + - clm_faxx + - clm_ct_ln + - clm_ct_fn + - clm_title + - clm_ct_ph + - clm_ct_phx + - clm_ea + - payee_nms + - pay_type + - pay_date + - pay_chknm + - pay_amt + - agt_co_id + - agt_co_nm + - agt_addr1 + - agt_addr2 + - agt_city + - agt_st + - agt_zip + - agt_ctry + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_fax + - agt_faxx + - agt_ct_ln + - agt_ct_fn + - agt_ct_ph + - agt_ct_phx + - agt_ea + - agt_lic_no + - loss_type + - loss_desc + - theft_ind + - cat_no + - tlos_ind + - cust_pr + - insd_ln + - insd_fn + - insd_title + - insd_co_nm + - insd_addr1 + - insd_addr2 + - insd_city + - insd_st + - insd_zip + - insd_ctry + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_fax + - insd_faxx + - insd_ea + - ownr_ln + - ownr_fn + - ownr_title + - ownr_co_nm + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_st + - ownr_zip + - ownr_ctry + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_fax + - ownr_faxx + - ownr_ea + - area_of_damage + - loss_cat + - est_number + - service_car + - special_coverage_policy + - csr + - po_number + - unit_number + - kmin + - kmout + - referral_source + - selling_dealer + - servicing_dealer + - servicing_dealer_contact + - selling_dealer_contact + - depreciation_taxes + - federal_tax_payable + - other_amount_payable + - towing_payable + - storage_payable + - adjustment_bottom_line + - tax_pstthr + - tax_tow_rt + - tax_sub_rt + - tax_paint_mat_rt + - tax_levies_rt + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..e7684a905 --- /dev/null +++ b/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,231 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..6b5aa011f --- /dev/null +++ b/hasura/migrations/1580346908847_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,233 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - tax_levies_rt + - tax_paint_mat_rt + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..8910ace88 --- /dev/null +++ b/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,233 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..7d2fcd6cc --- /dev/null +++ b/hasura/migrations/1580346914307_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,235 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - converted + - inproduction + - special_coverage_policy + - theft_ind + - tlos_ind + - asgn_date + - invoice_date + - loss_date + - pay_date + - kmin + - kmout + - est_number + - area_of_damage + - adjustment_bottom_line + - claim_total + - clm_total + - ded_amt + - deductible + - depreciation_taxes + - federal_tax_payable + - federal_tax_rate + - local_tax_rate + - other_amount_payable + - owner_owing + - pay_amt + - rate_atp + - rate_la1 + - rate_la2 + - rate_la3 + - rate_la4 + - rate_lab + - rate_lad + - rate_lae + - rate_laf + - rate_lag + - rate_lam + - rate_lar + - rate_las + - rate_lau + - rate_ma2s + - rate_ma2t + - rate_ma3s + - rate_mabl + - rate_macs + - rate_mahw + - rate_mapa + - rate_mash + - rate_matd + - state_tax_rate + - storage_payable + - tax_levies_rt + - tax_paint_mat_rt + - towing_payable + - agt_addr1 + - agt_addr2 + - agt_city + - agt_co_id + - agt_co_nm + - agt_ct_fn + - agt_ct_ln + - agt_ct_ph + - agt_ct_phx + - agt_ctry + - agt_ea + - agt_fax + - agt_faxx + - agt_lic_no + - agt_ph1 + - agt_ph1x + - agt_ph2 + - agt_ph2x + - agt_st + - agt_zip + - asgn_no + - asgn_type + - cat_no + - ciecaid + - clm_addr1 + - clm_addr2 + - clm_city + - clm_ct_fn + - clm_ct_ln + - clm_ct_ph + - clm_ct_phx + - clm_ctry + - clm_ea + - clm_fax + - clm_faxx + - clm_no + - clm_ofc_id + - clm_ofc_nm + - clm_ph1 + - clm_ph1x + - clm_ph2 + - clm_ph2x + - clm_st + - clm_title + - clm_zip + - csr + - cust_pr + - ded_status + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_ph1 + - est_st + - est_zip + - ins_addr1 + - ins_addr2 + - ins_city + - ins_co_id + - ins_co_nm + - ins_ct_fn + - ins_ct_ln + - ins_ct_ph + - ins_ct_phx + - ins_ctry + - insd_addr1 + - insd_addr2 + - insd_city + - insd_co_nm + - insd_ctry + - insd_ea + - insd_fax + - insd_faxx + - insd_fn + - insd_ln + - insd_ph1 + - insd_ph1x + - insd_ph2 + - insd_ph2x + - insd_st + - insd_title + - insd_zip + - ins_ea + - ins_fax + - ins_faxx + - ins_memo + - ins_ph1 + - ins_ph1x + - ins_ph2 + - ins_ph2x + - ins_st + - ins_title + - ins_zip + - labor_rate_desc + - labor_rate_id + - loss_cat + - loss_desc + - loss_type + - ownr_addr1 + - ownr_addr2 + - ownr_city + - ownr_co_nm + - ownr_ctry + - ownr_ea + - ownr_fax + - ownr_faxx + - ownr_fn + - ownr_ln + - ownr_ph1 + - ownr_ph1x + - ownr_ph2 + - ownr_ph2x + - ownr_st + - ownr_title + - ownr_zip + - pay_chknm + - payee_nms + - pay_type + - policy_no + - po_number + - referral_source + - regie_number + - ro_number + - selling_dealer + - selling_dealer_contact + - service_car + - servicing_dealer + - servicing_dealer_contact + - unit_number + - actual_completion + - actual_delivery + - actual_in + - created_at + - date_closed + - date_estimated + - date_exported + - date_invoiced + - date_open + - date_scheduled + - scheduled_completion + - scheduled_delivery + - scheduled_in + - updated_at + - id + - ownerid + - shopid + - statusid + - vehicleid + - tax_pstthr + - tax_sub_rt + - tax_tow_rt + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_update_permission From 7eedd9540346395c15a223d9091f601d3893882d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 29 Jan 2020 20:15:36 -0800 Subject: [PATCH 7/8] Added joblines to repair data. Field migrations to conform to cieca standards for joblines --- bodyshop_translations.babel | 115 ++++++++++++++++++ .../job-lines/job-lines.component.jsx | 57 +++++++-- ....component.jsx => job-lines.container.jsx} | 3 +- client/src/graphql/jobs.queries.js | 17 +++ .../jobs-detail.page.component.jsx | 5 +- client/src/translations/en_us/common.json | 9 ++ client/src/translations/es/common.json | 9 ++ client/src/translations/fr/common.json | 9 ++ .../1580356194265_alter_line_ref/down.yaml | 1 + .../1580356194265_alter_line_ref/up.yaml | 7 ++ .../down.yaml | 6 + .../up.yaml | 6 + 12 files changed, 230 insertions(+), 14 deletions(-) rename client/src/components/job-lines/{job-lines.container.component.jsx => job-lines.container.jsx} (89%) create mode 100644 hasura/migrations/1580356194265_alter_line_ref/down.yaml create mode 100644 hasura/migrations/1580356194265_alter_line_ref/up.yaml create mode 100644 hasura/migrations/1580356212983_alter_table_public_joblines_alter_column_line_ref/down.yaml create mode 100644 hasura/migrations/1580356212983_alter_table_public_joblines_alter_column_line_ref/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 861135c34..319a8d546 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -462,6 +462,121 @@ + + joblines + + + fields + + + act_price + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + db_price + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + line_desc + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + part_type + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + unq_seq + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + jobs diff --git a/client/src/components/job-lines/job-lines.component.jsx b/client/src/components/job-lines/job-lines.component.jsx index 7b1f6cca8..fedc980ed 100644 --- a/client/src/components/job-lines/job-lines.component.jsx +++ b/client/src/components/job-lines/job-lines.component.jsx @@ -1,33 +1,69 @@ import React, { useState } from "react"; import { Table } from "antd"; import { alphaSort } from "../../utils/sorters"; +import { useTranslation } from "react-i18next"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; -export default function JobLinesComponent({ loading, joblines }) { +export default function JobLinesComponent({ job }) { const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const { t } = useTranslation(); const columns = [ { - title: "Line #", - dataIndex: "line_ind", - key: "line_ind", + title: t("joblines.fields.unq_seq"), + dataIndex: "unq_seq", + key: "unq_seq", // onFilter: (value, record) => record.ro_number.includes(value), // filteredValue: state.filteredInfo.text || null, sorter: (a, b) => alphaSort(a, b), sortOrder: - state.sortedInfo.columnKey === "line_ind" && state.sortedInfo.order, - ellipsis: true + state.sortedInfo.columnKey === "unq_seq" && state.sortedInfo.order + //ellipsis: true }, { - title: "Description", + title: t("joblines.fields.line_desc"), dataIndex: "line_desc", key: "line_desc", - sorter: (a, b) => alphaSort(a, b), + sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), sortOrder: state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order, ellipsis: true + }, + { + title: t("joblines.fields.part_type"), + dataIndex: "part_type", + key: "part_type", + sorter: (a, b) => alphaSort(a.part_type, b.part_type), + sortOrder: + state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order, + ellipsis: true + }, + { + title: t("joblines.fields.db_price"), + dataIndex: "db_price", + key: "db_price", + sorter: (a, b) => a.db_price - b.db_price, + sortOrder: + state.sortedInfo.columnKey === "db_price" && state.sortedInfo.order, + ellipsis: true, + render: (text, record) => ( + {record.db_price} + ) + }, + { + title: t("joblines.fields.act_price"), + dataIndex: "act_price", + key: "act_price", + sorter: (a, b) => a.act_price - b.act_price, + sortOrder: + state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order, + ellipsis: true, + render: (text, record) => ( + {record.act_price} + ) } ]; @@ -39,14 +75,13 @@ export default function JobLinesComponent({ loading, joblines }) { // const { value } = event.target; // setState({ ...state, filterinfo: { text: [value] } }); // }; - return (
({ ...item }))} rowKey='id' - dataSource={joblines} + dataSource={job.joblines} onChange={handleTableChange} /> ); diff --git a/client/src/components/job-lines/job-lines.container.component.jsx b/client/src/components/job-lines/job-lines.container.jsx similarity index 89% rename from client/src/components/job-lines/job-lines.container.component.jsx rename to client/src/components/job-lines/job-lines.container.jsx index 70e74c7c5..cf59100b2 100644 --- a/client/src/components/job-lines/job-lines.container.component.jsx +++ b/client/src/components/job-lines/job-lines.container.jsx @@ -1,7 +1,7 @@ import React from "react"; import JobLinesComponent from "./job-lines.component"; import { useQuery } from "@apollo/react-hooks"; -import AlertComponent from "../../components/alert/alert.component"; +import AlertComponent from "../alert/alert.component"; import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; @@ -16,3 +16,4 @@ export default function JobLinesContainer({ jobId }) { ); } + \ No newline at end of file diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 5bffe873d..f90290794 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -159,6 +159,23 @@ export const GET_JOB_BY_PK = gql` ownr_fn ownr_ln } + + joblines{ + id + unq_seq + line_ind + line_desc + part_type + oem_partno + db_price + act_price + part_qty + mod_lbr_ty + db_hrs + mod_lb_hrs + lbr_op + lbr_amt + } } } `; diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 7f7c27aa7..d2a44a7ce 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -7,7 +7,8 @@ import { FaRegStickyNote, FaShieldAlt } from "react-icons/fa"; -import JobLinesContainer from "../../components/job-lines/job-lines.container.component"; +//import JobLinesContainer from "../../components/job-lines/job-lines.container"; +import JobsLines from '../../components/job-lines/job-lines.component' import JobsDetailClaims from "../../components/jobs-detail-claims/jobs-detail-claims.component"; import JobsDetailFinancials from "../../components/jobs-detail-financial/jobs-detail-financial.component"; import JobsDetailHeader from "../../components/jobs-detail-header/jobs-detail-header.component"; @@ -94,7 +95,7 @@ export default function JobsDetailPage({ } key="repairdata" > - + Date: Wed, 29 Jan 2020 21:16:27 -0800 Subject: [PATCH 8/8] WIP for editable cells. Changed the keys + added new cells for editing. --- .../job-lines-cell.component.jsx | 52 +++++++++++++++ .../job-lines.component.jsx | 66 ++++++++++++++----- .../job-lines.container.jsx | 0 .../jobs-detail.page.component.jsx | 3 +- 4 files changed, 104 insertions(+), 17 deletions(-) create mode 100644 client/src/components/job-detail-lines/job-lines-cell.component.jsx rename client/src/components/{job-lines => job-detail-lines}/job-lines.component.jsx (61%) rename client/src/components/{job-lines => job-detail-lines}/job-lines.container.jsx (100%) diff --git a/client/src/components/job-detail-lines/job-lines-cell.component.jsx b/client/src/components/job-detail-lines/job-lines-cell.component.jsx new file mode 100644 index 000000000..1ea38f1b2 --- /dev/null +++ b/client/src/components/job-detail-lines/job-lines-cell.component.jsx @@ -0,0 +1,52 @@ +import React from "react"; +import { Form, Input, InputNumber } from "antd"; +import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context"; + +export default class EditableCell extends React.Component { + getInput = () => { + if (this.props.inputType === "number") { + return ; + } + return ; + }; + + renderCell = ({ getFieldDecorator }) => { + const { + editing, + dataIndex, + title, + inputType, + record, + index, + children, + ...restProps + } = this.props; + return ( + + ); + }; + + render() { + return ( + + {this.renderCell} + + ); + } +} diff --git a/client/src/components/job-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx similarity index 61% rename from client/src/components/job-lines/job-lines.component.jsx rename to client/src/components/job-detail-lines/job-lines.component.jsx index fedc980ed..135dc6dea 100644 --- a/client/src/components/job-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -1,50 +1,58 @@ -import React, { useState } from "react"; -import { Table } from "antd"; -import { alphaSort } from "../../utils/sorters"; +import { Table, Button } from "antd"; +import React, { useContext, useState } from "react"; import { useTranslation } from "react-i18next"; +import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; +import { alphaSort } from "../../utils/sorters"; +import EditableCell from "./job-lines-cell.component"; export default function JobLinesComponent({ job }) { + //const form = useContext(JobDetailFormContext); + //const { getFieldDecorator } = form; const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const [editingKey, setEditingKey] = useState(""); const { t } = useTranslation(); const columns = [ { title: t("joblines.fields.unq_seq"), - dataIndex: "unq_seq", - key: "unq_seq", + dataIndex: "joblines.unq_seq", + key: "joblines.unq_seq", // onFilter: (value, record) => record.ro_number.includes(value), // filteredValue: state.filteredInfo.text || null, sorter: (a, b) => alphaSort(a, b), sortOrder: - state.sortedInfo.columnKey === "unq_seq" && state.sortedInfo.order - //ellipsis: true + state.sortedInfo.columnKey === "unq_seq" && state.sortedInfo.order, + //ellipsis: true, + editable: true }, { title: t("joblines.fields.line_desc"), dataIndex: "line_desc", - key: "line_desc", + key: "joblines.line_desc", sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), sortOrder: state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order, - ellipsis: true + ellipsis: true, + editable: true }, { title: t("joblines.fields.part_type"), dataIndex: "part_type", - key: "part_type", + key: "joblines.part_type", sorter: (a, b) => alphaSort(a.part_type, b.part_type), sortOrder: state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order, - ellipsis: true + ellipsis: true, + editable: true }, { title: t("joblines.fields.db_price"), dataIndex: "db_price", - key: "db_price", + key: "joblines.db_price", sorter: (a, b) => a.db_price - b.db_price, sortOrder: state.sortedInfo.columnKey === "db_price" && state.sortedInfo.order, @@ -56,13 +64,22 @@ export default function JobLinesComponent({ job }) { { title: t("joblines.fields.act_price"), dataIndex: "act_price", - key: "act_price", + key: "joblines.act_price", sorter: (a, b) => a.act_price - b.act_price, sortOrder: state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order, ellipsis: true, render: (text, record) => ( - {record.act_price} +
+ {" "} + {record.act_price}{" "} + +
) } ]; @@ -79,7 +96,26 @@ export default function JobLinesComponent({ job }) {
+ {editing ? ( + + {getFieldDecorator(dataIndex, { + rules: [ + { + required: true, + message: `Please Input ${title}!` + } + ], + initialValue: record[dataIndex] + })(this.getInput())} + + ) : ( + children + )} +
({ ...item }))} + columns={columns.map(col => { + if (!col.editable) { + return col; + } + return { + ...col, + onCell: record => ({ + record, + inputType: col.dataIndex === "age" ? "number" : "text", + dataIndex: col.dataIndex, + title: col.title, + editing: editingKey === record.id + }) + }; + })} + components={{ + body: { + cell: EditableCell + } + }} rowKey='id' dataSource={job.joblines} onChange={handleTableChange} diff --git a/client/src/components/job-lines/job-lines.container.jsx b/client/src/components/job-detail-lines/job-lines.container.jsx similarity index 100% rename from client/src/components/job-lines/job-lines.container.jsx rename to client/src/components/job-detail-lines/job-lines.container.jsx diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index d2a44a7ce..beb249db2 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -7,8 +7,7 @@ import { FaRegStickyNote, FaShieldAlt } from "react-icons/fa"; -//import JobLinesContainer from "../../components/job-lines/job-lines.container"; -import JobsLines from '../../components/job-lines/job-lines.component' +import JobsLines from '../../components/job-detail-lines/job-lines.component' import JobsDetailClaims from "../../components/jobs-detail-claims/jobs-detail-claims.component"; import JobsDetailFinancials from "../../components/jobs-detail-financial/jobs-detail-financial.component"; import JobsDetailHeader from "../../components/jobs-detail-header/jobs-detail-header.component";