Commit 66fcbdd93fdc66195bf7985b9117b2af172ba4c1
1 parent
6768e62d48
Exists in
master
avances mobile
Showing
3 changed files
with
85 additions
and
20 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaModalDetalleHojaRuta') | 1 | angular.module('focaModalDetalleHojaRuta') |
2 | .controller('focaModalDetalleHojaRutaController', | 2 | .controller('focaModalDetalleHojaRutaController', |
3 | [ | 3 | [ |
4 | '$filter', | 4 | '$filter', |
5 | '$scope', | 5 | '$scope', |
6 | '$uibModalInstance', | 6 | '$uibModalInstance', |
7 | 'remito', | 7 | 'remito', |
8 | function($filter, $scope, $uibModalInstance, remito) { | 8 | 'focaModalDetalleHojaRutaService', |
9 | function($filter, $scope, $uibModalInstance, remito, focaModalDetalleHojaRutaService) { | ||
9 | $scope.remito = remito; | 10 | $scope.remito = remito; |
11 | $scope.cisternas = []; | ||
12 | $scope.articuloSeleccionado = {}; | ||
13 | $scope.cambio = function(articulo) { | ||
14 | $scope.articuloSeleccionado = articulo; | ||
15 | }; | ||
16 | focaModalDetalleHojaRutaService.getCisternasByIdRemito($scope.remito.id) | ||
17 | .then(function(res) { | ||
18 | $scope.cisternas = res.data; | ||
19 | }); | ||
20 | |||
10 | $scope.aceptar = function() { | 21 | $scope.aceptar = function() { |
11 | var articulos = articulosDescargados(); | 22 | var articulos = articulosDescargados(); |
12 | var cisternaMovimientos = []; | 23 | var cisternaMovimientos = []; |
13 | var hojaRutaMovimientos = []; | 24 | var hojaRutaMovimientos = []; |
14 | for(var i = 0; i < articulos.length; i++) { | 25 | for(var i = 0; i < articulos.length; i++) { |
15 | var cisternaMovimiento = { | 26 | var cisternaMovimiento = { |
16 | idRemito: $scope.remito.id, | 27 | idRemito: $scope.remito.id, |
17 | cantidad: articulos[i].aCargar, | 28 | cantidad: articulos[i].aCargar, |
18 | metodo: 'descarga' | 29 | metodo: 'descarga' |
19 | } | 30 | }; |
20 | var hojaRutaMovimiento = { | 31 | var hojaRutaMovimiento = { |
21 | idRemito: $scope.remito.id, | 32 | idRemito: $scope.remito.id, |
22 | reciboDescarga: articulos[i].numeroRecibo | 33 | reciboDescarga: articulos[i].numeroRecibo |
23 | } | 34 | }; |
24 | cisternaMovimientos.push(cisternaMovimiento); | 35 | cisternaMovimientos.push(cisternaMovimiento); |
25 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 36 | hojaRutaMovimientos.push(hojaRutaMovimiento); |
26 | } | 37 | } |
27 | var result = { | 38 | var result = { |
28 | cisternaMovimientos: cisternaMovimientos, | 39 | cisternaMovimientos: cisternaMovimientos, |
29 | hojaRutaMovimientos: hojaRutaMovimientos, | 40 | hojaRutaMovimientos: hojaRutaMovimientos, |
30 | idHojaRuta: $scope.remito.idHojaRuta | 41 | idRemito: $scope.remito.id, |
31 | } | 42 | observaciones: $scope.remito.observaciones |
43 | }; | ||
32 | $uibModalInstance.close(result); | 44 | $uibModalInstance.close(result); |
33 | }; | 45 | }; |
34 | 46 | ||
35 | $scope.cancel = function() { | 47 | $scope.cancel = function() { |
36 | $uibModalInstance.dismiss('cancel'); | 48 | $uibModalInstance.dismiss('cancel'); |
37 | }; | 49 | }; |
38 | 50 | ||
39 | $scope.validar = function() { | 51 | $scope.validar = function() { |
40 | if(!articulosDescargados().length) { | 52 | if(!articulosDescargados().length) { |
41 | return true; | 53 | return true; |
42 | } | 54 | } |
43 | return false; | 55 | return false; |
44 | }; | 56 | }; |
45 | 57 | ||
46 | function articulosDescargados() { | 58 | function articulosDescargados() { |
47 | var articulosDescargados = $scope.remito.articulosRemito.filter( | 59 | var articulosDescargados = $scope.remito.articulosRemito.filter( |
48 | function(articulo) { | 60 | function(articulo) { |
49 | if(articulo.aCargar && articulo.numeroRecibo) { | 61 | if(articulo.aCargar && articulo.numeroRecibo) { |
50 | return articulo; | 62 | return articulo; |
51 | } | 63 | } |
52 | }); | 64 | }); |
53 | return articulosDescargados; | 65 | return articulosDescargados; |
54 | } | 66 | } |
55 | } | 67 | } |
56 | ] | 68 | ] |
57 | ); | 69 | ); |
58 | 70 |
src/js/service.js
1 | angular.module('focaModalDetalleHojaRuta') | 1 | angular.module('focaModalDetalleHojaRuta') |
2 | .service('focaModalDetalleHojaRutaService', [ | 2 | .service('focaModalDetalleHojaRutaService', [ |
3 | '$http', | 3 | '$http', |
4 | 'API_ENDPOINT', | 4 | 'API_ENDPOINT', |
5 | function($http, API_ENDPOINT) { | 5 | function($http, API_ENDPOINT) { |
6 | return { | 6 | return { |
7 | getDetallesHojaRuta: function() { | 7 | getDetallesHojaRuta: function() { |
8 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 8 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
9 | }, | ||
10 | getCisternasByIdRemito: function(idRemito) { | ||
11 | return $http.get(API_ENDPOINT.URL + '/cisternas/obtener/remito/' + idRemito); | ||
9 | } | 12 | } |
10 | }; | 13 | }; |
11 | } | 14 | } |
12 | ]); | 15 | ]); |
13 | 16 |
src/views/modal-detalle-hoja-ruta.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <h5 class="modal-title">Detalle de descarga</h5> | 2 | <h5 class="modal-title">Detalle de descarga</h5> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body" id="modal-body"> | 4 | <div class="modal-body" id="modal-body"> |
5 | <form name="formDetalleHojaRuta"> | 5 | <form name="formDetalleHojaRuta"> |
6 | <div class="form-group row"> | 6 | <div class="form-group row"> |
7 | <div class="col-12 px-0"> | 7 | <div class="col-12 px-0"> |
8 | <label class="form-control-sm"> | 8 | <label class="form-control-sm"> |
9 | <b>Remito Nº</b> | 9 | <b>Remito Nº</b> |
10 | <span ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"/> | 10 | <span ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"/> |
11 | </label> | 11 | </label> |
12 | </div> | 12 | </div> |
13 | <div class="col-12 px-0"> | 13 | <div class="col-12 px-0"> |
14 | <label class="form-control-sm"> | 14 | <label class="form-control-sm"> |
15 | <b>Cliente</b> | 15 | <b>Cliente</b> |
16 | </label> | 16 | </label> |
17 | <span ng-bind="remito.nombreCliente"/> | 17 | <span ng-bind="remito.nombreCliente"/> |
18 | </div> | 18 | </div> |
19 | <div class="col-12 px-0"> | 19 | <div class="col-12 px-0"> |
20 | <label class="form-control-sm"> | 20 | <label class="form-control-sm"> |
21 | <b>Domicilio</b> | 21 | <b>Domicilio</b> |
22 | <span ng-bind="remito.domicilioStamp"/> | 22 | <span ng-bind="remito.domicilioStamp"/> |
23 | </label> | 23 | </label> |
24 | </div> | 24 | </div> |
25 | <div class="col-12 px-0"> | 25 | <div class="col-12 px-0"> |
26 | <strong>Articulo a descargar</strong> | ||
26 | <table class="table table-sm"> | 27 | <table class="table table-sm"> |
27 | <thead> | 28 | <thead> |
28 | <tr> | 29 | <tr> |
30 | <th></th> | ||
29 | <th>Articulo</th> | 31 | <th>Articulo</th> |
30 | <th>Total</th> | 32 | <th>Total</th> |
31 | <th>A descargar</th> | 33 | <th>Descargado</th> |
32 | <th>Nº Recibo</th> | ||
33 | </tr> | 34 | </tr> |
34 | </thead> | 35 | </thead> |
35 | <tbody> | 36 | <tbody> |
36 | <tr ng-repeat="(key, articulo) in remito.articulosRemito"> | 37 | <tr ng-repeat="(key, articulo) in remito.articulosRemito"> |
38 | <td class="pt-2"><input | ||
39 | type="radio" | ||
40 | name="articuloRadio" | ||
41 | id="{{'articulo' + articulo.id}}" | ||
42 | ng-click="cambio(articulo)" | ||
43 | ng-disabled="articulo.cargado" | ||
44 | ></td> | ||
37 | <td ng-bind="articulo.descripcion"></td> | 45 | <td ng-bind="articulo.descripcion"></td> |
38 | <td ng-bind="articulo.cantidad"></td> | 46 | <td ng-bind="articulo.cantidad"></td> |
47 | <td ng-bind="articulo.descargado || articulo.cantidad"></td> | ||
48 | </tbody> | ||
49 | </table> | ||
50 | <strong>Cisterna</strong> | ||
51 | <table class="table table-sm"> | ||
52 | <thead> | ||
53 | <tr> | ||
54 | <th>Código</th> | ||
55 | <th>Articulo</th> | ||
56 | <th>Total</th> | ||
57 | <th>A descargar</th> | ||
58 | </tr> | ||
59 | </thead> | ||
60 | <tbody> | ||
61 | <tr ng-repeat="(key, cisterna) in cisternas"> | ||
62 | <td ng-bind="cisterna.codigo"></td> | ||
63 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | ||
64 | <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | ||
39 | <td><input | 65 | <td><input |
40 | class="form-control form-control-sm" | 66 | class="form-control form-control-sm" |
41 | type="number" | 67 | type="number" |
42 | ng-model="articulo.aCargar" | 68 | ng-model="cisterna.aDescargar" |
43 | foca-focus="key === 0"/></td> | 69 | foca-focus="" |
44 | <td><input | 70 | ng-disabled="articuloSeleccionado.idArticulo != cisterna.cisternaCarga.idProducto"/></td> |
45 | class="form-control form-control-sm" | 71 | </tr> |
46 | type="number" | ||
47 | ng-model="articulo.numeroRecibo"/></td> | ||
48 | </tr> | ||
49 | </tbody> | 72 | </tbody> |
50 | </table> | 73 | </table> |
51 | </div> | 74 | </div> |
52 | <div class="col-12 px-0 py-0"> | 75 | <div class="col-12 px-0"> |
53 | <label class="form-control-sm"> | 76 | <label class="form-control-sm px-0"> |
54 | <b>Observaciones</b> | 77 | <b>Observaciones</b> |
55 | </label> | 78 | </label> |
56 | </div> | 79 | </div> |
57 | <div class="col-12 pl-0"> | 80 | <div class="col-12"> |
58 | <textarea | 81 | <textarea |
59 | ng-model="remito.observaciones" | 82 | ng-model="remito.observaciones" |
60 | class="form-control mx-2" | 83 | class="form-control form-control-sm" |
61 | rows="5" | 84 | rows="1" |
62 | ></textarea> | 85 | ></textarea> |
63 | </div> | 86 | </div> |
87 | <div class="col-12 row mt-2"> | ||
88 | <label class="form-control-sm px-0 col-3"><b>Nº Recibo</b></label> | ||
89 | <input | ||
90 | class="form-control form-control-sm col-4" | ||
91 | type="number" | ||
92 | ng-model="numeroRecibo"> | ||
93 | <button | ||
94 | class="ml-4 form-control-sm btn btn-success col-4" | ||
95 | ladda="cargando" | ||
96 | data-spinner-color="#FF0000" | ||
97 | type="button" | ||
98 | ng-disabled="!distribucionDisponible()" | ||
99 | ng-click="cargarACisternas(vehiculo)" | ||
100 | foca-focus="distribucionDisponible()"> | ||
101 | Descargar | ||
102 | </button> | ||
103 | </div> | ||
64 | </div> | 104 | </div> |
65 | </form> | 105 | </form> |
66 | </div> | 106 | </div> |
67 | <div class="modal-footer py-2"> | 107 | <div class="modal-footer py-2"> |
68 | <button | 108 | <button |
109 | class="btn btn-danger btn-sm" | ||
110 | type="button" | ||
111 | ng-click="" | ||
112 | ng-disabled="" | ||
113 | >Anular</button> | ||
114 | <button | ||
69 | class="btn btn-secondary btn-sm" | 115 | class="btn btn-secondary btn-sm" |
70 | type="button" | 116 | type="button" |
117 | ng-click="cancel()" | ||
118 | >Cancelar</button> | ||
119 | <button | ||
120 | class="btn btn-primary btn-sm" | ||
121 | type="button" | ||
71 | ng-click="aceptar()" | 122 | ng-click="aceptar()" |