cart & checkout: apply validation based on required inputs in each service & add phone input in checkout page

This commit is contained in:
2025-10-14 23:25:08 +03:00
parent af27d1e509
commit b88cc28c89
13 changed files with 186 additions and 113 deletions

View File

@@ -1,3 +1,4 @@
import { Form } from "antd";
import ProInputCard from "components/ProInputCard/ProInputCard.tsx";
import ProRatioGroups from "components/ProRatioGroups/ProRatioGroups.tsx";
import { selectCart, updateEstimateTime } from "features/order/orderSlice.ts";
@@ -27,22 +28,24 @@ export default function TimeEstimateCard() {
return (
<>
<ProInputCard title={t("cart.estimateTime")}>
<ProRatioGroups
options={[
{ label: t("cart.now"), value: "now", price: "" },
{ label: t("cart.later"), value: "later", price: "" },
]}
value={estimateWay}
onRatioClick={(value) => {
if (value === "now") {
setEstimateWay(value);
handleEstimateTimeSave(new Date(), "now");
} else {
setEstimateWay(value);
setIsEstimateTimeOpen(true);
}
}}
/>
<Form.Item name="estimateWay" required rules={[{ required: true }]}>
<ProRatioGroups
options={[
{ label: t("cart.now"), value: "now", price: "" },
{ label: t("cart.later"), value: "later", price: "" },
]}
value={estimateWay}
onRatioClick={(value) => {
if (value === "now") {
setEstimateWay(value);
handleEstimateTimeSave(new Date(), "now");
} else {
setEstimateWay(value);
setIsEstimateTimeOpen(true);
}
}}
/>
</Form.Item>
</ProInputCard>
{isDesktop ? (
<Dialog