text: (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{25:function(t,e,a){"use strict";var s=a(8),r=a(9),c={name:"CatalogItem",props:{product:Object,required:!0},filters:{toFix:s.a,formattedPrice:r.a}},n=a(1),i=Object(n.a)(c,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{key:t.product.id,staticClass:"col-12 col-sm-6 col-md-6 col-md-3 col-lg-3 pl-1 pr-1"},[a("div",{staticClass:"card"},[a("router-link",{staticClass:"mx-auto p-2 pt-4",attrs:{to:{name:"product",params:{title:t.product.title}}}},[a("picture",[a("img",{staticClass:"card-img-top",attrs:{src:"/img/"+t.product.img,alt:"image"}})])]),t._v(" "),a("div",{staticClass:"card-body"},[a("p",{staticClass:"card-subtext text-center font-weight-bold"},[t._v("\n                Брэнд: "+t._s(t.product.brands.name)+"\n            ")]),t._v(" "),a("p",{staticClass:"card-text text-center font-weight-bold"},[t._v("\n                Цена: "+t._s(t._f("formattedPrice")(t._f("toFix")(t.product.price)))+"\n            ")]),t._v(" "),a("h5",{staticClass:"card-title text-center font-weight-bold"},[t._v("\n                "+t._s(t.product.name)+"\n            ")]),t._v(" "),a("router-link",{staticClass:"mx-auto btn-main p-2",attrs:{to:{name:"product",params:{title:t.product.title}}}},[t._v("\n                Подробнее\n                "),a("picture",[a("img",{staticClass:"btn-image",attrs:{src:"/img/cart.svg",alt:""}})])])],1)],1)])}),[],!1,null,null,null);e.a=i.exports},8:function(t,e,a){"use strict";function s(t){return(t=parseFloat(t)).toFixed(2)+" L"}a.d(e,"a",(function(){return s}))},9:function(t,e,a){"use strict";function s(t){var e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g," "),e.join(".")}a.d(e,"a",(function(){return s}))},94:function(t,e,a){"use strict";a.r(e);var s=a(0),r=a.n(s),c=a(18),n=a.n(c),i=a(4),o=a.n(i),l=a(2),d=a(13),u=a(25),p={props:["meta_data"],data:function(){return{offset:2}},computed:{pages:function(){for(var t=[],e=this.rangeStart;e<=this.rangeEnd;e++)t.push(e);return t},rangeStart:function(){var t=this.meta_data.current_page-this.offset;return t>0?t:1},rangeEnd:function(){return Math.ceil(this.meta_data.total/this.meta_data.per_page)}},methods:{next:function(t){this.$emit("next",t)}}},_=a(1),m=Object(_.a)(p,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("nav",{staticClass:"mt-3"},[a("ul",{staticClass:"pagination pagination-lg"},[a("li",{staticClass:"page-item",class:{disabled:null===t.meta_data.prev_page_url}},[a("a",{staticClass:"page-link",attrs:{href:"#"},on:{click:function(e){return t.next(t.meta_data.current_page-1)}}},[t._v("\n                «\n            ")])]),t._v(" "),t._l(t.pages,(function(e){return a("li",{key:e,staticClass:"page-item",class:{active:t.meta_data.current_page===e}},[a("a",{staticClass:"page-link",attrs:{href:"#"},on:{click:function(a){return a.preventDefault(),t.next(e)}}},[t._v("\n                "+t._s(e)+"\n            ")])])})),t._v(" "),a("li",{staticClass:"page-item",class:{disabled:t.meta_data.current_page===t.meta_data.last_page}},[a("a",{staticClass:"page-link",attrs:{href:"#"},on:{click:function(e){return t.next(t.meta_data.current_page+1)}}},[t._v("\n                »\n            ")])])],2)])}),[],!1,null,null,null).exports;function v(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,s)}return a}function h(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?v(Object(a),!0).forEach((function(e){f(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):v(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function f(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function g(t,e,a,s,r,c,n){try{var i=t[c](n),o=i.value}catch(t){return void a(t)}i.done?e(o):Promise.resolve(o).then(s,r)}function b(t){return function(){var e=this,a=arguments;return new Promise((function(s,r){var c=t.apply(e,a);function n(t){g(c,s,r,n,i,"next",t)}function i(t){g(c,s,r,n,i,"throw",t)}n(void 0)}))}}var C={name:"CatalogPage",components:{CatalogItem:u.a,Pagination:m},data:function(){return{prices:[],catalog_products:[],categories:[],brands:[],selected:{type:Object,sortBy:null,prices:[],categories:[],brands:[],search:"",custom_search:"",sort_field:"name",sort_direction:"desc"},meta_data:{last_page:null,current_page:1,prev_page_url:null,per_page:null,total:""}}},mounted:function(){var t=this;return b(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.fetchProducts(),t.fetchPrices(),t.fetchCategories(),t.fetchBrands();case 4:case"end":return e.stop()}}),e)})))()},watch:{selected:{handler:function(){this.fetchProducts(),this.fetchCategories(),this.fetchBrands(),this.fetchPrices(),this.meta_data.total},deep:!0},search:function(){this.this.meta_data.current_page+1>this.this.meta_data.last_page&&(this.this.meta_data.current_page=this.meta_data.last_page-1)},custom_search:function(){this.this.meta_data.current_page+1>this.this.meta_data.last_page&&(this.this.meta_data.current_page=this.meta_data.last_page-1)}},methods:h(h({},Object(l.b)("catalog",{getProducts:d.a,getCategories:d.b,getPrice:d.c})),{},{change_sort:function(t){switch(t){case"min":this.selected.sort_field="price",this.selected.sort_direction="asc";break;case"max":this.selected.sort_field="price",this.selected.sort_direction="desc"}},fetchProducts:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;o.a.get("/api/catalog/".concat(this.$route.params.slug),{params:h(h({},this.selected),{},{page:e})}).then((function(e){t.catalog_products=e.data.products.data,t.meta_data.last_page=e.data.products.last_page,t.meta_data.current_page=e.data.products.current_page,t.meta_data.prev_page_url=e.data.products.prev_page_url,t.meta_data.total=e.data.products.total,t.meta_data.per_page=e.data.products.per_page}))},fetchBrands:function(){var t=this;return b(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.a.get("/api/catalog/".concat(t.$route.params.slug),{params:n.a.omit(t.selected,"brands")}).then((function(e){t.brands=e.data.brands}));case 2:case"end":return e.stop()}}),e)})))()},fetchCategories:function(){var t=this;return b(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.a.get("/api/catalog/".concat(t.$route.params.slug),{params:n.a.omit(t.selected,"categories")}).then((function(e){t.categories=e.data.categories}));case 2:case"end":return e.stop()}}),e)})))()},fetchPrices:function(){var t=this;return b(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.a.get("/api/catalog/".concat(t.$route.params.slug),{params:n.a.omit(t.selected,"prices")}).then((function(e){t.prices=e.data.prices}));case 2:case"end":return e.stop()}}),e)})))()}})},x=Object(_.a)(C,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("main",{staticClass:"main"},[a("div",{staticClass:"row no-gutters pt-5"},[a("div",{staticClass:"col-12 col-sm-12 col-md-12 col-lg-3"},[a("aside",{staticClass:"aside"},[a("form",[a("div",{staticClass:"product-category form-row pl-1 pr-1 pt-1"},[a("div",{staticClass:"product-producer form-row pl-1 pr-1 pt-1"},[t._m(0),t._v(" "),a("div",{staticClass:"col-12"},[a("div",{staticClass:"form-group"},[a("input",{directives:[{name:"model",rawName:"v-model",value:t.selected.search,expression:"selected.search"}],staticClass:"form-control",attrs:{type:"text",name:"search",id:"catalogSearch",placeholder:"Введите название товара ..."},domProps:{value:t.selected.search},on:{input:function(e){e.target.composing||t.$set(t.selected,"search",e.target.value)}}})])])]),t._v(" "),t._m(1),t._v(" "),a("div",{staticClass:"col-12"},t._l(t.categories,(function(e,s){return a("label",{key:s,staticClass:"container"},[0!==e.products_count?a("span",{staticClass:"checkbox-text"},[t._v(t._s(e.name)+" ("+t._s(e.products_count)+")")]):t._e(),t._v(" "),0!==e.products_count?a("input",{directives:[{name:"model",rawName:"v-model",value:t.selected.categories,expression:"selected.categories"}],attrs:{type:"checkbox",name:"category",id:"category"+s},domProps:{value:e.id,checked:Array.isArray(t.selected.categories)?t._i(t.selected.categories,e.id)>-1:t.selected.categories},on:{change:function(a){var s=t.selected.categories,r=a.target,c=!!r.checked;if(Array.isArray(s)){var n=e.id,i=t._i(s,n);r.checked?i<0&&t.$set(t.selected,"categories",s.concat([n])):i>-1&&t.$set(t.selected,"categories",s.slice(0,i).concat(s.slice(i+1)))}else t.$set(t.selected,"categories",c)}}}):t._e(),t._v(" "),0!==e.products_count?a("span",{staticClass:"checkmark"}):t._e()])})),0)]),t._v(" "),a("div",{staticClass:"price-filter form-row pl-1 pr-1 "},[t._m(2),t._v(" "),a("div",{staticClass:"col-12"},t._l(t.prices,(function(e,s){return a("label",{key:s,staticClass:"container"},[0!==e.products_count?a("span",{staticClass:"checkbox-text"},[t._v(" "+t._s(e.name)+" ("+t._s(e.products_count)+")")]):t._e(),t._v(" "),0!==e.products_count?a("input",{directives:[{name:"model",rawName:"v-model",value:t.selected.prices,expression:"selected.prices"}],attrs:{type:"checkbox",name:"category",id:"price"+s},domProps:{value:s,checked:Array.isArray(t.selected.prices)?t._i(t.selected.prices,s)>-1:t.selected.prices},on:{change:function(e){var a=t.selected.prices,r=e.target,c=!!r.checked;if(Array.isArray(a)){var n=s,i=t._i(a,n);r.checked?i<0&&t.$set(t.selected,"prices",a.concat([n])):i>-1&&t.$set(t.selected,"prices",a.slice(0,i).concat(a.slice(i+1)))}else t.$set(t.selected,"prices",c)}}}):t._e(),t._v(" "),0!==e.products_count?a("span",{staticClass:"checkmark"}):t._e()])})),0)]),t._v(" "),a("div",{staticClass:"product-brand form-row pl-1 pr-1 pt-1"},[t._m(3),t._v(" "),a("div",{staticClass:"col-12"},t._l(t.brands,(function(e,s){return a("label",{key:s,staticClass:"container"},[0!==e.products_count?a("span",{staticClass:"checkbox-text"},[t._v(t._s(e.name)+" ("+t._s(e.products_count)+")")]):t._e(),t._v(" "),0!==e.products_count?a("input",{directives:[{name:"model",rawName:"v-model",value:t.selected.brands,expression:"selected.brands"}],attrs:{type:"checkbox",name:"brand",id:"brand"+s},domProps:{value:e.id,checked:Array.isArray(t.selected.brands)?t._i(t.selected.brands,e.id)>-1:t.selected.brands},on:{change:function(a){var s=t.selected.brands,r=a.target,c=!!r.checked;if(Array.isArray(s)){var n=e.id,i=t._i(s,n);r.checked?i<0&&t.$set(t.selected,"brands",s.concat([n])):i>-1&&t.$set(t.selected,"brands",s.slice(0,i).concat(s.slice(i+1)))}else t.$set(t.selected,"brands",c)}}}):t._e(),t._v(" "),0!==e.products_count?a("span",{staticClass:"checkmark"}):t._e()])})),0)])])])]),t._v(" "),a("div",{staticClass:"col-12 col-sm-12 col-md-12 col-lg-9"},[a("div",{staticClass:"row no-gutters"},[a("div",{staticClass:"col-12"},[a("div",{staticClass:"d-flex flex-row flex-wrap justify-content-between"},[a("div",{staticClass:"product-qty"},[a("input",{directives:[{name:"model",rawName:"v-model",value:t.selected.custom_search,expression:"selected.custom_search"}],staticClass:"ml-3 form-control",attrs:{type:"text",name:"search",id:"productSearch",placeholder:"Поиск ..."},domProps:{value:t.selected.custom_search},on:{input:function(e){e.target.composing||t.$set(t.selected,"custom_search",e.target.value)}}}),t._v(" "),a("p",{staticClass:"font-weight-bold pt-2 pl-3"},[t._v("В наличии ("+t._s(this.meta_data.total)+") шт.")])]),t._v(" "),a("div",{staticClass:"product-sort"},[a("div",{staticClass:"dropdown"},[a("button",{staticClass:"btn-sort p-3",attrs:{type:"button",id:"dropdownMenuButton","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[t._v("\n                                    Сортировать по цене:\n                                ")]),t._v(" "),a("div",{staticClass:"dropdown-menu",attrs:{"aria-labelledby":"dropdownMenuButton"}},[a("a",{staticClass:"btn-sort m-1",on:{click:function(e){return t.change_sort("max")}}},[t._v("По увеличению")]),t._v(" "),a("a",{staticClass:"btn-sort m-1",on:{click:function(e){return t.change_sort("min")}}},[t._v("По убыванию")])])])])])])]),t._v(" "),a("div",{staticClass:"row no-gutters"},t._l(t.catalog_products,(function(t){return a("CatalogItem",{key:t.id,attrs:{product:t}})})),1),t._v(" "),a("div",{staticClass:"row no-gutters mt-2 pr-4 pb-5"},[a("div",{staticClass:"col-12"},[a("nav",{attrs:{"aria-label":"Page navigation product  "}},[a("pagination",{attrs:{meta_data:t.meta_data},on:{next:t.fetchProducts}})],1)])])])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12"},[e("div",{staticClass:"d-flex flex-row"},[e("h5",[this._v("Поиск")]),this._v(" "),e("div",{staticClass:"line"})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12"},[e("div",{staticClass:"d-flex flex-row"},[e("h5",[this._v("Категория")]),this._v(" "),e("div",{staticClass:"line"})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12"},[e("div",{staticClass:"d-flex flex-row"},[e("h5",[this._v("Цена")]),this._v(" "),e("div",{staticClass:"line"})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12"},[e("div",{staticClass:"d-flex flex-row"},[e("h5",[this._v("Бренды")]),this._v(" "),e("div",{staticClass:"line"})])])}],!1,null,null,null);e.default=x.exports}}]);
  //# sourceMappingURL=3.js.map