{"version":3,"sources":["webpack:///./resources/js/src/app/components/item/QuantityInput.vue?b65e","webpack:///./resources/js/src/app/components/item/QuantityInput.vue","webpack:///./resources/js/src/app/components/item/QuantityInput.vue?f4be","webpack:///./resources/js/src/app/components/item/QuantityInput.vue?8dc2"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","ref","class","disabled","waiting","domProps","value","displayValue","on","change","$event","setValue","target","_l","amountOptions","amount","min","max","key","_v","_s","_e","_withStripped","name","props","type","Number","required","timeout","default","interval","Boolean","variationId","useAppearance","inject","itemId","data","compValue","compMin","compMax","compInterval","compDecimals","onValueChanged","created","defaultValue","minDecimals","floatLength","intervalDecimals","Math","debounce","$emit","isNullOrUndefined","fetchQuantityFromBasket","computed","variationBasketQuantity","itemSetVariationId","totalQuantity","$store","state","basket","items","forEach","basketItem","setComponents","setComponent","quantity","basketObject","find","variations","isMinimum","isDefined","isMaximum","minimumHint","$translate","$options","filters","numberFormat","maximumHint","Max","itemSetId","getters","variation","id","currentVariation","mapState","basketItems","watch","newValue","handler","oldValue","deep","newInterval","methods","increaseValue","formatFloat","decreaseValue","diff","replace","App","decimalSeparator","parseFloat","isNaN","limit","$refs","quantityInputField","component","options","__file"],"mappings":"kGAAA,IAAIA,EAAS,WACX,IAAIC,EAAMC,KACNC,EAAKF,EAAIG,eACTC,EAAKJ,EAAIK,MAAMD,IAAMF,EACzB,OAAOE,EAAG,MAAO,CAAEE,YAAa,8BAAgC,CAC9DF,EACE,SACA,CACEG,IAAK,qBACLD,YAAa,yBACbE,MAAO,CAAEC,SAAUT,EAAIU,SACvBC,SAAU,CAAEC,MAAOZ,EAAIa,cACvBC,GAAI,CACFC,OAAQ,SAASC,GACf,OAAOhB,EAAIiB,SAASD,EAAOE,OAAON,UAIxCZ,EAAImB,GAAGnB,EAAIoB,eAAe,SAASC,GACjC,OAAOA,GAAUrB,EAAIsB,OAAStB,EAAIuB,KAAOF,GAAUrB,EAAIuB,KACnDnB,EAAG,SAAU,CAAEoB,IAA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AKqB,KAAOrB,KAAK6C,aAAc7C,KAAK8C,cAAc,GAIvEqD,YAAYxF,EAAQX,KAAK6C,aAAc7C,KAAK8C,cAAc,IAG1D,GAAKuD,IAASrG,KAAK6C,eAEtBwD,EAAOrG,KAAK6C,aAAe,EAE3BlC,GAAS0F,EAIT1F,GAASX,KAAK6C,aAAewD,EAEjC1F,EAAQgG,YAAMhG,EAAOX,KAAK2C,QAAS3C,KAAK4C,WAI5CjC,EAAQwF,YAAYxF,EAAOX,KAAK8C,iBAElB9C,KAAK0C,WAEf1C,KAAK0C,UAAY/B,EACjBX,KAAK+C,kBAECS,YAAkBxD,KAAK4G,MAAMC,sBAEnC7G,KAAK4G,MAAMC,mBAAmBlG,MAAQX,KAAKY,eAInD6C,wBA5EJ,YA8EaD,YAAkBxD,KAAKqB,MAAQrB,KAAK2D,yBAA2B3D,KAAKqB,KAAwC,IAAjCrB,KAAK2D,wBAGjF3D,KAAK2C,QAAU3C,KAAK6C,aAEkB,IAAjC7C,KAAK2D,0BAGV3D,KAAK2C,QAAU3C,KAAKqB,KAGnBmC,YAAkBxD,KAAKsB,KAkBxBtB,KAAKuD,MAAM,gBAAgB,IAf3BvD,KAAK4C,QAAU5C,KAAKsB,IAAMtB,KAAK2D,wBAE3B3D,KAAK2D,wBAA0B3D,KAAK6C,aAAe7C,KAAKsB,KAExDtB,KAAK2C,QAAU,EACf3C,KAAK4C,QAAU,EACf5C,KAAKuD,MAAM,gBAAgB,IAI3BvD,KAAKuD,MAAM,gBAAgB,IAQnCvD,KAAKgB,SAAShB,KAAK2C,Y,QErV3BmE,EAAY,YACd,EACAhH,EHoBoB,IGlBpB,EACA,KACA,KACA,MAuBFgH,EAAUC,QAAQC,OAAS,yDACZ,UAAAF,E","file":"chunks/ceres-client-46.min.js","sourcesContent":["var render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\"div\", { staticClass: \"qty-box d-flex h-100 w-100\" }, [\n _c(\n \"select\",\n {\n ref: \"quantityInputField\",\n staticClass: \"qty-select text-center\",\n class: { disabled: _vm.waiting },\n domProps: { value: _vm.displayValue },\n on: {\n change: function($event) {\n return _vm.setValue($event.target.value)\n }\n }\n },\n _vm._l(_vm.amountOptions, function(amount) {\n return amount >= _vm.min && (!_vm.max || amount <= _vm.max)\n ? _c(\"option\", { key: amount, domProps: { value: amount } }, [\n _vm._v(_vm._s(amount))\n ])\n : _vm._e()\n }),\n 0\n )\n ])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { floatLength, formatFloat, limit } from \"ceres/app/helper/number\";\nimport { defaultValue, isDefined, isNullOrUndefined } from \"ceres/app/helper/utils\";\nimport { debounce } from \"ceres/app/helper/debounce\";\nimport { mapState } from \"vuex\";\n\nexport default {\n name: \"quantity-input\",\n\n props: {\n value: {\n type: Number,\n required: true\n },\n timeout: {\n type: Number,\n required: false,\n default: 500\n },\n min: {\n type: Number,\n required: false,\n default: 0\n },\n max: {\n type: Number,\n required: false\n },\n interval: {\n type: Number,\n required: false,\n default: 1\n },\n waiting: {\n type: Boolean,\n required: false\n },\n variationId: {\n type: Number,\n required: false\n },\n useAppearance: Boolean\n },\n\n inject: {\n itemId: {\n default: null\n }\n },\n\n data()\n {\n return {\n compValue: this.value,\n compMin: this.min,\n compMax: this.max,\n compInterval: this.interval,\n compDecimals: 0,\n onValueChanged: null,\n amountOptions: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]\n };\n },\n\n created()\n {\n this.compInterval = defaultValue(this.compInterval, 1);\n this.compInterval = this.compInterval === 0 ? 1 : this.compInterval;\n\n const minDecimals = floatLength(this.min);\n const intervalDecimals = floatLength(this.compInterval);\n\n this.compDecimals = Math.max(minDecimals, intervalDecimals);\n\n this.onValueChanged = debounce(() =>\n {\n this.$emit(\"quantity-change\", this.compValue);\n }, defaultValue(this.timeout, 500));\n\n if (!isNullOrUndefined(this.variationId))\n {\n this.fetchQuantityFromBasket();\n }\n },\n\n computed:\n {\n variationBasketQuantity()\n {\n if (isNullOrUndefined(this.variationId))\n {\n return 0;\n }\n\n if (this.itemSetVariationId > 0 && this.variationId !== this.itemSetVariationId)\n {\n let totalQuantity = 0;\n\n this.$store.state.basket.items.forEach((basketItem) =>\n {\n if (basketItem.variationId === this.itemSetVariationId)\n {\n basketItem.setComponents.forEach((setComponent) =>\n {\n if (setComponent.variationId === this.variationId)\n {\n totalQuantity += setComponent.quantity;\n }\n });\n }\n });\n\n return totalQuantity;\n }\n else\n {\n const basketObject = this.$store.state.basket.items.find(variations => variations.variationId === this.variationId);\n\n return basketObject ? basketObject.quantity : 0;\n }\n\n return 0;\n },\n\n isMinimum()\n {\n return isDefined(this.compMin) && (this.compValue - this.compInterval) < this.compMin;\n },\n\n isMaximum()\n {\n return isDefined(this.compMax) && (this.compValue + this.compInterval) > this.compMax;\n },\n\n minimumHint()\n {\n return this.$translate(\n \"Ceres::Template.singleItemQuantityMin\",\n {\n min: this.$options.filters.numberFormat(this.compMin)\n }\n );\n },\n\n maximumHint()\n {\n return this.$translate(\n \"Ceres::Template.singleItemQuantityMax\",\n {\n max: this.$options.filters.numberFormat(this.Max)\n }\n );\n },\n\n displayValue()\n {\n return this.$options.filters.numberFormat(this.compValue);\n },\n\n itemSetVariationId()\n {\n if (this.$store.state.items.itemSetId > 0)\n {\n return this.$store.getters[`${this.$store.state.items.itemSetId}/currentItemVariation`].variation.id;\n }\n\n return 0;\n },\n\n currentVariation() {\n return this.$store.getters[`${this.itemId}/currentItemVariation`]\n },\n\n ...mapState({\n basketItems: state => state.basket.items\n })\n },\n\n watch:\n {\n variationId(newValue)\n {\n if (isDefined(newValue))\n {\n this.fetchQuantityFromBasket();\n }\n },\n\n basketItems:\n {\n handler(newValue, oldValue)\n {\n if (isDefined(this.variationId))\n {\n this.fetchQuantityFromBasket();\n }\n },\n deep: true\n },\n\n min(newValue)\n {\n this.compMin = newValue;\n this.fetchQuantityFromBasket();\n },\n\n max(newValue)\n {\n this.compMax = newValue;\n this.fetchQuantityFromBasket();\n },\n\n value(newValue, oldValue)\n {\n if (newValue !== oldValue)\n {\n this.setValue(newValue);\n }\n },\n\n interval(newInterval)\n {\n this.compInterval = defaultValue(newInterval, 1)\n }\n },\n\n methods:\n {\n increaseValue()\n {\n const newValue = formatFloat(this.compValue + this.compInterval, this.compDecimals);\n\n if ((isNullOrUndefined(this.compMax) || newValue <= this.compMax) && !this.waiting)\n {\n this.setValue(newValue);\n }\n },\n\n decreaseValue()\n {\n const newValue = formatFloat(this.compValue - this.compInterval, this.compDecimals);\n\n if ((isNullOrUndefined(this.compMin) || newValue >= this.compMin) && !this.waiting)\n {\n this.setValue(newValue);\n }\n },\n\n setValue(value)\n {\n // consider the configured decimal seperator (if the input is typed in the input field)\n if (typeof value === \"string\")\n {\n value = value.replace(App.decimalSeparator || \",\", \".\");\n }\n\n value = parseFloat(value);\n if (isNaN(value))\n {\n value = defaultValue(this.compMin, 1);\n }\n\n // limit new value to min/ max value\n value = limit(value, this.compMin, this.compMax);\n\n // make sure, new value is an even multiple of interval\n let diff;\n if (this.variationBasketQuantity === 0 && this.min !== 0)\n {\n diff = formatFloat((value - this.min) % this.compInterval, this.compDecimals, true);\n }\n else\n {\n diff = formatFloat(value % this.compInterval, this.compDecimals, true);\n }\n\n if (diff > 0 && diff !== this.compInterval)\n {\n if (diff < this.compInterval / 2)\n {\n value -= diff;\n }\n else\n {\n value += this.compInterval - diff;\n }\n value = limit(value, this.compMin, this.compMax);\n }\n\n // cut fraction\n value = formatFloat(value, this.compDecimals);\n\n if (value !== this.compValue)\n {\n this.compValue = value;\n this.onValueChanged();\n }\n else if (!isNullOrUndefined(this.$refs.quantityInputField))\n {\n this.$refs.quantityInputField.value = this.displayValue;\n }\n },\n\n fetchQuantityFromBasket()\n {\n if (!isNullOrUndefined(this.min) && this.variationBasketQuantity >= this.min && this.variationBasketQuantity !== 0)\n {\n // set the minimum value to the interval, if the item is already in the basket\n this.compMin = this.compInterval;\n }\n else if (this.variationBasketQuantity === 0)\n {\n // reset the minimum, when item is not in the basket\n this.compMin = this.min;\n }\n\n if (!isNullOrUndefined(this.max))\n {\n // decrease maximum quantity by quantity of variations already in basket\n this.compMax = this.max - this.variationBasketQuantity;\n\n if (this.variationBasketQuantity + this.compInterval > this.max)\n {\n this.compMin = 0;\n this.compMax = 0;\n this.$emit(\"out-of-stock\", true);\n }\n else\n {\n this.$emit(\"out-of-stock\", false);\n }\n }\n else\n {\n this.$emit(\"out-of-stock\", false);\n }\n\n this.setValue(this.compMin);\n }\n }\n}\n","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./QuantityInput.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!./QuantityInput.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./QuantityInput.vue?vue&type=template&id=62163595&\"\nimport script from \"./QuantityInput.vue?vue&type=script&lang=js&\"\nexport * from \"./QuantityInput.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(\"/Users/fhartwig/Sites/pp-heySilvity/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('62163595')) {\n api.createRecord('62163595', component.options)\n } else {\n api.reload('62163595', component.options)\n }\n module.hot.accept(\"./QuantityInput.vue?vue&type=template&id=62163595&\", function () {\n api.rerender('62163595', {\n render: render,\n staticRenderFns: staticRenderFns\n })\n })\n }\n}\ncomponent.options.__file = \"resources/js/src/app/components/item/QuantityInput.vue\"\nexport default component.exports"],"sourceRoot":""}