text: (window.webpackJsonp=window.webpackJsonp||[]).push([[13],{385:function(t,e,a){"use strict";a.r(e);var n=a(2),r=a.n(n);function s(t,e,a,n,r,s,i){try{var o=t[s](i),c=o.value}catch(t){return void a(t)}o.done?e(c):Promise.resolve(c).then(n,r)}function i(t){return function(){var e=this,a=arguments;return new Promise((function(n,r){var i=t.apply(e,a);function o(t){s(i,n,r,o,c,"next",t)}function c(t){s(i,n,r,o,c,"throw",t)}o(void 0)}))}}var o={data:function(){return{filter:"",listFilter:[],listProductos:[],fullscreenLoading:!1,currentPage1:1,page:0}},mounted:function(){this.getListarProductos()},methods:{handleSizeChange:function(t){console.log("".concat(t," items per page"))},handleCurrentChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.page=t,0==t?t=0:t-=1;var e=10*t,a=e+10;this.listFilter=this.listProductos.slice(e,a)},getListarProductos:function(){var t=this;return i(r.a.mark((function e(){var a;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.fullscreenLoading=!0,"/landing/landing-page/index",e.next=4,t.callGetApi("get","/landing/landing-page/index",{filter:t.filter});case 4:200==(a=e.sent).status?(t.listProductos=a.data,t.handleCurrentChange()):(401==a.status&&(t.$router.push({name:"login"}),location.reload(),localStorage.clear()),419==a.status&&(t.notification("error","Fue necesario recargar la página",0),location.reload())),t.fullscreenLoading=!1;case 7:case"end":return e.stop()}}),e)})))()},abrirLandingPage:function(t){var e=this;return i(r.a.mark((function a(){var n;return r.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return e.fullscreenLoading=!0,"/landing/landing-page/getURI",a.next=4,e.callGetApi("get","/landing/landing-page/getURI",{id:t.id});case 4:200==(n=a.sent).status?e.$router.replace({name:"sms.index",params:{enlace:n.data}}):(401==n.status&&(e.$router.push({name:"login"}),location.reload(),localStorage.clear()),419==n.status&&(e.notification("error","Fue necesario recargar la página",0),location.reload())),e.fullscreenLoading=!1;case 7:case"end":return a.stop()}}),a)})))()},abrirLandingPage2:function(t){var e=this;return i(r.a.mark((function a(){var n;return r.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return e.fullscreenLoading=!0,"/landing/landing-page/getURI",a.next=4,e.callGetApi("get","/landing/landing-page/getURI",{id:t.id});case 4:200==(n=a.sent).status?e.copyURL(n.data):(401==n.status&&(e.$router.push({name:"login"}),location.reload(),localStorage.clear()),419==n.status&&(e.notification("error","Fue necesario recargar la página",0),location.reload())),e.fullscreenLoading=!1;case 7:case"end":return a.stop()}}),a)})))()},abrirExternalLandingPage:function(t){var e=this;return i(r.a.mark((function a(){var n;return r.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return e.fullscreenLoading=!0,"/landing/landing-page/getURI",a.next=4,e.callGetApi("get","/landing/landing-page/getURI",{id:t.id});case 4:200==(n=a.sent).status?window.open("".concat(n.data),"_blank"):(401==n.status&&(e.$router.push({name:"login"}),location.reload(),localStorage.clear()),419==n.status&&(e.notification("error","Fue necesario recargar la página",0),location.reload())),e.fullscreenLoading=!1;case 7:case"end":return a.stop()}}),a)})))()},copyURL:function(t){return i(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,copy(t);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),alert("Cannot copy");case 8:case"end":return e.stop()}}),e,null,[[0,5]])})))()},setCambiarEstadoProducto:function(t,e){var a=this;this.$swal.fire({title:"¿Está seguro de "+(1==t?"desactivar":"activar")+" el cliente?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#2196F3",cancelButtonColor:"#F44336",confirmButtonText:1==t?"Si, desactivar":"Si, activar"}).then((function(n){if(n.value){a.fullscreenLoading=!0;var r="/landing/landing-page/destroy/"+e;axios.delete(r,{params:{status:1==t?"I":"A"}}).then((function(e){a.notification("success","Se "+(1==t?"desactivo":"activo")+" el cliente",0),a.getListarProductos()})).catch((function(t){401==t.response.status&&(a.$router.push({name:"login"}),location.reload(),localStorage.clear(),a.fullscreenLoading=!1),419==t.response.status&&(a.notification("error","Fue necesario recargar la página",0),location.reload())}))}}))}}},c=a(14),l=Object(c.a)(o,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"pcoded-content"},[a("div",{staticClass:"page-header"},[a("div",{staticClass:"page-block"},[a("div",{staticClass:"row align-items-center"},[a("div",{staticClass:"col-md-12"},[t._m(0),t._v(" "),a("ul",{staticClass:"breadcrumb"},[a("li",{staticClass:"breadcrumb-item"},[a("router-link",{attrs:{to:{name:"landing.page"}}},[a("i",{staticClass:"fas fa-users"})])],1),t._v(" "),a("li",{staticClass:"breadcrumb-item"},[a("router-link",{attrs:{to:{name:"landing.page"}}},[t._v("\n                Navegar entre Productos\n              ")])],1)])])])])]),t._v(" "),a("div",{staticClass:"row"},[a("div",{staticClass:"col-sm-12"},[a("div",{staticClass:"card"},[a("div",{staticClass:"card-header"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col-sm-6"},[a("form",{staticClass:"form-inline",on:{submit:function(t){t.preventDefault()}}},[a("div",{staticClass:"form-group mx-sm-3 mb-2 fill"},[a("label",{staticClass:"sr-only"},[t._v("Buscar")]),t._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:t.filter,expression:"filter"}],staticClass:"form-control",attrs:{type:"text",placeholder:"Buscar"},domProps:{value:t.filter},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.preventDefault(),t.getListarProductos(e))},input:function(e){e.target.composing||(t.filter=e.target.value)}}})]),t._v(" "),a("button",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:t.fullscreenLoading,expression:"fullscreenLoading",modifiers:{fullscreen:!0,lock:!0}}],staticClass:"btn btn-primary mb-2",attrs:{type:"button"},on:{"&click":function(e){return t.getListarProductos(e)}}},[t._v("\n                  Buscar\n                ")])])]),t._v(" "),t.listPermissions.includes("producto.crear")?a("div",{staticClass:"btn-group card-option"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Nuevo Producto",placement:"top"}},[a("router-link",{staticClass:"btn btn-icon btn-outline-primary",attrs:{to:{name:"producto.crear"}}},[a("i",{staticClass:"feather icon-plus"})])],1)],1):t._e()])]),t._v(" "),a("div",{staticClass:"card-body table-border-style"},[a("div",{staticClass:"table-responsive"},[t.listFilter.length?[a("table",{staticClass:"table table-hover"},[t._m(1),t._v(" "),a("tbody",t._l(t.listFilter,(function(e,n){return a("tr",{key:n},[a("td",{domProps:{textContent:t._s(e.description)}}),t._v(" "),a("td",{domProps:{textContent:t._s(e.detalle)}}),t._v(" "),a("td",{domProps:{textContent:t._s(e.price)}}),t._v(" "),a("td",["A"==e.status?a("el-tag",{attrs:{type:"success"},domProps:{textContent:t._s(e.status_description)}}):a("el-tag",{attrs:{type:"danger"},domProps:{textContent:t._s(e.status_description)}})],1),t._v(" "),a("td",["A"==e.status?[t.listPermissions.includes("producto.editar")?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Editar Producto",placement:"top"}},[a("router-link",{staticClass:"btn btn-icon btn-outline-primary",attrs:{to:{name:"producto.editar",params:{id:e.id}}}},[a("i",{staticClass:"feather icon-edit"})])],1):t._e(),t._v(" "),t.listPermissions.includes("producto.desactivar")?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Desactivar Producto",placement:"top"}},[a("button",{staticClass:"btn btn-icon btn-outline-danger",on:{click:function(a){return a.preventDefault(),t.setCambiarEstadoProducto(1,e.id)}}},[a("i",{staticClass:"fas fa-eye-slash"})])]):t._e()]:[t.listPermissions.includes("producto.activar")?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Activar Producto",placement:"top"}},[a("button",{staticClass:"btn btn-icon btn-outline-danger",on:{click:function(a){return a.preventDefault(),t.setCambiarEstadoProducto(2,e.id)}}},[a("i",{staticClass:"fas fa-eye"})])]):t._e()],t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Enviar Mensaje",placement:"top"}},[a("button",{staticClass:"btn btn-icon btn-outline-primary",on:{click:function(a){return a.preventDefault(),t.abrirLandingPage(e)}}},[a("i",{staticClass:"fas fa-sms"})])]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Copiar Enlace",placement:"top"}},[a("button",{staticClass:"btn btn-icon btn-outline-primary",on:{click:function(a){return a.preventDefault(),t.abrirLandingPage2(e)}}},[a("i",{staticClass:"fas fa-link"})])]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Abrir LandingPage",placement:"top"}},[a("button",{staticClass:"btn btn-icon btn-outline-primary",on:{click:function(a){return a.preventDefault(),t.abrirExternalLandingPage(e)}}},[a("i",{staticClass:"fas fa-external-link-alt"})])])],2)])})),0)]),t._v(" "),a("el-pagination",{attrs:{background:"","current-page":t.currentPage1,"page-size":10,layout:"total, prev, pager, next",total:t.listProductos.length},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange,"update:currentPage":function(e){t.currentPage1=e},"update:current-page":function(e){t.currentPage1=e}}})]:[a("div",{staticClass:"alert alert-primary",attrs:{role:"alert"}},[t._v("\n                No se encontraron registros\n              ")])]],2)])])])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"page-header-title"},[e("h5",{staticClass:"m-b-10"},[this._v("Gestión Productos")])])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("thead",[a("tr",[a("th",[t._v("Nombre")]),t._v(" "),a("th",[t._v("Detalle")]),t._v(" "),a("th",[t._v("Precio")]),t._v(" "),a("th",[t._v("Estado")]),t._v(" "),a("th",[t._v("Acciones")])])])}],!1,null,"332849e4",null);e.default=l.exports}}]);