From 03d99a27c3c10c735acb461631c4bacd19718b38 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 16 Dec 2019 17:41:07 -0800 Subject: [PATCH] Jobslines schema. Added phone number formatting. --- client/package.json | 1 + client/src/App/App.container.jsx | 16 +-- client/src/App/App.js | 21 +-- .../phone-form-item.component.jsx | 14 ++ .../job-lines/job-lines.component.jsx | 53 +++++++ .../job-lines.container.component.jsx | 19 +++ .../job-tombstone/job-tombstone.component.jsx | 129 +++++++++++++++--- .../jobs-list/jobs-list.component.jsx | 8 +- client/src/graphql/jobs-lines.queries.js | 11 ++ client/src/graphql/jobs.queries.js | 32 ++--- client/src/graphql/resolvers.js | 5 +- .../pages/jobs-detail/jobs-detail.page.jsx | 44 +++++- client/src/pages/manage/manage.page.jsx | 13 +- client/yarn.lock | 7 + .../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 | 82 +++++++++++ .../up.yaml | 84 ++++++++++++ .../down.yaml | 81 +++++++++++ .../up.yaml | 83 +++++++++++ .../down.yaml | 82 +++++++++++ .../up.yaml | 84 ++++++++++++ .../down.yaml | 6 + .../up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 24 ++++ .../down.yaml | 12 ++ .../up.yaml | 20 +++ .../down.yaml | 6 + .../up.yaml | 45 ++++++ .../down.yaml | 6 + .../up.yaml | 42 ++++++ .../down.yaml | 6 + .../up.yaml | 44 ++++++ .../down.yaml | 6 + .../up.yaml | 17 +++ 42 files changed, 1076 insertions(+), 72 deletions(-) create mode 100644 client/src/components/form-items-formatted/phone-form-item.component.jsx create mode 100644 client/src/components/job-lines/job-lines.component.jsx create mode 100644 client/src/components/job-lines/job-lines.container.component.jsx create mode 100644 client/src/graphql/jobs-lines.queries.js create mode 100644 hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/down.yaml create mode 100644 hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/up.yaml create mode 100644 hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/down.yaml create mode 100644 hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/up.yaml create mode 100644 hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/down.yaml create mode 100644 hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/up.yaml create mode 100644 hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/down.yaml create mode 100644 hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/up.yaml create mode 100644 hasura/migrations/1576535389457_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1576535389457_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1576535397848_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1576535397848_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1576535406904_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1576535406904_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/down.yaml create mode 100644 hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/up.yaml create mode 100644 hasura/migrations/1576545362627_create_table_public_joblines/down.yaml create mode 100644 hasura/migrations/1576545362627_create_table_public_joblines/up.yaml create mode 100644 hasura/migrations/1576545371943_track_all_relationships/down.yaml create mode 100644 hasura/migrations/1576545371943_track_all_relationships/up.yaml create mode 100644 hasura/migrations/1576545448467_update_permission_user_public_table_joblines/down.yaml create mode 100644 hasura/migrations/1576545448467_update_permission_user_public_table_joblines/up.yaml create mode 100644 hasura/migrations/1576545454196_update_permission_user_public_table_joblines/down.yaml create mode 100644 hasura/migrations/1576545454196_update_permission_user_public_table_joblines/up.yaml create mode 100644 hasura/migrations/1576545472510_update_permission_user_public_table_joblines/down.yaml create mode 100644 hasura/migrations/1576545472510_update_permission_user_public_table_joblines/up.yaml create mode 100644 hasura/migrations/1576545476731_update_permission_user_public_table_joblines/down.yaml create mode 100644 hasura/migrations/1576545476731_update_permission_user_public_table_joblines/up.yaml diff --git a/client/package.json b/client/package.json index d994efdca..635a86e66 100644 --- a/client/package.json +++ b/client/package.json @@ -16,6 +16,7 @@ "react": "^16.12.0", "react-apollo": "^3.1.3", "react-dom": "^16.12.0", + "react-number-format": "^4.3.1", "react-router-dom": "^5.1.2", "react-scripts": "3.2.0", "react-trello": "^2.2.3", diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index 148ed0fe0..54ccd8791 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -49,14 +49,14 @@ class AppContainer extends Component { // split based on operation type ({ query }) => { const definition = getMainDefinition(query); - console.log( - "##Intercepted GQL Transaction : " + - definition.operation + - "|" + - definition.name.value + - "##", - query - ); + // console.log( + // "##Intercepted GQL Transaction : " + + // definition.operation + + // "|" + + // definition.name.value + + // "##", + // query + // ); return ( definition.kind === "OperationDefinition" && definition.operation === "subscription" diff --git a/client/src/App/App.js b/client/src/App/App.js index 3935637b4..4d60a8be2 100644 --- a/client/src/App/App.js +++ b/client/src/App/App.js @@ -23,23 +23,24 @@ export default () => { useEffect(() => { //Run the auth code only on the first render. - const unsubscribeFromAuth = auth.onIdTokenChanged(async user => { + const unsubscribeFromAuth = auth.onAuthStateChanged(async user => { if (user) { let token; token = await user.getIdToken(); const idTokenResult = await user.getIdTokenResult(); const hasuraClaim = idTokenResult.claims["https://hasura.io/jwt/claims"]; + if (!hasuraClaim) { + // Check if refresh is required. + const metadataRef = firebase + .database() + .ref("metadata/" + user.uid + "/refreshTime"); - // Check if refresh is required. - const metadataRef = firebase - .database() - .ref("metadata/" + user.uid + "/refreshTime"); - metadataRef.on("value", async params => { - console.log("params", params); - // Force refresh to pick up the latest custom claims changes. - token = await user.getIdToken(true); - }); + metadataRef.on("value", async () => { + // Force refresh to pick up the latest custom claims changes. + token = await user.getIdToken(true); + }); + } apolloClient.writeData({ data: { diff --git a/client/src/components/form-items-formatted/phone-form-item.component.jsx b/client/src/components/form-items-formatted/phone-form-item.component.jsx new file mode 100644 index 000000000..30638a00c --- /dev/null +++ b/client/src/components/form-items-formatted/phone-form-item.component.jsx @@ -0,0 +1,14 @@ +import React, { forwardRef } from "react"; +import NumberFormat from "react-number-format"; +function FormItemPhone(props, ref) { + return ( + + ); +} + +export default forwardRef(FormItemPhone); diff --git a/client/src/components/job-lines/job-lines.component.jsx b/client/src/components/job-lines/job-lines.component.jsx new file mode 100644 index 000000000..3117b4072 --- /dev/null +++ b/client/src/components/job-lines/job-lines.component.jsx @@ -0,0 +1,53 @@ +import React, { useState } from "react"; +import { Table } from "antd"; +import { alphaSort } from "../../utils/sorters"; + +export default function JobLinesComponent({ loading, joblines }) { + const [state, setState] = useState({ + sortedInfo: {}, + filteredInfo: { text: "" } + }); + + const columns = [ + { + title: "Line #", + dataIndex: "line_ind", + key: "line_ind", + // 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 + }, + { + title: "Description", + dataIndex: "line_desc", + key: "line_desc", + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order, + ellipsis: true + } + ]; + + const handleTableChange = (pagination, filters, sorter) => { + setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); + }; + + const handleChange = event => { + const { value } = event.target; + setState({ ...state, filterinfo: { text: [value] } }); + }; +console.log('joblines', joblines) + return ( + ({ ...item }))} + rowKey="id" + dataSource={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.component.jsx new file mode 100644 index 000000000..c5f4a994a --- /dev/null +++ b/client/src/components/job-lines/job-lines.container.component.jsx @@ -0,0 +1,19 @@ +import React from "react"; +import JobLinesComponent from "./job-lines.component"; +import { useQuery } from "@apollo/react-hooks"; +import AlertComponent from "../../components/alert/alert.component"; + +import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; + +export default function JobLinesContainer({ match }) { + const { jobId } = match.params; + + const { loading, error, data } = useQuery(GET_JOB_LINES_BY_PK, { + variables: { id: jobId }, + fetchPolicy: "network-only" + }); + if (error) return ; + return ( + + ); +} diff --git a/client/src/components/job-tombstone/job-tombstone.component.jsx b/client/src/components/job-tombstone/job-tombstone.component.jsx index caad9477a..61bf67b9d 100644 --- a/client/src/components/job-tombstone/job-tombstone.component.jsx +++ b/client/src/components/job-tombstone/job-tombstone.component.jsx @@ -1,8 +1,30 @@ import React, { useState } from "react"; import AlertComponent from "../alert/alert.component"; -import { Form, Input, Row, Col, Button } from "antd"; +import { + Form, + Input, + Row, + Col, + Button, + Typography, + PageHeader, + Descriptions, + Tag +} from "antd"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { useMutation } from "@apollo/react-hooks"; +import FormItemPhone from "../form-items-formatted/phone-form-item.component"; + +const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 12 } + } +}; function JobTombstone({ job, ...otherProps }) { const [jobContext, setJobContext] = useState(job); @@ -22,8 +44,6 @@ function JobTombstone({ job, ...otherProps }) { otherProps.form.validateFieldsAndScroll((err, values) => { if (!err) { - console.log("Received values of form: ", values); - mutationUpdateJob({ variables: { jobId: jobContext.id, job: values } }).then(r => console.log("result", r)); @@ -32,27 +52,102 @@ function JobTombstone({ job, ...otherProps }) { }; const handleChange = event => { - const { name, value } = event.target; + const { name, value } = event.target ? event.target : event; setJobContext({ ...jobContext, [name]: value }); }; const { getFieldDecorator } = otherProps.form; return ( -
-
- - - {getFieldDecorator("ro_number", { - initialValue: jobContext.ro_number - })()} + + {jobContext?.status}} + extra={[ + + - - - + ]} + > + + + $ {jobContext.claim_total?.toFixed(2)} + + + $ {jobContext.deductible?.toFixed(2)} + + + + + + Information + + {getFieldDecorator("ro_number", { + initialValue: jobContext.ro_number + })()} - + + + {getFieldDecorator("est_number", { + initialValue: jobContext.est_number + })()} + + + + + Insurance Information + + {getFieldDecorator("est_co_nm", { + initialValue: jobContext.est_co_nm + })()} + + + + {getFieldDecorator("est_ct_ln", { + initialValue: jobContext.est_ct_ln + })()} + + + {getFieldDecorator("est_ct_fn", { + initialValue: jobContext.est_ct_fn + })()} + + + + + {getFieldDecorator("est_ph1", { + initialValue: jobContext.est_ph1 + })( + + )} + + + {getFieldDecorator("est_ea", { + initialValue: jobContext.est_ea, + rules: [ + { + type: "email", + message: "This is not a valid email address." + } + ] + })()} + + + ); } diff --git a/client/src/components/jobs-list/jobs-list.component.jsx b/client/src/components/jobs-list/jobs-list.component.jsx index 3a69bd18b..bfc3e40ae 100644 --- a/client/src/components/jobs-list/jobs-list.component.jsx +++ b/client/src/components/jobs-list/jobs-list.component.jsx @@ -6,7 +6,7 @@ import { alphaSort } from "../../utils/sorters"; export default function JobsPage({ loading, jobs }) { const [state, setState] = useState({ sortedInfo: {}, - filteredInfo: null + filteredInfo: { text: "" } }); const columns = [ @@ -14,8 +14,8 @@ export default function JobsPage({ loading, jobs }) { title: "RO #", dataIndex: "ro_number", key: "ro_number", - onFilter: (value, record) => record.ro_number.includes(value), - filteredValue: state.filteredInfo.text || null, + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, sorter: (a, b) => alphaSort(a, b), sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order, @@ -88,7 +88,7 @@ export default function JobsPage({ loading, jobs }) { }; const handleChange = event => { - const { name, value } = event.target; + const { value } = event.target; setState({ ...state, filterinfo: { text: [value] } }); }; diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js new file mode 100644 index 000000000..4203fdf06 --- /dev/null +++ b/client/src/graphql/jobs-lines.queries.js @@ -0,0 +1,11 @@ +import { gql } from "apollo-boost"; + +export const GET_JOB_LINES_BY_PK = gql` + query GET_JOB_LINES_BY_PK($id: uuid!) { + joblines(where: { jobid: { _eq: $id } }) { + id + line_ind + line_desc + } + } +`; diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 92cdaf83a..dd8f3bf3b 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -62,29 +62,11 @@ export const GET_JOB_BY_PK = gql` last_name phone } - 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_mabl - rate_ma3s - rate_macs - rate_mahw - rate_mapa - rate_mash - rate_matd + est_co_nm + est_ph1 + est_ea + est_ct_fn + est_ct_ln regie_number ro_number scheduled_completion @@ -92,6 +74,8 @@ export const GET_JOB_BY_PK = gql` scheduled_delivery status updated_at + claim_total + deductible vehicle { plate_no v_vin @@ -109,6 +93,8 @@ export const UPDATE_JOB = gql` update_jobs(where: { id: { _eq: $jobId } }, _set: $job) { returning { id + est_ph1 + est_ea } } } diff --git a/client/src/graphql/resolvers.js b/client/src/graphql/resolvers.js index 296cf8344..b293bfd8b 100644 --- a/client/src/graphql/resolvers.js +++ b/client/src/graphql/resolvers.js @@ -1,8 +1,5 @@ import { gql } from "apollo-boost"; -import { - GET_CURRENT_USER, - GET_WHITE_BOARD_LEFT_SIDER_VISIBLE -} from "./local.queries"; +import { GET_CURRENT_USER } from "./local.queries"; export const typeDefs = gql` extend type Mutation { diff --git a/client/src/pages/jobs-detail/jobs-detail.page.jsx b/client/src/pages/jobs-detail/jobs-detail.page.jsx index c3e4aacba..abe320abe 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.jsx @@ -4,7 +4,8 @@ import SpinComponent from "../../components/loading-spinner/loading-spinner.comp import AlertComponent from "../../components/alert/alert.component"; import JobTombstone from "../../components/job-tombstone/job-tombstone.component"; import { GET_JOB_BY_PK } from "../../graphql/jobs.queries"; -import { Breadcrumb } from "antd"; +import { Tabs, Icon, Row } from "antd"; +import JobLinesContainer from "../../components/job-lines/job-lines.container.component"; function JobsDetailPage({ match }) { const { jobId } = match.params; @@ -17,7 +18,46 @@ function JobsDetailPage({ match }) { return (
- + + + + + + + + Lines + + } + key="lines" + > + + + + + Rates + + } + key="rates" + > + Estimate Rates + + + + Parts + + } + key="parts" + > + Estimate Parts + + +
); } diff --git a/client/src/pages/manage/manage.page.jsx b/client/src/pages/manage/manage.page.jsx index b4cf8133e..8239a7475 100644 --- a/client/src/pages/manage/manage.page.jsx +++ b/client/src/pages/manage/manage.page.jsx @@ -8,7 +8,7 @@ import JobsDetailPage from "../jobs-detail/jobs-detail.page"; import HeaderContainer from "../../components/header/header.container"; import FooterComponent from "../../components/footer/footer.component"; -import { Layout, BackTop } from "antd"; +import { Layout, BackTop, Col } from "antd"; const { Header, Content, Footer } = Layout; //This page will handle all routing for the entire application. @@ -20,10 +20,15 @@ export default function Manage({ match }) { - + + - - + + +
diff --git a/client/yarn.lock b/client/yarn.lock index 14fcd6b30..210d9773d 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -10050,6 +10050,13 @@ react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.2, react-lifecycles resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== +react-number-format@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/react-number-format/-/react-number-format-4.3.1.tgz#eccfc851d88d74c894ba463620ccb467defbdefb" + integrity sha512-ze6Lp7SGM71Jr0uZhUaN6grthv08NKTfJezS26zAWZq63ubmJ++FOX7ueGSK27EvpT7/e3ce9L3jlqr1YMFS7Q== + dependencies: + prop-types "^15.7.2" + react-popopo@^2.1.9: version "2.1.9" resolved "https://registry.yarnpkg.com/react-popopo/-/react-popopo-2.1.9.tgz#d93f70a8fb68227907d00c0cea4d8f5d321053ea" diff --git a/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/down.yaml b/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/down.yaml new file mode 100644 index 000000000..9962c7227 --- /dev/null +++ b/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "claim_total"; + type: run_sql diff --git a/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/up.yaml b/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/up.yaml new file mode 100644 index 000000000..da2211212 --- /dev/null +++ b/hasura/migrations/1576535281752_alter_table_public_jobs_add_column_claim_total/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "claim_total" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/down.yaml b/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/down.yaml new file mode 100644 index 000000000..4843e177d --- /dev/null +++ b/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" DROP COLUMN "deducitble"; + type: run_sql diff --git a/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/up.yaml b/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/up.yaml new file mode 100644 index 000000000..3ca55acc7 --- /dev/null +++ b/hasura/migrations/1576535291979_alter_table_public_jobs_add_column_deducitble/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."jobs" ADD COLUMN "deducitble" numeric NULL; + type: run_sql diff --git a/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/down.yaml b/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/down.yaml new file mode 100644 index 000000000..aeca06626 --- /dev/null +++ b/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE ONLY "public"."jobs" ALTER COLUMN "deducitble" SET DEFAULT 0; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."jobs"."deducitble" IS E'null' + type: run_sql diff --git a/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/up.yaml b/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/up.yaml new file mode 100644 index 000000000..9d5ce5e31 --- /dev/null +++ b/hasura/migrations/1576535325194_alter_table_public_jobs_alter_column_deducitble/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE ONLY "public"."jobs" ALTER COLUMN "deducitble" SET DEFAULT 0; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."jobs"."deducitble" IS E'' + type: run_sql diff --git a/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/down.yaml b/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/down.yaml new file mode 100644 index 000000000..9422e952a --- /dev/null +++ b/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE ONLY "public"."jobs" ALTER COLUMN "claim_total" SET DEFAULT 0; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."jobs"."claim_total" IS E'null' + type: run_sql diff --git a/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/up.yaml b/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/up.yaml new file mode 100644 index 000000000..a55ee0000 --- /dev/null +++ b/hasura/migrations/1576535331249_alter_table_public_jobs_alter_column_claim_total/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE ONLY "public"."jobs" ALTER COLUMN "claim_total" SET DEFAULT 0; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."jobs"."claim_total" IS E'' + type: run_sql diff --git a/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..8b3bf4f17 --- /dev/null +++ b/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,82 @@ +- 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: + - actual_completion + - actual_delivery + - actual_in + - created_at + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - federal_tax_rate + - invoice_date + - labor_rate_desc + - labor_rate_id + - local_tax_rate + - ownerid + - 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 + - regie_number + - ro_number + - scheduled_completion + - scheduled_delivery + - scheduled_in + - shopid + - state_tax_rate + - status + - updated_at + - vehicleid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..15a874168 --- /dev/null +++ b/hasura/migrations/1576535389457_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,84 @@ +- 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: + - actual_completion + - actual_delivery + - actual_in + - claim_total + - created_at + - deducitble + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - federal_tax_rate + - invoice_date + - labor_rate_desc + - labor_rate_id + - local_tax_rate + - ownerid + - 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 + - regie_number + - ro_number + - scheduled_completion + - scheduled_delivery + - scheduled_in + - shopid + - state_tax_rate + - status + - updated_at + - vehicleid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1576535397848_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1576535397848_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..2cab84166 --- /dev/null +++ b/hasura/migrations/1576535397848_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,81 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - invoice_date + - federal_tax_rate + - local_tax_rate + - 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 + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - labor_rate_desc + - labor_rate_id + - regie_number + - ro_number + - status + - actual_completion + - actual_delivery + - actual_in + - scheduled_completion + - scheduled_delivery + - scheduled_in + - created_at + - updated_at + - id + - ownerid + - shopid + - 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/1576535397848_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1576535397848_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..9a3c6d01b --- /dev/null +++ b/hasura/migrations/1576535397848_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,83 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - actual_completion + - actual_delivery + - actual_in + - claim_total + - created_at + - deducitble + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - federal_tax_rate + - id + - invoice_date + - labor_rate_desc + - labor_rate_id + - local_tax_rate + - ownerid + - 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 + - regie_number + - ro_number + - scheduled_completion + - scheduled_delivery + - scheduled_in + - shopid + - state_tax_rate + - status + - updated_at + - 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/1576535406904_update_permission_user_public_table_jobs/down.yaml b/hasura/migrations/1576535406904_update_permission_user_public_table_jobs/down.yaml new file mode 100644 index 000000000..10ed07cd3 --- /dev/null +++ b/hasura/migrations/1576535406904_update_permission_user_public_table_jobs/down.yaml @@ -0,0 +1,82 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - actual_completion + - actual_delivery + - actual_in + - created_at + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - federal_tax_rate + - invoice_date + - labor_rate_desc + - labor_rate_id + - local_tax_rate + - ownerid + - 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 + - regie_number + - ro_number + - scheduled_completion + - scheduled_delivery + - scheduled_in + - shopid + - state_tax_rate + - status + - updated_at + - 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/1576535406904_update_permission_user_public_table_jobs/up.yaml b/hasura/migrations/1576535406904_update_permission_user_public_table_jobs/up.yaml new file mode 100644 index 000000000..559577e7b --- /dev/null +++ b/hasura/migrations/1576535406904_update_permission_user_public_table_jobs/up.yaml @@ -0,0 +1,84 @@ +- args: + role: user + table: + name: jobs + schema: public + type: drop_update_permission +- args: + permission: + columns: + - actual_completion + - actual_delivery + - actual_in + - claim_total + - created_at + - deducitble + - est_addr1 + - est_addr2 + - est_city + - est_co_nm + - est_ct_fn + - est_ct_ln + - est_ctry + - est_ea + - est_number + - est_ph1 + - est_st + - est_zip + - federal_tax_rate + - invoice_date + - labor_rate_desc + - labor_rate_id + - local_tax_rate + - ownerid + - 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 + - regie_number + - ro_number + - scheduled_completion + - scheduled_delivery + - scheduled_in + - shopid + - state_tax_rate + - status + - updated_at + - 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/1576535450019_alter_table_public_jobs_alter_column_deducitble/down.yaml b/hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/down.yaml new file mode 100644 index 000000000..a5c10f54e --- /dev/null +++ b/hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."deducitble" IS E'null' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "deductible" to "deducitble"; + type: run_sql diff --git a/hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/up.yaml b/hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/up.yaml new file mode 100644 index 000000000..43f679e73 --- /dev/null +++ b/hasura/migrations/1576535450019_alter_table_public_jobs_alter_column_deducitble/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: COMMENT ON COLUMN "public"."jobs"."deducitble" IS E'' + type: run_sql +- args: + sql: alter table "public"."jobs" rename column "deducitble" to "deductible"; + type: run_sql diff --git a/hasura/migrations/1576545362627_create_table_public_joblines/down.yaml b/hasura/migrations/1576545362627_create_table_public_joblines/down.yaml new file mode 100644 index 000000000..cf8ad114d --- /dev/null +++ b/hasura/migrations/1576545362627_create_table_public_joblines/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: DROP TABLE "public"."joblines" + type: run_sql diff --git a/hasura/migrations/1576545362627_create_table_public_joblines/up.yaml b/hasura/migrations/1576545362627_create_table_public_joblines/up.yaml new file mode 100644 index 000000000..da0b6b197 --- /dev/null +++ b/hasura/migrations/1576545362627_create_table_public_joblines/up.yaml @@ -0,0 +1,24 @@ +- args: + sql: CREATE EXTENSION IF NOT EXISTS pgcrypto; + type: run_sql +- args: + sql: "CREATE TABLE \"public\".\"joblines\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(), + \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz + NOT NULL DEFAULT now(), \"jobid\" uuid NOT NULL, \"unq_seq\" integer, \"line_ind\" + text, \"line_desc\" text, \"part_type\" text, \"oem_partno\" text, \"est_seq\" + integer, \"db_ref\" text, \"line_ref\" text, \"tax_part\" boolean NOT NULL DEFAULT + true, \"db_price\" numeric, \"act_price\" numeric, \"part_qty\" integer, \"alt_partno\" + text, \"mod_lbr_ty\" text, \"db_hrs\" numeric, \"mod_lb_hrs\" numeric, \"lbr_op\" + text, \"lbr_amt\" numeric, PRIMARY KEY (\"id\") , FOREIGN KEY (\"jobid\") REFERENCES + \"public\".\"jobs\"(\"id\") ON UPDATE cascade 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_joblines_updated_at\"\nBEFORE + UPDATE ON \"public\".\"joblines\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT + ON TRIGGER \"set_public_joblines_updated_at\" ON \"public\".\"joblines\" \nIS + 'trigger to set value of column \"updated_at\" to current timestamp on row update';\n" + type: run_sql +- args: + name: joblines + schema: public + type: add_existing_table_or_view diff --git a/hasura/migrations/1576545371943_track_all_relationships/down.yaml b/hasura/migrations/1576545371943_track_all_relationships/down.yaml new file mode 100644 index 000000000..9a850b159 --- /dev/null +++ b/hasura/migrations/1576545371943_track_all_relationships/down.yaml @@ -0,0 +1,12 @@ +- args: + relationship: job + table: + name: joblines + schema: public + type: drop_relationship +- args: + relationship: joblines + table: + name: jobs + schema: public + type: drop_relationship diff --git a/hasura/migrations/1576545371943_track_all_relationships/up.yaml b/hasura/migrations/1576545371943_track_all_relationships/up.yaml new file mode 100644 index 000000000..34e894140 --- /dev/null +++ b/hasura/migrations/1576545371943_track_all_relationships/up.yaml @@ -0,0 +1,20 @@ +- args: + name: job + table: + name: joblines + schema: public + using: + foreign_key_constraint_on: jobid + type: create_object_relationship +- args: + name: joblines + table: + name: jobs + schema: public + using: + foreign_key_constraint_on: + column: jobid + table: + name: joblines + schema: public + type: create_array_relationship diff --git a/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..d290bbba0 --- /dev/null +++ b/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..c3c78f1c5 --- /dev/null +++ b/hasura/migrations/1576545448467_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,45 @@ +- args: + permission: + allow_upsert: true + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - unq_seq + - line_ind + - line_desc + - part_type + - oem_partno + - est_seq + - db_ref + - line_ref + - tax_part + - db_price + - act_price + - part_qty + - alt_partno + - mod_lbr_ty + - db_hrs + - mod_lb_hrs + - lbr_op + - lbr_amt + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..89e5a61ad --- /dev/null +++ b/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..2fd92b690 --- /dev/null +++ b/hasura/migrations/1576545454196_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,42 @@ +- args: + permission: + allow_aggregations: false + columns: + - tax_part + - est_seq + - part_qty + - unq_seq + - act_price + - db_hrs + - db_price + - lbr_amt + - mod_lb_hrs + - alt_partno + - db_ref + - lbr_op + - line_desc + - line_ind + - line_ref + - mod_lbr_ty + - oem_partno + - part_type + - created_at + - updated_at + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + limit: null + role: user + table: + name: joblines + schema: public + type: create_select_permission diff --git a/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..e97fa62bd --- /dev/null +++ b/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..006378c0b --- /dev/null +++ b/hasura/migrations/1576545472510_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,44 @@ +- args: + permission: + columns: + - tax_part + - est_seq + - part_qty + - unq_seq + - act_price + - db_hrs + - db_price + - lbr_amt + - mod_lb_hrs + - alt_partno + - db_ref + - lbr_op + - line_desc + - line_ind + - line_ref + - mod_lbr_ty + - oem_partno + - part_type + - created_at + - updated_at + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_update_permission diff --git a/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..0578ffde5 --- /dev/null +++ b/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..ffc97a4a3 --- /dev/null +++ b/hasura/migrations/1576545476731_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,17 @@ +- args: + permission: + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: joblines + schema: public + type: create_delete_permission