Commit ed56953fa08ecce21174375217bfa82c538c5843
1 parent
6b92393911
Exists in
master
a
Showing
2 changed files
with
8 additions
and
2 deletions
 
Show diff stats
src/js/controller.js
| 1 | angular.module('focaOrdenCarga') | 1 | angular.module('focaOrdenCarga') | 
| 2 | .controller('focaOrdenCargaController', [ | 2 | .controller('focaOrdenCargaController', [ | 
| 3 | '$scope', | 3 | '$scope', | 
| 4 | '$location', | 4 | '$location', | 
| 5 | '$filter', | 5 | '$filter', | 
| 6 | '$timeout', | 6 | '$timeout', | 
| 7 | 'focaOrdenCargaService', | 7 | 'focaOrdenCargaService', | 
| 8 | 'focaBotoneraLateralService', | 8 | 'focaBotoneraLateralService', | 
| 9 | 'focaModalService', | 9 | 'focaModalService', | 
| 10 | '$uibModal', | 10 | '$uibModal', | 
| 11 | function ( | 11 | function ( | 
| 12 | $scope, $location, $filter, $timeout, focaOrdenCargaService, | 12 | $scope, $location, $filter, $timeout, focaOrdenCargaService, | 
| 13 | focaBotoneraLateralService, focaModalService, $uibModal) { | 13 | focaBotoneraLateralService, focaModalService, $uibModal) { | 
| 14 | 14 | ||
| 15 | init(); | 15 | init(); | 
| 16 | 16 | ||
| 17 | function init() { | 17 | function init() { | 
| 18 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA | 18 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA | 
| 19 | $scope.fecha = new Date(); | 19 | $scope.fecha = new Date(); | 
| 20 | $scope.isNumber = angular.isNumber; | 20 | $scope.isNumber = angular.isNumber; | 
| 21 | $scope.show = false; | 21 | $scope.show = false; | 
| 22 | $scope.cargando = true; | 22 | $scope.cargando = true; | 
| 23 | $scope.cabeceras = []; | 23 | $scope.cabeceras = []; | 
| 24 | $scope.botonera = focaOrdenCargaService.getBotonera(); | 24 | $scope.botonera = focaOrdenCargaService.getBotonera(); | 
| 25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { | 
| 26 | maxDate: new Date(), | 26 | maxDate: new Date(), | 
| 27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) | 
| 28 | }; | 28 | }; | 
| 29 | $scope.ordenCarga = { | 29 | $scope.ordenCarga = { | 
| 30 | id: 0, | 30 | id: 0, | 
| 31 | cliente: {}, | 31 | cliente: {}, | 
| 32 | proveedor: {}, | 32 | proveedor: {}, | 
| 33 | domicilio: { dom: '' }, | 33 | domicilio: { dom: '' }, | 
| 34 | vendedor: {}, | 34 | vendedor: {}, | 
| 35 | fechaCarga: new Date(), | 35 | fechaCarga: new Date(), | 
| 36 | cotizacion: {}, | 36 | cotizacion: {}, | 
| 37 | articulosNotaPedido: [], | 37 | articulosNotaPedido: [], | 
| 38 | notaPedidoPlazo: [], | 38 | notaPedidoPlazo: [], | 
| 39 | notaPedidoPuntoDescarga: [] | 39 | notaPedidoPuntoDescarga: [] | 
| 40 | }; | 40 | }; | 
| 41 | $scope.hojaRuta = { | 41 | $scope.hojaRuta = { | 
| 42 | fecha: new Date(), | 42 | fecha: new Date(), | 
| 43 | litros: 0, | 43 | litros: 0, | 
| 44 | chofer: {}, | 44 | chofer: {}, | 
| 45 | vehiculo: { | 45 | vehiculo: { | 
| 46 | capacidad: 0, | 46 | capacidad: 0, | 
| 47 | cisternas: [] | 47 | cisternas: [] | 
| 48 | }, | 48 | }, | 
| 49 | transportista: {}, | 49 | transportista: {}, | 
| 50 | remitosTabla: [] | 50 | remitosTabla: [] | 
| 51 | }; | 51 | }; | 
| 52 | } | 52 | } | 
| 53 | 53 | ||
| 54 | //SETEO BOTONERA LATERAL | 54 | //SETEO BOTONERA LATERAL | 
| 55 | $timeout(function () { | 55 | $timeout(function () { | 
| 56 | focaBotoneraLateralService.showSalir(false); | 56 | focaBotoneraLateralService.showSalir(false); | 
| 57 | focaBotoneraLateralService.showPausar(true); | 57 | focaBotoneraLateralService.showPausar(true); | 
| 58 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | 58 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | 
| 59 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 59 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 
| 60 | }); | 60 | }); | 
| 61 | 61 | ||
| 62 | $scope.seleccionarVehiculo = function () { | 62 | $scope.seleccionarVehiculo = function () { | 
| 63 | 63 | ||
| 64 | seleccionarTransportista().then( | 64 | seleccionarTransportista().then( | 
| 65 | 65 | ||
| 66 | function (transportista) { | 66 | function (transportista) { | 
| 67 | elegirTransportista(transportista); | 67 | elegirTransportista(transportista); | 
| 68 | 68 | ||
| 69 | var parametrosModal = { | 69 | var parametrosModal = { | 
| 70 | columnas: [ | 70 | columnas: [ | 
| 71 | { | 71 | { | 
| 72 | propiedad: 'codigo', | 72 | propiedad: 'codigo', | 
| 73 | nombre: 'Código' | 73 | nombre: 'Código' | 
| 74 | }, | 74 | }, | 
| 75 | { | 75 | { | 
| 76 | propiedad: 'tractor', | 76 | propiedad: 'tractor', | 
| 77 | nombre: 'tractor' | 77 | nombre: 'tractor' | 
| 78 | }, | 78 | }, | 
| 79 | { | 79 | { | 
| 80 | propiedad: 'semi', | 80 | propiedad: 'semi', | 
| 81 | nombre: 'Semi' | 81 | nombre: 'Semi' | 
| 82 | }, | 82 | }, | 
| 83 | { | 83 | { | 
| 84 | propiedad: 'capacidadTotalCisternas', | 84 | propiedad: 'capacidadTotalCisternas', | 
| 85 | nombre: 'Capacidad' | 85 | nombre: 'Capacidad' | 
| 86 | } | 86 | }, | 
| 87 | // { | ||
| 88 | // propiedad: 'cantidad', | ||
| 89 | // nombre: 'carga' | ||
| 90 | // } | ||
| 87 | ], | 91 | ], | 
| 88 | query: '/vehiculo/transportista/' + transportista.COD, | 92 | query: '/vehiculo/transportista/' + transportista.COD, | 
| 93 | // query: '/cisterna_carga/cisterna/vehiculo/transportista/' + transportista.COD, | ||
| 89 | titulo: 'Búsqueda de vehiculos', | 94 | titulo: 'Búsqueda de vehiculos', | 
| 90 | subTitulo: transportista.COD + '-' + transportista.NOM | 95 | subTitulo: transportista.COD + '-' + transportista.NOM | 
| 91 | }; | 96 | }; | 
| 92 | 97 | ||
| 93 | focaModalService.modal(parametrosModal).then( | 98 | focaModalService.modal(parametrosModal).then( | 
| 94 | function (vehiculo) { | 99 | function (vehiculo) { | 
| 95 | $scope.$broadcast('addCabecera', { | 100 | $scope.$broadcast('addCabecera', { | 
| 96 | label: 'Vehículo:', | 101 | label: 'Vehículo:', | 
| 97 | valor: vehiculo.codigo | 102 | valor: vehiculo.codigo | 
| 98 | }); | 103 | }); | 
| 99 | $scope.hojaRuta.vehiculo = vehiculo; | 104 | $scope.hojaRuta.vehiculo = vehiculo; | 
| 100 | $scope.hojaRuta.transportista = transportista; | 105 | $scope.hojaRuta.transportista = transportista; | 
| 101 | $scope.hojaRuta.vehiculo.cisternas = vehiculo.cisternas; | 106 | $scope.hojaRuta.vehiculo.cisternas = vehiculo.cisternas; | 
| 102 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 107 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 
| 108 | console.log($scope.hojaRuta.vehiculo.cisternas); | ||
| 103 | }, function () { | 109 | }, function () { | 
| 104 | seleccionarTransportista(); | 110 | seleccionarTransportista(); | 
| 105 | }); | 111 | }); | 
| 106 | }); | 112 | }); | 
| 107 | }; | 113 | }; | 
| 108 | 114 | ||
| 109 | function seleccionarTransportista() { | 115 | function seleccionarTransportista() { | 
| 110 | var parametrosModal = { | 116 | var parametrosModal = { | 
| 111 | titulo: 'Búsqueda de Transportista', | 117 | titulo: 'Búsqueda de Transportista', | 
| 112 | query: '/transportista', | 118 | query: '/transportista', | 
| 113 | columnas: [ | 119 | columnas: [ | 
| 114 | { | 120 | { | 
| 115 | nombre: 'Código', | 121 | nombre: 'Código', | 
| 116 | propiedad: 'COD' | 122 | propiedad: 'COD' | 
| 117 | }, | 123 | }, | 
| 118 | { | 124 | { | 
| 119 | nombre: 'Nombre', | 125 | nombre: 'Nombre', | 
| 120 | propiedad: 'NOM' | 126 | propiedad: 'NOM' | 
| 121 | }, | 127 | }, | 
| 122 | { | 128 | { | 
| 123 | nombre: 'CUIT', | 129 | nombre: 'CUIT', | 
| 124 | propiedad: 'CUIT' | 130 | propiedad: 'CUIT' | 
| 125 | } | 131 | } | 
| 126 | ] | 132 | ] | 
| 127 | }; | 133 | }; | 
| 128 | return focaModalService.modal(parametrosModal); | 134 | return focaModalService.modal(parametrosModal); | 
| 129 | }; | 135 | }; | 
| 130 | 136 | ||
| 131 | $scope.seleccionarFechaDeReparto = function () { | 137 | $scope.seleccionarFechaDeReparto = function () { | 
| 132 | focaModalService.modalFecha('Fecha').then(function (fecha) { | 138 | focaModalService.modalFecha('Fecha').then(function (fecha) { | 
| 133 | $scope.$broadcast('addCabecera', { | 139 | $scope.$broadcast('addCabecera', { | 
| 134 | label: 'Fecha:', | 140 | label: 'Fecha:', | 
| 135 | valor: fecha.toLocaleDateString() | 141 | valor: fecha.toLocaleDateString() | 
| 136 | }); | 142 | }); | 
| 137 | 143 | ||
| 138 | $scope.fecha = fecha; | 144 | $scope.fecha = fecha; | 
| 139 | if ($scope.hojaRuta.vehiculo.cisternas) | 145 | if ($scope.hojaRuta.vehiculo.cisternas) | 
| 140 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 146 | getEstadosCisternas($scope.hojaRuta.vehiculo.cisternas); | 
| 141 | }); | 147 | }); | 
| 142 | }; | 148 | }; | 
| 143 | 149 | ||
| 144 | $scope.seleccionarHojasDeRuta = function () { | 150 | $scope.seleccionarHojasDeRuta = function () { | 
| 145 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 151 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 
| 146 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 152 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 
| 147 | return; | 153 | return; | 
| 148 | } | 154 | } | 
| 149 | $uibModal.open( | 155 | $uibModal.open( | 
| 150 | { | 156 | { | 
| 151 | ariaLabelledBy: 'Hojas de Ruta', | 157 | ariaLabelledBy: 'Hojas de Ruta', | 
| 152 | templateUrl: 'modal-hojas-ruta.html', | 158 | templateUrl: 'modal-hojas-ruta.html', | 
| 153 | controller: 'focaOrdenCargaController', | 159 | controller: 'focaOrdenCargaController', | 
| 154 | size: 'md', | 160 | size: 'md', | 
| 155 | resolve: { | 161 | resolve: { | 
| 156 | filters: { | 162 | filters: { | 
| 157 | cisternas: $scope.hojaRuta.vehiculo.id | 163 | cisternas: $scope.hojaRuta.vehiculo.id | 
| 158 | } | 164 | } | 
| 159 | } | 165 | } | 
| 160 | } | 166 | } | 
| 161 | ); | 167 | ); | 
| 162 | var idVehiculo = $scope.hojaRuta.vehiculo.id | 168 | var idVehiculo = $scope.hojaRuta.vehiculo.id | 
| 163 | focaOrdenCargaService.getHojasRuta(idVehiculo) | 169 | focaOrdenCargaService.getHojasRuta(idVehiculo) | 
| 164 | .then(function (res) { | 170 | .then(function (res) { | 
| 165 | console.log(res); | 171 | console.log(res); | 
| 166 | }) | 172 | }) | 
| 167 | .catch(function (err) { | 173 | .catch(function (err) { | 
| 168 | console.error(err) | 174 | console.error(err) | 
| 169 | }) | 175 | }) | 
| 170 | } | 176 | } | 
| 171 | 177 | ||
| 172 | $scope.seleccionarRemitoAbierto = function () { | 178 | $scope.seleccionarRemitoAbierto = function () { | 
| 173 | if ($scope.hojaRuta.vehiculo.capacidad === 0) { | 179 | if ($scope.hojaRuta.vehiculo.capacidad === 0) { | 
| 174 | focaModalService.alert('Debe ingresar vehiculo'); | 180 | focaModalService.alert('Debe ingresar vehiculo'); | 
| 175 | return; | 181 | return; | 
| 176 | } else { | 182 | } else { | 
| 177 | mostrarDetalle($scope.hojaRuta); | 183 | mostrarDetalle($scope.hojaRuta); | 
| 178 | } | 184 | } | 
| 179 | }; | 185 | }; | 
| 180 | 186 | ||
| 181 | $scope.seleccionarChofer = function () { | 187 | $scope.seleccionarChofer = function () { | 
| 182 | var parametrosModal = { | 188 | var parametrosModal = { | 
| 183 | titulo: 'Búsqueda de Chofer', | 189 | titulo: 'Búsqueda de Chofer', | 
| 184 | query: '/chofer', | 190 | query: '/chofer', | 
| 185 | columnas: [ | 191 | columnas: [ | 
| 186 | { | 192 | { | 
| 187 | propiedad: 'id', | 193 | propiedad: 'id', | 
| 188 | nombre: 'Código', | 194 | nombre: 'Código', | 
| 189 | filtro: { | 195 | filtro: { | 
| 190 | nombre: 'rellenarDigitos', | 196 | nombre: 'rellenarDigitos', | 
| 191 | parametro: 3 | 197 | parametro: 3 | 
| 192 | } | 198 | } | 
| 193 | }, | 199 | }, | 
| 194 | { | 200 | { | 
| 195 | propiedad: 'nombre', | 201 | propiedad: 'nombre', | 
| 196 | nombre: 'Nombre' | 202 | nombre: 'Nombre' | 
| 197 | }, | 203 | }, | 
| 198 | { | 204 | { | 
| 199 | propiedad: 'dni', | 205 | propiedad: 'dni', | 
| 200 | nombre: 'DNI' | 206 | nombre: 'DNI' | 
| 201 | }, | 207 | }, | 
| 202 | { | 208 | { | 
| 203 | propiedad: 'telefono', | 209 | propiedad: 'telefono', | 
| 204 | nombre: 'Teléfono' | 210 | nombre: 'Teléfono' | 
| 205 | } | 211 | } | 
| 206 | ] | 212 | ] | 
| 207 | }; | 213 | }; | 
| 208 | focaModalService.modal(parametrosModal).then( | 214 | focaModalService.modal(parametrosModal).then( | 
| 209 | function (chofer) { | 215 | function (chofer) { | 
| 210 | $scope.ordenCarga.chofer = chofer; | 216 | $scope.ordenCarga.chofer = chofer; | 
| 211 | $scope.$broadcast('addCabecera', { | 217 | $scope.$broadcast('addCabecera', { | 
| 212 | label: 'Chofer:', | 218 | label: 'Chofer:', | 
| 213 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' + chofer.nombre | 219 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' + chofer.nombre | 
| 214 | }); | 220 | }); | 
| 215 | 221 | ||
| 216 | $filter('filter')($scope.botonera, { | 222 | $filter('filter')($scope.botonera, { | 
| 217 | label: 'Chofer', | 223 | label: 'Chofer', | 
| 218 | })[0].checked = true; | 224 | })[0].checked = true; | 
| 219 | }, function () { | 225 | }, function () { | 
| 220 | // funcion ejecutada cuando se cancela el modal | 226 | // funcion ejecutada cuando se cancela el modal | 
| 221 | } | 227 | } | 
| 222 | ); | 228 | ); | 
| 223 | }; | 229 | }; | 
| 224 | 230 | ||
| 225 | $scope.seleccionarGraficar = function () { | 231 | $scope.seleccionarGraficar = function () { | 
| 226 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 232 | if (!$scope.hojaRuta.vehiculo.cisternas.length) { | 
| 227 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 233 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 
| 228 | return; | 234 | return; | 
| 229 | } | 235 | } | 
| 230 | $uibModal.open( | 236 | $uibModal.open( | 
| 231 | { | 237 | { | 
| 232 | ariaLabelledBy: 'Grafico de cisternas', | 238 | ariaLabelledBy: 'Grafico de cisternas', | 
| 233 | templateUrl: 'modal-grafico-cisternas.html', | 239 | templateUrl: 'modal-grafico-cisternas.html', | 
| 234 | controller: 'focaModalGraficoCisternasController', | 240 | controller: 'focaModalGraficoCisternasController', | 
| 235 | size: 'md', | 241 | size: 'md', | 
| 236 | resolve: { | 242 | resolve: { | 
| 237 | filters: { | 243 | filters: { | 
| 238 | cisternas: $scope.hojaRuta.vehiculo.cisternas | 244 | cisternas: $scope.hojaRuta.vehiculo.cisternas | 
| 239 | } | 245 | } | 
| 240 | } | 246 | } | 
| 241 | } | 247 | } | 
| 242 | ); | 248 | ); | 
| 243 | }; | 249 | }; | 
| 244 | 250 | ||
| 245 | function elegirTransportista(transportista) { | 251 | function elegirTransportista(transportista) { | 
| 246 | var codigo = ('00000' + transportista.COD).slice(-5); | 252 | var codigo = ('00000' + transportista.COD).slice(-5); | 
| 247 | $scope.idTransportista = transportista.COD; | 253 | $scope.idTransportista = transportista.COD; | 
| 248 | $scope.filtros = transportista.NOM.trim(); | 254 | $scope.filtros = transportista.NOM.trim(); | 
| 249 | $scope.$broadcast('addCabecera', { | 255 | $scope.$broadcast('addCabecera', { | 
| 250 | label: 'Transportista:', | 256 | label: 'Transportista:', | 
| 251 | valor: codigo + ' - ' + transportista.NOM | 257 | valor: codigo + ' - ' + transportista.NOM | 
| 252 | }); | 258 | }); | 
| 253 | } | 259 | } | 
| 254 | 260 | ||
| 255 | function getEstadosCisternas(cisternas) { | 261 | function getEstadosCisternas(cisternas) { | 
| 256 | cisternas.forEach(function (cisterna) { | 262 | cisternas.forEach(function (cisterna) { | 
| 257 | focaOrdenCargaService | 263 | focaOrdenCargaService | 
| 258 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 264 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 
| 259 | .then(function (res) { | 265 | .then(function (res) { | 
| 260 | cisterna.estado = res.data; | 266 | cisterna.estado = res.data; | 
| 261 | }) | 267 | }) | 
| 262 | .catch(function (err) { console.error(err) }); | 268 | .catch(function (err) { console.error(err) }); | 
| 263 | }); | 269 | }); | 
| 264 | } | 270 | } | 
| 265 | 271 | ||
| 266 | function mostrarDetalle(hojasRutas) { | 272 | function mostrarDetalle(hojasRutas) { | 
| 267 | var modalInstance = $uibModal.open( | 273 | var modalInstance = $uibModal.open( | 
| 268 | { | 274 | { | 
| 269 | ariaLabelledBy: '', | 275 | ariaLabelledBy: '', | 
| 270 | templateUrl: 'modal-detalle-carga.html', | 276 | templateUrl: 'modal-detalle-carga.html', | 
| 271 | controller: 'focaModalDetalleController', | 277 | controller: 'focaModalDetalleController', | 
| 272 | resolve: { | 278 | resolve: { | 
| 273 | parametrosModal: function () { | 279 | parametrosModal: function () { | 
| 274 | return { | 280 | return { | 
| 275 | hojasRutas: hojasRutas, | 281 | hojasRutas: hojasRutas, | 
| 276 | orden: $scope.hojaRuta.orden | 282 | orden: $scope.hojaRuta.orden | 
| 277 | }; | 283 | }; | 
| 278 | } | 284 | } | 
| 279 | }, | 285 | }, | 
| 280 | size: 'lg', | 286 | size: 'lg', | 
| 281 | backdrop: false | 287 | backdrop: false | 
| 282 | } | 288 | } | 
| 283 | ); | 289 | ); | 
| 284 | return modalInstance.result | 290 | return modalInstance.result | 
| 285 | .then(function (res) { | 291 | .then(function (res) { | 
| 286 | res.cisternas.forEach(function (cisterna) { | 292 | res.cisternas.forEach(function (cisterna) { | 
| 287 | $scope.cisternaCargas.push(cisterna.cisternaCarga); | 293 | $scope.cisternaCargas.push(cisterna.cisternaCarga); | 
| 288 | }); | 294 | }); | 
| 289 | $scope.cisternaMovimientos = res.movimientos; | 295 | $scope.cisternaMovimientos = res.movimientos; | 
| 290 | $scope.articulosRecibidos = res.articulos; | 296 | $scope.articulosRecibidos = res.articulos; | 
| 291 | $scope.articulos = res.articulos; | 297 | $scope.articulos = res.articulos; | 
| 292 | $filter('filter')($scope.botonera, { | 298 | $filter('filter')($scope.botonera, { | 
| 293 | label: 'Detalle de Carga', | 299 | label: 'Detalle de Carga', | 
| 294 | })[0].checked = true; | 300 | })[0].checked = true; | 
| 295 | }) | 301 | }) | 
| 296 | .catch(function (e) { console.error(e); }); | 302 | .catch(function (e) { console.error(e); }); | 
| 297 | }; | 303 | }; | 
| 298 | 304 | ||
| 299 | function crearOrdenCarga() { | 305 | function crearOrdenCarga() { | 
| 300 | if (!$scope.hojaRuta.vehiculo) { | 306 | if (!$scope.hojaRuta.vehiculo) { | 
| 301 | focaModalService.alert('Ingrese Vehículo'); | 307 | focaModalService.alert('Ingrese Vehículo'); | 
| 302 | return; | 308 | return; | 
| 303 | } else if (!$scope.hojaRuta.chofer) { | 309 | } else if (!$scope.hojaRuta.chofer) { | 
| 304 | focaBotoneraLateralService.alert('Ingrese Chofer'); | 310 | focaBotoneraLateralService.alert('Ingrese Chofer'); | 
| 305 | return; | 311 | return; | 
| 306 | } | 312 | } | 
| 307 | 313 | ||
| 308 | focaBotoneraLateralService.startGuardar(); | 314 | focaBotoneraLateralService.startGuardar(); | 
| 309 | $scope.saveLoading = true; | 315 | $scope.saveLoading = true; | 
| 310 | 316 | ||
| 311 | } | 317 | } | 
| 312 | 318 | ||
| 313 | $scope.$watch('ordenCarga', function (newValue) { | 319 | $scope.$watch('ordenCarga', function (newValue) { | 
| 314 | focaBotoneraLateralService.setPausarData({ | 320 | focaBotoneraLateralService.setPausarData({ | 
| 315 | label: 'ordenCarga', | 321 | label: 'ordenCarga', | 
| 316 | val: newValue | 322 | val: newValue | 
| 317 | }); | 323 | }); | 
| 318 | }, true); | 324 | }, true); | 
| 319 | 325 | ||
| 320 | $scope.$watch('ordenCarga', function (newValue) { | 326 | $scope.$watch('ordenCarga', function (newValue) { | 
| 321 | focaBotoneraLateralService.setPausarData({ | 327 | focaBotoneraLateralService.setPausarData({ | 
| 322 | label: 'ordenCarga', | 328 | label: 'ordenCarga', | 
| 323 | val: newValue | 329 | val: newValue | 
| 324 | }); | 330 | }); | 
| 325 | focaBotoneraLateralService.setRutasPausadas({ | 331 | focaBotoneraLateralService.setRutasPausadas({ | 
| 326 | label: 'rutas', | 332 | label: 'rutas', | 
| 327 | val: 'orden-carga' | 333 | val: 'orden-carga' | 
| 328 | }); | 334 | }); | 
| 329 | }, true); | 335 | }, true); | 
| 330 | 336 | ||
| 331 | $scope.salir = function () { | 337 | $scope.salir = function () { | 
| 332 | $location.path('/'); | 338 | $location.path('/'); | 
| 333 | }; | 339 | }; | 
| 334 | 340 | ||
| 335 | function salir() { | 341 | function salir() { | 
| 336 | var confirmacion = false; | 342 | var confirmacion = false; | 
| 337 | 343 | ||
| 338 | if (!angular.equals($scope.ordenCarga, $scope.inicial)) { | 344 | if (!angular.equals($scope.ordenCarga, $scope.inicial)) { | 
| 339 | confirmacion = true; | 345 | confirmacion = true; | 
| 340 | } | 346 | } | 
| 341 | 347 | ||
| 342 | if (confirmacion) { | 348 | if (confirmacion) { | 
| 343 | focaModalService.confirm( | 349 | focaModalService.confirm( | 
| 344 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 350 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 
| 345 | ).then(function (data) { | 351 | ).then(function (data) { | 
| 346 | if (data) { | 352 | if (data) { | 
| 347 | $location.path('/'); | 353 | $location.path('/'); | 
| 348 | } | 354 | } | 
| 349 | }); | 355 | }); | 
| 350 | } else { | 356 | } else { | 
| 351 | $location.path('/'); | 357 | $location.path('/'); | 
| 352 | } | 358 | } | 
| 353 | } | 359 | } | 
| 354 | }]); | 360 | }]); | 
| 355 | 361 | 
src/views/orden-carga.html
| 1 | <div class="row"> | 1 | <div class="row"> | 
| 2 | <foca-cabecera-facturador titulo="'Orden de Carga'" numero="puntoVenta + '-' + comprobante" | 2 | <foca-cabecera-facturador titulo="'Orden de Carga'" numero="puntoVenta + '-' + comprobante" | 
| 3 | fecha="ordenCarga.fechaCarga" class="mb-0 col-lg-12"></foca-cabecera-facturador> | 3 | fecha="ordenCarga.fechaCarga" class="mb-0 col-lg-12"></foca-cabecera-facturador> | 
| 4 | </div> | 4 | </div> | 
| 5 | <div class="row"> | 5 | <div class="row"> | 
| 6 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 6 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 
| 7 | <div class="row px-5 py-2 botonera-secundaria"> | 7 | <div class="row px-5 py-2 botonera-secundaria"> | 
| 8 | <div class="col-12"> | 8 | <div class="col-12"> | 
| 9 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | 9 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | 
| 10 | </div> | 10 | </div> | 
| 11 | </div> | 11 | </div> | 
| 12 | 12 | ||
| 13 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | 13 | <table class="puntero table table-default table-hover table-sm table-abm table-striped mb-0"> | 
| 14 | <thead> | 14 | <thead> | 
| 15 | <tr> | 15 | <tr> | 
| 16 | <th>Cisterna</th> | 16 | <th>Cisterna</th> | 
| 17 | <th>Producto</th> | 17 | <th>Producto</th> | 
| 18 | <th>Capacidad Total</th> | 18 | <th>Capacidad Total</th> | 
| 19 | <th>Carga</th> | 19 | <th>Carga</th> | 
| 20 | <th>Disponible</th> | 20 | <th>Disponible</th> | 
| 21 | <th class="text-center"> | 21 | <th class="text-center"> | 
| 22 | </th> | 22 | </th> | 
| 23 | </tr> | 23 | </tr> | 
| 24 | </thead> | 24 | </thead> | 
| 25 | <tbody> | 25 | <tbody> | 
| 26 | <tr ng-repeat="cisterna in hojaRuta.vehiculo.cisternas"> | 26 | <tr ng-repeat="cisterna in hojaRuta.vehiculo.cisternas"> | 
| 27 | <td ng-bind="cisterna.codigo"></td> | 27 | <td ng-bind="cisterna.codigo"></td> | 
| 28 | <td>producto</td> | 28 | <td>producto</td> | 
| 29 | <td ng-bind="cisterna.capacidad"></td> | 29 | <td ng-bind="cisterna.capacidad"></td> | 
| 30 | <td ng-bind="cisterna.cantidadDescargada"></td> | 30 | <td ng-bind="cisterna.cantidadDescargada"></td> | 
| 31 | <td>{{cisterna.capacidad - cisterna.cantidadDescargada}}</td> | 31 | <td>{{cisterna.capacidad - cisterna.cantidadDescargada}}</td> | 
| 32 | </tr> | 32 | </tr> | 
| 33 | </tbody> | 33 | </tbody> | 
| 34 | </table> | 34 | </table> | 
| 35 | </div> | 35 | </div> | 
| 36 | </div> | 36 | </div> | 
| 37 | 37 |