add card details validation
This commit is contained in:
@@ -493,6 +493,8 @@
|
|||||||
"edit": "تعديل",
|
"edit": "تعديل",
|
||||||
"yourInformation": "تفاصيلك",
|
"yourInformation": "تفاصيلك",
|
||||||
"minimumAmountShouldBe1OMR": "يجب أن يكون المبلغ الأدنى 1 OMR",
|
"minimumAmountShouldBe1OMR": "يجب أن يكون المبلغ الأدنى 1 OMR",
|
||||||
"add": "أضف"
|
"add": "أضف",
|
||||||
|
"senderNameRequired": "يجب أن يكون اسم المرسل مطلوب",
|
||||||
|
"receiverNameRequired": "يجب أن يكون اسم المستلم مطلوب"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,6 +505,8 @@
|
|||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"yourInformation": "Your Information",
|
"yourInformation": "Your Information",
|
||||||
"minimumAmountShouldBe1OMR": "Minimum amount should be 1 OMR",
|
"minimumAmountShouldBe1OMR": "Minimum amount should be 1 OMR",
|
||||||
"add": "Add"
|
"add": "Add",
|
||||||
|
"senderNameRequired": "Sender name is required",
|
||||||
|
"receiverNameRequired": "Receiver name is required"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default function CardDetailsPage() {
|
|||||||
useState(false);
|
useState(false);
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
// Find the initial index based on selected cardId from gift details
|
// Find the initial index based on selected cardId from gift details
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -54,9 +55,14 @@ export default function CardDetailsPage() {
|
|||||||
|
|
||||||
const currentCard = cards && cards.length > 0 ? cards[currentIndex] : null;
|
const currentCard = cards && cards.length > 0 ? cards[currentIndex] : null;
|
||||||
|
|
||||||
const handleCheckout = useCallback(() => {
|
const handleCheckout = useCallback(async () => {
|
||||||
navigate(`/${subdomain}/checkout`);
|
try {
|
||||||
}, [subdomain]);
|
await form.validateFields();
|
||||||
|
navigate(`/${subdomain}/checkout`);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}, [subdomain, form, navigate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -136,6 +142,7 @@ export default function CardDetailsPage() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Form
|
<Form
|
||||||
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
style={{ display: "flex", flexDirection: "column", gap: 16 }}
|
style={{ display: "flex", flexDirection: "column", gap: 16 }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function ReceivernformationCard() {
|
|||||||
return (
|
return (
|
||||||
<ProInputCard title={t("cardDetails.receiverInformation")}>
|
<ProInputCard title={t("cardDetails.receiverInformation")}>
|
||||||
<div className={styles.customerInformationCard}>
|
<div className={styles.customerInformationCard}>
|
||||||
<Form.Item name="receiverName">
|
<Form.Item name="receiverName" rules={[{ required: true, message: t("cardDetails.receiverNameRequired") }]}>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t("cardDetails.receiverName")}
|
placeholder={t("cardDetails.receiverName")}
|
||||||
size="large"
|
size="large"
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ export default function SenderformationCard() {
|
|||||||
return (
|
return (
|
||||||
<ProInputCard title={t("cardDetails.yourInformation")}>
|
<ProInputCard title={t("cardDetails.yourInformation")}>
|
||||||
<div className={styles.customerInformationCard}>
|
<div className={styles.customerInformationCard}>
|
||||||
<Form.Item name="senderName">
|
<Form.Item
|
||||||
|
name="senderName"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: t("cardDetails.senderNameRequired") },
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t("cardDetails.yourName")}
|
placeholder={t("cardDetails.yourName")}
|
||||||
size="large"
|
size="large"
|
||||||
|
|||||||
Reference in New Issue
Block a user