Compare commits
	
		
			4 commits
		
	
	
		
			8502fb72d9
			...
			eda9d5ce6c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| eda9d5ce6c | |||
| 
							 | 
						0d5551406a | ||
| 
							 | 
						ece866a3ec | ||
| 
							 | 
						77bdccdf86 | 
					 2 changed files with 59 additions and 7 deletions
				
			
		
							
								
								
									
										35
									
								
								public/js/app.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								public/js/app.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -2957,6 +2957,13 @@ __webpack_require__.r(__webpack_exports__);
 | 
			
		|||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
/* harmony default export */ __webpack_exports__["default"] = ({
 | 
			
		||||
  name: "SubpedidosGdc",
 | 
			
		||||
| 
						 | 
				
			
			@ -2982,9 +2989,25 @@ __webpack_require__.r(__webpack_exports__);
 | 
			
		|||
    fetchSubpedidos: function fetchSubpedidos() {
 | 
			
		||||
      var _this2 = this;
 | 
			
		||||
 | 
			
		||||
      axios.get("/api/subpedidos/resources").then(function (response) {
 | 
			
		||||
      axios.get("/api/subpedidos/resources", {
 | 
			
		||||
        params: {
 | 
			
		||||
          grupo_de_compra: this.gdc
 | 
			
		||||
        }
 | 
			
		||||
      }).then(function (response) {
 | 
			
		||||
        _this2.subpedidos = response.data.data;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    totalAprobados: function totalAprobados() {
 | 
			
		||||
      var suma = 0;
 | 
			
		||||
      var aprobados = this.subpedidos.filter(function (sp) {
 | 
			
		||||
        return sp.aprobado;
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      for (var i = 0; i < aprobados.length; i++) {
 | 
			
		||||
        suma += parseFloat(aprobados[i].total.replace(/,/g, ''));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return suma;
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted: function mounted() {
 | 
			
		||||
| 
						 | 
				
			
			@ -5922,6 +5945,16 @@ var render = function () {
 | 
			
		|||
        [
 | 
			
		||||
          _vm._m(0),
 | 
			
		||||
          _vm._v(" "),
 | 
			
		||||
          _c("tfoot", [
 | 
			
		||||
            _c("tr", [
 | 
			
		||||
              _c("th"),
 | 
			
		||||
              _vm._v(" "),
 | 
			
		||||
              _c("th", [_vm._v("Total de los aprobados")]),
 | 
			
		||||
              _vm._v(" "),
 | 
			
		||||
              _c("th", [_vm._v("$ " + _vm._s(_vm.totalAprobados()))]),
 | 
			
		||||
            ]),
 | 
			
		||||
          ]),
 | 
			
		||||
          _vm._v(" "),
 | 
			
		||||
          _c(
 | 
			
		||||
            "tbody",
 | 
			
		||||
            _vm._l(this.subpedidos, function (subpedido) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,11 +8,18 @@
 | 
			
		|||
                    <th><abbr title="Aprobacion">Aprobación</abbr></th>
 | 
			
		||||
                </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
                <tbody>
 | 
			
		||||
                    <subpedido-row v-for="subpedido in this.subpedidos"
 | 
			
		||||
                                   :subpedido="subpedido" :key="subpedido.id">
 | 
			
		||||
                    </subpedido-row>
 | 
			
		||||
                </tbody>
 | 
			
		||||
            <tfoot>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <th></th>
 | 
			
		||||
                    <th>Total de los aprobados</th>
 | 
			
		||||
                    <th>$ {{ totalAprobados() }}</th>
 | 
			
		||||
                </tr>
 | 
			
		||||
            </tfoot>
 | 
			
		||||
            <tbody>
 | 
			
		||||
                <subpedido-row v-for="subpedido in this.subpedidos"
 | 
			
		||||
                               :subpedido="subpedido" :key="subpedido.id">
 | 
			
		||||
                </subpedido-row>
 | 
			
		||||
            </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
        <p class="has-text-centered" v-show="this.subpedidos.length === 0">
 | 
			
		||||
            Todavía no hay ningún pedido para administrar.
 | 
			
		||||
| 
						 | 
				
			
			@ -39,9 +46,21 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        fetchSubpedidos() {
 | 
			
		||||
            axios.get("/api/subpedidos/resources").then(response => {
 | 
			
		||||
            axios.get("/api/subpedidos/resources", {
 | 
			
		||||
                params: {
 | 
			
		||||
                    grupo_de_compra: this.gdc
 | 
			
		||||
                }
 | 
			
		||||
            }).then(response => {
 | 
			
		||||
                this.subpedidos = response.data.data
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        totalAprobados() {
 | 
			
		||||
            let suma = 0;
 | 
			
		||||
            let aprobados = this.subpedidos.filter(sp => sp.aprobado);
 | 
			
		||||
            for (let i = 0; i < aprobados.length; i++) {
 | 
			
		||||
                suma += parseFloat(aprobados[i].total.replace(/,/g, ''));
 | 
			
		||||
            }
 | 
			
		||||
            return suma;
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue