Commit 761e2779b55f174af3e665876d7635533763b07b

Authored by Benjamin Rodriguez
1 parent 85e02bd58e
Exists in master

hojaruta

src/js/controller.js
... ... @@ -26,7 +26,6 @@ angular.module('focaOrdenCarga')
26 26 maxDate: new Date(),
27 27 minDate: new Date(2010, 0, 1)
28 28 };
29   -
30 29 $scope.ordenCarga = {
31 30 id: 0,
32 31 cliente: {},
... ... @@ -60,28 +59,6 @@ angular.module('focaOrdenCarga')
60 59 focaBotoneraLateralService.addCustomButton('Salir', salir);
61 60 });
62 61  
63   - function seleccionarTransportista() {
64   - var parametrosModal = {
65   - titulo: 'Búsqueda de Transportista',
66   - query: '/transportista',
67   - columnas: [
68   - {
69   - nombre: 'Código',
70   - propiedad: 'COD'
71   - },
72   - {
73   - nombre: 'Nombre',
74   - propiedad: 'NOM'
75   - },
76   - {
77   - nombre: 'CUIT',
78   - propiedad: 'CUIT'
79   - }
80   - ]
81   - };
82   - return focaModalService.modal(parametrosModal);
83   - };
84   -
85 62 $scope.seleccionarVehiculo = function () {
86 63  
87 64 seleccionarTransportista().then(
... ... @@ -129,25 +106,26 @@ angular.module('focaOrdenCarga')
129 106 });
130 107 };
131 108  
132   - $scope.seleccionarVerCisternas = function () {
133   - if (!$scope.hojaRuta.vehiculo.cisternas.length) {
134   - focaModalService.alert('Primero seleccione un vehículo con cisternas');
135   - return;
136   - }
137   - console.log($scope.hojaRuta.vehiculo);
138   - $uibModal.open(
139   - {
140   - ariaLabelledBy: 'Grafico de cisternas',
141   - templateUrl: 'modal-grafico-cisternas.html',
142   - controller: 'focaModalGraficoCisternasController',
143   - size: 'md',
144   - resolve: {
145   - filters: {
146   - cisternas: $scope.hojaRuta.vehiculo.cisternas
147   - }
  109 + function seleccionarTransportista() {
  110 + var parametrosModal = {
  111 + titulo: 'Búsqueda de Transportista',
  112 + query: '/transportista',
  113 + columnas: [
  114 + {
  115 + nombre: 'Código',
  116 + propiedad: 'COD'
  117 + },
  118 + {
  119 + nombre: 'Nombre',
  120 + propiedad: 'NOM'
  121 + },
  122 + {
  123 + nombre: 'CUIT',
  124 + propiedad: 'CUIT'
148 125 }
149   - }
150   - );
  126 + ]
  127 + };
  128 + return focaModalService.modal(parametrosModal);
151 129 };
152 130  
153 131 $scope.seleccionarFechaDeReparto = function () {
... ... @@ -163,6 +141,34 @@ angular.module('focaOrdenCarga')
163 141 });
164 142 };
165 143  
  144 + $scope.seleccionarHojasDeRuta = function () {
  145 + if (!$scope.hojaRuta.vehiculo.cisternas.length) {
  146 + focaModalService.alert('Primero seleccione un vehículo con cisternas');
  147 + return;
  148 + }
  149 + $uibModal.open(
  150 + {
  151 + ariaLabelledBy: 'Hojas de Ruta',
  152 + templateUrl: 'modal-hojas-ruta.html',
  153 + controller: 'focaOrdenCargaController',
  154 + size: 'md',
  155 + resolve: {
  156 + filters: {
  157 + cisternas: $scope.hojaRuta.vehiculo.id
  158 + }
  159 + }
  160 + }
  161 + );
  162 + var idVehiculo = $scope.hojaRuta.vehiculo.id
  163 + focaOrdenCargaService.getHojasRuta(idVehiculo)
  164 + .then(function (res) {
  165 + console.log(res);
  166 + })
  167 + .catch(function (err) {
  168 + console.error(err)
  169 + })
  170 + }
  171 +
166 172 $scope.seleccionarRemitoAbierto = function () {
167 173 if ($scope.hojaRuta.vehiculo.capacidad === 0) {
168 174 focaModalService.alert('Debe ingresar vehiculo');
... ... @@ -216,16 +222,25 @@ angular.module('focaOrdenCarga')
216 222 );
217 223 };
218 224  
219   - function getEstadosCisternas(cisternas) {
220   - cisternas.forEach(function (cisterna) {
221   - focaOrdenCargaService
222   - .getEstadoCisterna(cisterna.id, $scope.fecha)
223   - .then(function (res) {
224   - cisterna.estado = res.data;
225   - })
226   - .catch(function (err) { console.error(err) });
227   - });
228   - }
  225 + $scope.seleccionarGraficar = function () {
  226 + if (!$scope.hojaRuta.vehiculo.cisternas.length) {
  227 + focaModalService.alert('Primero seleccione un vehículo con cisternas');
  228 + return;
  229 + }
  230 + $uibModal.open(
  231 + {
  232 + ariaLabelledBy: 'Grafico de cisternas',
  233 + templateUrl: 'modal-grafico-cisternas.html',
  234 + controller: 'focaModalGraficoCisternasController',
  235 + size: 'md',
  236 + resolve: {
  237 + filters: {
  238 + cisternas: $scope.hojaRuta.vehiculo.cisternas
  239 + }
  240 + }
  241 + }
  242 + );
  243 + };
229 244  
230 245 function elegirTransportista(transportista) {
231 246 var codigo = ('00000' + transportista.COD).slice(-5);
... ... @@ -237,6 +252,17 @@ angular.module('focaOrdenCarga')
237 252 });
238 253 }
239 254  
  255 + function getEstadosCisternas(cisternas) {
  256 + cisternas.forEach(function (cisterna) {
  257 + focaOrdenCargaService
  258 + .getEstadoCisterna(cisterna.id, $scope.fecha)
  259 + .then(function (res) {
  260 + cisterna.estado = res.data;
  261 + })
  262 + .catch(function (err) { console.error(err) });
  263 + });
  264 + }
  265 +
240 266 function mostrarDetalle(hojasRutas) {
241 267 var modalInstance = $uibModal.open(
242 268 {
... ... @@ -271,9 +297,17 @@ angular.module('focaOrdenCarga')
271 297 };
272 298  
273 299 function crearOrdenCarga() {
  300 + if (!$scope.hojaRuta.vehiculo) {
  301 + focaModalService.alert('Ingrese Vehículo');
  302 + return;
  303 + } else if (!$scope.hojaRuta.chofer) {
  304 + focaBotoneraLateralService.alert('Ingrese Chofer');
  305 + return;
  306 + }
274 307  
275 308 focaBotoneraLateralService.startGuardar();
276 309 $scope.saveLoading = true;
  310 +
277 311 }
278 312  
279 313 $scope.$watch('ordenCarga', function (newValue) {
... ... @@ -317,4 +351,4 @@ angular.module('focaOrdenCarga')
317 351 $location.path('/');
318 352 }
319 353 }
320   - }]);
  354 + }]);
... ... @@ -27,6 +27,9 @@ angular.module('focaOrdenCarga')
27 27 return $http.post(API_ENDPOINT.URL + '/cisterna/stock',
28 28 { idCisterna: id, fecha: fecha });
29 29 },
  30 + getHojasRuta: function (idVehiculo) {
  31 + return $http.get(API_ENDPOINT.URL + '/orden-carga/hoja-ruta/' + idVehiculo);
  32 + },
30 33 getBotonera: function () {
31 34 var result = [
32 35 {
... ... @@ -50,11 +53,12 @@ angular.module('focaOrdenCarga')
50 53 image: 'chofer_secundario.png'
51 54 },
52 55 {
53   - label: 'Ver Cisternas',
54   - image: 'verCisterna.png'
  56 + label: 'Graficar',
  57 + image: 'graficar.png'
55 58 }
56 59 ];
57 60 return result;
58 61 },
  62 +
59 63 };
60 64 }]);
src/views/orden-carga.html
... ... @@ -23,30 +23,14 @@
23 23 </tr>
24 24 </thead>
25 25 <tbody>
26   - <tr>
27   - <th scope="row">-</th>
28   - <td>-</td>
29   - <td>-</td>
30   - <td>-</td>
31   - <td>-</td>
32   - </tr>
33   - </tr>
34   - <tr>
35   - <th scope="row">-</th>
36   - <td>-</td>
37   - <td>-</td>
38   - <td>-</td>
39   - <td>-</td>
40   - </tr>
41   - <tr>
42   - <th scope="row">-</th>
43   - <td>-</td>
44   - <td>-</td>
45   - <td>-</td>
46   - <td>-</td>
  26 + <tr ng-repeat="cisterna in hojaRuta.vehiculo.cisternas">
  27 + <td ng-bind="cisterna.codigo"></td>
  28 + <td>producto</td>
  29 + <td ng-bind="cisterna.capacidad"></td>
  30 + <td ng-bind="cisterna.cantidadDescargada"></td>
  31 + <td>{{cisterna.capacidad - cisterna.cantidadDescargada}}</td>
47 32 </tr>
48 33 </tbody>
49   -
50 34 </table>
51 35 </div>
52 36 </div>
53 37 \ No newline at end of file