text: (window.webpackJsonp=window.webpackJsonp||[]).push([[25],{197:function(t,a,o){"use strict";o.r(a);var e=o(3),n={name:"AdminColorsList",components:{AdminCreateColor:o(34).a,NoDataComponent:e.default},data:function(){return{title:"Kolory",data:{},params:{ordering:"",pagination:""}}},methods:{loadData:function(){var t=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.$axios.get("admin/products/colors/all?page=".concat(a,"&ordering=").concat(this.params.ordering,"&pagination=").concat(this.params.pagination)).then((function(a){t.data=a.data})).catch((function(a){return t.handleAjaxError(a)}))},ordering:function(t){this.params.ordering=t,this.loadData()},pagination:function(t){this.params.pagination=t,this.loadData()},createColorModal:function(){this.$refs.createColor.openModal()},editColorModal:function(t){this.$refs.createColor.openModal("edit",t)},remove:function(t){var a=this;this.$confirm({message:"Na pewno chcesz usunąć kolor?",button:{no:"Nie",yes:"Tak"},callback:function(o){o&&a.$axios.delete("admin/products/colors/remove/".concat(t)).then((function(t){1===t.data.success&&(a.loadData(),a.$notify({group:"notification-success",title:"Udało się",text:t.data.msg}))})).catch((function(t){return a.handleAjaxError(t)}))}})}},created:function(){this.loadData(),document.title=this.title}},r=o(0),i=Object(r.a)(n,(function(){var t=this,a=t.$createElement,o=t._self._c||a;return o("div",{staticClass:"admin-page"},[o("h4",{staticClass:"title"},[t._v(t._s(t.title))]),t._v(" "),o("div",{staticClass:"options"},[o("b-button",{attrs:{variant:"outline-secondary"},on:{click:t.createColorModal}},[o("span",{staticClass:"fa fa-plus"})]),t._v(" "),o("b-dropdown",{attrs:{variant:"outline-secondary"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"fa fa-filter"})]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.ordering("DESC")}}},[t._v("Malejąco")]),t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.ordering("ASC")}}},[t._v("Rosnąco")])],1),t._v(" "),o("b-dropdown",{attrs:{variant:"outline-secondary"},scopedSlots:t._u([{key:"button-content",fn:function(){return[o("span",{staticClass:"fa fa-sort-numeric-up"})]},proxy:!0}])},[t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.pagination(6)}}},[t._v("6")]),t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.pagination(12)}}},[t._v("12")]),t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.pagination(18)}}},[t._v("18")]),t._v(" "),o("b-dropdown-item",{on:{click:function(a){return t.pagination(24)}}},[t._v("24")])],1)],1),t._v(" "),o("div",{staticClass:"content mt-4"},[t.data.data.length>0?o("table",{staticClass:"table"},[t._m(0),t._v(" "),o("tbody",t._l(t.data.data,(function(a,e){return o("tr",[o("th",{staticClass:"text-center",attrs:{scope:"row"}},[t._v(t._s(e+1))]),t._v(" "),o("td",[t._v(t._s(a.name))]),t._v(" "),o("td",[t._v(t._s(a.hex))]),t._v(" "),o("td",{style:"background:"+a.hex}),t._v(" "),o("td",{domProps:{innerHTML:t._s(a.locale)}}),t._v(" "),o("td",[o("b-button",{staticClass:"btn-sm",attrs:{variant:"outline-secondary"},on:{click:function(o){return t.editColorModal(a)}}},[t._v("Edytuj")]),t._v(" "),o("b-button",{staticClass:"btn-sm",attrs:{variant:"outline-secondary"},on:{click:function(o){return t.remove(a.id)}}},[t._v("Usuń\n                    ")])],1)])})),0)]):t._e(),t._v(" "),o("pagination",{attrs:{data:t.data},on:{"pagination-change-page":t.loadData}}),t._v(" "),t.data.data.length<1?o("no-data-component",{attrs:{msg:"Brak danych do wyświetlenia"}}):t._e()],1),t._v(" "),o("admin-create-color",{ref:"createColor",on:{loadData:t.loadData}})],1)}),[function(){var t=this,a=t.$createElement,o=t._self._c||a;return o("thead",[o("tr",[o("th",{staticClass:"text-center",attrs:{scope:"col"}},[t._v("L.p.")]),t._v(" "),o("th",{attrs:{scope:"col"}},[t._v("Nazwa")]),t._v(" "),o("th",{attrs:{scope:"col"}},[t._v("Kod")]),t._v(" "),o("th",{attrs:{scope:"col"}},[t._v("Kolor")]),t._v(" "),o("th",{attrs:{scope:"col"}},[t._v("Język")]),t._v(" "),o("th",{attrs:{scope:"col"}},[t._v("Opcje")])])])}],!1,null,"3659430c",null);a.default=i.exports},34:function(t,a,o){"use strict";var e=o(41),n={name:"AdminCreateColor",components:{ColourPicker:o.n(e).a},data:function(){return{title:"",data:{hex:"",name:"",locale:""},action:!1,colorId:"",loadSpinner:!1}},methods:{save:function(){var t=this;this.loadSpinner=!0;var a="admin/products/colors/create";!0===this.action&&(a="admin/products/colors/update/".concat(this.colorId)),this.$axios.post(a,this.data).then((function(a){t.loadSpinner=!1,1===a.data.success&&(t.data.hex="",t.data.name="",t.$emit("loadData"),t.closeModal())})).catch((function(a){t.loadSpinner=!1,t.handleAjaxError(a)}))},openModal:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;"edit"===t&&(this.action=!0,this.colorId=a.id,this.data.hex=a.hex,this.data.name=a.name,this.data.locale=a.locale_key),this.$refs["create-color"].show()},closeModal:function(){this.$refs["create-color"].hide()}}},r=o(0),i=Object(r.a)(n,(function(){var t=this,a=t.$createElement,o=t._self._c||a;return o("b-modal",{ref:"create-color",attrs:{"hide-footer":"",title:t.title}},[o("form",{on:{submit:function(a){return a.preventDefault(),t.save(a)}}},[o("div",{staticClass:"form-group"},[o("colour-picker",{attrs:{value:t.data.hex,"no-input":"",label:"Wybierz kolor",picker:"sketch"},model:{value:t.data.hex,callback:function(a){t.$set(t.data,"hex",a)},expression:"data.hex"}})],1),t._v(" "),o("div",{staticClass:"form-group"},[o("input",{directives:[{name:"model",rawName:"v-model",value:t.data.name,expression:"data.name"}],staticClass:"form-control",attrs:{id:"name",type:"text",placeholder:"Nazwa","aria-label":"Nazwa"},domProps:{value:t.data.name},on:{input:function(a){a.target.composing||t.$set(t.data,"name",a.target.value)}}})]),t._v(" "),o("div",{staticClass:"form-group"},[o("select",{directives:[{name:"model",rawName:"v-model",value:t.data.locale,expression:"data.locale"}],staticClass:"form-control",attrs:{id:"locale","aria-label":"Wybierz język"},on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.data,"locale",a.target.multiple?o:o[0])}}},[o("option",{attrs:{value:"",selected:""}},[t._v("Wybierz język")]),t._v(" "),o("option",{attrs:{value:"pl"}},[t._v("Polski")]),t._v(" "),o("option",{attrs:{value:"en"}},[t._v("Angielski")])])]),t._v(" "),o("div",{staticClass:"form-group"},[o("b-button",{attrs:{variant:"outline-secondary",type:"submit"}},[t.loadSpinner?o("b-spinner",{attrs:{small:""}}):t._e(),t._v(" Zapisz")],1)],1)])])}),[],!1,null,"a23e3666",null);a.a=i.exports}}]);