{"version":3,"sources":["webpack:///./resources/js/src/app/components/item/GraduatedPrices.vue","webpack:///resources/js/src/app/components/item/GraduatedPrices.vue","webpack:///./resources/js/src/app/components/item/GraduatedPrices.vue?bbdc","webpack:///./resources/js/src/app/components/item/GraduatedPrices.vue?aa7f"],"names":["render","_vm","this","_c","_self","graduatedPrices","_v","_s","$translate","staticClass","_l","price","index","class","paddingClasses","style","paddingInlineStyles","minimumOrderQuantity","unitPrice","formatted","attrs","name","activeGraduationIndex","_e","showBasePrice","basePrice","_withStripped","props","type","String","inject","itemId","default","computed","currentVariation","$store","getters","concat","prices","minQuantity","variation","_toConsumableArray","filter","sort","priceA","priceB","mayShowUnitPrice","isSinglePiece","unit","content","unitOfMeasurement","_this","variationOrderQuantity","length","reduce","prev","current","indexOf","state","items","component"],"mappings":"kGAAA,IAAIA,EAAS,WACX,IAAIC,EAAMC,KACRC,EAAKF,EAAIG,MAAMD,GACjB,OAAOF,EAAII,gBAAgB,GACvBF,EAAG,MAAO,CACRA,EAAG,IAAK,CACNF,EAAIK,GACFL,EAAIM,GACFN,EAAIO,WAAW,8CACb,OAGRP,EAAIK,GAAG,KACPH,EAAG,QAAS,CAAEM,YAAa,qCAAuC,CAChEN,EACE,QACA,CACEF,EAAIS,GAAGT,EAAII,iBAAiB,SAAUM,EAAOC,GAC3C,MAAO,CACLT,EAAG,KAAM,CACPA,EACE,KACA,CACEU,MAAOZ,EAAIa,eACXC,MAAOd,EAAIe,qBAEb,CACEf,EAAIK,GACFL,EAAIM,GACFN,EAAIO,WACF,8CAGF,IACAP,EAAIM,GAAGI,EAAMM,yBAIrBhB,EAAIK,GAAG,KACPH,EACE,KACA,CACEM,YAAa,kBACbI,MAAOZ,EAAIa,eACXC,MAAOd,EAAIe,qBAEb,CACEf,EAAIK,GACF,6BACEL,EAAIM,GAAGI,EAAMO,UAAUC,WACvB,8BAEJhB,EAAG,aAAc,CAAEiB,MAAO,CAAEC,KAAM,SAAY,CAC5CT,IAAUX,EAAIqB,sBAC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C,EAAAb,EAAAc,MAAA,IAAAd,EAAAc,KAAAC,SAAA,QAAAf,EAAAc,KAAAE,kBAEA,OAAAJ,IAAAC,GAGAzB,sBAAA,WACA,IAAA6B,EAAA,KACAb,EAAA,KAAAjC,gBAAAqC,QAAA,SAAA/B,GAAA,OAAAwC,EAAAC,wBAAAzC,EAAAM,wBAEA,IAAAqB,EAAAe,OAEA,SAGA,IAAA1C,EAAA2B,EAAAgB,QAAA,SAAAC,EAAAC,GAAA,OAAAD,EAAAtC,qBAAAuC,EAAAvC,qBAAAsC,EAAAC,KAEA,YAAAnD,gBAAAoD,QAAA9C,IAGAyC,uBAAA,WAEA,YAAAjB,OAAAuB,MAAAC,MAAA,KAAA5B,SAAA,KAAAI,OAAAuB,MAAAC,MAAA,KAAA5B,QAAAqB,0B,OElFIQ,EAAY,YACd,EACA5D,EHwHoB,IGtHpB,EACA,KACA,KACA,MAIa,UAAA4D,E","file":"chunks/ceres-32.min.js","sourcesContent":["var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _vm.graduatedPrices[0]\n    ? _c(\"div\", [\n        _c(\"b\", [\n          _vm._v(\n            _vm._s(\n              _vm.$translate(\"Ceres::Template.singleItemGraduatedPrices\")\n            ) + \":\"\n          ),\n        ]),\n        _vm._v(\" \"),\n        _c(\"table\", { staticClass: \"graduated-prices-table text-muted\" }, [\n          _c(\n            \"tbody\",\n            [\n              _vm._l(_vm.graduatedPrices, function (price, index) {\n                return [\n                  _c(\"tr\", [\n                    _c(\n                      \"td\",\n                      {\n                        class: _vm.paddingClasses,\n                        style: _vm.paddingInlineStyles,\n                      },\n                      [\n                        _vm._v(\n                          _vm._s(\n                            _vm.$translate(\n                              \"Ceres::Template.singleItemMinimumQuantity\"\n                            )\n                          ) +\n                            \" \" +\n                            _vm._s(price.minimumOrderQuantity)\n                        ),\n                      ]\n                    ),\n                    _vm._v(\" \"),\n                    _c(\n                      \"td\",\n                      {\n                        staticClass: \"graduated-price\",\n                        class: _vm.paddingClasses,\n                        style: _vm.paddingInlineStyles,\n                      },\n                      [\n                        _vm._v(\n                          \"\\n                        \" +\n                            _vm._s(price.unitPrice.formatted) +\n                            \"\\n                        \"\n                        ),\n                        _c(\"transition\", { attrs: { name: \"fade\" } }, [\n                          index === _vm.activeGraduationIndex\n                            ? _c(\"i\", {\n                                staticClass:\n                                  \"fa fa-lg fa-check-circle-o text-appearance\",\n                                attrs: { \"aria-hidden\": \"true\" },\n                              })\n                            : _vm._e(),\n                        ]),\n                      ],\n                      1\n                    ),\n                    _vm._v(\" \"),\n                    _vm.showBasePrice\n                      ? _c(\n                          \"td\",\n                          {\n                            staticClass:\n                              \"graduated-base-price pl-3 d-none d-xl-block\",\n                            class: _vm.paddingClasses,\n                            style: _vm.paddingInlineStyles,\n                          },\n                          [\n                            _vm._v(\n                              _vm._s(\n                                _vm.$translate(\n                                  \"Ceres::Template.singleItemGraduatedBasePrice\",\n                                  { price: price.basePrice }\n                                )\n                              )\n                            ),\n                          ]\n                        )\n                      : _vm._e(),\n                  ]),\n                  _vm._v(\" \"),\n                  _vm.showBasePrice\n                    ? _c(\n                        \"tr\",\n                        { staticClass: \"graduated-base-price d-xl-none\" },\n                        [\n                          _c(\"td\", {\n                            class: _vm.paddingClasses,\n                            style: _vm.paddingInlineStyles,\n                          }),\n                          _vm._v(\" \"),\n                          _c(\n                            \"td\",\n                            {\n                              class: _vm.paddingClasses,\n                              style: _vm.paddingInlineStyles,\n                            },\n                            [\n                              _vm._v(\n                                _vm._s(\n                                  _vm.$translate(\n                                    \"Ceres::Template.singleItemGraduatedBasePrice\",\n                                    { price: price.basePrice }\n                                  )\n                                )\n                              ),\n                            ]\n                          ),\n                        ]\n                      )\n                    : _vm._e(),\n                ]\n              }),\n            ],\n            2\n          ),\n        ]),\n        _vm._v(\" \"),\n        _c(\"br\"),\n      ])\n    : _vm._e()\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","<template>\n    <div v-if=\"graduatedPrices[0]\">\n        <b>{{ $translate(\"Ceres::Template.singleItemGraduatedPrices\") }}:</b>\n        <table class=\"graduated-prices-table text-muted\">\n            <tbody>\n                <template v-for=\"(price, index) in graduatedPrices\">\n                    <tr>\n                        <td :class=\"paddingClasses\" :style=\"paddingInlineStyles\">{{ $translate(\"Ceres::Template.singleItemMinimumQuantity\") }} {{ price.minimumOrderQuantity }}</td>\n                        <td :class=\"paddingClasses\" :style=\"paddingInlineStyles\" class=\"graduated-price\">\n                            {{ price.unitPrice.formatted }}\n                            <transition name=\"fade\">\n                                <i class=\"fa fa-lg fa-check-circle-o text-appearance\" v-if=\"index === activeGraduationIndex\" aria-hidden=\"true\"></i>\n                            </transition>\n                        </td>\n                        <td v-if=\"showBasePrice\" :class=\"paddingClasses\" :style=\"paddingInlineStyles\" class=\"graduated-base-price pl-3 d-none d-xl-block\">{{ $translate(\"Ceres::Template.singleItemGraduatedBasePrice\", { \"price\": price.basePrice }) }}</td>\n                    </tr>\n                    <tr v-if=\"showBasePrice\" class=\"graduated-base-price d-xl-none\">\n                        <td :class=\"paddingClasses\" :style=\"paddingInlineStyles\"></td>\n                        <td :class=\"paddingClasses\" :style=\"paddingInlineStyles\">{{ $translate(\"Ceres::Template.singleItemGraduatedBasePrice\", { \"price\": price.basePrice }) }}</td>\n                    </tr>\n                </template>\n            </tbody>\n        </table>\n        <br>\n    </div>\n</template>\n\n<script>\nexport default {\n\n    name: \"graduated-prices\",\n\n    props: {\n        paddingClasses: {\n            type: String\n        },\n        paddingInlineStyles: {\n            type: String\n        }\n    },\n\n    inject: {\n        itemId: {\n            default: null\n        }\n    },\n\n    computed:\n    {\n        graduatedPrices()\n        {\n            const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n\n            let prices = currentVariation && currentVariation.prices.graduatedPrices;\n            const minQuantity = currentVariation && currentVariation.variation.minimumOrderQuantity;\n\n            prices = prices.filter(price => price.minimumOrderQuantity > minQuantity);\n\n            return [...prices].sort((priceA, priceB) =>\n            {\n                return priceA.minimumOrderQuantity - priceB.minimumOrderQuantity;\n            });\n        },\n\n       showBasePrice()\n       {\n            const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n            const mayShowUnitPrice = currentVariation.variation.mayShowUnitPrice;\n            const isSinglePiece = currentVariation.unit && currentVariation.unit.content === 1 && currentVariation.unit.unitOfMeasurement === \"C62\";\n\n            return mayShowUnitPrice && !isSinglePiece;\n       },\n\n        activeGraduationIndex()\n        {\n            const prices = this.graduatedPrices.filter(price => this.variationOrderQuantity >= price.minimumOrderQuantity);\n\n            if (!prices.length)\n            {\n                return -1;\n            }\n\n            const price = prices.reduce((prev, current) => (prev.minimumOrderQuantity > current.minimumOrderQuantity) ? prev : current);\n\n            return this.graduatedPrices.indexOf(price);\n        },\n\n        variationOrderQuantity()\n        {\n            return this.$store.state.items[this.itemId] && this.$store.state.items[this.itemId].variationOrderQuantity\n        }\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!./GraduatedPrices.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!./GraduatedPrices.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./GraduatedPrices.vue?vue&type=template&id=79b1c082\"\nimport script from \"./GraduatedPrices.vue?vue&type=script&lang=js\"\nexport * from \"./GraduatedPrices.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\nexport default component.exports"],"sourceRoot":""}