{"version":3,"sources":["webpack:///./resources/js/src/app/mixins/buttonSizeProperty.mixin.js","webpack:///./resources/js/src/app/components/basket/AddToBasket.vue?4bec","webpack:///resources/js/src/app/components/basket/AddToBasket.vue","webpack:///./resources/js/src/app/components/basket/AddToBasket.vue?d882","webpack:///./resources/js/src/app/components/basket/AddToBasket.vue"],"names":["BUTTON_SIZES","LEGACY_CLASS_MAP","ButtonSizePropertyMixin","props","buttonSize","type","String","default","validator","value","Object","keys","indexOf","computed","buttonSizeClass","hasOwnProperty","this","render","_vm","_h","$createElement","_c","_self","showQuantity","useLargeScale","canBeAddedToBasket","directives","name","rawName","staticClass","class","isLoading","attrs","title","$translate","on","click","$event","addToBasket","icon","loading","_e","_v","directToItem","$ceres","isItemView","quantity","timeout","min","minimumQuantity","max","maximumQuantity","interval","intervalQuantity","variationId","waiting","isSalable","allVariationsSelected","updateQuantity","handleButtonState","buttonLockState","buttonClasses","style","paddingInlineStyles","_f","_s","disabled","hasPrice","tooltipText","isWishList","role","_withStripped","extractPropertiesAndSurcharge","orderProperties","component","options","__file"],"mappings":"u7BAAA,IAAMA,EAAe,CAAC,SAAU,UAE1BC,EAAmB,CACrB,GAAM,SACN,GAAM,GACN,GAAM,UAGGC,EACb,CACIC,MAAO,CACHC,WACA,CACIC,KAAM,CAACC,OAAQ,MACfC,QAAS,KACTC,UAAW,SAAAC,GAEP,OAIsB,IAJf,CACH,IADG,OAEAT,EAFA,EAGAU,OAAOC,KAAKV,KACjBW,QAAQH,MAKtBI,SAAU,CACNC,gBADM,WAGF,OAAIb,EAAiBc,eAAeC,KAAKZ,YAE9BH,EAAiBe,KAAKZ,YAG1BY,KAAKZ,e,wCClCxB,IAAIa,EAAS,WACX,IAAIC,EAAMF,KACNG,EAAKD,EAAIE,eACTC,EAAKH,EAAII,MAAMD,IAAMF,EACzB,OAAOE,EAAG,MAAO,EACdH,EAAIK,cAAgBL,EAAIM,eAAiBN,EAAIO,mBAC1CJ,EACE,MACA,CACEK,WAAY,CAAC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ACc,SAAd,+CACc,sBAAd,cACc,uBAAd,sBAGU,EAAV,gBAGQ,KAAR,yCACA,YAEU,SAAV,sDAAY,OAAZ,KACU,EAAV,8CAEA,YAEU,EAAV,2CAEA,QAEY,EAAZ,MACA,aACA,4DACA,qBAEA,qBAKI,2BAzEJ,WA2EM,KAAN,yEAEM,IAHN,EAIA,KAJA,IAGA,iDAAQ,OAAR,0BAHM,IAME,IAAR,uBACA,CACU,GADV,QACA,QARA,SAAQ,EAAR,aAAQ,EAAR,IAWM,EAAN,2GAGI,aAxFJ,WA0FM,OAAN,IAAM,CAAN,eAGI,kBA7FJ,SA6FA,GAEM,KAAN,mBAOI,eAtGJ,SAsGA,GAEM,KAAN,aAIE,MACF,CACI,SADJ,SACA,GAEA,2BAEQ,KAAR,qEACQ,KAAR,4IAII,uBAVJ,SAUA,GAEA,oBAEQ,KAAR,aAII,aAlBJ,SAkBA,GAEA,WAEQ,KAAR,e,OE7ZIC,EAAY,YACd,EACAzD,EH4QoB,IG1QpB,EACA,KACA,KACA,MAuBFyD,EAAUC,QAAQC,OAAS,yDACZ,UAAAF,E","file":"chunks/ceres-9.min.js","sourcesContent":["const BUTTON_SIZES = [\"btn-sm\", \"btn-lg\"];\n\nconst LEGACY_CLASS_MAP = {\n    \"sm\": \"btn-sm\",\n    \"md\": \"\",\n    \"lg\": \"btn-lg\"\n};\n\nexport const ButtonSizePropertyMixin =\n{\n    props: {\n        buttonSize:\n        {\n            type: [String, null],\n            default: null,\n            validator: value =>\n            {\n                return [\n                    \"\",\n                    ...BUTTON_SIZES,\n                    ...Object.keys(LEGACY_CLASS_MAP)\n                ].indexOf(value) !== -1;\n            }\n        }\n    },\n\n    computed: {\n        buttonSizeClass()\n        {\n            if (LEGACY_CLASS_MAP.hasOwnProperty(this.buttonSize))\n            {\n                return LEGACY_CLASS_MAP[this.buttonSize];\n            }\n\n            return this.buttonSize;\n        }\n    }\n};\n","var render = function() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  return _c(\"div\", [\n    !_vm.showQuantity && _vm.useLargeScale && _vm.canBeAddedToBasket\n      ? _c(\n          \"div\",\n          {\n            directives: [{ name: \"tooltip\", rawName: \"v-tooltip\" }],\n            staticClass: \"add-to-basket-lg-container d-none d-lg-block\",\n            class: { \"no-pointer-events\": _vm.isLoading },\n            attrs: {\n              \"data-toggle\": \"tooltip\",\n              \"data-placement\": \"top\",\n              title: _vm.$translate(\"Ceres::Template.singleItemAddToBasket\")\n            },\n            on: {\n              click: function($event) {\n                return _vm.addToBasket()\n              }\n            }\n          },\n          [\n            _c(\"icon\", {\n              staticClass: \"fa-lg mobile-icon-right\",\n              attrs: { icon: \"cart-plus\", loading: _vm.isLoading }\n            })\n          ],\n          1\n        )\n      : _vm._e(),\n    _vm._v(\" \"),\n    !_vm.showQuantity && _vm.useLargeScale && !_vm.canBeAddedToBasket\n      ? _c(\n          \"div\",\n          {\n            directives: [{ name: \"tooltip\", rawName: \"v-tooltip\" }],\n            staticClass: \"add-to-basket-lg-container d-none d-lg-block\",\n            attrs: {\n              \"data-toggle\": \"tooltip\",\n              \"data-placement\": \"top\",\n              title: _vm.$translate(\"Ceres::Template.itemShowItem\")\n            },\n            on: {\n              click: function($event) {\n                return _vm.directToItem()\n              }\n            }\n          },\n          [\n            _c(\"i\", {\n              staticClass: \"fa fa-arrow-right fa-lg d-none d-sm-block\"\n            })\n          ]\n        )\n      : _vm._e(),\n    _vm._v(\" \"),\n    _vm.showQuantity && !_vm.useLargeScale\n      ? _c(\n          \"div\",\n          {\n            staticClass: \"d-inline\",\n            class: { \"d-lg-none\": !_vm.$ceres.isItemView }\n          },\n          [\n            _c(\"div\", { staticClass: \"add-to-basket-container\" }, [\n              _c(\n                \"div\",\n                { staticClass: \"quantity-input-container\" },\n                [\n                  _c(\"quantity-input\", {\n                    attrs: {\n                      value: _vm.quantity,\n                      timeout: 0,\n                      min: _vm.minimumQuantity,\n                      max: _vm.maximumQuantity,\n                      interval: _vm.intervalQuantity,\n                      \"variation-id\": _vm.variationId,\n                      waiting:\n                        _vm.isLoading ||\n                        !_vm.isSalable ||\n                        !_vm.allVariationsSelected\n                    },\n                    on: {\n                      \"quantity-change\": _vm.updateQuantity,\n                      \"out-of-stock\": _vm.handleButtonState\n                    }\n                  })\n                ],\n                1\n              ),\n              _vm._v(\" \"),\n              !_vm.allVariationsSelected || !_vm.isSalable\n                ? _c(\n                    \"button\",\n                    {\n                      directives: [{ name: \"tooltip\", rawName: \"v-tooltip\" }],\n                      staticClass:\n                        \"btn btn-block btn-primary btn-appearance disabled\",\n                      class: _vm.buttonClasses,\n                      style: _vm.paddingInlineStyles,\n                      attrs: {\n                        \"data-toggle\": \"tooltip\",\n                        \"data-placement\": \"top\",\n                        title: _vm.tooltipText\n                      }\n                    },\n                    [\n                      _c(\"i\", {\n                        staticClass: \"fa fa-shopping-cart\",\n                        attrs: { \"aria-hidden\": \"true\" }\n                      }),\n                      _vm._v(\n                        \"\\n                \" +\n                          _vm._s(\n                            _vm.$translate(\n                              \"Ceres::Template.singleItemAddToBasket\"\n                            )\n                          ) +\n                          \"\\n            \"\n                      )\n                    ]\n                  )\n                : !_vm.buttonLockState\n                ? _c(\n                    \"button\",\n                    {\n                      staticClass: \"btn btn-block btn-primary btn-appearance\",\n                      class: _vm.buttonClasses,\n                      style: _vm.paddingInlineStyles,\n                      attrs: { disabled: _vm.isLoading || !_vm.hasPrice },\n                      on: {\n                        click: function($event) {\n                          return _vm.addToBasket()\n                        }\n                      }\n                    },\n                    [\n                      _c(\"icon\", {\n                        attrs: { icon: \"shopping-cart\", loading: _vm.isLoading }\n                      }),\n                      _vm._v(\n                        \"\\n                \" +\n                          _vm._s(\n                            _vm.$translate(\n                              \"Ceres::Template.singleItemAddToBasket\"\n                            )\n                          ) +\n                          \"\\n            \"\n                      )\n                    ],\n                    1\n                  )\n                : _c(\n                    \"button\",\n                    {\n                      directives: [{ name: \"tooltip\", rawName: \"v-tooltip\" }],\n                      staticClass:\n                        \"btn btn-block btn-primary btn-appearance disabled\",\n                      class: _vm.buttonClasses,\n                      style: _vm.paddingInlineStyles,\n                      attrs: {\n                        \"data-toggle\": \"tooltip\",\n                        \"data-placement\": \"top\",\n                        title: _vm._f(\n                          \"translate\"\n                        )(\"Ceres::Template.singleItemQuantityMax\", {\n                          max: _vm.maximumQuantity\n                        })\n                      }\n                    },\n                    [\n                      _c(\"icon\", {\n                        attrs: { icon: \"shopping-cart\", waiting: _vm.isLoading }\n                      }),\n                      _vm._v(\n                        \"\\n                \" +\n                          _vm._s(\n                            _vm.$translate(\n                              \"Ceres::Template.singleItemAddToBasket\"\n                            )\n                          ) +\n                          \"\\n            \"\n                      )\n                    ],\n                    1\n                  )\n            ])\n          ]\n        )\n      : _vm._e(),\n    _vm._v(\" \"),\n    !_vm.showQuantity && !_vm.useLargeScale\n      ? _c(\n          \"div\",\n          { staticClass: \"d-inline\", class: { \"d-lg-none\": !_vm.isWishList } },\n          [\n            _c(\n              \"div\",\n              {\n                staticClass: \"btn-group\",\n                attrs: { role: \"group\", \"aria-label\": \"Thumb Control\" }\n              },\n              [\n                _vm.canBeAddedToBasket\n                  ? _c(\n                      \"button\",\n                      {\n                        staticClass:\n                          \"btn btn-primary btn-appearance mobile-width-button\",\n                        class: { \"no-pointer-events\": _vm.isLoading },\n                        attrs: { type: \"button\" },\n                        on: {\n                          click: function($event) {\n                            return _vm.addToBasket()\n                          }\n                        }\n                      },\n                      [\n                        _c(\"icon\", {\n                          staticClass: \"fa-lg mobile-icon-right\",\n                          attrs: {\n                            icon: \"shopping-cart\",\n                            loading: _vm.isLoading\n                          }\n                        }),\n                        _vm._v(\n                          \"\\n                \" +\n                            _vm._s(\n                              _vm.$translate(\n                                \"Ceres::Template.singleItemAddToBasket\"\n                              )\n                            ) +\n                            \"\\n            \"\n                        )\n                      ],\n                      1\n                    )\n                  : _vm._e(),\n                _vm._v(\" \"),\n                !_vm.canBeAddedToBasket\n                  ? _c(\n                      \"button\",\n                      {\n                        staticClass:\n                          \"btn btn-primary btn-appearance mobile-width-button\",\n                        attrs: { type: \"button\" },\n                        on: {\n                          click: function($event) {\n                            return _vm.directToItem()\n                          }\n                        }\n                      },\n                      [\n                        _c(\"i\", {\n                          staticClass:\n                            \"fa fa-arrow-right fa-lg d-none d-sm-block\",\n                          attrs: { \"aria-hidden\": \"true\" }\n                        }),\n                        _vm._v(\n                          \"\\n                \" +\n                            _vm._s(\n                              _vm.$translate(\"Ceres::Template.itemShowItem\")\n                            ) +\n                            \"\\n            \"\n                        )\n                      ]\n                    )\n                  : _vm._e()\n              ]\n            )\n          ]\n        )\n      : _vm._e()\n  ])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","<template>\n    <div>\n        <div :class=\"{'no-pointer-events': isLoading}\" class=\"add-to-basket-lg-container d-none d-lg-block\" v-if=\"!showQuantity && useLargeScale && canBeAddedToBasket\"\n             v-tooltip data-toggle=\"tooltip\" data-placement=\"top\" :title=\"$translate('Ceres::Template.singleItemAddToBasket')\" @click=\"addToBasket()\">\n            <icon icon=\"cart-plus\" class=\"fa-lg mobile-icon-right\" :loading=\"isLoading\"></icon>\n        </div>\n\n        <div class=\"add-to-basket-lg-container d-none d-lg-block\" v-if=\"!showQuantity && useLargeScale && !canBeAddedToBasket\"\n             v-tooltip data-toggle=\"tooltip\" data-placement=\"top\" :title=\"$translate('Ceres::Template.itemShowItem')\" @click=\"directToItem()\">\n            <i class=\"fa fa-arrow-right fa-lg d-none d-sm-block\"></i>\n        </div>\n\n        <div class=\"d-inline\" v-if=\"showQuantity && !useLargeScale\" :class=\"{'d-lg-none': !$ceres.isItemView }\">\n            <div class=\"add-to-basket-container\">\n                <div class=\"quantity-input-container\">\n                    <quantity-input :value=\"quantity\"\n                                    @quantity-change=\"updateQuantity\"\n                                    @out-of-stock=\"handleButtonState\"\n                                    :timeout=\"0\"\n                                    :min=\"minimumQuantity\"\n                                    :max=\"maximumQuantity\"\n                                    :interval=\"intervalQuantity\"\n                                    :variation-id=\"variationId\"\n                                    :waiting=\"isLoading || !isSalable || !allVariationsSelected\">\n                    </quantity-input>\n                </div>\n\n                <button\n                        v-if=\"!allVariationsSelected || !isSalable\"\n                        class=\"btn btn-block btn-primary btn-appearance disabled\"\n                        v-tooltip\n                        data-toggle=\"tooltip\"\n                        data-placement=\"top\"\n                        :title=\"tooltipText\"\n                        :class=\"buttonClasses\"\n                        :style=\"paddingInlineStyles\">\n                    <i class=\"fa fa-shopping-cart\" aria-hidden=\"true\"></i>\n                    {{ $translate(\"Ceres::Template.singleItemAddToBasket\") }}\n                </button>\n                <button\n                        v-else-if=\"!buttonLockState\"\n                        :disabled=\"isLoading || !hasPrice\"\n                        class=\"btn btn-block btn-primary btn-appearance\"\n                        @click=\"addToBasket()\"\n                        :class=\"buttonClasses\"\n                        :style=\"paddingInlineStyles\">\n                    <icon icon=\"shopping-cart\" :loading=\"isLoading\"></icon>\n                    {{ $translate(\"Ceres::Template.singleItemAddToBasket\") }}\n                </button>\n                <button v-else\n                        class=\"btn btn-block btn-primary btn-appearance disabled\"\n                        v-tooltip\n                        data-toggle=\"tooltip\"\n                        data-placement=\"top\"\n                        :title=\"'Ceres::Template.singleItemQuantityMax' | translate({ max: maximumQuantity })\"\n                        :class=\"buttonClasses\"\n                        :style=\"paddingInlineStyles\">\n                    <icon icon=\"shopping-cart\" :waiting=\"isLoading\"></icon>\n                    {{ $translate(\"Ceres::Template.singleItemAddToBasket\") }}\n                </button>\n            </div>\n        </div>\n\n        <div class=\"d-inline\" v-if=\"!showQuantity && !useLargeScale\" :class=\"{'d-lg-none': !isWishList }\">\n            <div class=\"btn-group\" role=\"group\" aria-label=\"Thumb Control\">\n                <button type=\"button\" :class=\"{'no-pointer-events': isLoading}\" v-if=\"canBeAddedToBasket\" class=\"btn btn-primary btn-appearance mobile-width-button\" @click=\"addToBasket()\">\n                    <icon icon=\"shopping-cart\" class=\"fa-lg mobile-icon-right\" :loading=\"isLoading\"></icon>\n                    {{ $translate(\"Ceres::Template.singleItemAddToBasket\") }}\n                </button>\n                <button type=\"button\" v-if=\"!canBeAddedToBasket\" class=\"btn btn-primary btn-appearance mobile-width-button\" @click=\"directToItem()\">\n                    <i class=\"fa fa-arrow-right fa-lg d-none d-sm-block\" aria-hidden=\"true\"></i>\n                    {{ $translate(\"Ceres::Template.itemShowItem\") }}\n                </button>\n            </div>\n        </div>\n    </div>\n</template>\n\n<script>\nimport ExceptionMap from \"../../exceptions/ExceptionMap\";\nimport { navigateTo } from \"../../services/UrlService\";\nimport { isNullOrUndefined, isDefined } from \"../../helper/utils\";\nimport { mapState } from \"vuex\";\nimport { ButtonSizePropertyMixin } from \"../../mixins/buttonSizeProperty.mixin\";\n\nconst NotificationService = require(\"../../services/NotificationService\");\n\nexport default {\n    mixins: [ButtonSizePropertyMixin],\n\n    props:\n    {\n        itemUrl: String,\n        showQuantity:\n        {\n            type: Boolean,\n            default: false\n        },\n        useLargeScale:\n        {\n            type: Boolean,\n            default: false\n        },\n        variationId:\n        {\n            type: Number\n        },\n        isSalable:\n        {\n            type: Boolean,\n            default: false\n        },\n        hasChildren:\n        {\n            type: Boolean,\n            default: false\n        },\n        intervalQuantity:\n        {\n            type: Number,\n            default: 1\n        },\n        minimumQuantity:\n        {\n            type: Number,\n            default: 0\n        },\n        maximumQuantity:\n        {\n            type: Number,\n            default: null\n        },\n        orderProperties:\n        {\n            type: Array,\n            default: () => []\n        },\n        hasOrderProperties:\n        {\n            type: Boolean,\n            default: false\n        },\n        hasPrice:\n        {\n            type: Boolean,\n            default: true\n        },\n        paddingClasses:\n        {\n            type: String,\n            default: null\n        },\n        paddingInlineStyles:\n        {\n            type: String,\n            default: null\n        },\n        isWishList:\n        {\n            type: Boolean,\n            default: false\n        },\n        propQuantity:\n        {\n            type: Number,\n            default: null\n        },\n        itemType:\n        {\n            type: String,\n            default: null\n        }\n    },\n\n    inject: {\n        itemId: {\n            default: null\n        }\n    },\n\n    computed:\n    {\n        isSet()\n        {\n            return (\n                this.$store.state.items[this.itemId]\n                && this.$store.state.items[this.itemId].variation\n                && this.$store.state.items[this.itemId].variation.documents[0].data.item.itemType === \"set\"\n            ) || this.itemType === \"set\";\n        },\n\n        canBeAddedToBasket()\n        {\n            return this.isSalable &&\n                !this.hasChildren &&\n                !(this.minimumQuantity != 1 || this.intervalQuantity != 1) &&\n                !this.requiresProperties &&\n                this.hasPrice &&\n                !this.isSet;\n        },\n\n        requiresProperties()\n        {\n            return App.config.item.requireOrderProperties &&\n                (this.hasOrderProperties || this.orderProperties.filter(property => property.property.isShownOnItemPage).length > 0);\n        },\n\n        buttonClasses()\n        {\n            const classes = [];\n\n            if (isDefined(this.buttonSizeClass))\n            {\n                classes.push(this.buttonSizeClass);\n            }\n\n            if (isDefined(this.paddingClasses))\n            {\n                classes.push(this.paddingClasses.split(\" \"));\n            }\n\n            return classes;\n        },\n\n        tooltipText()\n        {\n            if (this.hasAvailableVariations)\n            {\n                return this.$translate(\"Ceres::Template.singleItemPleaseSelectValidVariation\");\n            }\n            else\n            {\n                return this.$translate(\"Ceres::Template.singleItemPleaseSelectNotAvailable\");\n            }\n        },\n\n        variationOrderQuantity()\n        {\n            return this.$store.state.items[this.itemId] && this.$store.state.items[this.itemId].variationOrderQuantity;\n        },\n\n        variationMissingProperties()\n        {\n            return this.$store.getters[`${this.itemId}/variationMissingProperties`];\n        },\n\n        hasAvailableVariations()\n        {\n            return this.$store.state.items[this.itemId]\n                && this.$store.state.items[this.itemId].variationSelect\n                && this.$store.state.items[this.itemId].variationSelect.variations.some(variation => variation.isSalable);\n        },\n\n        allVariationsSelected()\n        {\n            if (this.isSet)\n            {\n                return this.$store.getters[\"itemSetAllVariationSelected\"];\n            }\n            else\n            {\n                // FIX return true if module is not registered. This equals the default value from the module\n                // and is required to use this component in other contexts, e.g. the category view\n                return !this.$store.state.items[this.itemId]\n                    || (this.$store.state.items[this.itemId].variationSelect\n                        && this.$store.state.items[this.itemId].variationSelect.isVariationSelected);\n            }\n        },\n\n        isLoading()\n        {\n            return this.$store.state.items.isAddToBasketLoading === this.variationId || this.$store.state.items.isSetLoading;\n        },\n\n        ...mapState({\n            basketItems: state => state.basket.items,\n            isBasketLoading: state => state.basket.isBasketLoading\n        })\n    },\n\n    data()\n    {\n        return {\n            quantity: 1,\n            buttonLockState: false\n        };\n    },\n\n    methods:\n    {\n        /**\n         * add an item to basket-resource\n         */\n        addToBasket()\n        {\n            this.$store.dispatch(\"loadComponent\", \"add-item-to-basket-overlay\");\n            this.$store.dispatch(\"loadComponent\", \"basket-preview\");\n\n            if (this.variationMissingProperties !== undefined && this.variationMissingProperties.length)\n            {\n                this.showMissingPropertiesError();\n            }\n            else if (this.isSalable || this.isSet)\n            {\n                this.$store.commit(\"setIsAddToBasketLoading\", this.variationId);\n\n                const orderParamsAndSurcharge = extractPropertiesAndSurcharge(this.orderProperties);\n\n                const basketObject =\n                    {\n                        variationId             :   this.variationId,\n                        quantity                :   this.quantity,\n                        basketItemOrderParams   :   orderParamsAndSurcharge.orderParams,\n                        totalOrderParamsMarkup  :   orderParamsAndSurcharge.totalSurcharge\n                    };\n\n                if(this.isSet)\n                {\n                    const setComponents = [];\n                    this.$store.state.items.setComponentIds.forEach(itemId =>\n                    {\n                        const setComponent = this.$store.getters[`${itemId}/currentItemVariation`];\n\n                        const variationId = setComponent && setComponent.variation.id;\n\n                        // Extract order properties and total surcharge for set components\n                        const setComponentOrderParamsAndSurcharge = extractPropertiesAndSurcharge(\n                            setComponent.properties.filter(prop => prop.property.isOderProperty)\n                        );\n\n                        setComponents.push({\n                            variationId: variationId,\n                            quantity: this.$store.state.items[itemId].variationOrderQuantity,\n                            basketItemOrderParams: setComponentOrderParamsAndSurcharge.orderParams,\n                            totalOrderParamsMarkup: setComponentOrderParamsAndSurcharge.totalSurcharge\n                        });\n                    });\n                    basketObject.setComponents = setComponents;\n                }\n\n                this.$store.dispatch(\"addBasketItem\", basketObject).then(\n                    response =>\n                    {\n                        document.dispatchEvent(new CustomEvent(\"afterBasketItemAdded\", { detail: basketObject }));\n                        this.$store.commit(\"setIsAddToBasketLoading\", 0);\n                    },\n                    error =>\n                    {\n                        this.$store.commit(\"setIsAddToBasketLoading\", 0);\n\n                        if (error.data)\n                        {\n                            NotificationService.error(\n                                this.$translate(\n                                    \"Ceres::Template.\" + ExceptionMap.get(error.data.exceptionCode.toString()),\n                                    error.data.placeholder\n                                )\n                            ).closeAfter(5000);\n                        }\n                    });\n            }\n        },\n        showMissingPropertiesError()\n        {\n            this.$store.commit(`${this.itemId}/setVariationMarkInvalidProps`, true);\n\n            const propertyNames = this.variationMissingProperties.map(property => property.property.names.name);\n            let errorMsgContent = \"\";\n\n            for (const name of propertyNames)\n            {\n                errorMsgContent += name + \"<br>\";\n            }\n\n            NotificationService.error(this.$translate(\"Ceres::Template.singleItemMissingOrderPropertiesError\").replace(\"<properties>\", errorMsgContent));\n        },\n\n        directToItem()\n        {\n            navigateTo(this.itemUrl);\n        },\n\n        handleButtonState(value)\n        {\n            this.buttonLockState = value;\n        },\n\n        /**\n         * update the property quantity of the current instance\n         * @param value\n         */\n        updateQuantity(value)\n        {\n            this.quantity = value;\n        }\n    },\n\n    watch:\n    {\n        quantity(value)\n        {\n            if(!isNullOrUndefined(this.itemId))\n            {\n                this.$store.commit(`${this.itemId}/setVariationOrderQuantity`, value);\n                this.$store.commit(`${this.itemId}/setVariationPropertySurcharges`, this.$store.getters[`${this.itemId}/variationBasePrice`]);\n            }\n        },\n\n        variationOrderQuantity(value)\n        {\n            if (this.quantity !== value)\n            {\n                this.quantity = value;\n            }\n        },\n\n        propQuantity(value)\n        {\n            if (!isNaN(value))\n            {\n                this.quantity = value;\n            }\n        }\n    }\n}\n\nfunction extractPropertiesAndSurcharge(orderProperties)\n{\n    let totalSurcharge = 0;\n    const orderParams = [];\n\n    orderProperties.forEach((orderProperty) =>\n    {\n        if(!isNullOrUndefined(orderProperty.property.value))\n        {\n            const property = orderProperty.property;\n\n            if (property.valueType === \"float\" &&\n                !isNullOrUndefined(property.value) &&\n                property.value.slice(-1) === App.decimalSeparator)\n            {\n                property.value = property.value.substr(0, property.value.length - 1);\n            }\n\n            totalSurcharge += (orderProperty.surcharge || 0) + (property.surcharge || 0);\n\n            orderParams.push({\n                propertyId: property.id,\n                type: property.valueType,\n                name: property.names.name,\n                value: property.value\n            });\n        }\n    });\n\n    return {\n        orderParams: orderParams,\n        totalSurcharge: totalSurcharge\n    };\n}\n</script>\n","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddToBasket.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddToBasket.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./AddToBasket.vue?vue&type=template&id=729fe3ab&\"\nimport script from \"./AddToBasket.vue?vue&type=script&lang=js&\"\nexport * from \"./AddToBasket.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/home/jenkins/workspace/Ceres_Build_Stable/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('729fe3ab')) {\n      api.createRecord('729fe3ab', component.options)\n    } else {\n      api.reload('729fe3ab', component.options)\n    }\n    module.hot.accept(\"./AddToBasket.vue?vue&type=template&id=729fe3ab&\", function () {\n      api.rerender('729fe3ab', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"resources/js/src/app/components/basket/AddToBasket.vue\"\nexport default component.exports"],"sourceRoot":""}