Commit a65d046f3d041086084592f008f3aefaac943633
1 parent
d1f4e3a1e6
Exists in
master
and in
2 other branches
arreglo en responsividad.
Showing
2 changed files
with
115 additions
and
128 deletions
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaHojaRuta') |
2 | 2 | .controller('listaHojaRutaCtrl', |
3 | 3 | [ |
4 | - '$scope', | |
5 | - '$location', | |
6 | - '$filter', | |
7 | - '$uibModal', | |
8 | - 'hojaRutaService', | |
9 | - 'focaLoginService', | |
10 | - 'focaModalService', | |
11 | - '$rootScope', | |
12 | - '$localStorage', | |
13 | - function ( | |
14 | - $scope, | |
15 | - $location, | |
16 | - $filter, | |
17 | - $uibModal, | |
18 | - hojaRutaService, | |
19 | - focaLoginService, | |
20 | - focaModalService, | |
21 | - $rootScope, | |
22 | - $localStorage | |
23 | - ) { | |
4 | + '$scope', '$location', '$filter', '$uibModal', 'hojaRutaService', | |
5 | + 'focaLoginService', 'focaModalService', '$rootScope', '$localStorage', | |
6 | + function ($scope, $location, $filter, $uibModal, hojaRutaService, | |
7 | + focaLoginService, focaModalService, $rootScope, $localStorage) { | |
24 | 8 | |
25 | 9 | var loginData = focaLoginService.getLoginData(); |
26 | - | |
27 | 10 | config(); |
28 | - | |
11 | + init(); | |
29 | 12 | function config() { |
30 | - | |
31 | 13 | $scope.cabecera = []; |
32 | 14 | $scope.showCabecera = true; |
33 | 15 | $scope.now = new Date(); |
34 | 16 | $scope.puntoVenta = '0000'; |
35 | 17 | $scope.comprobante = '00000000'; |
36 | 18 | } |
37 | - | |
38 | - hojaRutaService.getHojaRuta(loginData.chofer).then(function (res) { | |
39 | - | |
40 | - if (res.data) { | |
41 | - var hojaRuta = res.data; | |
42 | - $scope.hojaRuta = hojaRuta; | |
43 | - $scope.puntoVenta = hojaRuta.sucursal; | |
44 | - $scope.comprobante = hojaRuta.numeroHojaRuta; | |
45 | - addCabecera('Transportista:', hojaRuta.transportista.NOM); | |
46 | - addCabecera('Chofer:', hojaRuta.chofer.nombre); | |
47 | - addCabecera('Vehículo:', hojaRuta.vehiculo.tractor); | |
48 | - } else { | |
49 | - focaModalService.alert('Sin hoja de ruta asignada'); | |
50 | - $location.path('/'); | |
51 | - } | |
52 | - | |
53 | - watch(); | |
54 | - | |
55 | - if (!$scope.estadoRed) { | |
56 | - getLSHojaRuta(); | |
57 | - } | |
58 | - | |
59 | - | |
60 | - }); | |
61 | - | |
19 | + function init() { | |
20 | + hojaRutaService.getHojaRuta(loginData.chofer) | |
21 | + .then(function (res) { | |
22 | + if (res.data) { | |
23 | + var hojaRuta = res.data; | |
24 | + $scope.hojaRuta = hojaRuta; | |
25 | + $scope.puntoVenta = hojaRuta.sucursal; | |
26 | + $scope.comprobante = hojaRuta.numeroHojaRuta; | |
27 | + addCabecera('Transportista:', hojaRuta.transportista.NOM); | |
28 | + addCabecera('Chofer:', hojaRuta.chofer.nombre); | |
29 | + addCabecera('Vehículo:', hojaRuta.vehiculo.tractor); | |
30 | + } else { | |
31 | + focaModalService.alert('Sin hoja de ruta asignada'); | |
32 | + $location.path('/'); | |
33 | + } | |
34 | + watch(); | |
35 | + if (!$scope.estadoRed) { | |
36 | + getLSHojaRuta(); | |
37 | + } | |
38 | + }); | |
39 | + } | |
62 | 40 | function watch() { |
63 | - | |
64 | 41 | $scope.$watch('hojaRuta', function (nuevoValor) { |
65 | 42 | $localStorage.hojaRuta = JSON.stringify(nuevoValor); |
66 | 43 | }, true); |
67 | 44 | } |
68 | - | |
69 | 45 | $scope.verDetalle = function (remito) { |
70 | 46 | var modalInstance = $uibModal.open( |
71 | 47 | { |
... | ... | @@ -80,20 +56,13 @@ angular.module('focaHojaRuta') |
80 | 56 | size: 'lg' |
81 | 57 | } |
82 | 58 | ); |
83 | - modalInstance.result.then(function () { | |
84 | - //funcion se ejecuta cuando se carga pantalla | |
85 | - }); | |
59 | + modalInstance.result | |
60 | + .then(function (data) { | |
61 | + //funcion se ejecuta cuando se carga pantalla | |
62 | + console.log(data); | |
63 | + }) | |
64 | + .catch(function (e) { console.info(e); }); | |
86 | 65 | }; |
87 | - | |
88 | - function addCabecera(label, valor) { | |
89 | - var propiedad = $filter('filter')($scope.cabecera, { label: label }, true); | |
90 | - if (propiedad.length === 1) { | |
91 | - propiedad[0].valor = valor; | |
92 | - } else { | |
93 | - $scope.cabecera.push({ label: label, valor: valor }); | |
94 | - } | |
95 | - } | |
96 | - | |
97 | 66 | $scope.rellenar = function (relleno, longitud) { |
98 | 67 | relleno = '' + relleno; |
99 | 68 | while (relleno.length < longitud) { |
... | ... | @@ -102,11 +71,9 @@ angular.module('focaHojaRuta') |
102 | 71 | |
103 | 72 | return relleno; |
104 | 73 | }; |
105 | - | |
106 | 74 | $scope.salir = function () { |
107 | 75 | $location.path('/'); |
108 | 76 | }; |
109 | - | |
110 | 77 | $scope.terminarHojaRuta = function () { |
111 | 78 | focaModalService |
112 | 79 | .confirm('¿Desea terminar la hoja de ruta? No podra realizar ninguna ' + |
... | ... | @@ -136,7 +103,6 @@ angular.module('focaHojaRuta') |
136 | 103 | ); |
137 | 104 | } |
138 | 105 | }; |
139 | - | |
140 | 106 | $scope.datosExtraCierre = function (terminar) { |
141 | 107 | var modalInstance = $uibModal.open( |
142 | 108 | { |
... | ... | @@ -146,7 +112,6 @@ angular.module('focaHojaRuta') |
146 | 112 | ); |
147 | 113 | modalInstance.result.then(terminar); |
148 | 114 | }; |
149 | - | |
150 | 115 | $scope.modalDescargas = function () { |
151 | 116 | delete $scope.hojaRuta.remitos[0].cliente; |
152 | 117 | var remito = $scope.hojaRuta.remitos[0]; |
... | ... | @@ -158,7 +123,6 @@ angular.module('focaHojaRuta') |
158 | 123 | ' esta vacía.\n'; |
159 | 124 | else |
160 | 125 | mostrarMensaje = false; |
161 | - | |
162 | 126 | } |
163 | 127 | if (mostrarMensaje === true) { |
164 | 128 | focaModalService.alert(msg); |
... | ... | @@ -173,26 +137,32 @@ angular.module('focaHojaRuta') |
173 | 137 | }, |
174 | 138 | } |
175 | 139 | ); |
176 | - | |
177 | 140 | modalInstance.result.then(function (data) { |
178 | - | |
179 | 141 | console.log(data); |
180 | 142 | }); |
181 | 143 | }; |
182 | - | |
183 | 144 | $rootScope.$on('estadoRed', function (event, value) { |
184 | 145 | $scope.estadoRed = value; |
185 | 146 | }); |
186 | - | |
147 | + function addCabecera(label, valor) { | |
148 | + var propiedad = $filter('filter')($scope.cabecera, { label: label }, true); | |
149 | + if (propiedad.length === 1) { | |
150 | + propiedad[0].valor = valor; | |
151 | + } else { | |
152 | + $scope.cabecera.push({ label: label, valor: valor }); | |
153 | + } | |
154 | + } | |
187 | 155 | function getLSHojaRuta() { |
188 | 156 | |
189 | 157 | var hojaRuta = JSON.parse($localStorage.hojaRuta || null); |
190 | 158 | |
191 | 159 | if (hojaRuta) { |
160 | + console.log('getLSHojaRuta() => ', hojaRuta); | |
192 | 161 | $scope.hojaRuta = hojaRuta; |
193 | 162 | delete $localStorage.hojaRuta; |
194 | 163 | } |
195 | 164 | } |
196 | 165 | |
197 | 166 | } |
198 | - ]); | |
167 | + ] | |
168 | + ); |
src/views/lista-hoja-ruta.html
1 | -<div> | |
1 | +<div class="row mx-0"> | |
2 | 2 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
3 | 3 | <div class="row p-1 panel-informativo"> |
4 | 4 | <div class="col-12"> |
... | ... | @@ -59,62 +59,79 @@ |
59 | 59 | </div> |
60 | 60 | </div> |
61 | 61 | </div> |
62 | - <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | |
63 | - <div class="row grilla-articulo"> | |
64 | - <table ng-hide="hojaRuta.abierta" class="table table-responsive table-striped table-sm table-dark"> | |
65 | - <thead> | |
66 | - <tr> | |
67 | - <th>#</th> | |
68 | - <th>Número</th> | |
69 | - <th>Razon Social</th> | |
70 | - <th>Domicilio</th> | |
71 | - <th> </th> | |
72 | - </tr> | |
73 | - </thead> | |
74 | - <tbody class="tabla-articulo-body"> | |
75 | - <tr | |
76 | - ng-repeat="(key, remito) in hojaRuta.remitos" | |
77 | - > | |
78 | - <td ng-bind="key + 1"></td> | |
79 | - <td | |
80 | - ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante" | |
81 | - ></td> | |
82 | - <td ng-bind="remito.nombreCliente"></td> | |
83 | - <td ng-bind="remito.domicilioStamp"></td> | |
84 | - <td> | |
85 | - <button | |
86 | - class="btn btn-secondary" | |
87 | - type="button" | |
88 | - ng-click="verDetalle(remito)" | |
89 | - ><i class="fa fa-search" aria-hidden="true"></i> | |
90 | - </button> | |
91 | - </td> | |
92 | - </tr> | |
93 | - </tbody> | |
94 | - </table> | |
62 | + <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2 mb-5"> | |
63 | + <div ng-hide="hojaRuta.abierta" class="row"> | |
64 | + <div class="col p-0"> | |
65 | + <table class="table table-striped table-sm table-dark"> | |
66 | + <thead> | |
67 | + <tr> | |
68 | + <th class="align-middle">#</th> | |
69 | + <th class="align-middle">Número</th> | |
70 | + <th class="align-middle">Razon Social</th> | |
71 | + <th class="align-middle" colspan="2">Domicilio</th> | |
72 | + </tr> | |
73 | + </thead> | |
74 | + <tbody class="tabla-articulo-body"> | |
75 | + <tr | |
76 | + ng-repeat="(key, remito) in hojaRuta.remitos" | |
77 | + > | |
78 | + <td class="align-middle" ng-bind="key + 1"></td> | |
79 | + <td | |
80 | + class="align-middle" | |
81 | + ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante" | |
82 | + ></td> | |
83 | + <td class="align-middle" ng-bind="remito.nombreCliente"></td> | |
84 | + <td class="align-middle" ng-bind="remito.domicilioStamp"></td> | |
85 | + <td class="align-middle"> | |
86 | + <div class="btn-group-vertical"> | |
87 | + <button | |
88 | + class="btn btn-secondary my-1 rounded" | |
89 | + type="button" | |
90 | + ng-click="verDetalle(remito)"> | |
91 | + <i class="fa fa-search" aria-hidden="true"></i> | |
92 | + </button> | |
93 | + <button | |
94 | + class="btn btn-secondary my-1 rounded" | |
95 | + type="button"> | |
96 | + <i class="fa fa-check fa-lg text-success" aria-hidden="true"></i> | |
97 | + </button> | |
98 | + <button | |
99 | + ng-show="remito.rechazado" | |
100 | + class="btn btn-secondary my-1 rounded" | |
101 | + type="button"> | |
102 | + <i class="fa fa-remove fa-lg text-danger" aria-hidden="true"></i> | |
103 | + </button> | |
104 | + </div> | |
105 | + </td> | |
106 | + </tr> | |
107 | + </tbody> | |
108 | + </table> | |
109 | + </div> | |
95 | 110 | </div> |
96 | 111 | <div ng-show="hojaRuta.abierta" class="row grilla-articulo"> |
97 | - <table class="table table-striped table-sm table-dark"> | |
98 | - <thead> | |
99 | - <tr> | |
100 | - <th colspan="3" class="text-center">Remito abierto Nº | |
101 | - {{[hojaRuta.remitos[0].sucursal, hojaRuta.remitos[0].numeroRemito] | comprobante}} | |
102 | - </th> | |
103 | - </tr> | |
104 | - <tr> | |
105 | - <th>Cisterna</th> | |
106 | - <th>Producto</th> | |
107 | - <th>Disponibles</th> | |
108 | - </tr> | |
109 | - </thead> | |
110 | - <tbody> | |
111 | - <tr ng-repeat="cisterna in hojaRuta.remitos[0].cisternas"> | |
112 | - <td ng-bind="cisterna.codigo"></td> | |
113 | - <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | |
114 | - <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | |
115 | - </tr> | |
116 | - </tbody> | |
117 | - </table> | |
112 | + <div class="col p-0"> | |
113 | + <table class="table table-striped table-sm table-dark"> | |
114 | + <thead> | |
115 | + <tr> | |
116 | + <th colspan="3" class="text-center">Remito abierto Nº | |
117 | + {{[hojaRuta.remitos[0].sucursal, hojaRuta.remitos[0].numeroRemito] | comprobante}} | |
118 | + </th> | |
119 | + </tr> | |
120 | + <tr> | |
121 | + <th>Cisterna</th> | |
122 | + <th>Producto</th> | |
123 | + <th>Disponibles</th> | |
124 | + </tr> | |
125 | + </thead> | |
126 | + <tbody> | |
127 | + <tr ng-repeat="cisterna in hojaRuta.remitos[0].cisternas"> | |
128 | + <td ng-bind="cisterna.codigo"></td> | |
129 | + <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | |
130 | + <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | |
131 | + </tr> | |
132 | + </tbody> | |
133 | + </table> | |
134 | + </div> | |
118 | 135 | <table class="table table-striped table-sm table-dark"> |
119 | 136 | <thead> |
120 | 137 | <tr> |