Added fields to claim data page.

This commit is contained in:
Patrick Fic
2020-01-27 19:08:43 -08:00
parent 265bc7d486
commit e8ea15a1a5
37 changed files with 4184 additions and 44 deletions

View File

@@ -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 (
<div>
<div>
<Form.Item label='Estimator Last Name'>
{isFieldTouched("est_ct_ln") ? "Yes" : "No"}
{getFieldDecorator("est_ct_ln", {
initialValue: job.est_ct_ln
})(<Input name='est_ct_ln' />)}
</Form.Item>
<Form.Item label='Estimator First Name'>
{getFieldDecorator("est_ct_fn", {
initialValue: job.est_ct_fn
})(<Input name='est_ct_fn' />)}
</Form.Item>
<Form.Item label='Estimator Phone #'>
{getFieldDecorator("est_ph1", {
initialValue: job.est_ph1
})(<FormItemPhone customInput={Input} name='est_ph1' />)}
</Form.Item>
<Form.Item label='Estimator Email'>
{getFieldDecorator("est_ea", {
initialValue: job.est_ea,
rules: [
{
type: "email",
message: "This is not a valid email address."
}
]
})(<Input name='est_ea' />)}
</Form.Item>
</div>
<Form.Item label={t("jobs.fields.csr")}>
{getFieldDecorator("csr", {
initialValue: job.csr
})(<Input name='csr' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.loss_desc")}>
{getFieldDecorator("loss_desc", {
initialValue: job.loss_desc
})(<Input name='loss_desc' />)}
</Form.Item>
TODO: How to handle different taxes and marking them as exempt?
{
// <Form.Item label={t("jobs.fields.exempt")}>
// {getFieldDecorator("exempt", {
// initialValue: job.exempt
// })(<Input name='exempt' />)}
// </Form.Item>
}
<Form.Item label={t("jobs.fields.ponumber")}>
{getFieldDecorator("po_number", {
initialValue: job.po_number
})(<Input name='po_number' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.unitnumber")}>
{getFieldDecorator("unit_number", {
initialValue: job.unit_number
})(<Input name='unit_number' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.specialcoveragepolicy")}>
{getFieldDecorator("special_coverage_policy", {
initialValue: job.special_coverage_policy,
valuePropName: "checked"
})(<Switch name='special_coverage_policy' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.kmin")}>
{getFieldDecorator("kmin", {
initialValue: job.kmin
})(<Input name='kmin' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.kmout")}>
{getFieldDecorator("kmout", {
initialValue: job.kmout
})(<Input name='kmout' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.referralsource")}>
{getFieldDecorator("referral_source", {
initialValue: job.referral_source
})(<Input name='referral_source' />)}
</Form.Item>
<Form.Item label='Estimator Phone #'>
{getFieldDecorator("est_ph1", {
initialValue: job.est_ph1
})(<FormItemPhone customInput={Input} name='est_ph1' />)}
</Form.Item>
<Form.Item label='Estimator Email'>
{getFieldDecorator("est_ea", {
initialValue: job.est_ea,
rules: [
{
type: "email",
message: "This is not a valid email address."
}
]
})(<Input name='est_ea' />)}
</Form.Item>
</div>
);
}

View File

@@ -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 {

View File

@@ -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 <SpinComponent />;
if (error) return <AlertComponent message={error.message} type='error' />;
return data.jobs_by_pk ? (
<JobDetailFormContext.Provider value={form}>
<JobsDetailPage

View File

@@ -61,6 +61,7 @@
"claim_total": "Claim Total",
"clm_no": "Claim #",
"clm_total": "Claim Total",
"csr": "Customer Service Rep.",
"customerowing": "Customer Owing",
"date_closed": "Closed",
"date_estimated": "Date Estimated",
@@ -70,11 +71,16 @@
"date_scheduled": "Scheduled",
"deductible": "Deductible",
"est_number": "Estimate Number",
"kmin": "Mileage In",
"kmout": "Mileage Out",
"loss_desc": "Loss of Use",
"owner": "Owner",
"owner_owing": "Cust. Owes",
"ownr_ea": "Email",
"phone1": "Phone 1",
"phoneshort": "PH",
"ponumber": "PO Number",
"referralsource": "Referral Source",
"repairtotal": "Repair Total",
"ro_number": "RO #",
"scheduled_completion": "Scheduled Completion",
@@ -83,6 +89,7 @@
"servicecar": "Service Car",
"specialcoveragepolicy": "Special Coverage Policy",
"status": "Job Status",
"unitnumber": "Unit #",
"vehicle": "Vehicle"
},
"labels": {

View File

@@ -61,6 +61,7 @@
"claim_total": "Reclamar total",
"clm_no": "Reclamación #",
"clm_total": "Reclamar total",
"csr": "Representante de servicio al cliente.",
"customerowing": "Cliente debido",
"date_closed": "Cerrado",
"date_estimated": "Fecha estimada",
@@ -70,11 +71,16 @@
"date_scheduled": "Programado",
"deductible": "Deducible",
"est_number": "Numero Estimado",
"kmin": "Kilometraje en",
"kmout": "Kilometraje",
"loss_desc": "Perdida de uso",
"owner": "Propietario",
"owner_owing": "Cust. Debe",
"ownr_ea": "Email",
"phone1": "Teléfono 1",
"phoneshort": "PH",
"ponumber": "numero postal",
"referralsource": "Fuente de referencia",
"repairtotal": "Reparación total",
"ro_number": "RO #",
"scheduled_completion": "Finalización programada",
@@ -83,6 +89,7 @@
"servicecar": "Auto de servicio",
"specialcoveragepolicy": "Política de cobertura especial",
"status": "Estado del trabajo",
"unitnumber": "Unidad #",
"vehicle": "Vehículo"
},
"labels": {

View File

@@ -61,6 +61,7 @@
"claim_total": "Total réclamation",
"clm_no": "Prétendre #",
"clm_total": "Total réclamation",
"csr": "représentant du service à la clientèle",
"customerowing": "Client propriétaire",
"date_closed": "Fermé",
"date_estimated": "Date estimée",
@@ -70,11 +71,16 @@
"date_scheduled": "Prévu",
"deductible": "Déductible",
"est_number": "Numéro d'estimation",
"kmin": "Kilométrage en",
"kmout": "Kilométrage hors",
"loss_desc": "Perte d'usage",
"owner": "Propriétaire",
"owner_owing": "Cust. Owes",
"ownr_ea": "Email",
"phone1": "Téléphone 1",
"phoneshort": "PH",
"ponumber": "Numéro de bon de commande",
"referralsource": "Source de référence",
"repairtotal": "Réparation totale",
"ro_number": "RO #",
"scheduled_completion": "Achèvement planifié",
@@ -83,6 +89,7 @@
"servicecar": "Voiture de service",
"specialcoveragepolicy": "Politique de couverture spéciale",
"status": "Statut de l'emploi",
"unitnumber": "Unité #",
"vehicle": "Véhicule"
},
"labels": {