BOD-11 BOD-12 BOD-10 WIP Guided manual estimate creation.
This commit is contained in:
@@ -4088,6 +4088,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>manualnew</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>postInvoices</name>
|
<name>postInvoices</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -6350,27 +6371,6 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
<concept_node>
|
|
||||||
<name>available_new_jobs</name>
|
|
||||||
<definition_loaded>false</definition_loaded>
|
|
||||||
<description></description>
|
|
||||||
<comment></comment>
|
|
||||||
<default_text></default_text>
|
|
||||||
<translations>
|
|
||||||
<translation>
|
|
||||||
<language>en-US</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
<translation>
|
|
||||||
<language>es-MX</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
<translation>
|
|
||||||
<language>fr-CA</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
</translations>
|
|
||||||
</concept_node>
|
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>availablenew</name>
|
<name>availablenew</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -6694,6 +6694,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>newowner</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>newvehicle</name>
|
<name>newvehicle</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -7968,6 +7989,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>selectexistingornew</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
@@ -9024,6 +9066,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>selectexistingornew</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>validation</name>
|
<name>validation</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const Sdiv = styled.div`
|
|||||||
width: 80%;
|
width: 80%;
|
||||||
top: 10%;
|
top: 10%;
|
||||||
left: 10%;
|
left: 10%;
|
||||||
background-color: #ffcc00;
|
// background-color: #ffcc00;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
||||||
|
|||||||
@@ -0,0 +1,290 @@
|
|||||||
|
import { Collapse, Form, Input, InputNumber, Switch, DatePicker } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||||
|
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
||||||
|
|
||||||
|
export default function JobsCreateJobsInfo({ form }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { getFieldValue } = form;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Collapse defaultActiveKey="insurance">
|
||||||
|
<Collapse.Panel
|
||||||
|
key="insurance"
|
||||||
|
header={t("menus.jobsdetail.insurance")}
|
||||||
|
>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_co_id")} name="ins_co_id">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.policy_no")} name="policy_no">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.clm_no")} name="clm_no">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.regie_number")} name="regie_number">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
TODO: missing KOL field???
|
||||||
|
<Form.Item label={t("jobs.fields.loss_date")} name="loss_date">
|
||||||
|
<DatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
CAA # seems not correct based on field mapping Class seems not correct
|
||||||
|
based on field mapping
|
||||||
|
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_addr1")} name="ins_addr1">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_city")} name="ins_city">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_ct_ln")} name="ins_ct_ln">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_ct_fn")} name="ins_ct_fn">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ins_ph1")} name="ins_ph1">
|
||||||
|
<FormItemPhone customInput={Input} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.ins_ea")}
|
||||||
|
name="ins_ea"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
type: "email",
|
||||||
|
message: "This is not a valid email address."
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormItemEmail email={getFieldValue("ins_ea")} />
|
||||||
|
</Form.Item>
|
||||||
|
Appraiser Info
|
||||||
|
<Form.Item label={t("jobs.fields.est_co_nm")} name="est_co_nm">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.est_ct_fn")} name="est_ct_fn">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.est_ct_ln")} name="est_ct_ln">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
TODO: Field is pay date but title is inspection date. Likely
|
||||||
|
incorrect?
|
||||||
|
<Form.Item label={t("jobs.fields.pay_date")} name="pay_date">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.est_ph1")} name="est_ph1">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.est_ea")}
|
||||||
|
name="est_ea"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
type: "email",
|
||||||
|
message: "This is not a valid email address."
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormItemEmail email={getFieldValue("est_ea")} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.selling_dealer")}
|
||||||
|
name="selling_dealer"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.servicing_dealer")}
|
||||||
|
name="servicing_dealer"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.selling_dealer_contact")}
|
||||||
|
name="selling_dealer_contact"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.servicing_dealer_contact")}
|
||||||
|
name="servicing_dealer_contact"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</Collapse.Panel>
|
||||||
|
<Collapse.Panel key="claim" header={t("menus.jobsdetail.claimdetail")}>
|
||||||
|
<Form.Item label={t("jobs.fields.csr")} name="csr">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.loss_desc")} name="loss_desc">
|
||||||
|
<Input />
|
||||||
|
</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")} name="po_number">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.unitnumber")} name="unit_number">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.specialcoveragepolicy")}
|
||||||
|
valuePropName="checked"
|
||||||
|
name="special_coverage_policy"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.kmin")} name="kmin">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.kmout")} name="kmout">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.referralsource")}
|
||||||
|
name="referral_source"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</Collapse.Panel>
|
||||||
|
<Collapse.Panel
|
||||||
|
key="financial"
|
||||||
|
header={t("menus.jobsdetail.financials")}
|
||||||
|
>
|
||||||
|
<Form.Item label={t("jobs.fields.ded_amt")} name="ded_amt">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.ded_status")} name="ded_status">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.depreciation_taxes")}
|
||||||
|
name="depreciation_taxes"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
TODO This is equivalent of GST payable.
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.federal_tax_payable")}
|
||||||
|
name="federal_tax_payable"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
TODO equivalent of other customer amount
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.other_amount_payable")}
|
||||||
|
name="other_amount_payable"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.towing_payable")}
|
||||||
|
name="towing_payable"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.storage_payable")}
|
||||||
|
name="storage_payable"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.adjustment_bottom_line")}
|
||||||
|
name="adjustment_bottom_line"
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
Totals Table
|
||||||
|
<Form.Item
|
||||||
|
label={t("jobs.fields.labor_rate_desc")}
|
||||||
|
name="labor_rate_desc"
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lab")} name="rate_lab">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lad")} name="rate_lad">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lae")} name="rate_lae">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lar")} name="rate_lar">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_las")} name="rate_las">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_laf")} name="rate_laf">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lam")} name="rate_lam">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lag")} name="rate_lag">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
Note //TODO Remove ATP rate?
|
||||||
|
<Form.Item label={t("jobs.fields.rate_atp")} name="rate_atp">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_lau")} name="rate_lau">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_la1")} name="rate_la1">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_la2")} name="rate_la2">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_la3")} name="rate_la3">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_la4")} name="rate_la4">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_mapa")} name="rate_mapa">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_mash")} name="rate_mash">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_mahw")} name="rate_mahw">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_ma2s")} name="rate_ma2s">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_ma3s")} name="rate_ma3s">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_mabl")} name="rate_mabl">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_macs")} name="rate_macs">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_matd")} name="rate_matd">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.rate_laa")} name="rate_laa">
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
</Collapse.Panel>
|
||||||
|
</Collapse>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,15 +1,27 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Row, Col, Typography } from "antd";
|
import { Row, Col, Typography } from "antd";
|
||||||
|
import JobsCreateOwnerInfoNewComponent from "./jobs-create-owner-info.new.component";
|
||||||
|
import JobsCreateOwnerInfoSearchComponent from "./jobs-create-owner-info.search.component";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export default function JobsCreateOwnerInfoComponent({ loading, owners }) {
|
export default function JobsCreateOwnerInfoComponent({ loading, owners }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Row>
|
<Row>
|
||||||
<Typography.Title>XX</Typography.Title>
|
<Typography.Title>{t("jobs.labels.create.ownerinfo")}</Typography.Title>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row gutter={4}>
|
||||||
<Col span={16}></Col>
|
<Col span={16}>
|
||||||
|
<JobsCreateOwnerInfoSearchComponent
|
||||||
|
loading={loading}
|
||||||
|
owners={owners}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
|
||||||
<Col span={8}></Col>
|
<Col span={8}>
|
||||||
|
<JobsCreateOwnerInfoNewComponent />
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ export default function JobsCreateOwnerContainer() {
|
|||||||
const [state] = useContext(JobCreateContext);
|
const [state] = useContext(JobCreateContext);
|
||||||
const { loading, error, data } = useQuery(QUERY_SEARCH_OWNER_BY_IDX, {
|
const { loading, error, data } = useQuery(QUERY_SEARCH_OWNER_BY_IDX, {
|
||||||
variables: { search: `%${state.owner.search}%` },
|
variables: { search: `%${state.owner.search}%` },
|
||||||
skip: !state.vehicle.search
|
skip: !state.owner.search
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
return (
|
return (
|
||||||
<JobsCreateOwnerInfoComponent
|
<JobsCreateOwnerInfoComponent
|
||||||
loading={loading}
|
loading={loading}
|
||||||
owners={data ? data.owners : null}
|
owners={data ? data.search_owner : null}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import { Form, Input, Checkbox, Switch } from "antd";
|
||||||
|
import React, { useContext } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||||
|
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
||||||
|
|
||||||
|
export default function JobsCreateOwnerInfoNewComponent() {
|
||||||
|
const [state, setState] = useContext(JobCreateContext);
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Checkbox
|
||||||
|
defaultChecked={state.owner.new}
|
||||||
|
checked={state.owner.new}
|
||||||
|
onChange={() => {
|
||||||
|
setState({
|
||||||
|
...state,
|
||||||
|
owner: {
|
||||||
|
...state.owner,
|
||||||
|
new: !state.owner.new,
|
||||||
|
selectedid: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("jobs.labels.create.newowner")}
|
||||||
|
</Checkbox>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_ln")}
|
||||||
|
name={["owner", "data", "ownr_ln"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_fn")}
|
||||||
|
name={["owner", "data", "ownr_fn"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.allow_text_message")}
|
||||||
|
valuePropName="checked"
|
||||||
|
name={["owner", "data", "allow_text_message"]}
|
||||||
|
>
|
||||||
|
<Switch disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_addr1")}
|
||||||
|
name={["owner", "data", "ownr_addr1"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_addr2")}
|
||||||
|
name={["owner", "data", "ownr_addr2"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_city")}
|
||||||
|
name={["owner", "data", "ownr_city"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_ctry")}
|
||||||
|
name={["owner", "data", "ownr_ctry"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_ea")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
type: "email",
|
||||||
|
message: "This is not a valid email address."
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
name={["owner", "data", "ownr_ea"]}
|
||||||
|
>
|
||||||
|
<FormItemEmail
|
||||||
|
//TODO Fix this email={getFieldValue("ownr_ea")}
|
||||||
|
disabled={!state.owner.new}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_ph1")}
|
||||||
|
name={["owner", "data", "ownr_ph1"]}
|
||||||
|
>
|
||||||
|
<FormItemPhone customInput={Input} disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_st")}
|
||||||
|
name={["owner", "data", "ownr_st"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_zip")}
|
||||||
|
name={["owner", "data", "ownr_zip"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.preferred_contact")}
|
||||||
|
name={["owner", "data", "preferred_contact"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("owners.fields.ownr_title")}
|
||||||
|
name={["owner", "data", "ownr_title"]}
|
||||||
|
>
|
||||||
|
<Input disabled={!state.owner.new} />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { Input, Table } from "antd";
|
||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Table, Input } from "antd";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import { alphaSort } from "../../utils/sorters";
|
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
|
||||||
export default function JobsCreateOwnerInfoSearchComponent({
|
export default function JobsCreateOwnerInfoSearchComponent({
|
||||||
loading,
|
loading,
|
||||||
@@ -19,34 +19,61 @@ export default function JobsCreateOwnerInfoSearchComponent({
|
|||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("vehicles.fields.v_vin"),
|
title: t("owners.fields.ownr_ln"),
|
||||||
dataIndex: "v_vin",
|
dataIndex: "ownr_ln",
|
||||||
key: "v_vin",
|
key: "ownr_ln",
|
||||||
sorter: (a, b) => alphaSort(a.v_vin, b.v_vin),
|
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
tableState.sortedInfo.columnKey === "v_vin" &&
|
tableState.sortedInfo.columnKey === "ownr_ln" &&
|
||||||
tableState.sortedInfo.order,
|
tableState.sortedInfo.order
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("owners.fields.ownr_fn"),
|
||||||
|
dataIndex: "ownr_fn",
|
||||||
|
key: "ownr_fn",
|
||||||
|
sorter: (a, b) => alphaSort(a.ownr_fn, b.ownr_fn),
|
||||||
|
sortOrder:
|
||||||
|
tableState.sortedInfo.columnKey === "ownr_fn" &&
|
||||||
|
tableState.sortedInfo.order
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("owners.fields.ownr_addr1"),
|
||||||
|
dataIndex: "ownr_addr1",
|
||||||
|
key: "ownr_addr1",
|
||||||
|
sorter: (a, b) => alphaSort(a.ownr_addr1, b.ownr_addr1),
|
||||||
|
sortOrder:
|
||||||
|
tableState.sortedInfo.columnKey === "ownr_addr1" &&
|
||||||
|
tableState.sortedInfo.order
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("owners.fields.ownr_city"),
|
||||||
|
dataIndex: "ownr_city",
|
||||||
|
key: "ownr_city",
|
||||||
|
sorter: (a, b) => alphaSort(a.ownr_city, b.ownr_city),
|
||||||
|
sortOrder:
|
||||||
|
tableState.sortedInfo.columnKey === "ownr_city" &&
|
||||||
|
tableState.sortedInfo.order
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("owners.fields.ownr_ea"),
|
||||||
|
dataIndex: "ownr_ea",
|
||||||
|
key: "ownr_ea",
|
||||||
|
sorter: (a, b) => alphaSort(a.ownr_ea, b.ownr_ea),
|
||||||
|
sortOrder:
|
||||||
|
tableState.sortedInfo.columnKey === "ownr_ea" &&
|
||||||
|
tableState.sortedInfo.order
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("owners.fields.ownr_ph1"),
|
||||||
|
dataIndex: "ownr_ph1",
|
||||||
|
key: "ownr_ph1",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/vehicles/" + record.id}>{record.v_vin}</Link>
|
<PhoneFormatter>{record.ownr_ph1}</PhoneFormatter>
|
||||||
)
|
),
|
||||||
},
|
sorter: (a, b) => alphaSort(a.ownr_ph1, b.ownr_ph1),
|
||||||
{
|
sortOrder:
|
||||||
title: t("vehicles.fields.description"),
|
tableState.sortedInfo.columnKey === "ownr_ph1" &&
|
||||||
dataIndex: "description",
|
tableState.sortedInfo.order
|
||||||
key: "description",
|
|
||||||
render: (text, record) => {
|
|
||||||
return (
|
|
||||||
<span>{`${record.v_model_yr} ${record.v_make_desc} ${record.v_model_desc} ${record.v_color}`}</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("vehicles.fields.plate_no"),
|
|
||||||
dataIndex: "plate",
|
|
||||||
key: "plate",
|
|
||||||
render: (text, record) => {
|
|
||||||
return <span>{`${record.plate_st} | ${record.plate_no}`}</span>;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -61,32 +88,32 @@ export default function JobsCreateOwnerInfoSearchComponent({
|
|||||||
title={() => {
|
title={() => {
|
||||||
return (
|
return (
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder='Search...'
|
placeholder="Search..."
|
||||||
onSearch={value => {
|
onSearch={value => {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
vehicle: { ...state.vehicle, search: value }
|
owner: { ...state.owner, search: value }
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
enterButton
|
enterButton
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
size='small'
|
size="small"
|
||||||
pagination={{ position: "top" }}
|
pagination={{ position: "top" }}
|
||||||
columns={columns.map(item => ({ ...item }))}
|
columns={columns.map(item => ({ ...item }))}
|
||||||
rowKey='id'
|
rowKey="id"
|
||||||
dataSource={vehicles}
|
dataSource={owners}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
rowSelection={{
|
rowSelection={{
|
||||||
onSelect: props => {
|
onSelect: props => {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
vehicle: { ...state.vehicle, new: false, selectedid: props.id }
|
owner: { ...state.owner, new: false, selectedid: props.id }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
type: "radio",
|
type: "radio",
|
||||||
selectedRowKeys: [state.vehicle.selectedid]
|
selectedRowKeys: [state.owner.selectedid]
|
||||||
}}
|
}}
|
||||||
onRow={(record, rowIndex) => {
|
onRow={(record, rowIndex) => {
|
||||||
return {
|
return {
|
||||||
@@ -95,8 +122,8 @@ export default function JobsCreateOwnerInfoSearchComponent({
|
|||||||
if (record.id) {
|
if (record.id) {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
vehicle: {
|
owner: {
|
||||||
...state.vehicle,
|
...state.owner,
|
||||||
new: false,
|
new: false,
|
||||||
selectedid: record.id
|
selectedid: record.id
|
||||||
}
|
}
|
||||||
@@ -107,7 +134,7 @@ export default function JobsCreateOwnerInfoSearchComponent({
|
|||||||
}
|
}
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
vehicle: { ...state.vehicle, selectedid: null }
|
owner: { ...state.owner, selectedid: null }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import { Checkbox, Col, Row, Typography } from "antd";
|
import { Col, Row, Typography } from "antd";
|
||||||
import React, { useContext } from "react";
|
import React from "react";
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import JobsCreateVehicleInfoNewComponent from "./jobs-create-vehicle-info.new.component";
|
import JobsCreateVehicleInfoNewComponent from "./jobs-create-vehicle-info.new.component";
|
||||||
import JobsCreateVehicleInfoSearchComponent from "./jobs-create-vehicle-info.search.component";
|
import JobsCreateVehicleInfoSearchComponent from "./jobs-create-vehicle-info.search.component";
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoComponent({ loading, vehicles }) {
|
export default function JobsCreateVehicleInfoComponent({ loading, vehicles }) {
|
||||||
const [state, setState] = useContext(JobCreateContext);
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -19,22 +17,6 @@ export default function JobsCreateVehicleInfoComponent({ loading, vehicles }) {
|
|||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Checkbox
|
|
||||||
defaultChecked={state.vehicle.new}
|
|
||||||
checked={state.vehicle.new}
|
|
||||||
onChange={() => {
|
|
||||||
setState({
|
|
||||||
...state,
|
|
||||||
vehicle: {
|
|
||||||
...state.vehicle,
|
|
||||||
new: !state.vehicle.new,
|
|
||||||
selectedid: null
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("jobs.labels.create.newvehicle")}
|
|
||||||
</Checkbox>
|
|
||||||
<JobsCreateVehicleInfoNewComponent />
|
<JobsCreateVehicleInfoNewComponent />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -1,14 +1,30 @@
|
|||||||
import { DatePicker, Form, Input } from "antd";
|
import { DatePicker, Form, Input, Checkbox } from "antd";
|
||||||
import React, { useContext } from "react";
|
import React, { useContext } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoNewComponent() {
|
export default function JobsCreateVehicleInfoNewComponent() {
|
||||||
const [state] = useContext(JobCreateContext);
|
const [state, setState] = useContext(JobCreateContext);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Checkbox
|
||||||
|
defaultChecked={state.vehicle.new}
|
||||||
|
checked={state.vehicle.new}
|
||||||
|
onChange={() => {
|
||||||
|
setState({
|
||||||
|
...state,
|
||||||
|
vehicle: {
|
||||||
|
...state.vehicle,
|
||||||
|
new: !state.vehicle.new,
|
||||||
|
selectedid: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("jobs.labels.create.newvehicle")}
|
||||||
|
</Checkbox>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("vehicles.fields.v_vin")}
|
label={t("vehicles.fields.v_vin")}
|
||||||
name={["vehicle", "data", "v_vin"]}
|
name={["vehicle", "data", "v_vin"]}
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ export default function JobsCreateVehicleInfoSearchComponent({
|
|||||||
};
|
};
|
||||||
//TODO Implement searching & pagination
|
//TODO Implement searching & pagination
|
||||||
|
|
||||||
console.log("vehicles", vehicles);
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
loading={loading}
|
loading={loading}
|
||||||
@@ -102,7 +101,7 @@ export default function JobsCreateVehicleInfoSearchComponent({
|
|||||||
selectedid: record.id
|
selectedid: record.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("Should be clearing fields.");
|
console.log("Should be clearing fields here...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,3 +90,23 @@ export const QUERY_ALL_OWNERS = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const QUERY_OWNER_FOR_JOB_CREATION = gql`
|
||||||
|
query QUERY_OWNER_FOR_JOB_CREATION($id: uuid!) {
|
||||||
|
owners_by_pk(id: $id) {
|
||||||
|
ownr_addr1
|
||||||
|
ownr_addr2
|
||||||
|
ownr_co_nm
|
||||||
|
ownr_city
|
||||||
|
ownr_ctry
|
||||||
|
ownr_ea
|
||||||
|
ownr_fn
|
||||||
|
ownr_ph1
|
||||||
|
ownr_ln
|
||||||
|
ownr_ph2
|
||||||
|
ownr_st
|
||||||
|
ownr_title
|
||||||
|
ownr_zip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import { Button } from "antd";
|
||||||
import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container";
|
import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container";
|
||||||
import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container";
|
import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
export default function JobsAvailablePageComponent({
|
export default function JobsAvailablePageComponent({
|
||||||
deleteJob,
|
deleteJob,
|
||||||
estDataLazyLoad
|
estDataLazyLoad
|
||||||
}) {
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Link to="/manage/jobs/create">
|
||||||
|
<Button>{t("jobs.actions.manualnew")}</Button>
|
||||||
|
</Link>
|
||||||
|
|
||||||
<JobsAvailableContainer
|
<JobsAvailableContainer
|
||||||
deleteJob={deleteJob}
|
deleteJob={deleteJob}
|
||||||
estDataLazyLoad={estDataLazyLoad}
|
estDataLazyLoad={estDataLazyLoad}
|
||||||
|
|||||||
@@ -1,24 +1,34 @@
|
|||||||
import { Button, message, Steps } from "antd";
|
import { Button, message, Steps } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState, useContext } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
|
||||||
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
|
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
|
||||||
|
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
||||||
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
import AlertComponent from "../../components/alert/alert.component";
|
||||||
|
import JobsCreateJobsInfo from "../../components/jobs-create-jobs-info/jobs-create-jobs-info.component";
|
||||||
|
|
||||||
export default function JobsCreateComponent() {
|
export default function JobsCreateComponent({ form }) {
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
|
const [errorMessage, setErrorMessage] = useState(null);
|
||||||
|
const [state] = useContext(JobCreateContext);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
title: t("jobs.labels.create.vehicleinfo"),
|
title: t("jobs.labels.create.vehicleinfo"),
|
||||||
content: <JobsCreateVehicleInfoContainer />
|
content: <JobsCreateVehicleInfoContainer />,
|
||||||
|
validation: !!state.vehicle.new || !!state.vehicle.selectedid,
|
||||||
|
error: t("vehicles.errors.selectexistingornew")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.labels.create.ownerinfo"),
|
title: t("jobs.labels.create.ownerinfo"),
|
||||||
content: <JobsCreateOwnerInfoContainer />
|
content: <JobsCreateOwnerInfoContainer />,
|
||||||
|
validation: !!state.owner.new || !!state.owner.selectedid,
|
||||||
|
error: t("owners.errors.selectexistingornew")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.labels.create.jobinfo"),
|
title: t("jobs.labels.create.jobinfo"),
|
||||||
content: "Last-content"
|
content: <JobsCreateJobsInfo form={form} />
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -28,8 +38,49 @@ export default function JobsCreateComponent() {
|
|||||||
const prev = () => {
|
const prev = () => {
|
||||||
setPageIndex(pageIndex - 1);
|
setPageIndex(pageIndex - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { Step } = Steps;
|
const { Step } = Steps;
|
||||||
|
|
||||||
|
const ProgressButtons = () => {
|
||||||
|
return (
|
||||||
|
<div className="steps-action" style={{ float: "right" }}>
|
||||||
|
{pageIndex > 0 && (
|
||||||
|
<Button style={{ margin: 8 }} onClick={() => prev()}>
|
||||||
|
Previous
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{pageIndex < steps.length - 1 && (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
form
|
||||||
|
.validateFields()
|
||||||
|
.then(r => {
|
||||||
|
if (steps[pageIndex].validation) {
|
||||||
|
setErrorMessage(null);
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
setErrorMessage(steps[pageIndex].error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => console.log("error", error));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{pageIndex === steps.length - 1 && (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
onClick={() => message.success("Processing complete!")}
|
||||||
|
>
|
||||||
|
Done
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Steps current={pageIndex}>
|
<Steps current={pageIndex}>
|
||||||
@@ -39,38 +90,33 @@ export default function JobsCreateComponent() {
|
|||||||
title={item.title}
|
title={item.title}
|
||||||
style={{ cursor: "pointer" }}
|
style={{ cursor: "pointer" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPageIndex(idx);
|
form
|
||||||
|
.validateFields()
|
||||||
|
.then(r => {
|
||||||
|
if (steps[pageIndex].validation) {
|
||||||
|
setErrorMessage(null);
|
||||||
|
setPageIndex(idx);
|
||||||
|
} else {
|
||||||
|
setErrorMessage(steps[pageIndex].error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => console.log("error", error));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Steps>
|
</Steps>
|
||||||
|
<ProgressButtons />
|
||||||
|
|
||||||
|
{errorMessage ? (
|
||||||
|
<AlertComponent message={errorMessage} type="error" />
|
||||||
|
) : null}
|
||||||
|
|
||||||
{steps.map((item, idx) => (
|
{steps.map((item, idx) => (
|
||||||
<div key={idx} style={{ display: idx === pageIndex ? "" : "none" }}>
|
<div key={idx} style={{ display: idx === pageIndex ? "" : "none" }}>
|
||||||
{item.content}
|
{item.content}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
<ProgressButtons />
|
||||||
<div className='steps-action'>
|
|
||||||
{pageIndex > 0 && (
|
|
||||||
<Button style={{ margin: 8 }} onClick={() => prev()}>
|
|
||||||
Previous
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{pageIndex < steps.length - 1 && (
|
|
||||||
<Button type='primary' onClick={() => next()}>
|
|
||||||
Next
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{pageIndex === steps.length - 1 && (
|
|
||||||
<Button
|
|
||||||
type='primary'
|
|
||||||
htmlType='submit'
|
|
||||||
onClick={() => message.success("Processing complete!")}>
|
|
||||||
Done
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,28 +2,71 @@ import React, { useState } from "react";
|
|||||||
import JobsCreateComponent from "./jobs-create.component";
|
import JobsCreateComponent from "./jobs-create.component";
|
||||||
import { Form } from "antd";
|
import { Form } from "antd";
|
||||||
import JobCreateContext from "./jobs-create.context";
|
import JobCreateContext from "./jobs-create.context";
|
||||||
export default function JobsCreateContainer() {
|
import { useMutation, useLazyQuery } from "react-apollo";
|
||||||
const [form] = Form.useForm();
|
import { INSERT_NEW_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { QUERY_OWNER_FOR_JOB_CREATION } from "../../graphql/owners.queries";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, null)(JobsCreateContainer);
|
||||||
|
|
||||||
|
function JobsCreateContainer({ bodyshop }) {
|
||||||
const contextState = useState({
|
const contextState = useState({
|
||||||
vehicle: { new: false, search: "", selectedid: null },
|
vehicle: { new: false, search: "", selectedid: null },
|
||||||
owner: { new: false, search: "", selectedid: null },
|
owner: { new: false, search: "", selectedid: null },
|
||||||
job: null
|
job: null
|
||||||
});
|
});
|
||||||
|
const [form] = Form.useForm();
|
||||||
const [state] = contextState;
|
const [state] = contextState;
|
||||||
|
const [insertJob] = useMutation(INSERT_NEW_JOB);
|
||||||
|
const [loadOwner] = useLazyQuery(QUERY_OWNER_FOR_JOB_CREATION);
|
||||||
|
|
||||||
const handleFinish = values => {
|
const handleFinish = values => {
|
||||||
console.log("Form Values", values);
|
console.log("Form Values", values);
|
||||||
//const vehicleSpread = state.vehicle.selectedid ? {vehicleid: state.vehicle.selectedid} : {vehicle: {data: { ...values.vehicle} }
|
console.log("state", state);
|
||||||
const job = Object.assign(
|
let job = Object.assign(
|
||||||
{},
|
{},
|
||||||
|
values,
|
||||||
{
|
{
|
||||||
vehicle: state.vehicle.selectedid ? null : values.vehicle,
|
vehicle: state.vehicle.selectedid ? null : values.vehicle,
|
||||||
vehicleid: state.vehicle.selectedid || null
|
vehicleid: state.vehicle.selectedid || null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
owner: state.owner.selectedid ? null : values.owner,
|
||||||
|
ownerid: state.owner.selectedid || null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: bodyshop.md_ro_statuses.default_imported || "Open*", //Pull from redux store.
|
||||||
|
shopid: bodyshop.id
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!!job.owner) {
|
||||||
|
//spread the owner into to the job
|
||||||
|
console.log("Spread New Owner");
|
||||||
|
let ownerData = job.owner.data;
|
||||||
|
delete ownerData.allow_text_message;
|
||||||
|
delete ownerData.preferred_contact;
|
||||||
|
job = { ...job, ...ownerData };
|
||||||
|
runInsertJob(job);
|
||||||
|
} else {
|
||||||
|
//lookup the owner and spread it then.
|
||||||
|
loadOwner({
|
||||||
|
variables: { id: state.owner.selectedid },
|
||||||
|
onCompleted: data => {
|
||||||
|
console.log("data", data);
|
||||||
|
runInsertJob({ ...job, ...data.owners_by_pk });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const runInsertJob = job => {
|
||||||
console.log("Job To Save", job);
|
console.log("Job To Save", job);
|
||||||
|
insertJob({ variables: { job: job } });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -303,6 +303,7 @@
|
|||||||
"addNote": "Add Note",
|
"addNote": "Add Note",
|
||||||
"changestatus": "Change Status",
|
"changestatus": "Change Status",
|
||||||
"convert": "Convert",
|
"convert": "Convert",
|
||||||
|
"manualnew": "Create New Job Manually",
|
||||||
"postInvoices": "Post Invoices",
|
"postInvoices": "Post Invoices",
|
||||||
"printCenter": "Print Center",
|
"printCenter": "Print Center",
|
||||||
"schedule": "Schedule"
|
"schedule": "Schedule"
|
||||||
@@ -416,7 +417,6 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"appointmentconfirmation": "Send confirmation to customer?",
|
"appointmentconfirmation": "Send confirmation to customer?",
|
||||||
"audit": "Audit Trail",
|
"audit": "Audit Trail",
|
||||||
"available_new_jobs": "",
|
|
||||||
"availablenew": "Available New Jobs",
|
"availablenew": "Available New Jobs",
|
||||||
"availablesupplements": "Available Supplements",
|
"availablesupplements": "Available Supplements",
|
||||||
"cards": {
|
"cards": {
|
||||||
@@ -435,6 +435,7 @@
|
|||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"jobinfo": "Job Info",
|
"jobinfo": "Job Info",
|
||||||
|
"newowner": "Create a new Owner instead. ",
|
||||||
"newvehicle": "Create a new Vehicle Instead",
|
"newvehicle": "Create a new Vehicle Instead",
|
||||||
"ownerinfo": "Owner Info",
|
"ownerinfo": "Owner Info",
|
||||||
"vehicleinfo": "Vehicle Info"
|
"vehicleinfo": "Vehicle Info"
|
||||||
@@ -522,7 +523,8 @@
|
|||||||
},
|
},
|
||||||
"owners": {
|
"owners": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "The record does not exist or you do not have access to it. "
|
"noaccess": "The record does not exist or you do not have access to it. ",
|
||||||
|
"selectexistingornew": "Select an existing owner record or create a new one. "
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"address": "Address",
|
"address": "Address",
|
||||||
@@ -605,6 +607,7 @@
|
|||||||
"vehicles": {
|
"vehicles": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "The vehicle does not exist or you do not have access to it.",
|
"noaccess": "The vehicle does not exist or you do not have access to it.",
|
||||||
|
"selectexistingornew": "Select an existing vehicle record or create a new one. ",
|
||||||
"validation": "Please ensure all fields are entered correctly.",
|
"validation": "Please ensure all fields are entered correctly.",
|
||||||
"validationtitle": "Validation Error"
|
"validationtitle": "Validation Error"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -303,6 +303,7 @@
|
|||||||
"addNote": "Añadir la nota",
|
"addNote": "Añadir la nota",
|
||||||
"changestatus": "Cambiar Estado",
|
"changestatus": "Cambiar Estado",
|
||||||
"convert": "Convertir",
|
"convert": "Convertir",
|
||||||
|
"manualnew": "",
|
||||||
"postInvoices": "Contabilizar facturas",
|
"postInvoices": "Contabilizar facturas",
|
||||||
"printCenter": "Centro de impresión",
|
"printCenter": "Centro de impresión",
|
||||||
"schedule": "Programar"
|
"schedule": "Programar"
|
||||||
@@ -416,7 +417,6 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"appointmentconfirmation": "¿Enviar confirmación al cliente?",
|
"appointmentconfirmation": "¿Enviar confirmación al cliente?",
|
||||||
"audit": "",
|
"audit": "",
|
||||||
"available_new_jobs": "",
|
|
||||||
"availablenew": "",
|
"availablenew": "",
|
||||||
"availablesupplements": "",
|
"availablesupplements": "",
|
||||||
"cards": {
|
"cards": {
|
||||||
@@ -435,6 +435,7 @@
|
|||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"jobinfo": "",
|
"jobinfo": "",
|
||||||
|
"newowner": "",
|
||||||
"newvehicle": "",
|
"newvehicle": "",
|
||||||
"ownerinfo": "",
|
"ownerinfo": "",
|
||||||
"vehicleinfo": ""
|
"vehicleinfo": ""
|
||||||
@@ -522,7 +523,8 @@
|
|||||||
},
|
},
|
||||||
"owners": {
|
"owners": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "El registro no existe o no tiene acceso a él."
|
"noaccess": "El registro no existe o no tiene acceso a él.",
|
||||||
|
"selectexistingornew": ""
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"address": "Dirección",
|
"address": "Dirección",
|
||||||
@@ -605,6 +607,7 @@
|
|||||||
"vehicles": {
|
"vehicles": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "El vehículo no existe o usted no tiene acceso a él.",
|
"noaccess": "El vehículo no existe o usted no tiene acceso a él.",
|
||||||
|
"selectexistingornew": "",
|
||||||
"validation": "Asegúrese de que todos los campos se ingresen correctamente.",
|
"validation": "Asegúrese de que todos los campos se ingresen correctamente.",
|
||||||
"validationtitle": "Error de validacion"
|
"validationtitle": "Error de validacion"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -303,6 +303,7 @@
|
|||||||
"addNote": "Ajouter une note",
|
"addNote": "Ajouter une note",
|
||||||
"changestatus": "Changer le statut",
|
"changestatus": "Changer le statut",
|
||||||
"convert": "Convertir",
|
"convert": "Convertir",
|
||||||
|
"manualnew": "",
|
||||||
"postInvoices": "Poster des factures",
|
"postInvoices": "Poster des factures",
|
||||||
"printCenter": "Centre d'impression",
|
"printCenter": "Centre d'impression",
|
||||||
"schedule": "Programme"
|
"schedule": "Programme"
|
||||||
@@ -416,7 +417,6 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"appointmentconfirmation": "Envoyer une confirmation au client?",
|
"appointmentconfirmation": "Envoyer une confirmation au client?",
|
||||||
"audit": "",
|
"audit": "",
|
||||||
"available_new_jobs": "",
|
|
||||||
"availablenew": "",
|
"availablenew": "",
|
||||||
"availablesupplements": "",
|
"availablesupplements": "",
|
||||||
"cards": {
|
"cards": {
|
||||||
@@ -435,6 +435,7 @@
|
|||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"jobinfo": "",
|
"jobinfo": "",
|
||||||
|
"newowner": "",
|
||||||
"newvehicle": "",
|
"newvehicle": "",
|
||||||
"ownerinfo": "",
|
"ownerinfo": "",
|
||||||
"vehicleinfo": ""
|
"vehicleinfo": ""
|
||||||
@@ -522,7 +523,8 @@
|
|||||||
},
|
},
|
||||||
"owners": {
|
"owners": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "L'enregistrement n'existe pas ou vous n'y avez pas accès."
|
"noaccess": "L'enregistrement n'existe pas ou vous n'y avez pas accès.",
|
||||||
|
"selectexistingornew": ""
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"address": "Adresse",
|
"address": "Adresse",
|
||||||
@@ -605,6 +607,7 @@
|
|||||||
"vehicles": {
|
"vehicles": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"noaccess": "Le véhicule n'existe pas ou vous n'y avez pas accès.",
|
"noaccess": "Le véhicule n'existe pas ou vous n'y avez pas accès.",
|
||||||
|
"selectexistingornew": "",
|
||||||
"validation": "Veuillez vous assurer que tous les champs sont correctement entrés.",
|
"validation": "Veuillez vous assurer que tous les champs sont correctement entrés.",
|
||||||
"validationtitle": "Erreur de validation"
|
"validationtitle": "Erreur de validation"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user