(window.webpackJsonpNewland_Toubiz_Poi_Neos=window.webpackJsonpNewland_Toubiz_Poi_Neos||[]).push([[152],{lZ91:function(e,t,s){"use strict";s.r(t);var i=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"tb-w-dynamic-field-filter"},[s("ul",{staticClass:"h-64 -mr-2 overflow-y-scroll"},[e._l(e.items,(function(t,i){return[s("li",{key:t.blueprint,staticClass:"pb-2 text-base font-bold",class:i>0?"pt-6":""},[e._v("\n                "+e._s(t.label)+"\n            ")]),e._v(" "),e._l(t.options,(function(i){return s("li",{key:i.id,staticClass:"border-gray-200 border-t pl-4 py-2 pr-4 text-sm",class:[e.selectedFilters[t.blueprint]&&e.selectedFilters[t.blueprint].includes(i.id)?"text-primary-500":"text-gray-800"]},[s("label",{staticClass:"flex justify-between items-center w-full cursor-pointer",attrs:{for:i.id}},[e._v("\n                    "+e._s(i.value)+"\n\n                    "),e.selectedFilters[t.blueprint]&&e.selectedFilters[t.blueprint].includes(i.id)?s("tb-w-icon",{attrs:{icon:"checkmark",size:".875"}}):e._e(),e._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedFilters[t.blueprint],expression:"selectedFilters[item.blueprint]"}],staticClass:"hidden",attrs:{type:"checkbox",id:i.id},domProps:{value:i.id,checked:Array.isArray(e.selectedFilters[t.blueprint])?e._i(e.selectedFilters[t.blueprint],i.id)>-1:e.selectedFilters[t.blueprint]},on:{change:function(s){var l=e.selectedFilters[t.blueprint],r=s.target,n=!!r.checked;if(Array.isArray(l)){var a=i.id,c=e._i(l,a);r.checked?c<0&&e.$set(e.selectedFilters,t.blueprint,l.concat([a])):c>-1&&e.$set(e.selectedFilters,t.blueprint,l.slice(0,c).concat(l.slice(c+1)))}else e.$set(e.selectedFilters,t.blueprint,n)}}})],1)])}))]}))],2),e._v(" "),s("div",{staticClass:"mt-6 flex justify-between"},[s("tb-w-button",{class:Object.keys(e.$store.state.filters[this.type].filter.dynamicFields).length?"":"cursor-not-allowed",attrs:{variant:"tertiary",disabled:!Object.keys(e.$store.state.filters[this.type].filter.dynamicFields).length},on:{click:e.reset}},[e._v("\n            "+e._s(e.$t("message.reset"))+"\n        ")]),e._v(" "),s("tb-w-button",{on:{click:function(t){e.$emit("input",{blueprintIds:e.blueprintIds,filteredBlueprints:e.removeEmptyFields(e.selectedFilters)})}}},[e._v("\n            "+e._s(e.$t("message.apply"))+"\n        ")])],1)])};i._withStripped=!0;var l={props:{items:{type:Array,default:null},type:{type:String,required:!0}},data:()=>({selectedFilters:{},blueprintIds:[]}),async created(){this.blueprintIds=this.items.map(e=>e.blueprint),this.selectedFilters=Object.assign(this.selectedFilters,this.getBlueprintsInThisSection(this.$store.state.filters[this.type].filter.dynamicFields)),this.items.forEach(e=>{this.selectedFilters[e.blueprint]?this.$set(this.selectedFilters,e.blueprint,this.selectedFilters[e.blueprint]):this.$set(this.selectedFilters,e.blueprint,[])}),this.unsubscribe=this.$store.subscribe(async(e,t)=>{"setFilter"===e.type&&(this.selectedFilters=Object.assign({},this.getBlueprintsInThisSection(t.filters[this.type].filter.dynamicFields)),this.items.forEach(e=>{this.selectedFilters[e.blueprint]||this.$set(this.selectedFilters,e.blueprint,[])}))})},beforeDestroy(){this.unsubscribe()},methods:{reset(){this.items.forEach(e=>{this.$set(this.selectedFilters,e.blueprint,[])}),this.$emit("input",{blueprintIds:this.blueprintIds,filteredBlueprints:{}})},removeEmptyFields(e){let t=e;return Object.keys(t).forEach(e=>{0===t[e].length&&delete t[e]}),t},getBlueprintsInThisSection(e){const t={};return this.blueprintIds.forEach(s=>{e[s]&&(t[s]=e[s])}),t}},i18n:{fallbackLocale:"de",silentFallbackWarn:"undefined"==typeof window,messages:{de:{message:{reset:"Zurücksetzen",apply:"Anwenden"}},en:{message:{reset:"Reset",apply:"Apply"}},fr:{message:{reset:"Réinitialiser",apply:"Appliquer"}},it:{message:{reset:"Ripristina",apply:"Applicare"}},es:{message:{reset:"Reiniciar",apply:"Aplicar"}},nl:{message:{reset:"Reset",apply:"Van toepassing zijn"}},cz:{message:{reset:"Resetovat",apply:"Aplikovat"}}}}},r=s("KHd+"),n=Object(r.a)(l,i,[],!1,null,null,null);n.options.__file="node_modules/@newland/toubiz-widget/src/components/basic/tb-w-dynamic-field-filter.vue";t.default=n.exports}}]);