enhance form label & add comment to product
This commit is contained in:
@@ -13,12 +13,10 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const isMobile = false; // Default to desktop
|
const isMobile = false; // Default to desktop
|
||||||
const message = { success: (msg: string) => console.log(msg) }; // Simple message handler
|
|
||||||
const isRTL = false; // Default to LTR
|
const isRTL = false; // Default to LTR
|
||||||
|
|
||||||
const handleDeleteItem = (itemId: string) => {
|
const handleDeleteItem = (itemId: string) => {
|
||||||
dispatch(removeItem(Number(itemId)));
|
dispatch(removeItem(Number(itemId)));
|
||||||
message.success(t("cart.deleteConfirmation.success"));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPopconfirmOverlayStyle = () => ({
|
const getPopconfirmOverlayStyle = () => ({
|
||||||
|
|||||||
@@ -274,7 +274,9 @@ label {
|
|||||||
width: fit-content !important;
|
width: fit-content !important;
|
||||||
padding-left: 5px !important;
|
padding-left: 5px !important;
|
||||||
color: "#A9A9AA" !important;
|
color: "#A9A9AA" !important;
|
||||||
border-radius: 888px;
|
border-radius: 888px !important;
|
||||||
|
padding: 0 0 4px !important;
|
||||||
|
margin: 0 0 2px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:where(.darkApp) .ant-form-item-label {
|
:where(.darkApp) .ant-form-item-label {
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import { RightOutlined, ShoppingCartOutlined } from "@ant-design/icons";
|
import { RightOutlined, ShoppingCartOutlined } from "@ant-design/icons";
|
||||||
import { Button, Form, Input, message, Row } from "antd";
|
import { Button, Form, Input, message, Row } from "antd";
|
||||||
import {
|
import { addItem } from "features/order/orderSlice";
|
||||||
addItem,
|
|
||||||
selectCart,
|
|
||||||
updateSpecialRequest,
|
|
||||||
} from "features/order/orderSlice";
|
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
import useBreakPoint from "hooks/useBreakPoint";
|
||||||
import { BottomSheet } from "pages/cart/components/specialRequest/BottomSheet.tsx";
|
import { BottomSheet } from "pages/cart/components/specialRequest/BottomSheet.tsx";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
@@ -34,10 +30,10 @@ export default function ProductFooter({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { themeName } = useAppSelector((state) => state.theme);
|
const { themeName } = useAppSelector((state) => state.theme);
|
||||||
const { specialRequest } = useAppSelector(selectCart);
|
|
||||||
const [isSpecialRequestOpen, setIsSpecialRequestOpen] = useState(false);
|
const [isSpecialRequestOpen, setIsSpecialRequestOpen] = useState(false);
|
||||||
const { isMobile, isDesktop } = useBreakPoint();
|
const { isMobile, isDesktop } = useBreakPoint();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
|
const [specialRequest, setSpecialRequest] = useState("");
|
||||||
|
|
||||||
// Check if product has any customization options
|
// Check if product has any customization options
|
||||||
const hasCustomizationOptions = useMemo(() => {
|
const hasCustomizationOptions = useMemo(() => {
|
||||||
@@ -67,6 +63,7 @@ export default function ProductFooter({
|
|||||||
price: product?.price,
|
price: product?.price,
|
||||||
image: product?.image,
|
image: product?.image,
|
||||||
description: product?.description,
|
description: product?.description,
|
||||||
|
comment: specialRequest,
|
||||||
variant: variantId,
|
variant: variantId,
|
||||||
extras: selectedExtras,
|
extras: selectedExtras,
|
||||||
extrasgroup: selectedGroups,
|
extrasgroup: selectedGroups,
|
||||||
@@ -85,7 +82,7 @@ export default function ProductFooter({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSpecialRequestSave = (value: string) => {
|
const handleSpecialRequestSave = (value: string) => {
|
||||||
dispatch(updateSpecialRequest(value));
|
setSpecialRequest(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSpecialRequestClose = () => {
|
const handleSpecialRequestClose = () => {
|
||||||
@@ -138,6 +135,7 @@ export default function ProductFooter({
|
|||||||
size="large"
|
size="large"
|
||||||
autoFocus={false}
|
autoFocus={false}
|
||||||
className={styles.inputField}
|
className={styles.inputField}
|
||||||
|
onChange={(e) => setSpecialRequest(e.target.value)}
|
||||||
suffix={
|
suffix={
|
||||||
<div
|
<div
|
||||||
className={styles.editButton}
|
className={styles.editButton}
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ export interface CartItem {
|
|||||||
extrasgroup?: string[];
|
extrasgroup?: string[];
|
||||||
isHasLoyalty?: boolean;
|
isHasLoyalty?: boolean;
|
||||||
no_of_stamps_give?: number;
|
no_of_stamps_give?: number;
|
||||||
|
comment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
|
|||||||
Reference in New Issue
Block a user