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,QAAQC,SAAS,MAC9B5B,EAAAA,cAAA,YAAOiB,EAAMU,QAAQE,QAAQ,MAC7B7B,EAAAA,cAAA,YAAOiB,EAAMU,QAAQG,OAGzB,KAEHb,EAAMc,cAAgBd,EAAMc,aAAahB,OACtCf,EAAAA,cAACC,EAAAA,SAAQ,KACLD,EAAAA,cAAA,OAAKE,UAAU,mDAAkDG,EAAAA,EAAAA,GAAU,0DAC3EL,EAAAA,cAAA,OAAKE,UAAU,4CACVe,EAAMc,aAAaf,KAAI,CAACgB,EAAMd,IAC3BlB,EAAAA,cAAA,OAAKoB,IAAK,gBAAgBF,IAAShB,UAAU,iDACxC8B,OAMjB,SAMhBhC,EAAAA,cAAA,OAAKE,UAAU,wCAAuCG,EAAAA,EAAAA,GAAU,2DAK7E,C","sources":["webpack:///./Scripts/Actions/StockBalanceAside.action.js","webpack:///./Scripts/Components/StockBalanceAside.js"],"sourcesContent":["import { get } from '../Services/http';\nimport { catchError } from './Error.action';\nimport {\n    STOCK_BALANCE_ASIDE_RECEIVE,\n    STOCK_BALANCE_ASIDE_ERROR,\n} from '../constants';\n\nexport const getStoreStockBalance = (variantSystemId) => (dispatch, getState) => {\n    // abort any existing, pending request.\n    // It's ok to call .abort() after the fetch has already completed, fetch simply ignores it.\n    return get(`/api/stores/inventory/${variantSystemId}`)\n        .then((response) => response.json())\n        .then((result) => dispatch(receive(result)))\n        .catch((ex) => dispatch(catchError(ex, (error) => stockBalanceError(error))));\n};\n\nexport const stockBalanceError = (error) => ({\n    type: STOCK_BALANCE_ASIDE_ERROR,\n    payload: {\n        error\n    },\n});\n\nexport const receive = (result) => ({\n    type: STOCK_BALANCE_ASIDE_RECEIVE,\n    payload: {\n        result\n    },\n});\n\n","import React, { useRef, Fragment } from 'react';\nimport { useSelector, useDispatch } from 'react-redux';\nimport AsideContent from './AsideContent';\nimport { getStoreStockBalance } from '../Actions/StockBalanceAside.action'\nimport { translate } from '../Services/translation';\n\nconst StoreStockBalanceAside = () => {\n    const { result } = useSelector((state) => state.storeStockBalance);\n    const { product } = useSelector((state) => state.currentProduct);\n    const storeRef = useRef({});\n    const asideRef = useRef();\n    const dispatch = useDispatch();\n\n    const showStockBalance = () => {\n        asideRef.current.toggleAside();\n        asideRef.current.loading(true);\n        dispatch(getStoreStockBalance(product.variantSystemId)).then(i => {\n            asideRef.current.loading(false);\n        });\n    };\n\n    const toggleShowMoreInfo = (store) => {\n        storeRef.current[store].classList.toggle('stock-balance-aside__store--show');\n    }\n\n    return (\n        <Fragment>\n            <button className=\"product-detail__show-aside\" onClick={() => showStockBalance()}>\n                <img src=\"/ui/images/marker-black.svg\" />\n                <span>{translate('code.product.stores.inventory.button.title')}</span>\n            </button>\n            <AsideContent ref={asideRef} title={translate('code.product.stores.inventory.aside.title')} cssClass=\"stock-balance\">\n                <div className=\"stock-balance-aside\">\n                    <div className=\"stock-balance-aside__info-wrapper\">\n                        <figure className=\"stock-balance-aside__image-container\">\n                            <img src={product.imageUrl} />\n                        </figure>\n                        <article className=\"stock-balance-aside__info\">\n                            <div className=\"stock-balance-aside__info-title\">\n                                {product.variantName}\n                            </div>\n                            <div className=\"stock-balance-aside__info-price\">\n                                {product.campaignPrice ?\n                                    <Fragment>\n                                        <span className=\"stock-balance-aside__info-price--campaign\">\n                                            {product.campaignPrice}\n                                        </span>\n                                        <span className=\"stock-balance-aside__info-price--old\">\n                                            ({product.price})\n                                        </span>\n                                    </Fragment>\n                                    :\n                                    <span className=\"stock-balance-aside__info-price--price\">\n                                        {product.price}\n                                    </span>\n                                }\n                            </div>\n                            <div className=\"stock-balance-aside__info-articlenumber\">\n                                <span>{translate('code.product.stores.inventory.aside.articlenumber')}: </span>\n                                <span>{product.baseProductId}</span>\n                            </div>\n                        </article>\n                    </div>\n                    <div className=\"stock-balance-aside__stock-info-wrapper\">\n                        {result && (\n                            result.length > 0 ?\n                                result.map((store, index) => (\n                                    <div ref={(ref) => (storeRef.current[store.name] = ref)} key={`store-${index}`} className=\"stock-balance-aside__store\" onClick={() => toggleShowMoreInfo(store.name)}>\n                                        <div className={`stock-balance-aside__stockstatus ${store.stockStatus.stockStatusCssClass}`}>\n                                            <span></span>\n                                        </div>\n                                        <div className=\"stock-balance-aside__store-expand\">\n                                        </div>\n                                        <div className=\"stock-balance-aside__store-info\">\n                                            <div className=\"stock-balance-aside__store-info-name\">{store.name}</div>\n                                            <div className={`stock-balance-aside__store-info-stock-description ${store.stockStatus.stockStatusCssClass}`}>\n                                                {store.stockStatus.description}\n                                            </div>\n                                        </div>\n                                        <div className={`stock-balance-aside__store-additional-info`}>\n                                            {store.address.address1 ?\n                                                <div className=\"stock-balance-aside__store-address\">\n                                                    <div className=\"stock-balance-aside__store-address-title\">{translate('code.product.stores.inventory.aside.address.title')}: </div>\n                                                    <span>{store.address.address1}, </span>\n                                                    <span>{store.address.zipCode}, </span>\n                                                    <span>{store.address.city}</span>\n                                                </div>\n                                                :\n                                                null\n                                            }\n                                            {store.openingHours && store.openingHours.length ?\n                                                <Fragment>\n                                                    <div className=\"stock-balance-aside__store-opening-hours-title\">{translate('code.product.stores.inventory.aside.openinghours.info')}</div>\n                                                    <div className=\"stock-balance-aside__store-opening-hours\">\n                                                        {store.openingHours.map((item, index) => (\n                                                            <div key={`opening-hour-${index}`} className=\"stock-balance-aside__store-opening-hours-item\">\n                                                                {item}\n                                                            </div>\n                                                        ))}\n                                                    </div>\n                                                </Fragment>\n                                                :\n                                                null\n                                            }\n                                        </div>\n                                    </div>\n                                ))\n                                :\n                                <div className=\"stock-balance-aside__missing-stores\">{translate(\"code.product.stores.inventory.aside.missing.stores\")}</div>\n                        )}\n                    </div>\n                </div>\n            </AsideContent>\n        </Fragment>\n    );\n};\n\nexport default StoreStockBalanceAside;"],"names":["stockBalanceError","error","type","STOCK_BALANCE_ASIDE_ERROR","payload","receive","result","STOCK_BALANCE_ASIDE_RECEIVE","StoreStockBalanceAside","useSelector","state","storeStockBalance","product","currentProduct","storeRef","useRef","asideRef","dispatch","useDispatch","showStockBalance","variantSystemId","current","toggleAside","loading","getState","get","then","response","json","catch","ex","catchError","i","React","Fragment","className","onClick","src","translate","AsideContent","ref","title","cssClass","imageUrl","variantName","campaignPrice","price","baseProductId","length","map","store","index","name","key","classList","toggle","toggleShowMoreInfo","stockStatus","stockStatusCssClass","description","address","address1","zipCode","city","openingHours","item"],"sourceRoot":""}