{"version":3,"sources":["webpack:///./src/components/AdminComponents/ProductoPresentacionesProcessAdmin.vue?71a4","webpack:///./src/services/presentaciones.service.js","webpack:///./src/components/AdminComponents/ProductoPresentacionesProcessAdmin.vue?6feb","webpack:///./src/services/productos-presentaciones.service.js","webpack:///src/components/AdminComponents/ProductoPresentacionesProcessAdmin.vue","webpack:///./src/components/AdminComponents/ProductoPresentacionesProcessAdmin.vue?a84e","webpack:///./src/components/AdminComponents/ProductoPresentacionesProcessAdmin.vue"],"names":["PresentacionesService","axios","get","process","id","data","post","delete","render","_vm","this","_h","$createElement","_c","_self","staticClass","_v","producto","staticStyle","_s","_f","nombre","descripcion","_e","ref","attrs","presentaciones","presentacionIdState","model","value","form","callback","$$v","$set","expression","precioState","trim","optionsDisponible","on","handleSubmit","type","reset","textSearch","windowWidth","items","fields","loadingData","sortBy","sortDesc","perPage","currentPage","toLowerCase","$event","scopedSlots","_u","key","fn","item","disponible","urlImagesCategorias","directives","name","rawName","modifiers","setModoEdition","Object","assign","deleteItem","proxy","rows","optionsPerPage","staticRenderFns","ProductosPresentacionesService","put","productosService","presentacionesService","productosPresentacionesService","producto_id","presentacion_id","precio","from","window","innerWidth","itemSeleted","created","$route","params","mounted","recoveryDataProducto","recuperarPresentaciones","recoveryPresentacionesDelProducto","$nextTick","addEventListener","payLoad","action","beforeDestroy","removeEventListener","methods","validation","title","variant","message","createRegister","editRegister","inProcess","validPrecio","validacionPresentacionIdSelect","titleModal","$t","messageModal","ejecuteDelete","$router","push","watch","to","computed","length","component"],"mappings":"2IAAA,W,qHCEqBA,E,4FACnB,WACE,OAAOC,IAAMC,IAAIC,mE,qBAEnB,SAAQC,GACN,OAAOH,IAAMC,IAAIC,6DAAmDC,K,gCAEtE,SAAmBC,GACjB,OAAOJ,IAAMK,KAAKH,4DAAkDE,K,gCAEtE,SAAmBD,GACjB,IAAMC,EAAK,CACTD,MAEF,OAAOH,IAAMM,OAAOJ,4DAAkD,CAACE,W,8BAEzE,SAAiBA,GACf,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E,KAAK8B,KAAO,SACZ0E,EAAG5B,OAAOlF,GAChB,kCACA,mBAAQ,KAAR,UACMM,KAAK8E,uBACL9E,KAAKgF,kCAAkChF,KAAK2E,OAAOC,OAAOlF,IAC1DM,KAAK+B,UAGT0E,SAAU,CACR9C,KADJ,WAEM,OAAO3D,KAAKkC,MAAMwE,UCldmW,I,wBCQvXC,EAAY,eACd,EACA7G,EACA+D,GACA,EACA,KACA,WACA,MAIa,aAAA8C,E","file":"js/chunk-72310b07.a9cb3597.js","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ProductoPresentacionesProcessAdmin.vue?vue&type=style&index=0&id=315fc9ab&lang=scss&scoped=true&\"","import axios from \"axios\";\r\n\r\nexport default class PresentacionesService {\r\n getAll(){\r\n return axios.get(process.env.VUE_APP_API_PUBLIC + \"presentaciones/all\")\r\n }\r\n getById(id){\r\n return axios.get(process.env.VUE_APP_API_PUBLIC + \"presentaciones/\"+id)\r\n }\r\n createPresentacion(data){\r\n return axios.post(process.env.VUE_APP_API_PUBLIC + \"presentaciones\",data)\r\n }\r\n deletePresentacion(id){\r\n const data={\r\n id\r\n }\r\n return axios.delete(process.env.VUE_APP_API_PUBLIC + \"presentaciones\",{data})\r\n }\r\n editPresentacion(data){\r\n return axios.post(process.env.VUE_APP_API_PUBLIC + \"presentaciones/edit\",data)\r\n }\r\n}\r\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"container-cental\"},[_c('h1',{staticClass:\"mt-5 mb-5\"},[_vm._v(\"PRESENTACIONES DE UN PRODUCTO\")]),(_vm.producto.nombre)?_c('div',{staticClass:\"row p-3\"},[_c('div',{staticClass:\"col-12\",staticStyle:{\"font-size\":\"35px\"}},[_vm._v(\" \"+_vm._s(_vm._f(\"todasLasPrimerasMayusculas\")(_vm.producto.nombre))+\" \")]),_c('div',{staticClass:\"col-12\"},[_vm._v(\" \"+_vm._s(_vm.producto.descripcion)+\" \")])]):_vm._e(),_c('div',{staticStyle:{\"padding\":\"30px\"}},[_c('b-form',{ref:\"formAdd\",staticStyle:{\"border\":\"1px solid #d8d8d8\"}},[_c('div',{staticClass:\"row p-3\"},[_c('b-form-group',{staticClass:\"col-md-3\",attrs:{\"id\":\"presentacionId\",\"label\":\"Presentacion*\",\"label-for\":\"presentacionId\"}},[_c('b-form-select',{ref:\"presentacionId\",attrs:{\"id\":\"presentacionId\",\"options\":_vm.presentaciones,\"state\":_vm.presentacionIdState,\"required\":\"\"},model:{value:(_vm.form.presentacion_id),callback:function ($$v) {_vm.$set(_vm.form, \"presentacion_id\", $$v)},expression:\"form.presentacion_id\"}})],1),_c('b-form-group',{staticClass:\"col-md-3\",attrs:{\"id\":\"precio\",\"label\":\"Precio*\",\"label-for\":\"precio\"}},[_c('b-form-input',{ref:\"precio\",attrs:{\"id\":\"precio\",\"type\":\"number\",\"placeholder\":\"precio del producto\",\"state\":_vm.precioState,\"required\":\"\",\"step\":\"0.1\",\"min\":0.1},model:{value:(_vm.form.precio),callback:function ($$v) {_vm.$set(_vm.form, \"precio\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"form.precio\"}})],1),_c('b-form-group',{staticClass:\"col-md-3\",attrs:{\"label\":\"Disponible\"}},[_c('b-form-radio-group',{staticClass:\"mb-3\",attrs:{\"options\":_vm.optionsDisponible,\"value-field\":\"item\",\"text-field\":\"name\"},model:{value:(_vm.form.disponible),callback:function ($$v) {_vm.$set(_vm.form, \"disponible\", $$v)},expression:\"form.disponible\"}})],1),_c('div',{staticClass:\"col-md-3 d-flex align-items-center justify-content-center\"},[_c('b-button',{attrs:{\"variant\":\"primary\"},on:{\"click\":_vm.handleSubmit}},[_vm._v(_vm._s(_vm.type == \"edit\" ? \"Guardar Cambios\" : \"Agregar\"))]),_c('b-button',{staticClass:\"ml-3\",attrs:{\"variant\":\"danger\"},on:{\"click\":_vm.reset}},[_vm._v(_vm._s(_vm.type == \"edit\" ? \"Cancelar\" : \"Salir\"))])],1)],1)])],1),_c('div',{staticClass:\"container-actions-top-table\"},[_c('div',{staticClass:\"container-searcher\"},[_c('b-input-group',{staticClass:\"mb-2\",attrs:{\"size\":\"sm\"}},[_c('b-input-group-prepend',{attrs:{\"is-text\":\"\"}},[_c('b-icon',{attrs:{\"icon\":\"search\"}})],1),_c('b-form-input',{attrs:{\"type\":\"search\",\"placeholder\":\"Buscador\"},model:{value:(_vm.textSearch),callback:function ($$v) {_vm.textSearch=(typeof $$v === 'string'? $$v.trim(): $$v)},expression:\"textSearch\"}})],1)],1)]),_c('div',{staticClass:\"container-table\"},[_c('b-table',{attrs:{\"striped\":\"\",\"stacked\":_vm.windowWidth < 600,\"hover\":\"\",\"items\":_vm.items,\"fields\":_vm.fields,\"busy\":_vm.loadingData,\"sort-by\":_vm.sortBy,\"sort-desc\":_vm.sortDesc,\"sort-icon-left\":\"\",\"responsive\":\"sm\",\"per-page\":_vm.perPage,\"current-page\":_vm.currentPage,\"filter\":_vm.textSearch.toLowerCase()},on:{\"update:sortBy\":function($event){_vm.sortBy=$event},\"update:sort-by\":function($event){_vm.sortBy=$event},\"update:sortDesc\":function($event){_vm.sortDesc=$event},\"update:sort-desc\":function($event){_vm.sortDesc=$event}},scopedSlots:_vm._u([{key:\"cell(disponible)\",fn:function(data){return [_vm._v(\" \"+_vm._s(data.item.disponible == 1 ? \"SI\" : \"NO\")+\" \")]}},{key:\"cell(imagen)\",fn:function(data){return [_c('img',{attrs:{\"src\":(\"\" + _vm.urlImagesCategorias + (data.item.imagen)),\"alt\":\"\",\"height\":\"100\"}})]}},{key:\"cell(actions)\",fn:function(data){return [_c('b-icon',{directives:[{name:\"b-tooltip\",rawName:\"v-b-tooltip.hover\",modifiers:{\"hover\":true}}],staticStyle:{\"margin\":\"0px 10px\",\"cursor\":\"pointer\"},attrs:{\"icon\":\"pencil-square\",\"variant\":\"warning\",\"scale\":\"1.5\",\"title\":\"Editar\"},on:{\"click\":function($event){return _vm.setModoEdition(Object.assign({}, data.item))}}}),_c('b-icon',{directives:[{name:\"b-tooltip\",rawName:\"v-b-tooltip.hover\",modifiers:{\"hover\":true}}],staticStyle:{\"margin\":\"0px 10px\",\"cursor\":\"pointer\"},attrs:{\"icon\":\"x-circle\",\"variant\":\"danger\",\"scale\":\"1.5\",\"title\":\"Eliminar\"},on:{\"click\":function($event){return _vm.deleteItem(Object.assign({}, data.item))}}})]}},{key:\"table-busy\",fn:function(){return [_c('div',{staticClass:\"text-center text-danger my-2\"},[_c('b-spinner',{staticClass:\"align-middle\"}),_c('strong',{staticStyle:{\"margin-left\":\"5px\"}},[_vm._v(\"Cargando Datos...\")])],1)]},proxy:true}])})],1),_c('div',{staticClass:\"container-paginator\"},[_c('b-pagination',{attrs:{\"total-rows\":_vm.rows,\"per-page\":_vm.perPage,\"aria-controls\":\"my-table\"},model:{value:(_vm.currentPage),callback:function ($$v) {_vm.currentPage=$$v},expression:\"currentPage\"}}),_c('span',{staticStyle:{\"margin-left\":\"15px\"}},[_vm._v(\"Items por página\")]),_c('b-form-select',{staticStyle:{\"width\":\"80px\",\"margin-left\":\"10px\"},attrs:{\"options\":_vm.optionsPerPage},model:{value:(_vm.perPage),callback:function ($$v) {_vm.perPage=$$v},expression:\"perPage\"}})],1)])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import axios from \"axios\";\r\n\r\nexport default class ProductosPresentacionesService {\r\n getByProductId(id){\r\n return axios.get(process.env.VUE_APP_API_PUBLIC + \"produpres/producto/\"+id)\r\n }\r\n deletePresentacionDeProducto(id){\r\n const data={\r\n id\r\n }\r\n return axios.delete(process.env.VUE_APP_API_PUBLIC + \"prodpres\",{data})\r\n }\r\n createProductoPresentacion(data){\r\n return axios.post(process.env.VUE_APP_API_PUBLIC + \"produpres\",data)\r\n }\r\n\r\n editProductoPresentacion(data){\r\n return axios.put(process.env.VUE_APP_API_PUBLIC + \"prodpres/edit\",data)\r\n } \r\n}\r\n","<template>\r\n <div class=\"container-cental\">\r\n <h1 class=\"mt-5 mb-5\">PRESENTACIONES DE UN PRODUCTO</h1>\r\n <div class=\"row p-3\" v-if=\"producto.nombre\">\r\n <div class=\"col-12\" style=\"font-size: 35px\">\r\n {{ producto.nombre | todasLasPrimerasMayusculas }}\r\n </div>\r\n <div class=\"col-12\">\r\n {{ producto.descripcion }}\r\n </div>\r\n </div>\r\n <div style=\"padding: 30px\">\r\n <b-form ref=\"formAdd\" style=\"border: 1px solid #d8d8d8\">\r\n <div class=\"row p-3\">\r\n <!-- selector de presentacion -->\r\n <b-form-group\r\n id=\"presentacionId\"\r\n label=\"Presentacion*\"\r\n label-for=\"presentacionId\"\r\n class=\"col-md-3\"\r\n >\r\n <b-form-select\r\n id=\"presentacionId\"\r\n v-model=\"form.presentacion_id\"\r\n :options=\"presentaciones\"\r\n ref=\"presentacionId\"\r\n :state=\"presentacionIdState\"\r\n required\r\n ></b-form-select>\r\n </b-form-group>\r\n <!-- PRECIO -->\r\n <b-form-group\r\n id=\"precio\"\r\n label=\"Precio*\"\r\n label-for=\"precio\"\r\n class=\"col-md-3\"\r\n >\r\n <b-form-input\r\n id=\"precio\"\r\n v-model.trim=\"form.precio\"\r\n type=\"number\"\r\n placeholder=\"precio del producto\"\r\n ref=\"precio\"\r\n :state=\"precioState\"\r\n required\r\n step=\"0.1\"\r\n :min=\"0.1\"\r\n ></b-form-input>\r\n </b-form-group>\r\n <!-- disponible -->\r\n <b-form-group label=\"Disponible\" class=\"col-md-3\">\r\n <b-form-radio-group\r\n v-model=\"form.disponible\"\r\n :options=\"optionsDisponible\"\r\n class=\"mb-3\"\r\n value-field=\"item\"\r\n text-field=\"name\"\r\n ></b-form-radio-group>\r\n </b-form-group>\r\n <div\r\n class=\"col-md-3 d-flex align-items-center justify-content-center\"\r\n >\r\n <b-button variant=\"primary\" @click=\"handleSubmit\">{{\r\n type == \"edit\" ? \"Guardar Cambios\" : \"Agregar\"\r\n }}</b-button>\r\n <b-button variant=\"danger\" class=\"ml-3\" @click=\"reset\">{{\r\n type == \"edit\" ? \"Cancelar\" : \"Salir\"\r\n }}</b-button>\r\n </div>\r\n </div>\r\n </b-form>\r\n </div>\r\n\r\n <div class=\"container-actions-top-table\">\r\n <div class=\"container-searcher\">\r\n <b-input-group size=\"sm\" class=\"mb-2\">\r\n <b-input-group-prepend is-text>\r\n <b-icon icon=\"search\"></b-icon>\r\n </b-input-group-prepend>\r\n <b-form-input\r\n type=\"search\"\r\n placeholder=\"Buscador\"\r\n v-model.trim=\"textSearch\"\r\n ></b-form-input>\r\n </b-input-group>\r\n </div>\r\n </div>\r\n <!-- tabla de presentaciones agregadas al producto -->\r\n <div class=\"container-table\">\r\n <b-table\r\n striped\r\n :stacked=\"windowWidth < 600\"\r\n hover\r\n :items=\"items\"\r\n :fields=\"fields\"\r\n :busy=\"loadingData\"\r\n :sort-by.sync=\"sortBy\"\r\n :sort-desc.sync=\"sortDesc\"\r\n sort-icon-left\r\n responsive=\"sm\"\r\n :per-page=\"perPage\"\r\n :current-page=\"currentPage\"\r\n :filter=\"textSearch.toLowerCase()\"\r\n >\r\n <template #cell(disponible)=\"data\">\r\n {{ data.item.disponible == 1 ? \"SI\" : \"NO\" }}\r\n </template>\r\n <template #cell(imagen)=\"data\">\r\n <img\r\n :src=\"`${urlImagesCategorias}${data.item.imagen}`\"\r\n alt=\"\"\r\n height=\"100\"\r\n />\r\n </template>\r\n <template #cell(actions)=\"data\">\r\n <b-icon\r\n icon=\"pencil-square\"\r\n variant=\"warning\"\r\n @click=\"setModoEdition({ ...data.item })\"\r\n scale=\"1.5\"\r\n style=\"margin: 0px 10px; cursor: pointer\"\r\n v-b-tooltip.hover\r\n title=\"Editar\"\r\n ></b-icon>\r\n <b-icon\r\n icon=\"x-circle\"\r\n variant=\"danger\"\r\n @click=\"deleteItem({ ...data.item })\"\r\n scale=\"1.5\"\r\n style=\"margin: 0px 10px; cursor: pointer\"\r\n v-b-tooltip.hover\r\n title=\"Eliminar\"\r\n ></b-icon>\r\n </template>\r\n <template #table-busy>\r\n <div class=\"text-center text-danger my-2\">\r\n <b-spinner class=\"align-middle\"></b-spinner>\r\n <strong style=\"margin-left: 5px\">Cargando Datos...</strong>\r\n </div>\r\n </template>\r\n </b-table>\r\n </div>\r\n <div class=\"container-paginator\">\r\n <b-pagination\r\n v-model=\"currentPage\"\r\n :total-rows=\"rows\"\r\n :per-page=\"perPage\"\r\n aria-controls=\"my-table\"\r\n ></b-pagination>\r\n <span style=\"margin-left: 15px\">Items por página</span>\r\n <b-form-select\r\n v-model=\"perPage\"\r\n :options=\"optionsPerPage\"\r\n style=\"width: 80px; margin-left: 10px\"\r\n ></b-form-select>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport ProductosPresentacionesService from \"@/services/productos-presentaciones.service\";\r\nimport ProductosService from \"@/services/productos.service\";\r\nimport PresentacionesService from \"@/services/presentaciones.service\";\r\nimport EventBus from \"@/services/eventBus.js\";\r\nexport default {\r\n name: \"UserProcessAdmin\",\r\n data() {\r\n return {\r\n productosService: null,\r\n presentacionesService: null,\r\n productosPresentacionesService: null,\r\n producto: {},\r\n form: {\r\n producto_id: null,\r\n presentacion_id: null,\r\n precio: null,\r\n disponible: 2,\r\n },\r\n precioState: null,\r\n presentacionIdState: null,\r\n optionsDisponible: [\r\n { item: 1, name: \"SI\" },\r\n { item: 2, name: \"NO\" },\r\n ],\r\n presentaciones: [{ text: \"Seleccione una presentación\", value: null }],\r\n type: \"create\",\r\n sortBy: \"presentacion\",\r\n fields: [\r\n { key: \"presentacion\", sortable: true },\r\n { key: \"precio\", sortable: true },\r\n { key: \"disponible\", sortable: true },\r\n { key: \"actions\", sortable: false },\r\n ],\r\n from: \"productopresentacionesadmin\",\r\n items: [],\r\n windowWidth: window.innerWidth,\r\n loadingData: false,\r\n perPage: 10,\r\n currentPage: 1,\r\n optionsPerPage: [5, 10, 25, 50, 100],\r\n textSearch: \"\",\r\n itemSeleted: null,\r\n sortDesc: false,\r\n };\r\n },\r\n created() {\r\n this.productosService = new ProductosService();\r\n this.presentacionesService = new PresentacionesService();\r\n this.productosPresentacionesService = new ProductosPresentacionesService();\r\n this.$route.params.id\r\n ? (this.form.producto_id = this.$route.params.id)\r\n : this.$router.push({ name: \"Admin\" });\r\n },\r\n mounted() {\r\n this.recoveryDataProducto();\r\n this.recuperarPresentaciones();\r\n this.recoveryPresentacionesDelProducto(this.$route.params.id);\r\n this.$nextTick(() => {\r\n window.addEventListener(\"resize\", () => {\r\n this.windowWidth = window.innerWidth;\r\n });\r\n });\r\n EventBus.$on(\"RESPONSE_MODAL_QUESTION\", (payLoad) => {\r\n if (payLoad.from == this.from) {\r\n switch (payLoad.action) {\r\n case \"delete\":\r\n this.ejecuteDelete();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n });\r\n },\r\n beforeDestroy() {\r\n window.removeEventListener(\"resize\", () => {\r\n this.windowWidth = window.innerWidth;\r\n });\r\n },\r\n methods: {\r\n recoveryDataProducto() {\r\n this.productosService\r\n .getById(this.$route.params.id)\r\n .then((result) => {\r\n this.producto = {};\r\n if (result.data.data) {\r\n this.producto = { ...result.data.data };\r\n } else {\r\n this.loadingData = false;\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"El producto no existe\",\r\n });\r\n this.$router.push({ name: \"ProductosList\" });\r\n }\r\n })\r\n .catch((err) => {\r\n console.log(err);\r\n });\r\n },\r\n recuperarPresentaciones() {\r\n this.presentacionesService\r\n .getAll()\r\n .then((result) => {\r\n this.presentaciones = this.presentaciones.concat(\r\n result.data.data.map((item) => {\r\n return { text: item.nombre, value: item.id };\r\n })\r\n );\r\n })\r\n .catch(() => {\r\n this.loadingData = false;\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"Error al recuperar listado de presentaciones\",\r\n });\r\n });\r\n },\r\n recoveryPresentacionesDelProducto(id) {\r\n this.loadingData = true;\r\n this.productosPresentacionesService\r\n .getByProductId(id)\r\n .then((result) => {\r\n this.items = [...result.data.data];\r\n this.loadingData = false;\r\n })\r\n .catch(() => {\r\n this.loadingData = false;\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"Error al recuperar items de la lista\",\r\n });\r\n });\r\n },\r\n handleSubmit() {\r\n if (!this.validation()) {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"warning\",\r\n message: \"Debes completar los campos obligatorios\",\r\n });\r\n return false\r\n }\r\n if (this.type === \"create\") {\r\n this.createRegister();\r\n } else {\r\n this.editRegister();\r\n }\r\n },\r\n createRegister() {\r\n this.inProcess = true;\r\n this.productosPresentacionesService\r\n .createProductoPresentacion(this.form)\r\n .then((result) => {\r\n if (result.data.status == 200) {\r\n this.form = {\r\n producto_id: this.producto.id,\r\n presentacion_id: null,\r\n precio: null,\r\n disponible: 2,\r\n };\r\n this.type = \"create\";\r\n this.items.push(result.data.data);\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Felicidades\",\r\n variant: \"success\",\r\n message: \"Registro creado satisfactoriamente\",\r\n });\r\n } else {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: result.data.errores.join(\" - \"),\r\n });\r\n }\r\n this.inProcess = false;\r\n })\r\n .catch(() => {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"Error al guardar el registro\",\r\n });\r\n this.inProcess = false;\r\n });\r\n },\r\n editRegister() {\r\n this.inProcess = true;\r\n this.productosPresentacionesService\r\n .editProductoPresentacion(this.form)\r\n .then((result) => {\r\n if (result.data.status == 200) {\r\n this.items = this.items.filter((item) => {\r\n return item.id != this.itemSeleted.id;\r\n });\r\n this.items.push(result.data.data);\r\n this.reset();\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Felicidades\",\r\n variant: \"success\",\r\n message: \"Registro editado satisfactoriamente\",\r\n });\r\n } else {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: result.data.errores.join(\" - \"),\r\n });\r\n }\r\n this.inProcess = false;\r\n })\r\n .catch(() => {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"Error al editar el registro\",\r\n });\r\n this.inProcess = false;\r\n });\r\n },\r\n validation() {\r\n /* validando precio*/\r\n const validPrecio = this.$refs.precio.checkValidity();\r\n this.precioState = validPrecio;\r\n /* validando un select*/\r\n const validacionPresentacionIdSelect = this.$refs.presentacionId.required\r\n ? this.$refs.presentacionId.value\r\n ? true\r\n : false\r\n : true;\r\n this.presentacionIdState = validacionPresentacionIdSelect;\r\n return validPrecio && validacionPresentacionIdSelect;\r\n },\r\n deleteItem(item) {\r\n this.itemSeleted = { ...item };\r\n EventBus.$emit(\"SHOW_MODAL_QUESTION\", {\r\n titleModal: this.$t('messages.elimination'),\r\n messageModal: \"¿Seguro desea eliminar el registro?\",\r\n action: \"delete\",\r\n from: this.from,\r\n });\r\n },\r\n ejecuteDelete() {\r\n if (!this.itemSeleted) return false;\r\n this.productosPresentacionesService\r\n .deletePresentacionDeProducto(this.itemSeleted.id)\r\n .then((result) => {\r\n if (result.data.status == 200) {\r\n this.items = this.items.filter((item) => {\r\n return item.id != this.itemSeleted.id;\r\n });\r\n this.itemSeleted = null;\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Felicidades\",\r\n variant: \"success\",\r\n message: \"Registro eliminado satisfactoriamente\",\r\n });\r\n }\r\n })\r\n .catch(() => {\r\n EventBus.$emit(\"MOSTRAR_TOAST\", {\r\n title: \"Error\",\r\n variant: \"danger\",\r\n message: \"Error al eliminar registro\",\r\n });\r\n });\r\n },\r\n setModoEdition(item) {\r\n this.itemSeleted = { ...item };\r\n this.form = {\r\n id: item.id,\r\n producto_id: item.producto_id,\r\n presentacion_id: item.presentacion_id,\r\n precio: item.precio,\r\n disponible: item.disponible,\r\n };\r\n this.type = \"edit\";\r\n },\r\n reset() {\r\n if (this.type == \"create\") this.$router.push({ name: \"ProductosList\" });\r\n this.itemSeleted = null;\r\n this.form = {\r\n producto_id: this.$route.params.id,\r\n presentacion_id: null,\r\n precio: null,\r\n disponible: 2,\r\n };\r\n this.type = \"create\";\r\n },\r\n },\r\n watch: {\r\n $route(to) {\r\n this.type = \"create\";\r\n to.params.id\r\n ? (this.form.producto_id = to.params.id)\r\n : this.$router.push({ name: \"Admin\" });\r\n this.recoveryDataProducto();\r\n this.recoveryPresentacionesDelProducto(this.$route.params.id);\r\n this.reset();\r\n },\r\n },\r\n computed: {\r\n rows() {\r\n return this.items.length;\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.container-cental {\r\n width: 100%;\r\n min-height: 700px;\r\n}\r\n.container-table {\r\n width: 100%;\r\n min-height: 300px;\r\n padding-bottom: 20px;\r\n}\r\n.container-paginator {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: baseline;\r\n width: 100%;\r\n padding-bottom: 20px;\r\n}\r\n.container-actions-top-table {\r\n display: flex;\r\n flex-wrap: wrap;\r\n justify-content: space-between;\r\n width: 100%;\r\n padding: 20px 30px;\r\n}\r\n@media (max-width: 470px) {\r\n .container-paginator {\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n}\r\n</style>\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ProductoPresentacionesProcessAdmin.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ProductoPresentacionesProcessAdmin.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ProductoPresentacionesProcessAdmin.vue?vue&type=template&id=315fc9ab&scoped=true&\"\nimport script from \"./ProductoPresentacionesProcessAdmin.vue?vue&type=script&lang=js&\"\nexport * from \"./ProductoPresentacionesProcessAdmin.vue?vue&type=script&lang=js&\"\nimport style0 from \"./ProductoPresentacionesProcessAdmin.vue?vue&type=style&index=0&id=315fc9ab&lang=scss&scoped=true&\"\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 \"315fc9ab\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}