diff --git a/client/src/components/contract-cars/contract-cars.container.jsx b/client/src/components/contract-cars/contract-cars.container.jsx index 6fb3d080f..eeed7bce0 100644 --- a/client/src/components/contract-cars/contract-cars.container.jsx +++ b/client/src/components/contract-cars/contract-cars.container.jsx @@ -1,9 +1,9 @@ import { useQuery } from "@apollo/client"; +import moment from "moment"; import React from "react"; import { QUERY_AVAILABLE_CC } from "../../graphql/courtesy-car.queries"; import AlertComponent from "../alert/alert.component"; import ContractCarsComponent from "./contract-cars.component"; -import moment from "moment"; export default function ContractCarsContainer({ selectedCarState, form }) { const { loading, error, data } = useQuery(QUERY_AVAILABLE_CC, { @@ -14,6 +14,11 @@ export default function ContractCarsContainer({ selectedCarState, form }) { const handleSelect = (record) => { setSelectedCar(record.id); + + console.log( + "🚀 ~ file: contract-cars.container.jsx ~ line 19 ~ record", + record + ); form.setFieldsValue({ kmstart: record.mileage, dailyrate: record.dailycost, diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx index 0395dc701..5b3cf34f9 100644 --- a/client/src/components/contract-form/contract-form.component.jsx +++ b/client/src/components/contract-form/contract-form.component.jsx @@ -1,6 +1,7 @@ import { Form, Input, InputNumber } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; +import ContractLicenseDecodeButton from "../contract-license-decode-button/contract-license-decode-button.component"; import ContractStatusSelector from "../contract-status-select/contract-status-select.component"; import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; @@ -19,9 +20,7 @@ export default function ContractFormComponent({ const { t } = useTranslation(); return (
-
- -
+ {create ? null : ( )} -
)} + - diff --git a/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx b/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx index fa62ebe39..1e93405c2 100644 --- a/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx +++ b/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx @@ -1,23 +1,16 @@ import { Slider } from "antd"; -import React, { useEffect, useState, forwardRef } from "react"; +import React, { forwardRef } from "react"; import { useTranslation } from "react-i18next"; -const CourtesyCarFuelComponent = ({ value = 100, onChange }, ref) => { - const [option, setOption] = useState(value); +const CourtesyCarFuelComponent = (props, ref) => { const { t } = useTranslation(); - useEffect(() => { - if (value !== option && onChange) { - onChange(option); - } - }, [value, option, onChange]); - const marks = { 0: { style: { color: "#f50", }, - label: t("courtesycars.labels.fuel.empty"), + label: {t("courtesycars.labels.fuel.empty")}, }, 13: t("courtesycars.labels.fuel.18"), 25: t("courtesycars.labels.fuel.14"), @@ -34,14 +27,6 @@ const CourtesyCarFuelComponent = ({ value = 100, onChange }, ref) => { }, }; - return ( - - ); + return ; }; export default forwardRef(CourtesyCarFuelComponent); diff --git a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx index b040db770..60c84e059 100644 --- a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx +++ b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx @@ -13,7 +13,10 @@ export default function FormsFieldChanged({ form }) { const loc = useLocation(); return ( - + {() => { if (form.isFieldsTouched()) return ( diff --git a/client/src/pages/contract-create/contract-create.page.component.jsx b/client/src/pages/contract-create/contract-create.page.component.jsx index a5790e641..29f90f027 100644 --- a/client/src/pages/contract-create/contract-create.page.component.jsx +++ b/client/src/pages/contract-create/contract-create.page.component.jsx @@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next"; import ContractCarsContainer from "../../components/contract-cars/contract-cars.container"; import ContractFormComponent from "../../components/contract-form/contract-form.component"; import ContractJobsContainer from "../../components/contract-jobs/contract-jobs.container"; -import ContractLicenseDecodeButton from "../../components/contract-license-decode-button/contract-license-decode-button.component"; export default function ContractCreatePageComponent({ form, selectedJobState, @@ -14,7 +13,12 @@ export default function ContractCreatePageComponent({ const { t } = useTranslation(); const CreateButton = ( - ); @@ -24,12 +28,18 @@ export default function ContractCreatePageComponent({ {CreateButton} - - + +
+ +
{CreateButton} ); diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx index 7c3a08c95..0c9c93daa 100644 --- a/client/src/pages/contract-create/contract-create.page.container.jsx +++ b/client/src/pages/contract-create/contract-create.page.container.jsx @@ -100,7 +100,6 @@ export function ContractCreatePageContainer({ layout="vertical" autoComplete="no" onFinish={handleFinish} - initialValues={{ fuelout: 100 }} >