transaltiosn & add clear coupon discount
This commit is contained in:
@@ -377,7 +377,9 @@
|
|||||||
"gotIt": "فهمت",
|
"gotIt": "فهمت",
|
||||||
"howItWorksDescription": "يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق.",
|
"howItWorksDescription": "يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق. يمكنك إرسال هدية إلى أي شخص عبر التطبيق.",
|
||||||
"senderEmail": "البريد الإلكتروني المرسل",
|
"senderEmail": "البريد الإلكتروني المرسل",
|
||||||
"save": "حفظ"
|
"save": "حفظ",
|
||||||
|
"pleaseEnterRoomNumber": "يرجى إدخال رقم الغرفة",
|
||||||
|
"pleaseEnterOfficeNumber": "يرجى إدخال رقم المكتب"
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"singup/Login": "الدخول / التسجيل",
|
"singup/Login": "الدخول / التسجيل",
|
||||||
|
|||||||
@@ -397,7 +397,9 @@
|
|||||||
"gotIt": "Got It",
|
"gotIt": "Got It",
|
||||||
"howItWorksDescription": "The gifted amount will be credited directly to your friend's wallet in the app. The recipient can use the amount to book a session of their choice within the app. The gifted amount is non-refundable and can only be used for booking sessions.",
|
"howItWorksDescription": "The gifted amount will be credited directly to your friend's wallet in the app. The recipient can use the amount to book a session of their choice within the app. The gifted amount is non-refundable and can only be used for booking sessions.",
|
||||||
"senderEmail": "Sender Email",
|
"senderEmail": "Sender Email",
|
||||||
"save": "Save"
|
"save": "Save",
|
||||||
|
"pleaseEnterRoomNumber": "Please enter room number",
|
||||||
|
"pleaseEnterOfficeNumber": "Please enter office number"
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"singup/Login": "Sing up / Login",
|
"singup/Login": "Sing up / Login",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface InputCardProps {
|
|||||||
placeholder: string;
|
placeholder: string;
|
||||||
value: string;
|
value: string;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
|
reuireqMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function InputCard({
|
export default function InputCard({
|
||||||
@@ -17,6 +18,7 @@ export default function InputCard({
|
|||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
required = false,
|
required = false,
|
||||||
|
reuireqMessage = "",
|
||||||
}: InputCardProps) {
|
}: InputCardProps) {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
@@ -27,7 +29,7 @@ export default function InputCard({
|
|||||||
<ProInputCard title={title} dividerStyle={{ margin: "5px 0 0 0" }}>
|
<ProInputCard title={title} dividerStyle={{ margin: "5px 0 0 0" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={name}
|
name={name}
|
||||||
rules={[{ required }]}
|
rules={[{ required, message: reuireqMessage }]}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Button, Form, Input, message } from "antd";
|
import { Button, Form, Input, message } from "antd";
|
||||||
|
import { CloseCircleOutlined } from "@ant-design/icons";
|
||||||
import { CouponBottomSheet } from "components/CustomBottomSheet/CouponBottomSheet";
|
import { CouponBottomSheet } from "components/CustomBottomSheet/CouponBottomSheet";
|
||||||
import { CouponDialog } from "components/CustomBottomSheet/CouponDialog";
|
import { CouponDialog } from "components/CustomBottomSheet/CouponDialog";
|
||||||
import CouponHeartIcon from "components/Icons/cart/CouponHeart.tsx";
|
import CouponHeartIcon from "components/Icons/cart/CouponHeart.tsx";
|
||||||
@@ -21,12 +22,14 @@ import { colors } from "ThemeConstants";
|
|||||||
export default function CouponCard() {
|
export default function CouponCard() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { restaurant } = useAppSelector((state) => state.order);
|
const { restaurant, discount } = useAppSelector((state) => state.order);
|
||||||
const { coupon } = useAppSelector(selectCart);
|
const { coupon } = useAppSelector(selectCart);
|
||||||
const { isDesktop } = useBreakPoint();
|
const { isDesktop } = useBreakPoint();
|
||||||
const [getDiscount] = useGetDiscountMutation();
|
const [getDiscount] = useGetDiscountMutation();
|
||||||
const [isCouponOpen, setIsCouponOpen] = useState(false);
|
const [isCouponOpen, setIsCouponOpen] = useState(false);
|
||||||
|
|
||||||
|
const isDiscountApplied = discount.value > 0 || discount.isDiscount || discount.isGift;
|
||||||
|
|
||||||
const handleCouponSave = (value: string) => {
|
const handleCouponSave = (value: string) => {
|
||||||
getDiscount({
|
getDiscount({
|
||||||
discountCode: value,
|
discountCode: value,
|
||||||
@@ -52,6 +55,18 @@ export default function CouponCard() {
|
|||||||
setIsCouponOpen(false);
|
setIsCouponOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClearDiscount = () => {
|
||||||
|
dispatch(updateCoupon(""));
|
||||||
|
dispatch(
|
||||||
|
updateDiscount({
|
||||||
|
value: 0,
|
||||||
|
isGift: false,
|
||||||
|
isDiscount: false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
message.success(t("cart.couponRemoved") || "Coupon removed");
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProInputCard
|
<ProInputCard
|
||||||
@@ -85,10 +100,21 @@ export default function CouponCard() {
|
|||||||
size="large"
|
size="large"
|
||||||
autoFocus={false}
|
autoFocus={false}
|
||||||
style={{ padding: "7px 11px", height: 48 }}
|
style={{ padding: "7px 11px", height: 48 }}
|
||||||
|
value={coupon}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
dispatch(updateCoupon(e.target.value));
|
dispatch(updateCoupon(e.target.value));
|
||||||
}}
|
}}
|
||||||
suffix={
|
suffix={
|
||||||
|
isDiscountApplied ? (
|
||||||
|
<CloseCircleOutlined
|
||||||
|
onClick={handleClearDiscount}
|
||||||
|
style={{
|
||||||
|
fontSize: 18,
|
||||||
|
color: "#999",
|
||||||
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
width: 100,
|
width: 100,
|
||||||
@@ -112,6 +138,7 @@ export default function CouponCard() {
|
|||||||
{t("cart.apply")}
|
{t("cart.apply")}
|
||||||
</ProText>
|
</ProText>
|
||||||
</Button>
|
</Button>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export default function CheckoutPage() {
|
|||||||
placeholder={t("address.roomNo")}
|
placeholder={t("address.roomNo")}
|
||||||
value={order?.roomNumber}
|
value={order?.roomNumber}
|
||||||
required
|
required
|
||||||
|
reuireqMessage={t("address.pleaseEnterRoomNumber")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{orderType === OrderType.ToOffice && (
|
{orderType === OrderType.ToOffice && (
|
||||||
@@ -83,6 +84,7 @@ export default function CheckoutPage() {
|
|||||||
placeholder={t("address.officeNo")}
|
placeholder={t("address.officeNo")}
|
||||||
value={order?.officeNumber}
|
value={order?.officeNumber}
|
||||||
required
|
required
|
||||||
|
reuireqMessage={t("address.pleaseEnterOfficeNumber")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{orderType === OrderType.Redeem && <VoucherSummary />}
|
{orderType === OrderType.Redeem && <VoucherSummary />}
|
||||||
|
|||||||
Reference in New Issue
Block a user