import { Form, Input } from "antd";
import ProInputCard from "components/ProInputCard/ProInputCard.tsx";
import { updatePlateCar } from "features/order/orderSlice";
import { useTranslation } from "react-i18next";
import { useAppDispatch, useAppSelector } from "redux/hooks";

export default function CarPlateCard() {
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

  const plateCar = useAppSelector((state) => state.order.plateCar);
  return (
    <>
      <ProInputCard
        title={t("cart.plateNumber")}
        dividerStyle={{ margin: "5px 0 0 0" }}
      >
        <Form.Item
          label={t("cart.plateNumber")}
          name="plateNumber"
          style={{ position: "relative", top: -5 }}
        >
          <Input
            placeholder={t("cart.plateNumber")}
            size="large"
            autoFocus={false}
            style={{ padding: "7px 11px", height: 50, borderRadius: 888 }}
            value={plateCar}
            onChange={(e) => {
              dispatch(updatePlateCar(e.target.value));
            }}
          />
        </Form.Item>
      </ProInputCard>
    </>
  );
}
