{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es.object.values.js","webpack:///./node_modules/core-js/internals/object-to-array.js","webpack:///./node_modules/core-js/modules/es.object.entries.js","webpack:///./resources/js/src/app/components/item/VariationSelect.vue","webpack:///resources/js/src/app/components/item/VariationSelect.vue","webpack:///./resources/js/src/app/components/item/VariationSelect.vue?19cf","webpack:///./resources/js/src/app/components/item/VariationSelect.vue?2512"],"names":["$","$values","values","target","stat","O","DESCRIPTORS","fails","uncurryThis","objectGetPrototypeOf","objectKeys","toIndexedObject","propertyIsEnumerable","f","push","IE_BUG","Object","create","createMethod","TO_ENTRIES","it","key","keys","IE_WORKAROUND","length","i","result","module","exports","entries","$entries","render","_vm","this","_c","_self","staticClass","attributes","possibleUnitCombinationIds","isContentVisible","_l","attribute","index","type","ref","refInFor","attrs","id","name","on","change","$event","selectAttribute","attributeId","value","addPleaseSelectOption","hasSelection","domProps","_v","_s","$translate","_e","hasEmptyOption","selectedAttributes","selected","attributeValueId","isAttributeSelectionValid","directives","rawName","isTextCut","expression","for","title","getSelectedAttributeValueName","class","images","active","invalid","click","getTooltip","src","imageUrl","alt","selectUnit","unitCombinationId","parseInt","selectedUnit","isUnitSelectionValid","possibleUnits","_t","_withStripped","NotificationService","require","props","forceContent","Boolean","default","inject","itemId","data","filteredVariationsCache","lastContentCount","mounted","$store","commit","concat","currentSelection","computed","currentVariation","getters","currentVariationSelect","state","items","variationSelect","variations","some","variation","App","config","item","showPleaseSelect","filteredVariations","filterVariations","_step","_iterator","_createForOfIteratorHelper","s","n","done","unitName","err","e","transformPossibleUnits","map","isNullOrUndefined","methods","onSelectionChange","unitId","setVariation","variationId","unsetInvalidSelection","qualifiedVariations","getQualifiedVariations","closestVariations","getClosestVariations","closestVariation","invalidSelection","getInvalidSelectionByVariation","correctSelection","attributeValue","getInvalidOptionTooltip","invalidSelections","attributesToReset","_step2","names","_iterator2","newUnit","join","isDefined","filter","find","closestSalableVariation","numberOfSalableChanges","closestNonSalableVariation","numberOfNonSalableChanges","_step3","_iterator3","changes","isNull","_step4","_iterator4","isSalable","_this","_loop","selectedAttributeId","variationAttribute","attributeToReset","attr","_step5","messages","JSON","parse","stringify","_iterator5","warn","closeAfter","strict","ignoreUnit","_this2","uniqueValues","_toConsumableArray","Set","isEmptyOptionSelected","_ret","_loop2","v","filterSalableVariations","_this3","dispatch","then","document","dispatchEvent","CustomEvent","detail","documents","content","$refs","attributesContaner","textWidth","clientWidth","selectedAttributeValueId","selectedAttributeValue","attrValue","_this4","sort","unitA","unitB","splitUnitName","unitNameSplit","split","isNaN","replace","currencyPattern","separator_thousands","watch","component"],"mappings":"0FACA,IAAIA,EAAI,EAAQ,IACZC,EAAU,EAAQ,KAAgCC,OAItDF,EAAE,CAAEG,OAAQ,SAAUC,MAAM,GAAQ,CAClCF,OAAQ,SAAgBG,GACtB,OAAOJ,EAAQI,O,iCCPnB,IAAIC,EAAc,EAAQ,IACtBC,EAAQ,EAAQ,GAChBC,EAAc,EAAQ,IACtBC,EAAuB,EAAQ,KAC/BC,EAAa,EAAQ,KACrBC,EAAkB,EAAQ,IAG1BC,EAAuBJ,EAFC,EAAQ,KAA8CK,GAG9EC,EAAON,EAAY,GAAGM,MAItBC,EAAST,GAAeC,GAAM,WAEhC,IAAIF,EAAIW,OAAOC,OAAO,MAEtB,OADAZ,EAAE,GAAK,GACCO,EAAqBP,EAAG,MAI9Ba,EAAe,SAAUC,GAC3B,OAAO,SAAUC,GAQf,IAPA,IAMIC,EANAhB,EAAIM,EAAgBS,GACpBE,EAAOZ,EAAWL,GAClBkB,EAAgBR,GAAsC,OAA5BN,EAAqBJ,GAC/CmB,EAASF,EAAKE,OACdC,EAAI,EACJC,EAAS,GAENF,EAASC,GACdJ,EAAMC,EAAKG,KACNnB,KAAgBiB,EAAgBF,KAAOhB,EAAIO,EAAqBP,EAAGgB,KACtEP,EAAKY,EAAQP,EAAa,CAACE,EAAKhB,EAAEgB,IAAQhB,EAAEgB,IAGhD,OAAOK,IAIXC,EAAOC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+E,EAAA/E,WACAuK,UAAAxF,EAAAwF,UACA1G,OAAAmG,EAAAnG,eAOA7B,UAAA,SAAAwI,GAEA,aAAAC,MAAAC,oBAEAC,YAAAH,EAAA,kDAAAC,MAAAC,mBAAA,GAAAE,aAMAxI,8BAAA,SAAAhC,GAEA,IAAAyK,EAAA,KAAAnJ,mBAAAtB,EAAAY,aACA8J,EAAA1K,EAAAvC,OAAA8J,MAAA,SAAAoD,GAAA,OAAAA,EAAAnJ,mBAAAiJ,KAEA,OAAAC,EAEAA,EAAAnK,KAEAqE,IAAAC,OAAAC,KAAAC,mBAAA,IAAA0F,EAEA,KAAAtJ,WAAA,0CAEA,KAAAA,WAAA,0CAGAwE,uBAAA,SAAA5C,GACA,IAAA6H,EAAA,KACA,OAAArM,OAAAa,QAAA2D,GAAA8H,MAAA,SAAAC,EAAAC,GAIA,OAHAD,EAAAF,EAAAI,cAAAF,EAAA,IACAC,EAAAH,EAAAI,cAAAD,EAAA,IAEAD,EAAA,GAAAC,EAAA,IACA,EAEAD,EAAA,GAAAC,EAAA,GACA,EAGAD,EAAA,GAAAC,EAAA,IACA,EAEAD,EAAA,GAAAC,EAAA,GACA,EAEA,MAGAC,cAAA,SAAAxF,GACA,IAAAyF,EAAAzF,EAAA0F,MAAA,KAOA,OALAC,MAAAF,EAAA,MACAA,EAAA,GAAAA,EAAA,GAAAG,QAAAxG,IAAAyG,gBAAAC,oBAAA,IACAL,EAAA,GAAArI,SAAAqI,EAAA,KAGAA,IAIAM,MACA,CACAtH,iBAAA,SAAApD,GAEA,KAAAiD,OAAAC,OAAA,GAAAC,OAAA,KAAAP,OAAA,6CAAA5C,IAEA4D,WAAA,WAGA,KAAAd,wBAAA,M,OEhsBI6H,EAAY,YACd,EACAlM,EHkboB,IGhbpB,EACA,KACA,KACA,MAIa,UAAAkM,E","file":"chunks/ceres-8.min.js","sourcesContent":["'use strict';\nvar $ = require('../internals/export');\nvar $values = require('../internals/object-to-array').values;\n\n// `Object.values` method\n// https://tc39.es/ecma262/#sec-object.values\n$({ target: 'Object', stat: true }, {\n  values: function values(O) {\n    return $values(O);\n  }\n});\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar objectGetPrototypeOf = require('../internals/object-get-prototype-of');\nvar objectKeys = require('../internals/object-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar $propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;\n\nvar propertyIsEnumerable = uncurryThis($propertyIsEnumerable);\nvar push = uncurryThis([].push);\n\n// in some IE versions, `propertyIsEnumerable` returns incorrect result on integer keys\n// of `null` prototype objects\nvar IE_BUG = DESCRIPTORS && fails(function () {\n  // eslint-disable-next-line es/no-object-create -- safe\n  var O = Object.create(null);\n  O[2] = 2;\n  return !propertyIsEnumerable(O, 2);\n});\n\n// `Object.{ entries, values }` methods implementation\nvar createMethod = function (TO_ENTRIES) {\n  return function (it) {\n    var O = toIndexedObject(it);\n    var keys = objectKeys(O);\n    var IE_WORKAROUND = IE_BUG && objectGetPrototypeOf(O) === null;\n    var length = keys.length;\n    var i = 0;\n    var result = [];\n    var key;\n    while (length > i) {\n      key = keys[i++];\n      if (!DESCRIPTORS || (IE_WORKAROUND ? key in O : propertyIsEnumerable(O, key))) {\n        push(result, TO_ENTRIES ? [key, O[key]] : O[key]);\n      }\n    }\n    return result;\n  };\n};\n\nmodule.exports = {\n  // `Object.entries` method\n  // https://tc39.es/ecma262/#sec-object.entries\n  entries: createMethod(true),\n  // `Object.values` method\n  // https://tc39.es/ecma262/#sec-object.values\n  values: createMethod(false)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $entries = require('../internals/object-to-array').entries;\n\n// `Object.entries` method\n// https://tc39.es/ecma262/#sec-object.entries\n$({ target: 'Object', stat: true }, {\n  entries: function entries(O) {\n    return $entries(O);\n  }\n});\n","var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _c(\n    \"div\",\n    { staticClass: \"row\" },\n    [\n      _vm.attributes.length ||\n      (_vm.possibleUnitCombinationIds.length > 1 && _vm.isContentVisible)\n        ? [\n            _vm._l(_vm.attributes, function (attribute, index) {\n              return _c(\n                \"div\",\n                { key: index, staticClass: \"col-12 variation-select\" },\n                [\n                  attribute.type === \"dropdown\"\n                    ? _c(\n                        \"div\",\n                        {\n                          ref: \"attributesContaner\",\n                          refInFor: true,\n                          staticClass: \"input-unit\",\n                        },\n                        [\n                          _c(\n                            \"select\",\n                            {\n                              staticClass: \"custom-select\",\n                              attrs: {\n                                id: \"custom-select_\" + attribute.name,\n                                \"data-testing\": \"variation-select-dropdown\",\n                              },\n                              on: {\n                                change: function ($event) {\n                                  return _vm.selectAttribute(\n                                    attribute.attributeId,\n                                    $event.target.value\n                                  )\n                                },\n                              },\n                            },\n                            [\n                              _vm.addPleaseSelectOption || !_vm.hasSelection\n                                ? _c(\"option\", { domProps: { value: -1 } }, [\n                                    _vm._v(\n                                      _vm._s(\n                                        _vm.$translate(\n                                          \"Ceres::Template.singleItemPleaseSelect\"\n                                        )\n                                      )\n                                    ),\n                                  ])\n                                : _vm._e(),\n                              _vm._v(\" \"),\n                              _vm.hasEmptyOption ||\n                              _vm.selectedAttributes[attribute.attributeId] ===\n                                null\n                                ? _c(\n                                    \"option\",\n                                    {\n                                      domProps: {\n                                        value: null,\n                                        selected:\n                                          _vm.selectedAttributes[\n                                            attribute.attributeId\n                                          ] === null,\n                                      },\n                                    },\n                                    [\n                                      _vm._v(\n                                        _vm._s(\n                                          _vm.$translate(\n                                            \"Ceres::Template.singleItemNoSelection\"\n                                          )\n                                        )\n                                      ),\n                                    ]\n                                  )\n                                : _vm._e(),\n                              _vm._v(\" \"),\n                              _vm._l(attribute.values, function (value) {\n                                return _c(\n                                  \"option\",\n                                  {\n                                    key: value.attributeValueId,\n                                    domProps: {\n                                      value: value.attributeValueId,\n                                      selected:\n                                        value.attributeValueId ===\n                                        _vm.selectedAttributes[\n                                          attribute.attributeId\n                                        ],\n                                    },\n                                  },\n                                  [\n                                    _vm.isAttributeSelectionValid(\n                                      attribute.attributeId,\n                                      value.attributeValueId,\n                                      true\n                                    )\n                                      ? [\n                                          _vm._v(\n                                            \"\\n                            \" +\n                                              _vm._s(value.name) +\n                                              \"\\n                        \"\n                                          ),\n                                        ]\n                                      : _vm.isAttributeSelectionValid(\n                                          attribute.attributeId,\n                                          value.attributeValueId,\n                                          false\n                                        )\n                                      ? [\n                                          _vm._v(\n                                            \"\\n                            \" +\n                                              _vm._s(\n                                                _vm.$translate(\n                                                  \"Ceres::Template.singleItemNotSalableAttribute\",\n                                                  { name: value.name }\n                                                )\n                                              ) +\n                                              \"\\n                        \"\n                                          ),\n                                        ]\n                                      : [\n                                          _vm._v(\n                                            \"\\n                            \" +\n                                              _vm._s(\n                                                _vm.$translate(\n                                                  \"Ceres::Template.singleItemInvalidAttribute\",\n                                                  { name: value.name }\n                                                )\n                                              ) +\n                                              \"\\n                        \"\n                                          ),\n                                        ],\n                                  ],\n                                  2\n                                )\n                              }),\n                            ],\n                            2\n                          ),\n                          _vm._v(\" \"),\n                          _c(\n                            \"label\",\n                            {\n                              directives: [\n                                {\n                                  name: \"tooltip\",\n                                  rawName: \"v-tooltip\",\n                                  value: _vm.isTextCut(attribute.name),\n                                  expression: \"isTextCut(attribute.name)\",\n                                },\n                              ],\n                              attrs: {\n                                for: \"custom-select_\" + attribute.name,\n                                \"data-toggle\": \"tooltip\",\n                                \"data-placement\": \"top\",\n                                title: attribute.name,\n                                \"data-testing\":\n                                  \"variation-select-dropdown-label\",\n                              },\n                            },\n                            [_vm._v(_vm._s(attribute.name))]\n                          ),\n                        ]\n                      )\n                    : attribute.type === \"box\" || attribute.type === \"image\"\n                    ? _c(\"div\", [\n                        _c(\n                          \"span\",\n                          {\n                            staticClass: \"text-muted\",\n                            attrs: { \"data-testing\": \"attribute-name\" },\n                          },\n                          [_vm._v(_vm._s(attribute.name) + \":\")]\n                        ),\n                        _vm._v(\" \"),\n                        _c(\n                          \"b\",\n                          { attrs: { \"data-testing\": \"attribute-value\" } },\n                          [\n                            _vm._v(\n                              _vm._s(\n                                _vm.getSelectedAttributeValueName(attribute)\n                              )\n                            ),\n                          ]\n                        ),\n                        _vm._v(\" \"),\n                        _c(\n                          \"div\",\n                          {\n                            staticClass: \"v-s-boxes py-3\",\n                            class: { images: attribute.type === \"image\" },\n                          },\n                          [\n                            _vm.addPleaseSelectOption\n                              ? _c(\n                                  \"div\",\n                                  {\n                                    staticClass:\n                                      \"v-s-box bg-white empty-option\",\n                                    class: {\n                                      active:\n                                        _vm.selectedAttributes[\n                                          attribute.attributeId\n                                        ] === -1,\n                                      invalid: !_vm.isAttributeSelectionValid(\n                                        attribute.attributeId,\n                                        -1\n                                      ),\n                                    },\n                                    attrs: {\n                                      \"data-testing\": \"variation-select-box\",\n                                    },\n                                    on: {\n                                      click: function ($event) {\n                                        return _vm.selectAttribute(\n                                          attribute.attributeId,\n                                          -1\n                                        )\n                                      },\n                                    },\n                                  },\n                                  [\n                                    _c(\"span\", { staticClass: \"mx-3\" }, [\n                                      _vm._v(\n                                        _vm._s(\n                                          _vm.$translate(\n                                            \"Ceres::Template.singleItemPleaseSelect\"\n                                          )\n                                        )\n                                      ),\n                                    ]),\n                                  ]\n                                )\n                              : _vm._e(),\n                            _vm._v(\" \"),\n                            _vm.hasEmptyOption\n                              ? _c(\n                                  \"div\",\n                                  {\n                                    staticClass:\n                                      \"v-s-box bg-white empty-option\",\n                                    class: {\n                                      active:\n                                        _vm.selectedAttributes[\n                                          attribute.attributeId\n                                        ] === null,\n                                      invalid: !_vm.isAttributeSelectionValid(\n                                        attribute.attributeId,\n                                        null,\n                                        true\n                                      ),\n                                    },\n                                    attrs: {\n                                      \"data-testing\": \"variation-select-box\",\n                                    },\n                                    on: {\n                                      click: function ($event) {\n                                        return _vm.selectAttribute(\n                                          attribute.attributeId,\n                                          null\n                                        )\n                                      },\n                                    },\n                                  },\n                                  [\n                                    _c(\"span\", { staticClass: \"mx-3\" }, [\n                                      _vm._v(\n                                        _vm._s(\n                                          _vm.$translate(\n                                            \"Ceres::Template.singleItemNoSelection\"\n                                          )\n                                        )\n                                      ),\n                                    ]),\n                                  ]\n                                )\n                              : _vm._e(),\n                            _vm._v(\" \"),\n                            _vm._l(attribute.values, function (value) {\n                              return _c(\n                                \"div\",\n                                {\n                                  directives: [\n                                    {\n                                      name: \"tooltip\",\n                                      rawName: \"v-tooltip\",\n                                      value: true,\n                                      expression: \"true\",\n                                    },\n                                  ],\n                                  key: value.attributeValueId,\n                                  staticClass: \"v-s-box bg-white\",\n                                  class: {\n                                    active:\n                                      value.attributeValueId ===\n                                      _vm.selectedAttributes[\n                                        attribute.attributeId\n                                      ],\n                                    invalid: !_vm.isAttributeSelectionValid(\n                                      attribute.attributeId,\n                                      value.attributeValueId,\n                                      true\n                                    ),\n                                  },\n                                  attrs: {\n                                    \"data-testing\": \"variation-select-box\",\n                                    \"data-html\": \"true\",\n                                    \"data-toggle\": \"tooltip\",\n                                    \"data-placement\": \"top\",\n                                    \"data-original-title\": _vm.getTooltip(\n                                      attribute,\n                                      value\n                                    ),\n                                  },\n                                  on: {\n                                    click: function ($event) {\n                                      return _vm.selectAttribute(\n                                        attribute.attributeId,\n                                        value.attributeValueId\n                                      )\n                                    },\n                                  },\n                                },\n                                [\n                                  attribute.type === \"box\"\n                                    ? _c(\"span\", { staticClass: \"mx-3\" }, [\n                                        _vm._v(_vm._s(value.name)),\n                                      ])\n                                    : _c(\"img\", {\n                                        staticClass: \"p-1\",\n                                        attrs: {\n                                          src: value.imageUrl,\n                                          alt: value.name,\n                                        },\n                                      }),\n                                ]\n                              )\n                            }),\n                          ],\n                          2\n                        ),\n                      ])\n                    : _vm._e(),\n                ]\n              )\n            }),\n            _vm._v(\" \"),\n            _vm.possibleUnitCombinationIds.length > 1 && _vm.isContentVisible\n              ? _c(\"div\", { staticClass: \"col-12 variation-select\" }, [\n                  _c(\"div\", { staticClass: \"input-unit\" }, [\n                    _c(\n                      \"select\",\n                      {\n                        staticClass: \"custom-select\",\n                        attrs: {\n                          id: \"unit-combination-ids-select\",\n                          \"data-testing\": \"variation-select-unit\",\n                        },\n                        on: {\n                          change: function ($event) {\n                            return _vm.selectUnit($event.target.value)\n                          },\n                        },\n                      },\n                      _vm._l(\n                        _vm.possibleUnitCombinationIds,\n                        function (unitCombinationId) {\n                          return _c(\n                            \"option\",\n                            {\n                              key: unitCombinationId,\n                              domProps: {\n                                value: unitCombinationId,\n                                selected:\n                                  parseInt(unitCombinationId) ===\n                                  _vm.selectedUnit,\n                              },\n                            },\n                            [\n                              _vm.isUnitSelectionValid(unitCombinationId)\n                                ? [\n                                    _vm._v(\n                                      \"\\n                            \" +\n                                        _vm._s(\n                                          _vm.possibleUnits[unitCombinationId]\n                                        ) +\n                                        \"\\n                        \"\n                                    ),\n                                  ]\n                                : [\n                                    _vm._v(\n                                      \"\\n                            \" +\n                                        _vm._s(\n                                          _vm.$translate(\n                                            \"Ceres::Template.singleItemInvalidAttribute\",\n                                            {\n                                              name: _vm.possibleUnits[\n                                                unitCombinationId\n                                              ],\n                                            }\n                                          )\n                                        ) +\n                                        \"\\n                        \"\n                                    ),\n                                  ],\n                            ],\n                            2\n                          )\n                        }\n                      ),\n                      0\n                    ),\n                    _vm._v(\" \"),\n                    _c(\n                      \"label\",\n                      {\n                        attrs: {\n                          for: \"unit-combination-ids-select\",\n                          \"data-testing\": \"variation-select-unit-label\",\n                        },\n                      },\n                      [\n                        _vm._v(\n                          _vm._s(\n                            _vm.$translate(\"Ceres::Template.singleItemContent\")\n                          )\n                        ),\n                      ]\n                    ),\n                  ]),\n                ])\n              : _vm._e(),\n          ]\n        : [_vm._t(\"default\")],\n    ],\n    2\n  )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","<template>\n    <div class=\"row\">\n        <template v-if=\"attributes.length || (possibleUnitCombinationIds.length > 1 && isContentVisible)\">\n            <div class=\"col-12 variation-select\" v-for=\"(attribute, index) in attributes\" :key=\"index\">\n                <!-- dropdown -->\n                <div class=\"input-unit\" ref=\"attributesContaner\" v-if=\"attribute.type === 'dropdown'\">\n                    <select :id=\"'custom-select_' + attribute.name\" class=\"custom-select\" @change=\"selectAttribute(attribute.attributeId, $event.target.value)\" data-testing=\"variation-select-dropdown\">\n                        <option :value=\"-1\" v-if=\"addPleaseSelectOption || !hasSelection\">{{ $translate(\"Ceres::Template.singleItemPleaseSelect\") }}</option>\n                        <option\n                                :value=\"null\" v-if=\"hasEmptyOption || selectedAttributes[attribute.attributeId] === null\"\n                                :selected=\"selectedAttributes[attribute.attributeId] === null\">{{ $translate(\"Ceres::Template.singleItemNoSelection\") }}</option>\n                        <option\n                                v-for=\"value in attribute.values\"\n                                :value=\"value.attributeValueId\"\n                                :selected=\"value.attributeValueId === selectedAttributes[attribute.attributeId]\"\n                                :key=\"value.attributeValueId\">\n                            <template v-if=\"isAttributeSelectionValid(attribute.attributeId, value.attributeValueId, true)\">\n                                {{ value.name }}\n                            </template>\n                            <template v-else-if=\"isAttributeSelectionValid(attribute.attributeId, value.attributeValueId, false)\">\n                                {{ $translate(\"Ceres::Template.singleItemNotSalableAttribute\", { \"name\": value.name }) }}\n                            </template>\n                            <template v-else>\n                                {{ $translate(\"Ceres::Template.singleItemInvalidAttribute\", { \"name\": value.name }) }}\n                            </template>\n                        </option>\n                    </select>\n                    <label :for=\"'custom-select_' + attribute.name\" v-tooltip=\"isTextCut(attribute.name)\" data-toggle=\"tooltip\" data-placement=\"top\" :title=\"attribute.name\" data-testing=\"variation-select-dropdown-label\">{{ attribute.name }}</label>\n                </div>\n                <!-- /dropdown -->\n\n                <!-- box and image -->\n                <div v-else-if=\"attribute.type === 'box' || attribute.type === 'image'\">\n                    <span class=\"text-muted\" data-testing=\"attribute-name\">{{ attribute.name }}:</span> <b data-testing=\"attribute-value\">{{ getSelectedAttributeValueName(attribute) }}</b>\n                    <div class=\"v-s-boxes py-3\" :class=\"{ 'images': attribute.type === 'image' }\">\n                        <div class=\"v-s-box bg-white empty-option\"\n                             data-testing=\"variation-select-box\"\n                             v-if=\"addPleaseSelectOption\"\n                             @click=\"selectAttribute(attribute.attributeId, -1)\"\n                             :class=\"{ 'active': selectedAttributes[attribute.attributeId] === -1, 'invalid': !isAttributeSelectionValid(attribute.attributeId, -1) }\">\n                            <span class=\"mx-3\">{{ $translate(\"Ceres::Template.singleItemPleaseSelect\") }}</span>\n                        </div>\n                        <div class=\"v-s-box bg-white empty-option\"\n                             data-testing=\"variation-select-box\"\n                             v-if=\"hasEmptyOption\"\n                             @click=\"selectAttribute(attribute.attributeId, null)\"\n                             :class=\"{ 'active': selectedAttributes[attribute.attributeId] === null, 'invalid': !isAttributeSelectionValid(attribute.attributeId, null, true) }\">\n                            <span class=\"mx-3\">{{ $translate(\"Ceres::Template.singleItemNoSelection\") }}</span>\n                        </div>\n\n                        <div class=\"v-s-box bg-white\"\n                             data-testing=\"variation-select-box\"\n                             v-for=\"value in attribute.values\"\n                             @click=\"selectAttribute(attribute.attributeId, value.attributeValueId)\"\n                             :class=\"{ 'active': value.attributeValueId === selectedAttributes[attribute.attributeId], 'invalid': !isAttributeSelectionValid(attribute.attributeId, value.attributeValueId, true) }\"\n                             v-tooltip=\"true\" data-html=\"true\" data-toggle=\"tooltip\" data-placement=\"top\" :data-original-title=\"getTooltip(attribute, value)\"\n                             :key=\"value.attributeValueId\">\n                            <span class=\"mx-3\" v-if=\"attribute.type === 'box'\">{{ value.name }}</span>\n                            <img class=\"p-1\" v-else :src=\"value.imageUrl\" :alt=\"value.name\">\n                        </div>\n                    </div>\n                </div>\n                <!-- /box and image -->\n            </div>\n\n            <!-- units -->\n            <div class=\"col-12 variation-select\" v-if=\"possibleUnitCombinationIds.length > 1 && isContentVisible\">\n                <div class=\"input-unit\">\n                    <select id=\"unit-combination-ids-select\" class=\"custom-select\" @change=\"selectUnit($event.target.value)\" data-testing=\"variation-select-unit\">\n                        <option\n                                v-for=\"unitCombinationId in possibleUnitCombinationIds\"\n                                :value=\"unitCombinationId\"\n                                :selected=\"parseInt(unitCombinationId) === selectedUnit\"\n                                :key=\"unitCombinationId\">\n                            <template v-if=\"isUnitSelectionValid(unitCombinationId)\">\n                                {{ possibleUnits[unitCombinationId] }}\n                            </template>\n                            <template v-else>\n                                {{ $translate(\"Ceres::Template.singleItemInvalidAttribute\", { \"name\": possibleUnits[unitCombinationId] }) }}\n                            </template>\n                        </option>\n                    </select>\n                    <label for=\"unit-combination-ids-select\" data-testing=\"variation-select-unit-label\">{{ $translate(\"Ceres::Template.singleItemContent\") }}</label>\n                </div>\n            </div>\n            <!-- /units -->\n        </template>\n\n        <template v-else>\n            <slot></slot>\n        </template>\n    </div>\n</template>\n\n<script>\nimport { textWidth } from \"../../helper/dom\";\nimport { isDefined, isNull, isNullOrUndefined } from \"../../helper/utils\";\n\nconst NotificationService = require(\"../../services/NotificationService\");\n\nexport default {\n\n    name: \"variation-select\",\n\n    props: {\n        forceContent:\n        {\n            type: Boolean,\n            default: false\n        }\n    },\n\n    inject: {\n        itemId: {\n            default: null\n        }\n    },\n\n    data()\n    {\n        return {\n            filteredVariationsCache: {},\n            lastContentCount: 0\n        };\n    },\n\n    mounted()\n    {\n        // initially check for valid selection and disable add to basket button\n        this.$store.commit(`${this.itemId}/variationSelect/setIsVariationSelected`, !!this.currentSelection);\n    },\n\n    computed:\n    {\n        currentVariation() {\n            return this.$store.getters[`${this.itemId}/currentItemVariation`];\n        },\n\n        currentVariationSelect() {\n            return this.$store.state.items[this.itemId] && this.$store.state.items[this.itemId].variationSelect;\n        },\n\n        /**\n         * returns true if any variation has no attributes\n         */\n        hasEmptyOption()\n        {\n            return this.variations.some(variation => !variation.attributes.length);\n        },\n\n        addPleaseSelectOption()\n        {\n            return App.config.item.showPleaseSelect;\n        },\n\n        /**\n         * returns the variation, based on the selected attributes / unit\n         * returns false if there are none or multiple results\n         */\n        currentSelection()\n        {\n            const filteredVariations = this.filterVariations(null, null, true);\n\n            if (filteredVariations.length === 1)\n            {\n                return filteredVariations[0];\n            }\n\n            return false;\n        },\n\n        /**\n         * returns all units, selectable by current selection\n         * prop 'forceContent' with value true will return all units, without filtering\n         */\n        possibleUnits()\n        {\n            // use an object, to make the entries unique\n            const possibleUnits = {};\n            const variations = this.forceContent ? this.variations : this.filterVariations(null, null, null, true);\n\n            for (const variation of variations)\n            {\n                possibleUnits[variation.unitCombinationId] = variation.unitName;\n            }\n\n            return possibleUnits;\n        },\n\n        possibleUnitCombinationIds()\n        {\n            return this.transformPossibleUnits(this.possibleUnits).map(value => value[0]);\n        },\n\n        isContentVisible()\n        {\n            return !this.forceContent && !!this.currentSelection || this.forceContent;\n        },\n\n        hasSelection()\n        {\n            return !isNullOrUndefined(this.selectedAttributes) && !Object.values(this.selectedAttributes).some((value) => value < 0);\n        },\n\n        attributes() {\n            return this.currentVariationSelect && this.currentVariationSelect.attributes;\n        },\n\n        selectedAttributes() {\n            return this.currentVariationSelect && this.currentVariationSelect.selectedAttributes;\n        },\n\n        selectedUnit() {\n            return this.currentVariationSelect && this.currentVariationSelect.selectedUnit;\n        },\n\n        variations() {\n            return this.currentVariationSelect && this.currentVariationSelect.variations;\n        }\n    },\n\n    methods:\n    {\n        /**\n         * select an attribute and check, if the selection is valid; if not, unsetInvalidSelection will be executed\n         * @param {number} attributeId\n         * @param {[number, string, null]} attributeValueId\n         */\n        selectAttribute(attributeId, attributeValueId)\n        {\n            attributeValueId = parseInt(attributeValueId) || null;\n\n            if (this.selectedAttributes[attributeId] !== attributeValueId)\n            {\n                this.$store.commit(`${this.itemId}/variationSelect/selectItemAttribute`, { attributeId, attributeValueId });\n                this.onSelectionChange(attributeId, attributeValueId, null);\n            }\n        },\n\n        /**\n         * select a unit and check, if the selection is valid; if not, unsetInvalidSelection will be executed\n         * @param {[number, string]} unitId\n         */\n        selectUnit(unitId)\n        {\n            unitId = parseInt(unitId);\n            this.$store.commit(`${this.itemId}/variationSelect/selectItemUnit`, unitId);\n            this.onSelectionChange(null, null, unitId);\n        },\n\n        onSelectionChange(attributeId, attributeValueId, unitId)\n        {\n            if (this.currentSelection)\n            {\n                this.setVariation(this.currentSelection.variationId);\n            }\n            else if (!this.hasSelection)\n            {\n                // user switched back to \"please select\"\n                this.setVariation(0);\n            }\n            else\n            {\n                this.unsetInvalidSelection(attributeId, attributeValueId, unitId);\n            }\n\n            this.lastContentCount = this.possibleUnitCombinationIds.length;\n        },\n\n        /**\n         * changes the selected attributes / unit, to ensure a valid seelction\n         * @param {[number, null]} attributeId\n         * @param {[number, null]} attributeValueId\n         * @param {[number, null]} unitId\n         */\n        unsetInvalidSelection(attributeId, attributeValueId, unitId)\n        {\n            const qualifiedVariations = this.getQualifiedVariations(attributeId, attributeValueId, unitId);\n            const closestVariations = this.getClosestVariations(qualifiedVariations);\n            \n            // if the salable 'closestVariations' is undefined, take the not-salable one\n            const closestVariation = closestVariations[0] || closestVariations[1];\n\n            if (!closestVariation)\n            {\n                return;\n            }\n\n            const invalidSelection = this.getInvalidSelectionByVariation(closestVariation);\n\n            this.correctSelection(invalidSelection);\n        },\n\n        getTooltip(attribute, attributeValue)\n        {\n            if(!this.isAttributeSelectionValid(attribute.attributeId, attributeValue.attributeValueId, true))\n            {\n                return this.getInvalidOptionTooltip(attribute.attributeId, attributeValue.attributeValueId);\n            }\n            else if(attribute.type === \"image\")\n            {\n                return this.$translate(\"Ceres::Template.singleItemAttributeTooltip\", {\n                    attribute: attribute.name,\n                    value: attributeValue.name\n                });\n            }\n\n            return \"\";\n        },\n\n        /**\n         * returns a string for box tooltips, for not available options\n         * @param {number} attributeId\n         * @param {number} attributeValueId\n         */\n        getInvalidOptionTooltip(attributeId, attributeValueId)\n        {\n            const qualifiedVariations = this.getQualifiedVariations(attributeId, attributeValueId);\n            const closestVariations   = this.getClosestVariations(qualifiedVariations);\n\n            if (!closestVariations || closestVariations.length <= 0)\n            {\n                return \"\";\n            }\n\n            const invalidSelections = [\n                !!closestVariations[0] ? this.getInvalidSelectionByVariation(closestVariations[0]) : null,\n                !!closestVariations[1] ? this.getInvalidSelectionByVariation(closestVariations[1]) : null\n            ];\n\n            if (!!invalidSelections[0]\n                && !!invalidSelections[1]\n                && invalidSelections[0].attributesToReset.length > invalidSelections[1].attributesToReset.length)\n            {\n                // there is a non-salable variation with less changes\n                return this.$translate(\"Ceres::Template.singleItemNotSalable\");\n            }\n\n            const invalidSelection = invalidSelections[0] || invalidSelections[1];\n            const names = [];\n\n            for (const attribute of invalidSelection.attributesToReset)\n            {\n                if (attribute.attributeId !== attributeId)\n                {\n                    names.push(\"<b>\" + attribute.name +\"</b>\");\n                }\n            }\n            if (invalidSelection.newUnit)\n            {\n                names.push(\n                    \"<b>\" + this.$translate(\"Ceres::Template.singleItemContent\") + \"</b>\"\n                );\n            }\n\n            if (!names.length)\n            {\n                return null;\n            }\n\n            return this.$translate(\"Ceres::Template.singleItemNotAvailableInSelection\", { name: names.join(\", \") });\n        },\n\n        /**\n         * returns a list of variations, filtered by attribute or unit\n         * @param {[number, null]} attributeId\n         * @param {[number, null]} attributeValueId\n         * @param {[number, null]} unitId\n         */\n        getQualifiedVariations(attributeId, attributeValueId, unitId)\n        {\n            if (isDefined(attributeValueId))\n            {\n                return this.variations.filter(variation =>\n                {\n                    return isDefined(variation.attributes.find(attribute =>\n                        attribute.attributeId === attributeId && attribute.attributeValueId === attributeValueId));\n                });\n            }\n            else if (isDefined(unitId))\n            {\n                return this.variations.filter(variation => variation.unitCombinationId === unitId);\n            }\n\n            return this.variations.filter(variation => !variation.attributes.length);\n        },\n\n        /**\n         * return a salable and a non-salable variation with the minimum number of changes on attributes compared to the current selection.\n         * @param {array} qualifiedVariations\n         */\n        getClosestVariations(qualifiedVariations)\n        {\n            let closestSalableVariation, numberOfSalableChanges;\n            let closestNonSalableVariation, numberOfNonSalableChanges;\n\n            for (const variation of qualifiedVariations)\n            {\n                let changes = 0;\n\n                if (variation.unitCombinationId !== this.selectedUnit && !isNull(this.selectedUnit))\n                {\n                    // when the unit dropdown isn't visible, it should have a lower weight for reset investigations\n                    const unitWeight = this.possibleUnitCombinationIds.length > 1 && this.isContentVisible ? 0.9 : 0.1;\n\n                    changes += unitWeight;\n                }\n\n                for (const attribute of variation.attributes)\n                {\n                    if (this.selectedAttributes[attribute.attributeId] !== attribute.attributeValueId)\n                    {\n                        changes++;\n                    }\n                }\n\n                if(variation.isSalable && (!numberOfSalableChanges || changes < numberOfSalableChanges))\n                {\n                    closestSalableVariation = variation;\n                    numberOfSalableChanges = changes;\n                }\n                else if (!variation.isSalable && (!numberOfNonSalableChanges || changes < numberOfNonSalableChanges))\n                {\n                    closestNonSalableVariation = variation;\n                    numberOfNonSalableChanges = changes;\n                }\n            }\n\n            return [closestSalableVariation, closestNonSalableVariation];\n        },\n\n        /**\n         * returns object with array 'attributesToReset' and newUnit. The attributesToReset contains all attributes, which are not matching with the given variation\n         * @param {object} variation\n         */\n        getInvalidSelectionByVariation(variation)\n        {\n            const attributesToReset = [];\n            let newUnit = null;\n\n            for (let selectedAttributeId in this.selectedAttributes)\n            {\n                selectedAttributeId = parseInt(selectedAttributeId);\n                const variationAttribute = variation.attributes.find(attribute => attribute.attributeId === selectedAttributeId);\n\n                if (!isNull(this.selectedAttributes[selectedAttributeId]))\n                {\n                    if (variationAttribute && variationAttribute.attributeValueId !== this.selectedAttributes[selectedAttributeId] || !variationAttribute)\n                    {\n                        const attributeToReset = this.attributes.find(attr => attr.attributeId === selectedAttributeId);\n\n                        attributesToReset.push(attributeToReset);\n                    }\n                }\n            }\n\n            if (variation.unitCombinationId !== this.selectedUnit)\n            {\n                newUnit = variation.unitCombinationId;\n            }\n\n            return { attributesToReset, newUnit };\n        },\n\n        /**\n         * resets all invalid attributes and change the unit, if required. Prints a message to the user if so.\n         * @param {object} invalidSelection\n         */\n        correctSelection(invalidSelection)\n        {\n            const messages   = [];\n            const attributes = JSON.parse(JSON.stringify(this.selectedAttributes));\n\n            for (const attributeToReset of invalidSelection.attributesToReset)\n            {\n                messages.push(\n                    this.$translate(\"Ceres::Template.singleItemNotAvailable\", { name: attributeToReset.name })\n                );\n\n                attributes[attributeToReset.attributeId] = (!this.hasEmptyOption && App.config.item.showPleaseSelect) ? -1 : null;\n            }\n\n            if (invalidSelection.newUnit)\n            {\n                if (this.lastContentCount > 1 && this.possibleUnitCombinationIds.length > 1 && !isNull(this.selectedUnit))\n                {\n                    messages.push(\n                        this.$translate(\"Ceres::Template.singleItemNotAvailable\", { name:\n                                this.$translate(\"Ceres::Template.singleItemContent\")\n                        })\n                    );\n                }\n\n                this.$store.commit(`${this.itemId}/variationSelect/selectItemUnit`, invalidSelection.newUnit);\n            }\n\n            this.$store.commit(`${this.itemId}/variationSelect/setItemSelectedAttributes`, attributes);\n\n            this.setVariation(this.currentSelection ? this.currentSelection.variationId : 0);\n\n            NotificationService.warn(\n                messages.join(\"<br>\")\n            ).closeAfter(5000);\n        },\n\n        /**\n         * returns matching variations with current selection\n         * attributes and unitId could be filled, to check a specific selection\n         * @param {object} attributes\n         * @param {number} unitId\n         * @param {boolean} strict\n         */\n        filterVariations(attributes, unitId, strict, ignoreUnit)\n        {\n            attributes = attributes || this.selectedAttributes;\n            unitId = unitId || this.selectedUnit;\n            strict = !!strict;\n            ignoreUnit = !!ignoreUnit;\n\n            const key = JSON.stringify(attributes) + \"_\" + unitId + \"_\" + strict + \"_\" + ignoreUnit;\n\n            if (isDefined(this.filteredVariationsCache[key]))\n            {\n                return this.filteredVariationsCache[key];\n            }\n\n            const uniqueValues = [...new Set(Object.values(attributes))];\n            const isEmptyOptionSelected = uniqueValues.length === 1 && isNull(uniqueValues[0]);\n            const filteredVariations = this.variations.filter(variation =>\n            {\n                // the selected unit is not matching\n                if (!ignoreUnit && variation.unitCombinationId !== unitId)\n                {\n                    return false;\n                }\n\n                // the variation has no attributes (only checked, if any attribute has a selected value); or the variation has attributes and empty option is selected\n                // requires more than 0 attributes\n                if (((!isEmptyOptionSelected && !variation.attributes.length) || (isEmptyOptionSelected && variation.attributes.length))\n                    && this.attributes.length > 0)\n                {\n                    return false;\n                }\n\n                for (const attributeId in attributes)\n                {\n                    const variationAttribute = variation.attributes.find(variationAttribute =>\n                        variationAttribute.attributeId === parseInt(attributeId));\n\n                    // an attribute is not matching with selection\n                    if (variationAttribute &&\n                        variationAttribute.attributeValueId !== attributes[attributeId] &&\n                        (strict || !strict && !isNull(attributes[attributeId]) && attributes[attributeId] !== -1))\n                    {\n                        return false;\n                    }\n                }\n\n                return true;\n            });\n\n            this.filteredVariationsCache[key] = filteredVariations;\n\n            return filteredVariations;\n        },\n\n        /**\n         * returns true, if the selection with a new attribute value would be valid\n         * @param {number} attributeId\n         * @param {[number, string, null]} attributeValueId\n         * @param {boolean} filterSalableVariations\n         */\n        isAttributeSelectionValid(attributeId, attributeValueId, filterSalableVariations)\n        {\n            attributeValueId = parseInt(attributeValueId) || null;\n            if (this.selectedAttributes[attributeId] === attributeValueId)\n            {\n                return true;\n            }\n\n            const selectedAttributes = JSON.parse(JSON.stringify(this.selectedAttributes));\n\n            selectedAttributes[attributeId] = parseInt(attributeValueId) || null;\n\n            const ignoreUnit = !(Object.keys(this.possibleUnits).length > 1 && this.isContentVisible);\n            let variations = this.filterVariations(selectedAttributes, null, null, ignoreUnit);\n\n            if (filterSalableVariations)\n            {\n                variations = variations.filter(variation => variation.isSalable)\n            }\n\n            return variations.length > 0;\n        },\n\n        /**\n         * returns true, if the selection with a new unitId would be valid\n         * @param {[number, string]} unitId\n         */\n        isUnitSelectionValid(unitId)\n        {\n            unitId = parseInt(unitId);\n            if (this.selectedUnit === unitId)\n            {\n                return true;\n            }\n\n            return this\n                .filterVariations(null, unitId)\n                .filter(variation => variation.isSalable)\n                .length > 0\n        },\n\n        /**\n         * dispatch vuex action 'loadVariation' to archive a variation\n         * dispatches a custom event named 'onVariationChanged'\n         * @param {[string, number, null]} variationId\n         */\n        setVariation(variationId)\n        {\n            if (!isDefined(variationId) && this.currentSelection)\n            {\n                variationId = this.currentSelection.variationId;\n            }\n\n            if (isDefined(variationId))\n            {\n                this.$store.dispatch(`${this.itemId}/loadVariation`, variationId).then(variation =>\n                {\n                    document.dispatchEvent(new CustomEvent(\"onVariationChanged\",\n                        {\n                            detail:\n                                {\n                                    attributes: variation.attributes,\n                                    documents: variation.documents,\n                                    itemId: this.itemId\n                                }\n                        }));\n                });\n            }\n        },\n\n        isTextCut(content)\n        {\n            if (this.$refs.attributesContaner)\n            {\n                return textWidth(content, \"Custom-Font, Helvetica, Arial, sans-serif\") > this.$refs.attributesContaner[0].clientWidth;\n            }\n\n            return false;\n        },\n\n        getSelectedAttributeValueName(attribute)\n        {\n            const selectedAttributeValueId =  this.selectedAttributes[attribute.attributeId];\n            const selectedAttributeValue = attribute.values.find(attrValue => attrValue.attributeValueId === selectedAttributeValueId);\n\n            if (selectedAttributeValue)\n            {\n                return selectedAttributeValue.name;\n            }\n            else if (App.config.item.showPleaseSelect && selectedAttributeValueId === -1)\n            {\n                return this.$translate(\"Ceres::Template.singleItemPleaseSelect\");\n            }\n            return this.$translate(\"Ceres::Template.singleItemNoSelection\");\n        },\n\n        transformPossibleUnits(possibleUnits)\n        {\n            return Object.entries(possibleUnits).sort((unitA, unitB) => {\n                unitA = this.splitUnitName(unitA[1]);\n                unitB = this.splitUnitName(unitB[1]);\n                // order by unit\n                if (unitA[1] < unitB[1]) {\n                    return -1;\n                }\n                if (unitA[1] > unitB[1]) {\n                    return 1;\n                }\n                // order by content (count)\n                if (unitA[0] < unitB[0]) {\n                    return -1;\n                }\n                if (unitA[0] > unitB[0]) {\n                    return 1;\n                }\n                return 0;\n            });\n        },\n        splitUnitName(unitName) {\n            const unitNameSplit = unitName.split(\" \");\n\n            if (!isNaN(unitNameSplit[0])) {\n                unitNameSplit[0] = unitNameSplit[0].replace(App.currencyPattern.separator_thousands, \"\");\n                unitNameSplit[0] = parseInt(unitNameSplit[0]);\n            }\n\n            return unitNameSplit;\n        }\n    },\n\n    watch:\n    {\n        currentSelection(value)\n        {\n            this.$store.commit(`${this.itemId}/variationSelect/setIsVariationSelected`, !!value);\n        },\n        variations()\n        {\n            // FIX unset variation cache after subsequent variations are loaded\n            this.filteredVariationsCache = {};\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!./VariationSelect.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!./VariationSelect.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./VariationSelect.vue?vue&type=template&id=588c1887\"\nimport script from \"./VariationSelect.vue?vue&type=script&lang=js\"\nexport * from \"./VariationSelect.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":""}