Updated contract creation to include auto status changes. BOD-314
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project be_version="2.7.1" version="1.2">
|
<babeledit_project version="1.2" be_version="2.7.1">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -4687,6 +4687,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>mileage</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>model</name>
|
<name>model</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -5159,6 +5180,27 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>outwith</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>return</name>
|
<name>return</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -4,15 +4,17 @@ import { QUERY_AVAILABLE_CC } from "../../graphql/courtesy-car.queries";
|
|||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ContractCarsComponent from "./contract-cars.component";
|
import ContractCarsComponent from "./contract-cars.component";
|
||||||
|
|
||||||
|
export default function ContractCarsContainer({ selectedCarState, form }) {
|
||||||
|
|
||||||
export default function ContractCarsContainer({ selectedCarState, bodyshop }) {
|
|
||||||
const { loading, error, data } = useQuery(QUERY_AVAILABLE_CC);
|
const { loading, error, data } = useQuery(QUERY_AVAILABLE_CC);
|
||||||
|
|
||||||
const [selectedCar, setSelectedCar] = selectedCarState;
|
const [selectedCar, setSelectedCar] = selectedCarState;
|
||||||
|
|
||||||
const handleSelect = record => {
|
const handleSelect = (record) => {
|
||||||
setSelectedCar(record.id);
|
setSelectedCar(record.id);
|
||||||
|
form.setFieldsValue({
|
||||||
|
kmstart: record.mileage,
|
||||||
|
dailyrate: record.dailycost,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
|||||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import InputPhone from "../form-items-formatted/phone-form-item.component";
|
import InputPhone from "../form-items-formatted/phone-form-item.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
export default function ContractFormComponent({ form }) {
|
export default function ContractFormComponent({ form, create = false }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -14,18 +14,21 @@ export default function ContractFormComponent({ form }) {
|
|||||||
<FormFieldsChanged form={form} />
|
<FormFieldsChanged form={form} />
|
||||||
</div>
|
</div>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
{create ? null : (
|
||||||
label={t("contracts.fields.status")}
|
<Form.Item
|
||||||
name="status"
|
label={t("contracts.fields.status")}
|
||||||
rules={[
|
name="status"
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<ContractStatusSelector />
|
>
|
||||||
</Form.Item>
|
<ContractStatusSelector />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("contracts.fields.start")}
|
label={t("contracts.fields.start")}
|
||||||
name="start"
|
name="start"
|
||||||
@@ -50,12 +53,14 @@ export default function ContractFormComponent({ form }) {
|
|||||||
>
|
>
|
||||||
<FormDatePicker />
|
<FormDatePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
{create ? null : (
|
||||||
label={t("contracts.fields.actualreturn")}
|
<Form.Item
|
||||||
name="actualreturn"
|
label={t("contracts.fields.actualreturn")}
|
||||||
>
|
name="actualreturn"
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<FormDatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
@@ -71,9 +76,11 @@ export default function ContractFormComponent({ form }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("contracts.fields.kmend")} name="kmend">
|
{create ? null : (
|
||||||
<InputNumber />
|
<Form.Item label={t("contracts.fields.kmend")} name="kmend">
|
||||||
</Form.Item>
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { DateFormatter } from "../../utils/DateFormatter";
|
|||||||
export default function CourtesyCarContractListComponent({ contracts }) {
|
export default function CourtesyCarContractListComponent({ contracts }) {
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: { text: "" }
|
filteredInfo: { text: "" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -26,7 +26,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
<Link to={`/manage/courtesycars/contracts/${record.id}`}>
|
<Link to={`/manage/courtesycars/contracts/${record.id}`}>
|
||||||
{record.agreementnumber || ""}
|
{record.agreementnumber || ""}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
@@ -40,7 +40,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
<Link to={`/manage/jobs/${record.job.id}`}>
|
<Link to={`/manage/jobs/${record.job.id}`}>
|
||||||
{record.job.ro_number || ""}
|
{record.job.ro_number || ""}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("contracts.fields.driver"),
|
title: t("contracts.fields.driver"),
|
||||||
@@ -50,7 +50,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "driver_ln" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "driver_ln" && state.sortedInfo.order,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${record.driver_fn || ""} ${record.driver_ln || ""}`
|
`${record.driver_fn || ""} ${record.driver_ln || ""}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("contracts.fields.status"),
|
title: t("contracts.fields.status"),
|
||||||
@@ -59,7 +59,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
render: (text, record) => t(record.status)
|
render: (text, record) => t(record.status),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("contracts.fields.start"),
|
title: t("contracts.fields.start"),
|
||||||
@@ -68,7 +68,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
sorter: (a, b) => alphaSort(a.start, b.start),
|
sorter: (a, b) => alphaSort(a.start, b.start),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "start" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "start" && state.sortedInfo.order,
|
||||||
render: (text, record) => <DateFormatter>{record.start}</DateFormatter>
|
render: (text, record) => <DateFormatter>{record.start}</DateFormatter>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("contracts.fields.scheduledreturn"),
|
title: t("contracts.fields.scheduledreturn"),
|
||||||
@@ -80,8 +80,8 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
state.sortedInfo.order,
|
state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<DateFormatter>{record.scheduledreturn}</DateFormatter>
|
<DateFormatter>{record.scheduledreturn}</DateFormatter>
|
||||||
)
|
),
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
@@ -91,7 +91,7 @@ export default function CourtesyCarContractListComponent({ contracts }) {
|
|||||||
<Table
|
<Table
|
||||||
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={contracts}
|
dataSource={contracts}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
|
|||||||
@@ -6,161 +6,137 @@ import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status
|
|||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button type="primary" loading={saveLoading} htmlType="submit">
|
<Button
|
||||||
|
type="primary"
|
||||||
|
loading={saveLoading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
</Button>
|
</Button>
|
||||||
<div className="imex-flex-row__grow imex-flex-row__margin-large">
|
<FormFieldsChanged form={form} />
|
||||||
<FormFieldsChanged form={form} />
|
<LayoutFormRow>
|
||||||
</div>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.make")}
|
||||||
label={t("courtesycars.fields.make")}
|
name="make"
|
||||||
name="make"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.model")}
|
||||||
label={t("courtesycars.fields.model")}
|
name="model"
|
||||||
name="model"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.year")}
|
||||||
label={t("courtesycars.fields.year")}
|
name="year"
|
||||||
name="year"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.plate")}
|
||||||
label={t("courtesycars.fields.plate")}
|
name="plate"
|
||||||
name="plate"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.color")}
|
||||||
label={t("courtesycars.fields.color")}
|
name="color"
|
||||||
name="color"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item
|
||||||
<Form.Item
|
label={t("courtesycars.fields.vin")}
|
||||||
label={t("courtesycars.fields.vin")}
|
name="vin"
|
||||||
name="vin"
|
rules={[
|
||||||
rules={[
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: t("general.validation.required"),
|
||||||
message: t("general.validation.required"),
|
},
|
||||||
},
|
]}
|
||||||
]}
|
>
|
||||||
>
|
<Input />
|
||||||
<Input />
|
</Form.Item>
|
||||||
</Form.Item>
|
</LayoutFormRow>
|
||||||
<Form.Item
|
<LayoutFormRow>
|
||||||
label={t("courtesycars.fields.fleetnumber")}
|
<Form.Item
|
||||||
name="fleetnumber"
|
label={t("courtesycars.fields.mileage")}
|
||||||
>
|
name="mileage"
|
||||||
<Input />
|
rules={[
|
||||||
</Form.Item>
|
{
|
||||||
<Form.Item
|
required: true,
|
||||||
label={t("courtesycars.fields.purchasedate")}
|
message: t("general.validation.required"),
|
||||||
name="purchasedate"
|
},
|
||||||
>
|
]}
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<InputNumber />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.servicestartdate")}
|
<Form.Item
|
||||||
name="servicestartdate"
|
label={t("courtesycars.fields.fleetnumber")}
|
||||||
>
|
name="fleetnumber"
|
||||||
<Input />
|
>
|
||||||
</Form.Item>
|
<Input />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.serviceenddate")}
|
<Form.Item
|
||||||
name="serviceenddate"
|
label={t("courtesycars.fields.purchasedate")}
|
||||||
>
|
name="purchasedate"
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<FormDatePicker />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.leaseenddate")}
|
<Form.Item
|
||||||
name="leaseenddate"
|
label={t("courtesycars.fields.servicestartdate")}
|
||||||
>
|
name="servicestartdate"
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<FormDatePicker />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.status")}
|
<Form.Item
|
||||||
name="status"
|
label={t("courtesycars.fields.serviceenddate")}
|
||||||
rules={[
|
name="serviceenddate"
|
||||||
{
|
>
|
||||||
required: true,
|
<FormDatePicker />
|
||||||
message: t("general.validation.required"),
|
</Form.Item>
|
||||||
},
|
<Form.Item
|
||||||
]}
|
label={t("courtesycars.fields.leaseenddate")}
|
||||||
>
|
name="leaseenddate"
|
||||||
<CourtesyCarStatus />
|
>
|
||||||
</Form.Item>
|
<FormDatePicker />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.nextservicekm")}
|
</LayoutFormRow>
|
||||||
name="nextservicekm"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("courtesycars.fields.nextservicedate")}
|
|
||||||
name="nextservicedate"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<FormDatePicker />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={t("courtesycars.fields.damage")} name="damage">
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={t("courtesycars.fields.notes")} name="notes">
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.fuel")}
|
label={t("courtesycars.fields.fuel")}
|
||||||
name="fuel"
|
name="fuel"
|
||||||
@@ -173,33 +149,78 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<CourtesyCarFuelSlider />
|
<CourtesyCarFuelSlider />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<LayoutFormRow>
|
||||||
label={t("courtesycars.fields.registrationexpires")}
|
<Form.Item
|
||||||
name="registrationexpires"
|
label={t("courtesycars.fields.status")}
|
||||||
rules={[
|
name="status"
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<CourtesyCarStatus />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
label={t("courtesycars.fields.insuranceexpires")}
|
<Form.Item
|
||||||
name="insuranceexpires"
|
label={t("courtesycars.fields.nextservicekm")}
|
||||||
rules={[
|
name="nextservicekm"
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
message: t("general.validation.required"),
|
required: true,
|
||||||
},
|
message: t("general.validation.required"),
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<FormDatePicker />
|
>
|
||||||
</Form.Item>
|
<InputNumber />
|
||||||
<Form.Item label={t("courtesycars.fields.dailycost")} name="dailycost">
|
</Form.Item>
|
||||||
<CurrencyInput />
|
<Form.Item
|
||||||
</Form.Item>
|
label={t("courtesycars.fields.nextservicedate")}
|
||||||
|
name="nextservicedate"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormDatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("courtesycars.fields.damage")} name="damage">
|
||||||
|
<Input.TextArea />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("courtesycars.fields.notes")} name="notes">
|
||||||
|
<Input.TextArea />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("courtesycars.fields.registrationexpires")}
|
||||||
|
name="registrationexpires"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormDatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("courtesycars.fields.insuranceexpires")}
|
||||||
|
name="insuranceexpires"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormDatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("courtesycars.fields.dailycost")} name="dailycost">
|
||||||
|
<CurrencyInput />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "model" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("courtesycars.fields.outwith"),
|
title: t("courtesycars.labels.outwith"),
|
||||||
dataIndex: "outwith",
|
dataIndex: "outwith",
|
||||||
key: "outwith",
|
key: "outwith",
|
||||||
// sorter: (a, b) => alphaSort(a.model, b.model),
|
// sorter: (a, b) => alphaSort(a.model, b.model),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default function LayoutFormRow({ header, children, grow = false }) {
|
|||||||
if (!!!children.length) {
|
if (!!!children.length) {
|
||||||
//We have only one element. It's going to get the whole thing.
|
//We have only one element. It's going to get the whole thing.
|
||||||
return (
|
return (
|
||||||
<div className='imex-form-row'>
|
<div className="imex-form-row">
|
||||||
{header ? (
|
{header ? (
|
||||||
<Typography.Title level={4}>{header}</Typography.Title>
|
<Typography.Title level={4}>{header}</Typography.Title>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -37,14 +37,17 @@ export default function LayoutFormRow({ header, children, grow = false }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='imex-form-row'>
|
<div className="imex-form-row">
|
||||||
{header ? <Typography.Title level={4}>{header}</Typography.Title> : null}
|
{header ? <Typography.Title level={4}>{header}</Typography.Title> : null}
|
||||||
<Row {...rowGutter}>
|
<Row {...rowGutter}>
|
||||||
{children.map((c, idx) => (
|
{children.map(
|
||||||
<Col key={idx} {...colSpan(c.props && c.props.span)}>
|
(c, idx) =>
|
||||||
{c}
|
c && (
|
||||||
</Col>
|
<Col key={idx} {...colSpan(c && c.props && c.props.span)}>
|
||||||
))}
|
{c}
|
||||||
|
</Col>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
export const INSERT_NEW_CONTRACT = gql`
|
export const INSERT_NEW_CONTRACT = gql`
|
||||||
mutation INSERT_NEW_CONTRACT($contract: [cccontracts_insert_input!]!) {
|
mutation INSERT_NEW_CONTRACT(
|
||||||
|
$contract: [cccontracts_insert_input!]!
|
||||||
|
$ccId: uuid!
|
||||||
|
) {
|
||||||
insert_cccontracts(objects: $contract) {
|
insert_cccontracts(objects: $contract) {
|
||||||
returning {
|
returning {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update_courtesycars_by_pk(
|
||||||
|
pk_columns: { id: $ccId }
|
||||||
|
_set: { status: "courtesycars.status.out" }
|
||||||
|
) {
|
||||||
|
status
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ export const INSERT_NEW_COURTESY_CAR = gql`
|
|||||||
|
|
||||||
export const QUERY_AVAILABLE_CC = gql`
|
export const QUERY_AVAILABLE_CC = gql`
|
||||||
query QUERY_AVAILABLE_CC {
|
query QUERY_AVAILABLE_CC {
|
||||||
courtesycars(where: { serviceenddate: { _is_null: true } }) {
|
courtesycars(
|
||||||
|
where: {
|
||||||
|
serviceenddate: { _is_null: true }
|
||||||
|
status: { _eq: "courtesycars.status.in" }
|
||||||
|
}
|
||||||
|
) {
|
||||||
color
|
color
|
||||||
dailycost
|
dailycost
|
||||||
damage
|
damage
|
||||||
@@ -26,6 +31,8 @@ export const QUERY_AVAILABLE_CC = gql`
|
|||||||
plate
|
plate
|
||||||
status
|
status
|
||||||
year
|
year
|
||||||
|
dailycost
|
||||||
|
mileage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -96,7 +103,9 @@ export const QUERY_CC_BY_PK = gql`
|
|||||||
status
|
status
|
||||||
vin
|
vin
|
||||||
year
|
year
|
||||||
|
mileage
|
||||||
cccontracts {
|
cccontracts {
|
||||||
|
agreementnumber
|
||||||
id
|
id
|
||||||
status
|
status
|
||||||
start
|
start
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ export default function ContractCreatePageComponent({
|
|||||||
{t("general.actions.create")}
|
{t("general.actions.create")}
|
||||||
</Button>
|
</Button>
|
||||||
<ContractJobsContainer selectedJobState={selectedJobState} />
|
<ContractJobsContainer selectedJobState={selectedJobState} />
|
||||||
<ContractCarsContainer selectedCarState={selectedCarState} />
|
<ContractCarsContainer selectedCarState={selectedCarState} form={form} />
|
||||||
<ContractLicenseDecodeButton form={form} />
|
<ContractLicenseDecodeButton form={form} />
|
||||||
<ContractFormComponent form={form} />
|
<ContractFormComponent create form={form} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
insertContract({
|
insertContract({
|
||||||
variables: {
|
variables: {
|
||||||
|
ccId: selectedCarState[0],
|
||||||
contract: {
|
contract: {
|
||||||
...values,
|
...values,
|
||||||
|
status: "contracts.status.out",
|
||||||
courtesycarid: selectedCarState[0],
|
courtesycarid: selectedCarState[0],
|
||||||
jobid: selectedJobState[0],
|
jobid: selectedJobState[0],
|
||||||
},
|
},
|
||||||
@@ -46,7 +48,7 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("contracts.successes.saved"),
|
message: t("contracts.successes.saved"),
|
||||||
});
|
});
|
||||||
|
form.resetFields();
|
||||||
history.push(
|
history.push(
|
||||||
`/manage/courtesycars/contracts/${response.data.insert_cccontracts.returning[0].id}`
|
`/manage/courtesycars/contracts/${response.data.insert_cccontracts.returning[0].id}`
|
||||||
);
|
);
|
||||||
@@ -87,7 +89,6 @@ export function ContractCreatePageContainer({ bodyshop, setBreadcrumbs }) {
|
|||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
autoComplete="no"
|
autoComplete="no"
|
||||||
initialValues={{ status: "contracts.status.new" }}
|
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
>
|
>
|
||||||
<ContractCreatePageComponent
|
<ContractCreatePageComponent
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export function CourtesyCarDetailPageContainer({
|
|||||||
form={form}
|
form={form}
|
||||||
autoComplete="no"
|
autoComplete="no"
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
|
layout="vertical"
|
||||||
initialValues={
|
initialValues={
|
||||||
data
|
data
|
||||||
? {
|
? {
|
||||||
|
|||||||
@@ -291,6 +291,7 @@
|
|||||||
"insuranceexpires": "Insurance Expires On",
|
"insuranceexpires": "Insurance Expires On",
|
||||||
"leaseenddate": "Lease Ends On",
|
"leaseenddate": "Lease Ends On",
|
||||||
"make": "Make",
|
"make": "Make",
|
||||||
|
"mileage": "Mileage",
|
||||||
"model": "Model",
|
"model": "Model",
|
||||||
"nextservicedate": "Next Service Date",
|
"nextservicedate": "Next Service Date",
|
||||||
"nextservicekm": "Next Service KMs",
|
"nextservicekm": "Next Service KMs",
|
||||||
@@ -317,6 +318,7 @@
|
|||||||
"empty": "Empty",
|
"empty": "Empty",
|
||||||
"full": "Full"
|
"full": "Full"
|
||||||
},
|
},
|
||||||
|
"outwith": "Out With",
|
||||||
"return": "Return Courtesy Car",
|
"return": "Return Courtesy Car",
|
||||||
"vehicle": "Vehicle Description"
|
"vehicle": "Vehicle Description"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -291,6 +291,7 @@
|
|||||||
"insuranceexpires": "",
|
"insuranceexpires": "",
|
||||||
"leaseenddate": "",
|
"leaseenddate": "",
|
||||||
"make": "",
|
"make": "",
|
||||||
|
"mileage": "",
|
||||||
"model": "",
|
"model": "",
|
||||||
"nextservicedate": "",
|
"nextservicedate": "",
|
||||||
"nextservicekm": "",
|
"nextservicekm": "",
|
||||||
@@ -317,6 +318,7 @@
|
|||||||
"empty": "",
|
"empty": "",
|
||||||
"full": ""
|
"full": ""
|
||||||
},
|
},
|
||||||
|
"outwith": "",
|
||||||
"return": "",
|
"return": "",
|
||||||
"vehicle": ""
|
"vehicle": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -291,6 +291,7 @@
|
|||||||
"insuranceexpires": "",
|
"insuranceexpires": "",
|
||||||
"leaseenddate": "",
|
"leaseenddate": "",
|
||||||
"make": "",
|
"make": "",
|
||||||
|
"mileage": "",
|
||||||
"model": "",
|
"model": "",
|
||||||
"nextservicedate": "",
|
"nextservicedate": "",
|
||||||
"nextservicekm": "",
|
"nextservicekm": "",
|
||||||
@@ -317,6 +318,7 @@
|
|||||||
"empty": "",
|
"empty": "",
|
||||||
"full": ""
|
"full": ""
|
||||||
},
|
},
|
||||||
|
"outwith": "",
|
||||||
"return": "",
|
"return": "",
|
||||||
"vehicle": ""
|
"vehicle": ""
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user