import { Form, Input, InputNumber } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import ContractStatusSelector from "../contract-status-select/contract-status-select.component";
import FormDatePicker from "../form-date-picker/form-date-picker.component";
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
import InputPhone from "../form-items-formatted/phone-form-item.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
export default function ContractFormComponent({ form, create = false }) {
  const { t } = useTranslation();
  return (
    <div>
      <div className="imex-flex-row__grow imex-flex-row__margin-large">
        <FormFieldsChanged form={form} />
      </div>
      <LayoutFormRow>
        {create ? null : (
          <Form.Item
            label={t("contracts.fields.status")}
            name="status"
            rules={[
              {
                required: true,
                message: t("general.validation.required"),
              },
            ]}
          >
            <ContractStatusSelector />
          </Form.Item>
        )}

        <Form.Item
          label={t("contracts.fields.start")}
          name="start"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <FormDatePicker />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.scheduledreturn")}
          name="scheduledreturn"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <FormDatePicker />
        </Form.Item>
        {create ? null : (
          <Form.Item
            label={t("contracts.fields.actualreturn")}
            name="actualreturn"
          >
            <FormDatePicker />
          </Form.Item>
        )}
      </LayoutFormRow>

      <LayoutFormRow>
        <Form.Item
          label={t("contracts.fields.kmstart")}
          name="kmstart"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <InputNumber />
        </Form.Item>
        {create ? null : (
          <Form.Item label={t("contracts.fields.kmend")} name="kmend">
            <InputNumber />
          </Form.Item>
        )}
      </LayoutFormRow>
      <LayoutFormRow>
        <Form.Item
          label={t("contracts.fields.driver_dlnumber")}
          name="driver_dlnumber"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_dlexpiry")}
          name="driver_dlexpiry"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <FormDatePicker />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_dlst")}
          name="driver_dlst"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_fn")}
          name="driver_fn"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_ln")}
          name="driver_ln"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_addr1")}
          name="driver_addr1"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_addr2")}
          name="driver_addr2"
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_city")}
          name="driver_city"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_state")}
          name="driver_state"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_zip")}
          name="driver_zip"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_ph1")}
          name="driver_ph1"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <InputPhone />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.driver_dob")}
          name="driver_dob"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <FormDatePicker />
        </Form.Item>
      </LayoutFormRow>

      <LayoutFormRow>
        <Form.Item
          label={t("contracts.fields.cc_num")}
          name="cc_num"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.cc_expiry")}
          name="cc_expiry"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.cc_cardholder")}
          name="cc_cardholder"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input />
        </Form.Item>
      </LayoutFormRow>
      <LayoutFormRow>
        <Form.Item label={t("contracts.fields.dailyrate")} name="dailyrate">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.actax")} name="actax">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.dailyfreekm")} name="dailyfreekm">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.refuelcharge")}
          name="refuelcharge"
        >
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.excesskmrate")}
          name="excesskmrate"
        >
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item
          label={t("contracts.fields.cleanupcharge")}
          name="cleanupcharge"
        >
          <InputNumber precision={2} />
        </Form.Item>
      </LayoutFormRow>
      <LayoutFormRow>
        <Form.Item
          label={t("contracts.fields.damagewaiver")}
          name="damagewaiver"
        >
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.federaltax")} name="federaltax">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.statetax")} name="statetax">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.localtax")} name="localtax">
          <InputNumber precision={2} />
        </Form.Item>
        <Form.Item label={t("contracts.fields.coverage")} name="coverage">
          <InputNumber precision={2} />
        </Form.Item>
      </LayoutFormRow>
    </div>
  );
}
