exports.id = 231;
exports.ids = [231];
exports.modules = {

/***/ 3098:
/***/ ((module) => {

// Exports
module.exports = {
	"center": "Order_center__VNFcJ",
	"paper": "Order_paper__c7nJv",
	"styledScrollBarList": "Order_styledScrollBarList__43WP4",
	"page": "Order_page__G5cau",
	"pageHeader": "Order_pageHeader__Av7oN",
	"pageContent": "Order_pageContent__mo_vq",
	"pageTitle": "Order_pageTitle__5rUED",
	"customIcon": "Order_customIcon__8AjWB",
	"OrderPage": "Order_OrderPage__ckLs_",
	"notFoundPage": "Order_notFoundPage__rCvo8",
	"notFoundText": "Order_notFoundText__M_lrg",
	"header": "Order_header__6cUdQ",
	"content": "Order_content__glsVH",
	"headerLeft": "Order_headerLeft___mnev",
	"fields": "Order_fields__d60yN",
	"textField": "Order_textField__7w5U1",
	"sums": "Order_sums__Sf694",
	"totalChangedBlock": "Order_totalChangedBlock__yERnJ",
	"totalChangedWarning": "Order_totalChangedWarning__EiQc6",
	"cart": "Order_cart__JkScu",
	"cartItem": "Order_cartItem__OZBQM",
	"itemBlock": "Order_itemBlock__kNNNd",
	"productName": "Order_productName__MTAT1",
	"mainImage": "Order_mainImage__6U5sK",
	"priceBlock": "Order_priceBlock__0Be_2",
	"price": "Order_price__0mJIp",
	"oldPrice": "Order_oldPrice__Mmz9J",
	"popper": "Order_popper__Sfs2b"
};


/***/ }),

/***/ 2024:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "b": () => (/* binding */ orderStatuses)
/* harmony export */ });
const orderStatuses = [
    "Pending",
    "Awaiting shipment",
    "Shipped",
    "Refunded",
    "Cancelled",
    "Completed"
];


/***/ }),

/***/ 1231:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ OrderPage)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _cromwell_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1815);
/* harmony import */ var _cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4536);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _apollo_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9114);
/* harmony import */ var _apollo_client__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_apollo_client__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _components_entity_entityEdit_EntityEdit__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4342);
/* harmony import */ var _constants_PageInfos__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(379);
/* harmony import */ var _helpers_customFields__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9143);
/* harmony import */ var _components_PageContent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1445);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_entity_entityEdit_EntityEdit__WEBPACK_IMPORTED_MODULE_5__, _helpers_customFields__WEBPACK_IMPORTED_MODULE_7__, _components_PageContent__WEBPACK_IMPORTED_MODULE_8__]);
([_components_entity_entityEdit_EntityEdit__WEBPACK_IMPORTED_MODULE_5__, _helpers_customFields__WEBPACK_IMPORTED_MODULE_7__, _components_PageContent__WEBPACK_IMPORTED_MODULE_8__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);









function OrderPage() {
    const client = (0,_cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__.getGraphQLClient)();
    const cstoreRef = (0,react__WEBPACK_IMPORTED_MODULE_3__.useRef)((0,_cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__.getCStore)({
        local: true
    }));
    const dataRef = (0,react__WEBPACK_IMPORTED_MODULE_3__.useRef)(null);
    const cartUpdatedRef = (0,react__WEBPACK_IMPORTED_MODULE_3__.useRef)(false);
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_entity_entityEdit_EntityEdit__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
        entityCategory: _cromwell_core__WEBPACK_IMPORTED_MODULE_1__.EDBEntity.Order,
        entityListRoute: _constants_PageInfos__WEBPACK_IMPORTED_MODULE_6__/* .orderListPageInfo.route */ .JB.route,
        entityBaseRoute: _constants_PageInfos__WEBPACK_IMPORTED_MODULE_6__/* .orderPageInfo.baseRoute */ .Pq.baseRoute,
        listLabel: "Orders",
        disableMeta: true,
        entityLabel: "Order",
        getById: (id)=>{
            const metaKeys = (0,_helpers_customFields__WEBPACK_IMPORTED_MODULE_7__/* .getCustomMetaKeysFor */ .He)(_cromwell_core__WEBPACK_IMPORTED_MODULE_1__.EDBEntity.Order);
            return client.getOrderById(id, _apollo_client__WEBPACK_IMPORTED_MODULE_4__.gql`
          fragment AdminOrderFragment on Order {
              ...OrderFragment
              ${metaKeys?.length ? `customMeta (keys: ${JSON.stringify(metaKeys)})` : ""}
              coupons {
                  ...CouponFragment
              }
          }
          ${client.CouponFragment}
          ${client.OrderFragment}
        `, "AdminOrderFragment");
        },
        update: client.updateOrder,
        create: client.createOrder,
        deleteOne: client.deleteOrder,
        customElements: {
            getEntityFields: (props)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_PageContent__WEBPACK_IMPORTED_MODULE_8__/* .PageContent */ .J, {
                    ...props,
                    cstoreRef: cstoreRef,
                    dataRef: dataRef,
                    cartUpdatedRef: cartUpdatedRef
                })
        },
        onSave: async ()=>{
            const data = dataRef.current;
            const cstore = cstoreRef.current;
            const cartInfo = cstore.getCartTotal();
            const updatedCartTotal = cartInfo.total ?? 0;
            const updatedOrderTotalPrice = parseFloat((updatedCartTotal + (data?.shippingPrice ?? 0)).toFixed(2));
            const inputData = {
                status: data.status,
                cart: JSON.stringify(cstore.getCart()),
                orderTotalPrice: cartUpdatedRef.current ? updatedOrderTotalPrice : data.orderTotalPrice,
                cartTotalPrice: cartUpdatedRef.current ? updatedCartTotal : data.cartTotalPrice,
                cartOldTotalPrice: data.cartOldTotalPrice,
                shippingPrice: data.shippingPrice,
                totalQnt: data.totalQnt,
                userId: data.userId,
                customerName: data.customerName,
                customerPhone: data.customerPhone,
                customerEmail: data.customerEmail,
                customerAddress: data.customerAddress,
                customerComment: data.customerComment,
                shippingMethod: data.shippingMethod,
                paymentMethod: data.paymentMethod,
                currency: data.currency,
                couponCodes: cstore.getCoupons()?.map((c)=>c.code) ?? [],
                customMeta: await (0,_helpers_customFields__WEBPACK_IMPORTED_MODULE_7__/* .getCustomMetaFor */ .Q7)(_cromwell_core__WEBPACK_IMPORTED_MODULE_1__.EDBEntity.Order)
            };
            return inputData;
        }
    });
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 1445:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "J": () => (/* binding */ PageContent)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _components_entity_entityEdit_components_EntityCustomFields__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7796);
/* harmony import */ var _cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4536);
/* harmony import */ var _mui_icons_material__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7915);
/* harmony import */ var _mui_icons_material__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _mui_material__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5692);
/* harmony import */ var _mui_material__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_mui_material__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4661);
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _components_inputs_AutocompleteInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8943);
/* harmony import */ var _components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2032);
/* harmony import */ var _constants_order__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2024);
/* harmony import */ var _constants_PageInfos__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(379);
/* harmony import */ var _helpers_addressParser__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(9177);
/* harmony import */ var _helpers_forceUpdate__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8673);
/* harmony import */ var _helpers_time__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(1454);
/* harmony import */ var _Order_module_scss__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(3098);
/* harmony import */ var _Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_Order_module_scss__WEBPACK_IMPORTED_MODULE_13__);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_entity_entityEdit_components_EntityCustomFields__WEBPACK_IMPORTED_MODULE_1__, _helpers_time__WEBPACK_IMPORTED_MODULE_11__]);
([_components_entity_entityEdit_components_EntityCustomFields__WEBPACK_IMPORTED_MODULE_1__, _helpers_time__WEBPACK_IMPORTED_MODULE_11__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);















function PageContent(props) {
    const { cartUpdatedRef  } = props;
    const forceUpdate = (0,_helpers_forceUpdate__WEBPACK_IMPORTED_MODULE_10__/* .useForceUpdate */ .N)();
    const cstore = props.cstoreRef.current;
    const cart = cstore.getCart();
    const [data, setData] = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(props.entityData);
    const [cartLoading, setCartLoading] = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false);
    const [cartProducts, setCartProducts] = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)([]);
    const location = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_6__.useLocation)();
    const cartInfo = cstore.getCartTotal();
    const updatedCartTotal = cartInfo.total ?? 0;
    const updatedOrderTotalPrice = parseFloat((updatedCartTotal + (data?.shippingPrice ?? 0)).toFixed(2));
    // Support old and new address format
    const { addressString , addressJson  } = (0,_helpers_addressParser__WEBPACK_IMPORTED_MODULE_12__/* .parseAddress */ .Cy)(data?.customerAddress);
    (0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(()=>{
        updateCart(props.entityData);
        props.dataRef.current = props.entityData;
    }, [
        props.entityData
    ]);
    const updateCart = async (order)=>{
        setCartLoading(true);
        let oldCart = order.cart;
        if (typeof oldCart === "string") {
            try {
                oldCart = JSON.parse(oldCart);
            } catch (e) {
                console.error(e);
            }
        }
        if (!Array.isArray(oldCart) || oldCart.length === 0) {
            oldCart = [];
        }
        oldCart.forEach((product)=>cstore.addToCart(product));
        if (order?.coupons?.length) {
            cstore.setCoupons(order.coupons);
        }
        const cart = cstore.getCart();
        const client = (0,_cromwell_core_frontend__WEBPACK_IMPORTED_MODULE_2__.getGraphQLClient)();
        const products = (await Promise.all(cart.map(async (item)=>{
            if (!item.product?.id) return;
            return client.getProductById(item.product.id).catch(console.error);
        }))).filter(Boolean);
        setCartProducts(products);
        setCartLoading(false);
        return cart;
    };
    const handleDeleteFromCart = (item)=>{
        cstore.removeFromCart(item);
        cartUpdatedRef.current = true;
        forceUpdate();
    };
    const handleInputChange = (prop, val)=>{
        if (data) {
            setData((prevData)=>{
                const newData = Object.assign({}, prevData);
                newData[prop] = val;
                props.dataRef.current = newData;
                return newData;
            });
        }
    };
    const onPriceChange = (value)=>{
        let newPrice = Number(value);
        if (!value) newPrice = 0;
        if (!isNaN(newPrice)) {
            cartUpdatedRef.current = true;
            handleInputChange("shippingPrice", newPrice);
        }
    };
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
        className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().OrderPage),
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().content),
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().fields),
                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                        container: true,
                        spacing: 3,
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_AutocompleteInput__WEBPACK_IMPORTED_MODULE_7__/* .AutocompleteInput */ .P, {
                                    value: data?.status ?? _constants_order__WEBPACK_IMPORTED_MODULE_14__/* .orderStatuses[0] */ .b[0],
                                    onChange: (event, newValue)=>{
                                        handleInputChange("status", newValue);
                                    },
                                    classes: {
                                        paper: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().popper)
                                    },
                                    options: _constants_order__WEBPACK_IMPORTED_MODULE_14__/* .orderStatuses */ .b,
                                    getOptionLabel: (option)=>option,
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    label: "Status"
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Name",
                                    value: data?.customerName || "",
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    onChange: (e)=>{
                                        handleInputChange("customerName", e.target.value);
                                    }
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Phone",
                                    value: data?.customerPhone || "",
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    onChange: (e)=>{
                                        handleInputChange("customerPhone", e.target.value);
                                    }
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Email",
                                    value: data?.customerEmail || "",
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    onChange: (e)=>{
                                        handleInputChange("customerEmail", e.target.value);
                                    }
                                })
                            }),
                            !addressJson && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 12,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Address",
                                    value: addressString || "",
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    onChange: (e)=>{
                                        handleInputChange("customerAddress", e.target.value);
                                    }
                                })
                            }),
                            addressJson && Object.entries(addressJson).map(([fieldKey, value])=>{
                                return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                    item: true,
                                    xs: 12,
                                    sm: 6,
                                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                        label: fieldKey,
                                        value: value || "",
                                        className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                        onChange: (e)=>{
                                            const newVal = e.target.value;
                                            handleInputChange("customerAddress", JSON.stringify({
                                                ...addressJson,
                                                [fieldKey]: newVal
                                            }));
                                        }
                                    })
                                }, fieldKey);
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 12,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Comment",
                                    value: data?.customerComment || "",
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    onChange: (e)=>{
                                        handleInputChange("customerComment", e.target.value);
                                    }
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Payment method",
                                    disabled: true,
                                    value: data?.paymentMethod,
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField)
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Shipping method",
                                    disabled: true,
                                    value: data?.shippingMethod,
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField)
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Shipping price",
                                    value: data?.shippingPrice ?? 0,
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    type: "currency",
                                    onChange: (e)=>onPriceChange(e.target.value)
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Created",
                                    value: (0,_helpers_time__WEBPACK_IMPORTED_MODULE_11__/* .toLocaleDateTimeString */ .MA)(data?.createDate),
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    disabled: true
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                item: true,
                                xs: 12,
                                sm: 6,
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_inputs_TextInput_TextInput__WEBPACK_IMPORTED_MODULE_8__/* .TextInput */ .o, {
                                    label: "Last updated",
                                    value: (0,_helpers_time__WEBPACK_IMPORTED_MODULE_11__/* .toLocaleDateTimeString */ .MA)(data?.updateDate),
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().textField),
                                    disabled: true
                                })
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_entity_entityEdit_components_EntityCustomFields__WEBPACK_IMPORTED_MODULE_1__/* .EntityCustomFields */ .O, {})
                        ]
                    })
                }),
                !!cstore.getCoupons()?.length && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().fields),
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            children: "Applied coupons"
                        }),
                        cstore.getCoupons().map((coupon)=>/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Box, {
                                sx: {
                                    display: "flex",
                                    alignItems: "center",
                                    mt: 2
                                },
                                children: [
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_router_dom__WEBPACK_IMPORTED_MODULE_6__.Link, {
                                        to: `${_constants_PageInfos__WEBPACK_IMPORTED_MODULE_9__/* .couponPageInfo.baseRoute */ .F7.baseRoute}/${coupon.id}`,
                                        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Box, {
                                            sx: {
                                                mr: 2,
                                                border: "1px dashed #222",
                                                py: "5px",
                                                px: "10px",
                                                borderRadius: "6px",
                                                cursor: "pointer"
                                            },
                                            children: coupon.code
                                        })
                                    }),
                                    coupon.discountType === "fixed" && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Box, {
                                        children: cstore.getPriceWithCurrency(coupon.value)
                                    }),
                                    coupon.discountType === "percentage" && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Box, {
                                        children: [
                                            coupon.value,
                                            "%"
                                        ]
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.IconButton, {
                                        sx: {
                                            ml: 2
                                        },
                                        onClick: ()=>{
                                            cstore.setCoupons(cstore.getCoupons().filter((c)=>c.id !== coupon.id));
                                            cartUpdatedRef.current = true;
                                            forceUpdate();
                                        },
                                        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_icons_material__WEBPACK_IMPORTED_MODULE_3__.Close, {})
                                    })
                                ]
                            }, coupon.id))
                    ]
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().sums),
                    children: [
                        data && !cartLoading && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                            children: [
                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                                    children: [
                                        "Cart total:",
                                        " ",
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                                            children: cstore.getPriceWithCurrency(cartUpdatedRef.current ? updatedCartTotal : data.cartTotalPrice)
                                        })
                                    ]
                                }),
                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                                    children: [
                                        "Shipping: ",
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                                            children: cstore.getPriceWithCurrency(data.shippingPrice ?? 0)
                                        })
                                    ]
                                }),
                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                                    children: [
                                        "Order total:",
                                        " ",
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                                            children: cstore.getPriceWithCurrency(cartUpdatedRef.current ? updatedOrderTotalPrice : data.orderTotalPrice)
                                        })
                                    ]
                                })
                            ]
                        }),
                        cartLoading && Array(4).fill(1).map((it, index)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Skeleton, {
                                style: {
                                    marginBottom: "3px"
                                },
                                height: "20px"
                            }, index))
                    ]
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().cart),
                    children: [
                        !cartLoading && cart?.map((it, i)=>{
                            const product = Object.assign({}, cartProducts.find((p)=>p.id === it?.product?.id), it.product);
                            const checkedAttrKeys = Object.keys(it.pickedAttributes || {});
                            if (product) {
                                const productLink = `${_constants_PageInfos__WEBPACK_IMPORTED_MODULE_9__/* .productPageInfo.baseRoute */ .On.baseRoute}/${product.id}`;
                                return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().cartItem),
                                    container: true,
                                    children: [
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                            item: true,
                                            xs: 1,
                                            className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_router_dom__WEBPACK_IMPORTED_MODULE_6__.Link, {
                                                to: productLink,
                                                state: {
                                                    prevRoute: location.pathname + location.search
                                                },
                                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
                                                    src: product.mainImage,
                                                    className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().mainImage)
                                                })
                                            })
                                        }),
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                            item: true,
                                            xs: 4,
                                            children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                                children: [
                                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_router_dom__WEBPACK_IMPORTED_MODULE_6__.Link, {
                                                        className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().productName),
                                                        to: productLink,
                                                        state: {
                                                            prevRoute: location.pathname + location.search
                                                        },
                                                        children: product.name
                                                    }),
                                                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                        className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().priceBlock),
                                                        children: [
                                                            product?.oldPrice !== undefined && product?.oldPrice !== null && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().oldPrice),
                                                                children: cstore.getPriceWithCurrency(product.oldPrice)
                                                            }),
                                                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().price),
                                                                children: cstore.getPriceWithCurrency(product?.price)
                                                            })
                                                        ]
                                                    })
                                                ]
                                            })
                                        }),
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                            item: true,
                                            xs: 3,
                                            className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                                children: checkedAttrKeys.map((key)=>{
                                                    const vals = it.pickedAttributes ? it.pickedAttributes[key] : [];
                                                    const valsStr = vals.join(", ");
                                                    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                                                        children: [
                                                            key,
                                                            ": ",
                                                            valsStr
                                                        ]
                                                    }, key);
                                                })
                                            })
                                        }),
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                            item: true,
                                            xs: 2,
                                            className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                                                    children: [
                                                        "Qty: ",
                                                        it.amount ?? 1
                                                    ]
                                                })
                                            })
                                        }),
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Grid, {
                                            item: true,
                                            xs: 1,
                                            className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                            style: {
                                                marginLeft: "auto",
                                                paddingRight: "0px"
                                            },
                                            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                className: (_Order_module_scss__WEBPACK_IMPORTED_MODULE_13___default().itemBlock),
                                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.IconButton, {
                                                    "aria-label": "Delete",
                                                    onClick: ()=>{
                                                        handleDeleteFromCart(it);
                                                    },
                                                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_icons_material__WEBPACK_IMPORTED_MODULE_3__.DeleteForever, {})
                                                })
                                            })
                                        })
                                    ]
                                }, i);
                            }
                        }),
                        cartLoading && Array(2).fill(1).map((it, index)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_mui_material__WEBPACK_IMPORTED_MODULE_4__.Skeleton, {
                                style: {
                                    margin: "0 20px 5px 20px"
                                },
                                height: "60px"
                            }, index))
                    ]
                })
            ]
        })
    });
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ })

};
;