Agregada tabla de bonos a la pantalla de admin

This commit is contained in:
Ale 2022-11-13 17:00:24 -03:00
parent 323b77f6dc
commit 6005cc01b7
5 changed files with 587 additions and 51 deletions

477
public/js/app.js vendored
View File

@ -2471,7 +2471,8 @@ __webpack_require__.r(__webpack_exports__);
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PedidosAdminDropdownDescargar_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PedidosAdminDropdownDescargar.vue */ "./resources/js/components/PedidosAdminDropdownDescargar.vue");
/* harmony import */ var _PedidosAdminTablaPedidos_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PedidosAdminTablaPedidos.vue */ "./resources/js/components/PedidosAdminTablaPedidos.vue");
/* harmony import */ var _PedidosAdminTablaBonos_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PedidosAdminTablaBonos.vue */ "./resources/js/components/PedidosAdminTablaBonos.vue");
/* harmony import */ var _PedidosAdminTablaPedidos_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PedidosAdminTablaPedidos.vue */ "./resources/js/components/PedidosAdminTablaPedidos.vue");
//
//
//
@ -2486,13 +2487,20 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "PedidosAdminBody",
components: {
PedidosAdminDropdownDescargar: _PedidosAdminDropdownDescargar_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
PedidosAdminTablaPedidos: _PedidosAdminTablaPedidos_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
PedidosAdminTablaPedidos: _PedidosAdminTablaPedidos_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
PedidosAdminTablaBonosVue: _PedidosAdminTablaBonos_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
},
data: function data() {
return {
@ -2510,25 +2518,17 @@ __webpack_require__.r(__webpack_exports__);
}).length > 0;
}
},
beforeCreate: function beforeCreate() {
var _this = this;
axios.get("/admin/obtener_sesion").then(function (response) {
_this.gdc = response.data.gdc;
_this.fetchPedidos();
});
},
beforeCreate: function beforeCreate() {},
methods: {
fetchPedidos: function fetchPedidos() {
var _this2 = this;
var _this = this;
axios.get("/api/subpedidos/resources", {
params: {
grupo_de_compra: this.gdc
}
}).then(function (response) {
_this2.pedidos = response.data.data;
_this.pedidos = response.data.data;
});
},
totalAprobados: function totalAprobados() {
@ -2545,10 +2545,15 @@ __webpack_require__.r(__webpack_exports__);
}
},
mounted: function mounted() {
var _this3 = this;
var _this2 = this;
Event.$on('sync-aprobacion', function (_) {
_this3.fetchPedidos();
_this2.fetchPedidos();
});
axios.get("/admin/obtener_sesion").then(function (response) {
_this2.gdc = response.data.gdc;
_this2.fetchPedidos();
});
}
});
@ -2614,6 +2619,34 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js&":
/*!*******************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js& ***!
\*******************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "PedidosAdminFilaBono",
props: {
nombre: String,
cantidad: Number,
total: Number
}
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaPedido.vue?vue&type=script&lang=js&":
/*!*********************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminFilaPedido.vue?vue&type=script&lang=js& ***!
@ -2713,6 +2746,121 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js&":
/*!*********************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js& ***!
\*********************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PedidosAdminFilaBono_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PedidosAdminFilaBono.vue */ "./resources/js/components/PedidosAdminFilaBono.vue");
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "PedidosAdminTablaBonos",
components: {
PedidosAdminFilaBonoVue: _PedidosAdminFilaBono_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
},
props: {
pedidos: {
type: Array,
required: true
}
},
computed: {
hayPedidos: function hayPedidos() {
return this.pedidos.length !== 0;
},
hayAprobados: function hayAprobados() {
return this.pedidosAprobados.length > 0;
},
pedidosAprobados: function pedidosAprobados() {
return this.pedidos.filter(function (p) {
return p.aprobado;
});
},
bonosCantidadesTotales: function bonosCantidadesTotales() {
var nombres = [];
var cantidades = [];
var precios = [];
var bonosAprobadosPorPedido = this.bonosPorPedido(this.pedidosAprobados);
bonosAprobadosPorPedido.forEach(function (bs) {
bs.forEach(function (b) {
if (!nombres.includes(b.nombre)) {
nombres.push(b.nombre);
cantidades.push(b.pivot.cantidad);
precios.push(b.precio);
} else {
for (var i = 0; i < nombres.length; i++) {
if (b.nombre === nombres[i]) {
cantidades[i] += b.pivot.cantidad;
}
}
}
});
});
var bonosAprobados = [];
for (var i = 0; i < nombres.length; i++) {
var bono = {
nombre: nombres[i],
cantidad: cantidades[i],
total: cantidades[i] * precios[i]
};
bonosAprobados.push(bono);
}
return bonosAprobados;
},
totalBonos: function totalBonos() {
var total = 0;
var bonos = this.bonosCantidadesTotales;
bonos.forEach(function (b) {
total += b.total;
});
return total;
}
},
methods: {
bonosPorPedido: function bonosPorPedido(pedidosArray) {
return pedidosArray.map(function (p) {
return p.productos.filter(function (pr) {
return pr.bono;
});
});
}
}
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaPedidos.vue?vue&type=script&lang=js&":
/*!***********************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminTablaPedidos.vue?vue&type=script&lang=js& ***!
@ -2722,6 +2870,7 @@ __webpack_require__.r(__webpack_exports__);
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PedidosAdminFilaPedido_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PedidosAdminFilaPedido.vue */ "./resources/js/components/PedidosAdminFilaPedido.vue");
//
//
//
@ -2746,8 +2895,12 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "PedidosAdminTablaPedidos",
components: {
PedidosAdminFilaPedidoVue: _PedidosAdminFilaPedido_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
},
props: {
pedidos: {
type: Array,
@ -5337,29 +5490,30 @@ var render = function () {
class: _vm.animation,
},
[
_c("pedidos-admin-dropdown-descargar", {
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.hayPedidos,
expression: "hayPedidos",
},
_c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.hayPedidos,
expression: "hayPedidos",
},
],
staticClass: "block",
},
[
_c("pedidos-admin-dropdown-descargar", { attrs: { gdc: _vm.gdc } }),
_vm._v(" "),
_c("pedidos-admin-tabla-pedidos", {
attrs: { pedidos: _vm.pedidos },
}),
_vm._v(" "),
_c("pedidos-admin-tabla-bonos", { attrs: { pedidos: _vm.pedidos } }),
],
attrs: { gdc: _vm.gdc },
}),
_vm._v(" "),
_c("pedidos-admin-tabla-pedidos", {
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.hayPedidos,
expression: "hayPedidos",
},
],
attrs: { pedidos: _vm.pedidos },
}),
1
),
_vm._v(" "),
_c(
"p",
@ -5380,8 +5534,7 @@ var render = function () {
),
]
),
],
1
]
)
}
var staticRenderFns = []
@ -5510,6 +5663,36 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true&":
/*!***********************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true& ***!
\***********************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("tr", [
_c("td", [_vm._v(_vm._s(_vm.nombre))]),
_vm._v(" "),
_c("td", [_vm._v(_vm._s(_vm.cantidad))]),
_vm._v(" "),
_c("td", [_vm._v("$" + _vm._s(_vm.total))]),
])
}
var staticRenderFns = []
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaPedido.vue?vue&type=template&id=b410bdee&scoped=true&":
@ -5589,6 +5772,82 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7&":
/*!*************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7& ***!
\*************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"table",
{ staticClass: "table is-fullwidth is-striped is-bordered" },
[
_vm._m(0),
_vm._v(" "),
_c("tfoot", [
_c("tr", [
_c("th"),
_vm._v(" "),
_c("th", [_vm._v("Total bonos")]),
_vm._v(" "),
_c("th", [_vm._v("$ " + _vm._s(_vm.totalBonos))]),
]),
]),
_vm._v(" "),
_c(
"tbody",
_vm._l(_vm.bonosCantidadesTotales, function (bono, i) {
return _c("pedidos-admin-fila-bono", {
key: i,
attrs: {
nombre: bono.nombre,
cantidad: bono.cantidad,
total: bono.total,
},
})
}),
1
),
]
)
}
var staticRenderFns = [
function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("thead", [
_c("tr", [
_c("th", [_c("abbr", { attrs: { title: "Bono" } }, [_vm._v("Bono")])]),
_vm._v(" "),
_c("th", { staticClass: "is-1" }, [
_c("abbr", { attrs: { title: "Cantidad" } }, [_vm._v("Cantidad")]),
]),
_vm._v(" "),
_c("th", [
_c("abbr", { attrs: { title: "Total a Pagar" } }, [
_vm._v("Total $"),
]),
]),
]),
])
},
]
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaPedidos.vue?vue&type=template&id=f46f2f60&":
@ -18566,8 +18825,10 @@ var map = {
"./components/NavMigas.vue": "./resources/js/components/NavMigas.vue",
"./components/PedidosAdminBody.vue": "./resources/js/components/PedidosAdminBody.vue",
"./components/PedidosAdminDropdownDescargar.vue": "./resources/js/components/PedidosAdminDropdownDescargar.vue",
"./components/PedidosAdminFilaBono.vue": "./resources/js/components/PedidosAdminFilaBono.vue",
"./components/PedidosAdminFilaPedido.vue": "./resources/js/components/PedidosAdminFilaPedido.vue",
"./components/PedidosAdminSwitchAprobacion.vue": "./resources/js/components/PedidosAdminSwitchAprobacion.vue",
"./components/PedidosAdminTablaBonos.vue": "./resources/js/components/PedidosAdminTablaBonos.vue",
"./components/PedidosAdminTablaPedidos.vue": "./resources/js/components/PedidosAdminTablaPedidos.vue",
"./components/ProductoModal.vue": "./resources/js/components/ProductoModal.vue",
"./components/ProductoRow.vue": "./resources/js/components/ProductoRow.vue",
@ -19425,6 +19686,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/PedidosAdminFilaBono.vue":
/*!**********************************************************!*\
!*** ./resources/js/components/PedidosAdminFilaBono.vue ***!
\**********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true& */ "./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true&");
/* harmony import */ var _PedidosAdminFilaBono_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PedidosAdminFilaBono.vue?vue&type=script&lang=js& */ "./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_PedidosAdminFilaBono_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
_PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
"ed1359dc",
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/PedidosAdminFilaBono.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js&":
/*!***********************************************************************************!*\
!*** ./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js& ***!
\***********************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminFilaBono_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./PedidosAdminFilaBono.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminFilaBono_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true&":
/*!*****************************************************************************************************!*\
!*** ./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true& ***!
\*****************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminFilaBono.vue?vue&type=template&id=ed1359dc&scoped=true&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminFilaBono_vue_vue_type_template_id_ed1359dc_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/js/components/PedidosAdminFilaPedido.vue":
@ -19563,6 +19893,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/PedidosAdminTablaBonos.vue":
/*!************************************************************!*\
!*** ./resources/js/components/PedidosAdminTablaBonos.vue ***!
\************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7& */ "./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7&");
/* harmony import */ var _PedidosAdminTablaBonos_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PedidosAdminTablaBonos.vue?vue&type=script&lang=js& */ "./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_PedidosAdminTablaBonos_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__["render"],
_PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/PedidosAdminTablaBonos.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js&":
/*!*************************************************************************************!*\
!*** ./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js& ***!
\*************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminTablaBonos_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./PedidosAdminTablaBonos.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminTablaBonos_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7&":
/*!*******************************************************************************************!*\
!*** ./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7& ***!
\*******************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/PedidosAdminTablaBonos.vue?vue&type=template&id=2a92c4e7&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_PedidosAdminTablaBonos_vue_vue_type_template_id_2a92c4e7___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/js/components/PedidosAdminTablaPedidos.vue":

View File

@ -1,11 +1,16 @@
<template>
<div class="container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init">
<pedidos-admin-dropdown-descargar v-show="hayPedidos"
:gdc="gdc">
</pedidos-admin-dropdown-descargar>
<pedidos-admin-tabla-pedidos v-show="hayPedidos"
:pedidos="pedidos">
</pedidos-admin-tabla-pedidos>
<div class="block" v-show="hayPedidos">
<pedidos-admin-dropdown-descargar
:gdc="gdc">
</pedidos-admin-dropdown-descargar>
<pedidos-admin-tabla-pedidos
:pedidos="pedidos">
</pedidos-admin-tabla-pedidos>
<pedidos-admin-tabla-bonos
:pedidos="pedidos">
</pedidos-admin-tabla-bonos>
</div>
<p class="has-text-centered" v-show="!hayPedidos">
Todavía no hay ningún pedido para administrar.
</p>
@ -14,12 +19,14 @@
<script>
import PedidosAdminDropdownDescargar from "./PedidosAdminDropdownDescargar.vue";
import PedidosAdminTablaBonosVue from './PedidosAdminTablaBonos.vue';
import PedidosAdminTablaPedidos from "./PedidosAdminTablaPedidos.vue";
export default {
name: "PedidosAdminBody",
components: {
PedidosAdminDropdownDescargar,
PedidosAdminTablaPedidos
PedidosAdminTablaPedidos,
PedidosAdminTablaBonosVue
},
data() {
return {
@ -36,10 +43,6 @@ export default {
}
},
beforeCreate() {
axios.get("/admin/obtener_sesion").then(response => {
this.gdc = response.data.gdc;
this.fetchPedidos();
});
},
methods: {
fetchPedidos() {
@ -63,7 +66,12 @@ export default {
mounted() {
Event.$on('sync-aprobacion', (_) => {
this.fetchPedidos();
})
});
axios.get("/admin/obtener_sesion").then(response => {
this.gdc = response.data.gdc;
this.fetchPedidos();
});
}
}
</script>

View File

@ -0,0 +1,22 @@
<template>
<tr>
<td>{{ nombre }}</td>
<td>{{ cantidad }}</td>
<td>${{ total }}</td>
</tr>
</template>
<script>
export default {
name: "PedidosAdminFilaBono",
props: {
nombre: String,
cantidad: Number,
total: Number
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,103 @@
<template>
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th><abbr title="Bono">Bono</abbr></th>
<th class="is-1"><abbr title="Cantidad">Cantidad</abbr></th>
<th><abbr title="Total a Pagar">Total $</abbr></th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Total bonos</th>
<th>$ {{ totalBonos }}</th>
</tr>
</tfoot>
<tbody>
<pedidos-admin-fila-bono v-for="(bono, i) in bonosCantidadesTotales" :key="i"
:nombre="bono.nombre"
:cantidad="bono.cantidad"
:total="bono.total">
</pedidos-admin-fila-bono>
</tbody>
</table>
</template>
<script>
import PedidosAdminFilaBonoVue from './PedidosAdminFilaBono.vue'
export default {
name: "PedidosAdminTablaBonos",
components: {
PedidosAdminFilaBonoVue
},
props: {
pedidos: {
type: Array,
required: true
}
},
computed: {
hayPedidos: function() {
return this.pedidos.length !== 0
},
hayAprobados: function() {
return this.pedidosAprobados.length > 0
},
pedidosAprobados: function() {
return this.pedidos.filter(p => p.aprobado);
},
bonosCantidadesTotales: function() {
let nombres = [];
let cantidades = [];
let precios = [];
let bonosAprobadosPorPedido = this.bonosPorPedido(this.pedidosAprobados);
bonosAprobadosPorPedido.forEach(bs => {
bs.forEach(b => {
if (!nombres.includes(b.nombre)) {
nombres.push(b.nombre);
cantidades.push(b.pivot.cantidad);
precios.push(b.precio);
} else {
for (let i = 0; i < nombres.length; i++) {
if (b.nombre === nombres[i]) {
cantidades[i] += b.pivot.cantidad;
}
}
}
});
});
let bonosAprobados = [];
for (let i = 0; i < nombres.length; i++) {
let bono = {
nombre: nombres[i],
cantidad: cantidades[i],
total: cantidades[i] * precios[i]
};
bonosAprobados.push(bono);
}
return bonosAprobados;
},
totalBonos: function() {
let total = 0;
let bonos = this.bonosCantidadesTotales;
bonos.forEach(b => {
total += b.total;
});
return total;
}
},
methods: {
bonosPorPedido(pedidosArray) {
return pedidosArray.map(p => p.productos.filter(pr => pr.bono))
}
},
}
</script>
<style>
</style>

View File

@ -23,8 +23,12 @@
</template>
<script>
import PedidosAdminFilaPedidoVue from './PedidosAdminFilaPedido.vue';
export default {
name: "PedidosAdminTablaPedidos",
components: {
PedidosAdminFilaPedidoVue
},
props: {
pedidos: {
type: Array,