Commit b35060854c965c80aa983f0dcd3296a5770c25c0
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !37
Showing
3 changed files
Show diff stats
src/js/controllerUltimosDespachos.js
... | ... | @@ -11,8 +11,39 @@ angular.module('focaCrearFactura') |
11 | 11 | |
12 | 12 | function config() { |
13 | 13 | |
14 | + $scope.productos = []; | |
15 | + | |
14 | 16 | crearFacturaService.getUltimosDespachos(parametros.planilla).then(function (res) { |
15 | - $scope.productos = res.data.slice(1, res.data.length); | |
17 | + | |
18 | + res.data.slice(1, res.data.length).forEach(function (producto) { | |
19 | + | |
20 | + producto.mangueras = []; | |
21 | + | |
22 | + producto.despachos.forEach(function (despacho) { | |
23 | + | |
24 | + var findCsu = producto.mangueras.filter(function (csu) { | |
25 | + return csu.csu === despacho.CSU.trim(); | |
26 | + })[0]; | |
27 | + | |
28 | + if (!findCsu) { | |
29 | + | |
30 | + var manguera = { | |
31 | + csu: despacho.CSU.trim(), | |
32 | + despachos: [despacho], | |
33 | + show: true | |
34 | + }; | |
35 | + | |
36 | + producto.mangueras.unshift(manguera); | |
37 | + } else { | |
38 | + findCsu.despachos.push(despacho); | |
39 | + } | |
40 | + }); | |
41 | + | |
42 | + $scope.productos.push(producto); | |
43 | + }); | |
44 | + | |
45 | + console.log($scope.productos); | |
46 | + | |
16 | 47 | }); |
17 | 48 | } |
18 | 49 |
src/js/service.js
... | ... | @@ -16,7 +16,7 @@ angular.module('focaCrearFactura') |
16 | 16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); |
17 | 17 | }, |
18 | 18 | getUltimosDespachos: function (numeroPlanilla) { |
19 | - return $http.get(route + '/turnos/productos/' + numeroPlanilla + '/true'); | |
19 | + return $http.get('http://10.231.45.194:9900' + '/turnos/productos/' + numeroPlanilla + '/true'); | |
20 | 20 | }, |
21 | 21 | setearDespachoOcupado: function (parametros) { |
22 | 22 | return $http.post(route + '/turnos/despacho-en-uso', parametros); |
src/views/modal-ultimos-despachos.html
... | ... | @@ -16,39 +16,39 @@ |
16 | 16 | </p> |
17 | 17 | </div> |
18 | 18 | </div> |
19 | - <div class="row my-2"> | |
20 | - <div class="col"> | |
21 | - <label> | |
22 | - <img class="w-50" ng-src="./img/surtidor.png" alt=""> | |
23 | - {{producto.despachos[0].CSU}} | |
24 | - </label> | |
25 | - <button | |
26 | - type="button" | |
27 | - class="btn p-1 text-secondary float-right border" | |
28 | - ng-click="manguera.show = !manguera.show"> | |
29 | - <i ng-show="!manguera.show" class="fa fa-minus px-1"></i> | |
30 | - <i ng-show="manguera.show" class="fa fa-plus px-1"></i> | |
31 | - </button> | |
32 | - <table class="table table-sm table-striped" ng-show="!manguera.show"> | |
33 | - <tbody> | |
34 | - <tr> | |
35 | - <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | |
36 | - <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].LTS"></td> | |
37 | - <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].IMP | currency: '$'"></td> | |
38 | - <td class="py-2 py-sm-1"> | |
39 | - <button | |
40 | - type="button" | |
41 | - class="btn btn-default btn-xs p-1 float-right" | |
42 | - title="Seleccionar" | |
43 | - ng-click="aceptar(producto)" | |
44 | - ><i class="fa fa-circle-thin" aria-hidden="true"></i> | |
45 | - </button> | |
46 | - </td> | |
47 | - </tr> | |
48 | - </tbody> | |
49 | - </table> | |
50 | - </div> | |
51 | - </div> | |
19 | + <div class="row my-2" ng-repeat="(key, manguera) in producto.mangueras"> | |
20 | + <div class="col"> | |
21 | + <label> | |
22 | + <img class="w-50" ng-src="./img/surtidor.png" alt=""> | |
23 | + {{manguera.csu}} | |
24 | + </label> | |
25 | + <button | |
26 | + type="button" | |
27 | + class="btn p-1 text-secondary float-right border" | |
28 | + ng-click="manguera.show = !manguera.show"> | |
29 | + <i ng-show="manguera.show" class="fa fa-minus px-1"></i> | |
30 | + <i ng-show="!manguera.show" class="fa fa-plus px-1"></i> | |
31 | + </button> | |
32 | + <table class="table table-sm table-striped" ng-show="manguera.show"> | |
33 | + <tbody> | |
34 | + <tr ng-repeat="despacho in manguera.despachos"> | |
35 | + <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | |
36 | + <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td> | |
37 | + <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td> | |
38 | + <td class="py-2 py-sm-1"> | |
39 | + <button | |
40 | + type="button" | |
41 | + class="btn btn-default btn-xs p-1 float-right" | |
42 | + title="Seleccionar" | |
43 | + ng-click="aceptar(producto)" | |
44 | + ><i class="fa fa-circle-thin" aria-hidden="true"></i> | |
45 | + </button> | |
46 | + </td> | |
47 | + </tr> | |
48 | + </tbody> | |
49 | + </table> | |
50 | + </div> | |
51 | + </div> | |
52 | 52 | </div> |
53 | 53 | |
54 | 54 | </div> |