From e8ea15a1a5d61dbb97981684ff5b7a19b9078e7e Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 27 Jan 2020 19:08:43 -0800 Subject: [PATCH] Added fields to claim data page. --- bodyshop_translations.babel | 147 ++++++++++++ .../jobs-detail-claims.component.jsx | 103 +++++--- client/src/graphql/jobs.queries.js | 7 + .../jobs-detail.page.container.jsx | 20 +- client/src/translations/en_us/common.json | 7 + client/src/translations/es/common.json | 7 + client/src/translations/fr/common.json | 7 + .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 214 +++++++++++++++++ .../up.yaml | 215 +++++++++++++++++ .../down.yaml | 212 +++++++++++++++++ .../up.yaml | 213 +++++++++++++++++ .../down.yaml | 214 +++++++++++++++++ .../up.yaml | 215 +++++++++++++++++ .../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 | 215 +++++++++++++++++ .../up.yaml | 219 +++++++++++++++++ .../down.yaml | 213 +++++++++++++++++ .../up.yaml | 217 +++++++++++++++++ .../down.yaml | 215 +++++++++++++++++ .../up.yaml | 219 +++++++++++++++++ .../down.yaml | 3 + .../up.yaml | 3 + .../down.yaml | 219 +++++++++++++++++ .../up.yaml | 220 ++++++++++++++++++ .../down.yaml | 217 +++++++++++++++++ .../up.yaml | 218 +++++++++++++++++ .../down.yaml | 219 +++++++++++++++++ .../up.yaml | 220 ++++++++++++++++++ 37 files changed, 4184 insertions(+), 44 deletions(-) create mode 100644 hasura/migrations/1580178912137_alter_table_public_jobs_add_column_csr/down.yaml create mode 100644 hasura/migrations/1580178912137_alter_table_public_jobs_add_column_csr/up.yaml create mode 100644 hasura/migrations/1580178922902_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580178922902_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580178929598_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580178929598_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580178936376_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580178936376_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580179243363_alter_table_public_jobs_add_column_po_number/down.yaml create mode 100644 hasura/migrations/1580179243363_alter_table_public_jobs_add_column_po_number/up.yaml create mode 100644 hasura/migrations/1580179295432_alter_table_public_jobs_add_column_unit_number/down.yaml create mode 100644 hasura/migrations/1580179295432_alter_table_public_jobs_add_column_unit_number/up.yaml create mode 100644 hasura/migrations/1580179755901_alter_table_public_jobs_add_column_kmin/down.yaml create mode 100644 hasura/migrations/1580179755901_alter_table_public_jobs_add_column_kmin/up.yaml create mode 100644 hasura/migrations/1580179762327_alter_table_public_jobs_add_column_kmout/down.yaml create mode 100644 hasura/migrations/1580179762327_alter_table_public_jobs_add_column_kmout/up.yaml create mode 100644 hasura/migrations/1580180067779_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180067779_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580180073360_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180073360_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580180078983_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180078983_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580180567863_alter_table_public_jobs_add_column_referral_source/down.yaml create mode 100644 hasura/migrations/1580180567863_alter_table_public_jobs_add_column_referral_source/up.yaml create mode 100644 hasura/migrations/1580180688551_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180688551_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580180694341_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180694341_update_permission_user_public_table_jobs/up.yaml create mode 100644 hasura/migrations/1580180700206_update_permission_user_public_table_jobs/down.yaml create mode 100644 hasura/migrations/1580180700206_update_permission_user_public_table_jobs/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 6af655c07..c50ae7d4a 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -856,6 +856,27 @@ + + csr + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + customerowing false @@ -1045,6 +1066,69 @@ + + kmin + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + kmout + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + loss_desc + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + owner false @@ -1150,6 +1234,48 @@ + + ponumber + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + referralsource + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + repairtotal false @@ -1318,6 +1444,27 @@ + + unitnumber + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + vehicle false diff --git a/client/src/components/jobs-detail-claims/jobs-detail-claims.component.jsx b/client/src/components/jobs-detail-claims/jobs-detail-claims.component.jsx index 3aec766b1..5d607eee3 100644 --- a/client/src/components/jobs-detail-claims/jobs-detail-claims.component.jsx +++ b/client/src/components/jobs-detail-claims/jobs-detail-claims.component.jsx @@ -1,44 +1,81 @@ +import { Form, Input, Switch } from "antd"; import React, { useContext } from "react"; -import { Form, Input } from "antd"; -import FormItemPhone from "../form-items-formatted/phone-form-item.component"; +import { useTranslation } from "react-i18next"; import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context"; +import FormItemPhone from "../form-items-formatted/phone-form-item.component"; export default function JobsDetailClaims({ job }) { const form = useContext(JobDetailFormContext); - const { getFieldDecorator, isFieldTouched } = form; + const { getFieldDecorator } = form; + const { t } = useTranslation(); return (
-
- - {isFieldTouched("est_ct_ln") ? "Yes" : "No"} - {getFieldDecorator("est_ct_ln", { - initialValue: job.est_ct_ln - })()} - - - {getFieldDecorator("est_ct_fn", { - initialValue: job.est_ct_fn - })()} - - - {getFieldDecorator("est_ph1", { - initialValue: job.est_ph1 - })()} - - - {getFieldDecorator("est_ea", { - initialValue: job.est_ea, - - rules: [ - { - type: "email", - message: "This is not a valid email address." - } - ] - })()} - -
+ + {getFieldDecorator("csr", { + initialValue: job.csr + })()} + + + {getFieldDecorator("loss_desc", { + initialValue: job.loss_desc + })()} + + TODO: How to handle different taxes and marking them as exempt? + { + // + // {getFieldDecorator("exempt", { + // initialValue: job.exempt + // })()} + // + } + + {getFieldDecorator("po_number", { + initialValue: job.po_number + })()} + + + {getFieldDecorator("unit_number", { + initialValue: job.unit_number + })()} + + + {getFieldDecorator("special_coverage_policy", { + initialValue: job.special_coverage_policy, + valuePropName: "checked" + })()} + + + {getFieldDecorator("kmin", { + initialValue: job.kmin + })()} + + + {getFieldDecorator("kmout", { + initialValue: job.kmout + })()} + + + {getFieldDecorator("referral_source", { + initialValue: job.referral_source + })()} + + + {getFieldDecorator("est_ph1", { + initialValue: job.est_ph1 + })()} + + + {getFieldDecorator("est_ea", { + initialValue: job.est_ea, + rules: [ + { + type: "email", + message: "This is not a valid email address." + } + ] + })()} +
); } diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 33f56e24b..93c36d10c 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -122,6 +122,13 @@ export const GET_JOB_BY_PK = gql` scheduled_completion scheduled_in service_car + csr + loss_desc + kmin + kmout + referral_source + unit_number + po_number special_coverage_policy scheduled_delivery job_status { diff --git a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx index 7003ea7f0..e0c49840b 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx @@ -4,11 +4,7 @@ import { useMutation, useQuery } from "react-apollo"; import { useTranslation } from "react-i18next"; import AlertComponent from "../../components/alert/alert.component"; import SpinComponent from "../../components/loading-spinner/loading-spinner.component"; -import { - CONVERT_JOB_TO_RO, - GET_JOB_BY_PK, - UPDATE_JOB -} from "../../graphql/jobs.queries"; +import { CONVERT_JOB_TO_RO, GET_JOB_BY_PK, UPDATE_JOB } from "../../graphql/jobs.queries"; import JobsDetailPage from "./jobs-detail.page.component"; import JobDetailFormContext from "./jobs-detail.page.context"; @@ -24,12 +20,13 @@ function JobsDetailPageContainer({ match, form }) { const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO); useEffect(() => { - document.title = - loading && !error - ? "..." - : t("titles.jobsdetail", { - ro_number: data.jobs_by_pk.ro_number - }); + document.title = loading + ? "..." + : error + ? t("titles.app") + : t("titles.jobsdetail", { + ro_number: data.jobs_by_pk.ro_number + }); }, [loading, data, t, error]); const handleSubmit = e => { @@ -58,6 +55,7 @@ function JobsDetailPageContainer({ match, form }) { if (loading) return ; if (error) return ; + return data.jobs_by_pk ? (