Commit a18e7039846b0f17a01c73675782064aabf9aa3b
1 parent
a9ba7eccaa
Exists in
master
Nuevo diseño
Showing
2 changed files
with
272 additions
and
254 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', |
| 4 | function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { | 4 | function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { |
| 5 | $scope.botonera = [ | 5 | $scope.botonera = [ |
| 6 | {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}}, | 6 | {texto: 'Transportista', imagen: '../img/abmPrecios.png', |
| 7 | {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}}, | 7 | accion: function() {$scope.seleccionarProveedor();}}, |
| 8 | {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}}, | 8 | {texto: 'Chofer', imagen: '../img/abmPrecios.png', |
| 9 | {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}}, | 9 | accion: function() {$scope.seleccionarChofer();}}, |
| 10 | {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}}, | 10 | {texto: 'Vehículo', imagen: '../img/abmPrecios.png', |
| 11 | {texto: '', accion: function() {}}, | 11 | accion: function() {$scope.seleccionarVehiculo();}}, |
| 12 | {texto: '', accion: function() {}}, | 12 | {texto: 'Tarifario', imagen: '../img/abmPrecios.png', |
| 13 | accion: function() {$scope.seleccionarTarifario();}}, | ||
| 14 | {texto: 'Remitos', imagen: '../img/abmPrecios.png', | ||
| 15 | accion: function() {$scope.seleccionarRemito();}}, | ||
| 13 | {texto: '', accion: function() {}} | 16 | {texto: '', accion: function() {}} |
| 14 | ]; | 17 | ]; |
| 15 | $scope.datepickerAbierto = false; | 18 | $scope.datepickerAbierto = false; |
| 16 | 19 | ||
| 17 | $scope.show = false; | 20 | $scope.show = false; |
| 18 | $scope.cargando = true; | 21 | $scope.cargando = true; |
| 19 | $scope.dateOptions = { | 22 | $scope.dateOptions = { |
| 20 | maxDate: new Date(), | 23 | maxDate: new Date(), |
| 21 | minDate: new Date(2010, 0, 1) | 24 | minDate: new Date(2010, 0, 1) |
| 22 | }; | 25 | }; |
| 23 | 26 | ||
| 24 | $scope.hojaRuta = { | 27 | $scope.hojaRuta = { |
| 25 | fecha: new Date(), | 28 | fecha: new Date(), |
| 26 | litros: 0, | 29 | litros: 0, |
| 27 | chofer: {}, | 30 | chofer: {}, |
| 28 | vehiculo: { | 31 | vehiculo: { |
| 29 | capacidad: 0 | 32 | capacidad: 0 |
| 30 | }, | 33 | }, |
| 31 | transportista: {}, | 34 | transportista: {}, |
| 32 | tarifario: { | 35 | tarifario: { |
| 33 | costo: null | 36 | costo: null |
| 34 | } | 37 | } |
| 35 | }; | 38 | }; |
| 36 | 39 | ||
| 37 | $scope.cabecera = []; | 40 | $scope.cabecera = []; |
| 38 | $scope.showCabecera = true; | 41 | $scope.showCabecera = true; |
| 39 | 42 | ||
| 40 | $scope.now = new Date(); | 43 | $scope.now = new Date(); |
| 41 | $scope.puntoVenta = '0000'; | 44 | $scope.puntoVenta = '0000'; |
| 42 | $scope.comprobante = '00000000'; | 45 | $scope.comprobante = '00000000'; |
| 43 | $scope.remitosTabla = []; | 46 | $scope.remitosTabla = []; |
| 44 | $scope.idLista = undefined; | 47 | $scope.idLista = undefined; |
| 45 | //La pantalla solo se usa para cargar pedidos | 48 | //La pantalla solo se usa para cargar pedidos |
| 46 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); | 49 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); |
| 47 | 50 | ||
| 48 | crearHojaRutaService.getNumeroHojaRuta().then( | 51 | crearHojaRutaService.getNumeroHojaRuta().then( |
| 49 | function(res) { | 52 | function(res) { |
| 50 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); | 53 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
| 51 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 54 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
| 52 | }, | 55 | }, |
| 53 | function(err) { | 56 | function(err) { |
| 54 | focaModalService.alert('La terminal no esta configurada correctamente'); | 57 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 55 | console.info(err); | 58 | console.info(err); |
| 56 | } | 59 | } |
| 57 | ); | 60 | ); |
| 58 | //La pantalla solo se usa para cargar pedidos | 61 | //La pantalla solo se usa para cargar pedidos |
| 59 | // if (hojaRutaTemp !== undefined) { | 62 | // if (hojaRutaTemp !== undefined) { |
| 60 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); | 63 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); |
| 61 | // $scope.hojaRuta = hojaRutaTemp; | 64 | // $scope.hojaRuta = hojaRutaTemp; |
| 62 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); | 65 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); |
| 63 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); | 66 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); |
| 64 | // $scope.idLista = $scope.hojaRuta.precioCondicion; | 67 | // $scope.idLista = $scope.hojaRuta.precioCondicion; |
| 65 | // crearHojaRutaService | 68 | // crearHojaRutaService |
| 66 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( | 69 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( |
| 67 | // function(res) { | 70 | // function(res) { |
| 68 | // $scope.remitosTabla = res.data; | 71 | // $scope.remitosTabla = res.data; |
| 69 | // } | 72 | // } |
| 70 | // ); | 73 | // ); |
| 71 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 74 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
| 72 | //(NO REQUERIDO EN ESTA VERSION) | 75 | //(NO REQUERIDO EN ESTA VERSION) |
| 73 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( | 76 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( |
| 74 | // function(res) { | 77 | // function(res) { |
| 75 | // $scope.hojaRuta.domicilio = res.data; | 78 | // $scope.hojaRuta.domicilio = res.data; |
| 76 | // } | 79 | // } |
| 77 | // ); | 80 | // ); |
| 78 | // } else { | 81 | // } else { |
| 79 | // $scope.hojaRuta.fechaCarga = new Date(); | 82 | // $scope.hojaRuta.fechaCarga = new Date(); |
| 80 | // $scope.hojaRuta.bomba = '0'; | 83 | // $scope.hojaRuta.bomba = '0'; |
| 81 | // $scope.hojaRuta.flete = '0'; | 84 | // $scope.hojaRuta.flete = '0'; |
| 82 | // $scope.idLista = undefined; | 85 | // $scope.idLista = undefined; |
| 83 | // } | 86 | // } |
| 84 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 87 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 85 | // $scope.addNewDom = function() { | 88 | // $scope.addNewDom = function() { |
| 86 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); | 89 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); |
| 87 | // }; | 90 | // }; |
| 88 | // $scope.removeNewChoice = function(choice) { | 91 | // $scope.removeNewChoice = function(choice) { |
| 89 | // if ($scope.hojaRuta.domicilio.length > 1) { | 92 | // if ($scope.hojaRuta.domicilio.length > 1) { |
| 90 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( | 93 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( |
| 91 | // function(c) { | 94 | // function(c) { |
| 92 | // return c.$$hashKey === choice.$$hashKey; | 95 | // return c.$$hashKey === choice.$$hashKey; |
| 93 | // } | 96 | // } |
| 94 | // ), 1); | 97 | // ), 1); |
| 95 | // } | 98 | // } |
| 96 | // }; | 99 | // }; |
| 97 | 100 | ||
| 98 | $scope.crearHojaRuta = function() { | 101 | $scope.crearHojaRuta = function() { |
| 99 | if($scope.hojaRuta.litros <= 0) { | 102 | if($scope.hojaRuta.litros <= 0) { |
| 100 | focaModalService.alert('Ingrese Remitos'); | 103 | focaModalService.alert('Ingrese Remitos'); |
| 101 | return; | 104 | return; |
| 102 | } | 105 | } |
| 103 | 106 | ||
| 104 | if(!$scope.hojaRuta.chofer.id) { | 107 | if(!$scope.hojaRuta.chofer.id) { |
| 105 | focaModalService.alert('Ingrese Chofer'); | 108 | focaModalService.alert('Ingrese Chofer'); |
| 106 | return; | 109 | return; |
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | if(!$scope.hojaRuta.vehiculo.id) { | 112 | if(!$scope.hojaRuta.vehiculo.id) { |
| 110 | focaModalService.alert('Ingrese Vehiculo'); | 113 | focaModalService.alert('Ingrese Vehiculo'); |
| 111 | return; | 114 | return; |
| 112 | } | 115 | } |
| 113 | 116 | ||
| 114 | if(!$scope.hojaRuta.transportista.codigo) { | 117 | if(!$scope.hojaRuta.transportista.codigo) { |
| 115 | focaModalService.alert('Ingrese Transportista'); | 118 | focaModalService.alert('Ingrese Transportista'); |
| 116 | return; | 119 | return; |
| 117 | } | 120 | } |
| 118 | 121 | ||
| 119 | if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { | 122 | if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { |
| 120 | focaModalService.alert( | 123 | focaModalService.alert( |
| 121 | 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' | 124 | 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' |
| 122 | ); | 125 | ); |
| 123 | return; | 126 | return; |
| 124 | } | 127 | } |
| 125 | 128 | ||
| 126 | if(!$scope.hojaRuta.tarifario.costo) { | 129 | if(!$scope.hojaRuta.tarifario.costo) { |
| 127 | focaModalService.alert('Ingrese Tarifario'); | 130 | focaModalService.alert('Ingrese Tarifario'); |
| 128 | return; | 131 | return; |
| 129 | } | 132 | } |
| 130 | 133 | ||
| 131 | var date = new Date(); | 134 | var date = new Date(); |
| 132 | var save = { | 135 | var save = { |
| 133 | hojaRuta: { | 136 | hojaRuta: { |
| 134 | id: 0, | 137 | id: 0, |
| 135 | fechaCreacion: | 138 | fechaCreacion: |
| 136 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 139 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 137 | .toISOString().slice(0, 19) .replace('T', ' '), | 140 | .toISOString().slice(0, 19) .replace('T', ' '), |
| 138 | idTransportista: $scope.hojaRuta.transportista.codigo, | 141 | idTransportista: $scope.hojaRuta.transportista.codigo, |
| 139 | idChofer: $scope.hojaRuta.chofer.id, | 142 | idChofer: $scope.hojaRuta.chofer.id, |
| 140 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 143 | idVehiculo: $scope.hojaRuta.vehiculo.id, |
| 141 | tarifaFlete: $scope.hojaRuta.tarifario.costo | 144 | tarifaFlete: $scope.hojaRuta.tarifario.costo |
| 142 | }, | 145 | }, |
| 143 | remitos: $scope.remitosTabla | 146 | remitos: $scope.remitosTabla |
| 144 | }; | 147 | }; |
| 145 | 148 | ||
| 146 | crearHojaRutaService.crearHojaRuta(save).then( | 149 | crearHojaRutaService.crearHojaRuta(save).then( |
| 147 | function(data) { | 150 | function(data) { |
| 148 | focaModalService.alert( | 151 | focaModalService.alert( |
| 149 | 'Hoja ruta creada Nº: ' + | 152 | 'Hoja ruta creada Nº: ' + |
| 150 | $scope.rellenar(data.data.sucursal, 4) + | 153 | $scope.rellenar(data.data.sucursal, 4) + |
| 151 | '-' + | 154 | '-' + |
| 152 | $scope.rellenar(data.data.numeroHojaRuta, 8) | 155 | $scope.rellenar(data.data.numeroHojaRuta, 8) |
| 153 | ); | 156 | ); |
| 154 | $scope.hojaRuta = { | 157 | $scope.hojaRuta = { |
| 155 | fecha: new Date(), | 158 | fecha: new Date(), |
| 156 | litros: 0, | 159 | litros: 0, |
| 157 | chofer: {}, | 160 | chofer: {}, |
| 158 | vehiculo: { | 161 | vehiculo: { |
| 159 | capacidad: 0 | 162 | capacidad: 0 |
| 160 | }, | 163 | }, |
| 161 | transportista: {}, | 164 | transportista: {}, |
| 162 | tarifario: { | 165 | tarifario: { |
| 163 | costo: null | 166 | costo: null |
| 164 | } | 167 | } |
| 165 | }; | 168 | }; |
| 166 | 169 | ||
| 167 | $scope.remitosTabla = []; | 170 | $scope.remitosTabla = []; |
| 168 | $scope.cabecera = []; | 171 | $scope.cabecera = []; |
| 169 | 172 | ||
| 170 | crearHojaRutaService.getNumeroHojaRuta().then(function(res) { | 173 | crearHojaRutaService.getNumeroHojaRuta().then(function(res) { |
| 171 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 174 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
| 172 | }); | 175 | }); |
| 173 | }, | 176 | }, |
| 174 | function(error) { | 177 | function(error) { |
| 175 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 178 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
| 176 | console.info(error); | 179 | console.info(error); |
| 177 | } | 180 | } |
| 178 | ); | 181 | ); |
| 179 | }; | 182 | }; |
| 180 | 183 | ||
| 181 | $scope.seleccionarProveedor = function() { | 184 | $scope.seleccionarProveedor = function() { |
| 182 | var modalInstance = $uibModal.open( | 185 | var modalInstance = $uibModal.open( |
| 183 | { | 186 | { |
| 184 | ariaLabelledBy: 'Busqueda de Transportista', | 187 | ariaLabelledBy: 'Busqueda de Transportista', |
| 185 | templateUrl: 'modal-proveedor.html', | 188 | templateUrl: 'modal-proveedor.html', |
| 186 | controller: 'focaModalProveedorCtrl', | 189 | controller: 'focaModalProveedorCtrl', |
| 187 | size: 'lg', | 190 | size: 'lg', |
| 188 | resolve: { | 191 | resolve: { |
| 189 | transportista: function() { | 192 | transportista: function() { |
| 190 | return true; | 193 | return true; |
| 191 | } | 194 | } |
| 192 | } | 195 | } |
| 193 | } | 196 | } |
| 194 | ); | 197 | ); |
| 195 | modalInstance.result.then( | 198 | modalInstance.result.then( |
| 196 | function(proveedor) { | 199 | function(proveedor) { |
| 197 | console.info($scope.hojaRuta); | 200 | console.info($scope.hojaRuta); |
| 198 | $scope.hojaRuta.transportista.codigo = proveedor.COD; | 201 | $scope.hojaRuta.transportista.codigo = proveedor.COD; |
| 199 | addCabecera('Transportista:', proveedor.NOM); | 202 | addCabecera('Transportista:', proveedor.NOM); |
| 200 | }, function() { | 203 | }, function() { |
| 201 | 204 | ||
| 202 | } | 205 | } |
| 203 | ); | 206 | ); |
| 204 | }; | 207 | }; |
| 205 | 208 | ||
| 206 | $scope.seleccionarChofer = function() { | 209 | $scope.seleccionarChofer = function() { |
| 207 | var modalInstance = $uibModal.open( | 210 | var modalInstance = $uibModal.open( |
| 208 | { | 211 | { |
| 209 | ariaLabelledBy: 'Busqueda de Chofer', | 212 | ariaLabelledBy: 'Busqueda de Chofer', |
| 210 | templateUrl: 'modal-chofer.html', | 213 | templateUrl: 'modal-chofer.html', |
| 211 | controller: 'focaModalChoferController', | 214 | controller: 'focaModalChoferController', |
| 212 | size: 'lg' | 215 | size: 'lg' |
| 213 | } | 216 | } |
| 214 | ); | 217 | ); |
| 215 | 218 | ||
| 216 | modalInstance.result.then( | 219 | modalInstance.result.then( |
| 217 | function(chofer) { | 220 | function(chofer) { |
| 218 | $scope.hojaRuta.chofer = chofer; | 221 | $scope.hojaRuta.chofer = chofer; |
| 219 | addCabecera('Chofer: ', chofer.nombre); | 222 | addCabecera('Chofer: ', chofer.nombre); |
| 220 | }, function() { | 223 | }, function() { |
| 221 | // funcion ejecutada cuando se cancela el modal | 224 | // funcion ejecutada cuando se cancela el modal |
| 222 | } | 225 | } |
| 223 | ); | 226 | ); |
| 224 | }; | 227 | }; |
| 225 | 228 | ||
| 226 | $scope.seleccionarVehiculo = function() { | 229 | $scope.seleccionarVehiculo = function() { |
| 227 | var modalInstance = $uibModal.open( | 230 | var modalInstance = $uibModal.open( |
| 228 | { | 231 | { |
| 229 | ariaLabelledBy: 'Busqueda de Vehiculo', | 232 | ariaLabelledBy: 'Busqueda de Vehiculo', |
| 230 | templateUrl: 'modal-vehiculo.html', | 233 | templateUrl: 'modal-vehiculo.html', |
| 231 | controller: 'focaModalVehiculoController', | 234 | controller: 'focaModalVehiculoController', |
| 232 | size: 'lg' | 235 | size: 'lg' |
| 233 | } | 236 | } |
| 234 | ); | 237 | ); |
| 235 | 238 | ||
| 236 | modalInstance.result.then( | 239 | modalInstance.result.then( |
| 237 | function(vehiculo) { | 240 | function(vehiculo) { |
| 238 | $scope.hojaRuta.vehiculo = vehiculo; | 241 | $scope.hojaRuta.vehiculo = vehiculo; |
| 239 | addCabecera('Tractor: ', vehiculo.tractor); | 242 | addCabecera('Tractor: ', vehiculo.tractor); |
| 240 | addCabecera('Semi: ', vehiculo.semi); | 243 | addCabecera('Semi: ', vehiculo.semi); |
| 241 | addCabecera('Capacidad: ', vehiculo.capacidad); | 244 | addCabecera('Capacidad: ', vehiculo.capacidad); |
| 242 | }, function() { | 245 | }, function() { |
| 243 | // funcion ejecutada cuando se cancela el modal | 246 | // funcion ejecutada cuando se cancela el modal |
| 244 | } | 247 | } |
| 245 | ); | 248 | ); |
| 246 | }; | 249 | }; |
| 247 | 250 | ||
| 248 | $scope.seleccionarTarifario = function() { | 251 | $scope.seleccionarTarifario = function() { |
| 249 | var modalInstance = $uibModal.open( | 252 | var modalInstance = $uibModal.open( |
| 250 | { | 253 | { |
| 251 | ariaLabelledBy: 'Busqueda de Tarifario', | 254 | ariaLabelledBy: 'Busqueda de Tarifario', |
| 252 | templateUrl: 'modal-tarifa-flete.html', | 255 | templateUrl: 'modal-tarifa-flete.html', |
| 253 | controller: 'focaModalTarifaFleteController', | 256 | controller: 'focaModalTarifaFleteController', |
| 254 | size: 'lg', | 257 | size: 'lg', |
| 255 | resolve: { | 258 | resolve: { |
| 256 | parametrosTarifaFlete: function() { | 259 | parametrosTarifaFlete: function() { |
| 257 | return $scope.hojaRuta.tarifario.costo; | 260 | return $scope.hojaRuta.tarifario.costo; |
| 258 | } | 261 | } |
| 259 | } | 262 | } |
| 260 | } | 263 | } |
| 261 | ); | 264 | ); |
| 262 | 265 | ||
| 263 | modalInstance.result.then( | 266 | modalInstance.result.then( |
| 264 | function(tarifario) { | 267 | function(tarifario) { |
| 265 | $scope.hojaRuta.tarifario = tarifario; | 268 | $scope.hojaRuta.tarifario = tarifario; |
| 266 | addCabecera('Tarifario: ', tarifario.costo); | 269 | addCabecera('Tarifario: ', tarifario.costo); |
| 267 | }, function() { | 270 | }, function() { |
| 268 | // funcion ejecutada cuando se cancela el modal | 271 | // funcion ejecutada cuando se cancela el modal |
| 269 | } | 272 | } |
| 270 | ); | 273 | ); |
| 271 | }; | 274 | }; |
| 272 | 275 | ||
| 273 | $scope.seleccionarRemito = function() { | 276 | $scope.seleccionarRemito = function() { |
| 274 | var modalInstance = $uibModal.open( | 277 | var modalInstance = $uibModal.open( |
| 275 | { | 278 | { |
| 276 | ariaLabelledBy: 'Busqueda de Remito', | 279 | ariaLabelledBy: 'Busqueda de Remito', |
| 277 | templateUrl: 'foca-modal-remito.html', | 280 | templateUrl: 'foca-modal-remito.html', |
| 278 | controller: 'focaModalRemitoController', | 281 | controller: 'focaModalRemitoController', |
| 279 | size: 'lg', | 282 | size: 'lg', |
| 280 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 283 | resolve: {usadoPor: function() {return 'hojaRuta';}} |
| 281 | } | 284 | } |
| 282 | ); | 285 | ); |
| 283 | modalInstance.result.then( | 286 | modalInstance.result.then( |
| 284 | function(remito) { | 287 | function(remito) { |
| 285 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 288 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { |
| 286 | if ($scope.remitosTabla[i].id === remito.id) { | 289 | if ($scope.remitosTabla[i].id === remito.id) { |
| 287 | focaModalService.alert('Remito ya incluido'); | 290 | focaModalService.alert('Remito ya incluido'); |
| 288 | return; | 291 | return; |
| 289 | } | 292 | } |
| 290 | } | 293 | } |
| 291 | 294 | ||
| 292 | var litros = 0; | 295 | var litros = 0; |
| 293 | for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 296 | for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { |
| 294 | litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 297 | litros = litros + parseFloat(remito.articulosRemito[j].cantidad); |
| 295 | } | 298 | } |
| 296 | 299 | ||
| 297 | if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 300 | if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { |
| 298 | focaModalService.alert( | 301 | focaModalService.alert( |
| 299 | 'Debe ingresar toda la información para el transporte' | 302 | 'Debe ingresar toda la información para el transporte' |
| 300 | ); | 303 | ); |
| 301 | return; | 304 | return; |
| 302 | } | 305 | } |
| 303 | 306 | ||
| 304 | if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 307 | if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) |
| 305 | { | 308 | { |
| 306 | var litrostotales = litros; | 309 | var litrostotales = litros; |
| 307 | litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 310 | litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; |
| 308 | focaModalService.alert( | 311 | focaModalService.alert( |
| 309 | 'La carga excede la capacidad disponible del vehiculo. ' + | 312 | 'La carga excede la capacidad disponible del vehiculo. ' + |
| 310 | 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 313 | 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' |
| 311 | ); | 314 | ); |
| 312 | } | 315 | } |
| 313 | 316 | ||
| 314 | remito.litros = litros; | 317 | remito.litros = litros; |
| 315 | $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 318 | $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
| 316 | $scope.remitosTabla.push(remito); | 319 | $scope.remitosTabla.push(remito); |
| 317 | }, function() { | 320 | }, function() { |
| 318 | // funcion ejecutada cuando se cancela el modal | 321 | // funcion ejecutada cuando se cancela el modal |
| 319 | } | 322 | } |
| 320 | ); | 323 | ); |
| 321 | }; | 324 | }; |
| 322 | 325 | ||
| 323 | $scope.getTotal = function() { | 326 | $scope.getTotal = function() { |
| 324 | var total = 0; | 327 | var total = 0; |
| 325 | var arrayTempArticulos = $scope.remitosTabla; | 328 | var arrayTempArticulos = $scope.remitosTabla; |
| 326 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 329 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 327 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 330 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 328 | } | 331 | } |
| 329 | return parseFloat(total.toFixed(2)); | 332 | return parseFloat(total.toFixed(2)); |
| 330 | }; | 333 | }; |
| 331 | 334 | ||
| 332 | $scope.getSubTotal = function() { | 335 | $scope.getSubTotal = function() { |
| 333 | if($scope.articuloACargar) { | 336 | if($scope.articuloACargar) { |
| 334 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 337 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 335 | } | 338 | } |
| 336 | }; | 339 | }; |
| 337 | 340 | ||
| 338 | $scope.limpiarPantalla = function() { | 341 | $scope.limpiarPantalla = function() { |
| 339 | $scope.limpiarFlete(); | 342 | $scope.limpiarFlete(); |
| 340 | $scope.hojaRuta.flete = '0'; | 343 | $scope.hojaRuta.flete = '0'; |
| 341 | $scope.hojaRuta.bomba = '0'; | 344 | $scope.hojaRuta.bomba = '0'; |
| 342 | $scope.hojaRuta.precioCondicion = ''; | 345 | $scope.hojaRuta.precioCondicion = ''; |
| 343 | $scope.remitosTabla = []; | 346 | $scope.remitosTabla = []; |
| 344 | $scope.hojaRuta.vendedor.nombre = ''; | 347 | $scope.hojaRuta.vendedor.nombre = ''; |
| 345 | $scope.hojaRuta.cliente = {nombre: ''}; | 348 | $scope.hojaRuta.cliente = {nombre: ''}; |
| 346 | $scope.hojaRuta.domicilio = {dom: ''}; | 349 | $scope.hojaRuta.domicilio = {dom: ''}; |
| 347 | $scope.hojaRuta.litros = 0; | 350 | $scope.hojaRuta.litros = 0; |
| 348 | $scope.domiciliosCliente = []; | 351 | $scope.domiciliosCliente = []; |
| 349 | }; | 352 | }; |
| 350 | //Recibe aviso si el teclado está en uso | 353 | //Recibe aviso si el teclado está en uso |
| 351 | // $rootScope.$on('usarTeclado', function(event, data) { | 354 | // $rootScope.$on('usarTeclado', function(event, data) { |
| 352 | // if(data) { | 355 | // if(data) { |
| 353 | // $scope.mostrarTeclado = true; | 356 | // $scope.mostrarTeclado = true; |
| 354 | // return; | 357 | // return; |
| 355 | // } | 358 | // } |
| 356 | // $scope.mostrarTeclado = false; | 359 | // $scope.mostrarTeclado = false; |
| 357 | // }) | 360 | // }) |
| 358 | $scope.selectFocus = function($event) { | 361 | $scope.selectFocus = function($event) { |
| 359 | //Si el teclado esta en uso no selecciona el valor | 362 | //Si el teclado esta en uso no selecciona el valor |
| 360 | // if($scope.mostrarTeclado) { | 363 | // if($scope.mostrarTeclado) { |
| 361 | // return; | 364 | // return; |
| 362 | // } | 365 | // } |
| 363 | $event.target.select(); | 366 | $event.target.select(); |
| 364 | }; | 367 | }; |
| 365 | 368 | ||
| 366 | $scope.salir = function() { | 369 | $scope.salir = function() { |
| 367 | $location.path('/'); | 370 | $location.path('/'); |
| 368 | }; | 371 | }; |
| 369 | 372 | ||
| 370 | $scope.parsearATexto = function(articulo) { | 373 | $scope.parsearATexto = function(articulo) { |
| 371 | articulo.cantidad = parseFloat(articulo.cantidad); | 374 | articulo.cantidad = parseFloat(articulo.cantidad); |
| 372 | articulo.precio = parseFloat(articulo.precio); | 375 | articulo.precio = parseFloat(articulo.precio); |
| 373 | }; | 376 | }; |
| 374 | 377 | ||
| 375 | $scope.rellenar = function(relleno, longitud) { | 378 | $scope.rellenar = function(relleno, longitud) { |
| 376 | relleno = '' + relleno; | 379 | relleno = '' + relleno; |
| 377 | while (relleno.length < longitud) { | 380 | while (relleno.length < longitud) { |
| 378 | relleno = '0' + relleno; | 381 | relleno = '0' + relleno; |
| 379 | } | 382 | } |
| 380 | 383 | ||
| 381 | return relleno; | 384 | return relleno; |
| 382 | }; | 385 | }; |
| 383 | 386 | ||
| 384 | $scope.quitarArticulo = function(key) { | 387 | $scope.quitarArticulo = function(key) { |
| 385 | $scope.remitosTabla.splice(key, 1); | 388 | $scope.remitosTabla.splice(key, 1); |
| 386 | var litros = 0; | 389 | var litros = 0; |
| 387 | 390 | ||
| 388 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 391 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { |
| 389 | litros += parseFloat($scope.remitosTabla[i].litros); | 392 | litros += parseFloat($scope.remitosTabla[i].litros); |
| 390 | } | 393 | } |
| 391 | 394 | ||
| 392 | $scope.hojaRuta.litros = litros; | 395 | $scope.hojaRuta.litros = litros; |
| 393 | 396 | ||
| 394 | }; | 397 | }; |
| 395 | 398 | ||
| 396 | function addCabecera(label, valor) { | 399 | function addCabecera(label, valor) { |
| 397 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 400 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 398 | if(propiedad.length === 1) { | 401 | if(propiedad.length === 1) { |
| 399 | propiedad[0].valor = valor; | 402 | propiedad[0].valor = valor; |
| 400 | } else { | 403 | } else { |
| 401 | $scope.cabecera.push({label: label, valor: valor}); | 404 | $scope.cabecera.push({label: label, valor: valor}); |
| 402 | } | 405 | } |
| 403 | } | 406 | } |
| 404 | 407 | ||
| 405 | /*function removeCabecera(label) { | 408 | /*function removeCabecera(label) { |
| 406 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 409 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 407 | if(propiedad.length === 1){ | 410 | if(propiedad.length === 1){ |
| 408 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 411 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 409 | } | 412 | } |
| 410 | }*/ | 413 | }*/ |
| 411 | } | 414 | } |
| 412 | ] | 415 | ] |
| 413 | ) | 416 | ) |
| 414 | .controller('hojaRutaListaCtrl', [ | 417 | .controller('hojaRutaListaCtrl', [ |
| 415 | '$scope', | 418 | '$scope', |
| 416 | 'crearHojaRutaService', | 419 | 'crearHojaRutaService', |
| 417 | '$location', | 420 | '$location', |
| 418 | function($scope, crearHojaRutaService, $location) { | 421 | function($scope, crearHojaRutaService, $location) { |
| 419 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { | 422 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { |
| 420 | $scope.hojaRutas = datos.data; | 423 | $scope.hojaRutas = datos.data; |
| 421 | }); | 424 | }); |
| 422 | $scope.editar = function(hojaRuta) { | 425 | $scope.editar = function(hojaRuta) { |
| 423 | crearHojaRutaService.setHojaRuta(hojaRuta); | 426 | crearHojaRutaService.setHojaRuta(hojaRuta); |
| 424 | $location.path('/venta-nota-pedido/abm/'); | 427 | $location.path('/venta-nota-pedido/abm/'); |
| 425 | }; | 428 | }; |
| 426 | $scope.crearPedido = function() { | 429 | $scope.crearPedido = function() { |
| 427 | crearHojaRutaService.clearHojaRuta(); | 430 | crearHojaRutaService.clearHojaRuta(); |
| 428 | $location.path('/venta-nota-pedido/abm/'); | 431 | $location.path('/venta-nota-pedido/abm/'); |
| 429 | }; | 432 | }; |
| 430 | } | 433 | } |
| 431 | ]) | 434 | ]) |
| 432 | .controller('focaCrearHojaRutaFichaClienteController', [ | 435 | .controller('focaCrearHojaRutaFichaClienteController', [ |
| 433 | '$scope', | 436 | '$scope', |
| 434 | 'crearHojaRutaService', | 437 | 'crearHojaRutaService', |
| 435 | '$location', | 438 | '$location', |
| 436 | function($scope, crearHojaRutaService, $location) { | 439 | function($scope, crearHojaRutaService, $location) { |
| 437 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { | 440 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { |
| 438 | $scope.hojaRutas = datos.data; | 441 | $scope.hojaRutas = datos.data; |
| 439 | }); | 442 | }); |
| 440 | $scope.editar = function(hojaRuta) { | 443 | $scope.editar = function(hojaRuta) { |
| 441 | crearHojaRutaService.setHojaRuta(hojaRuta); | 444 | crearHojaRutaService.setHojaRuta(hojaRuta); |
| 442 | $location.path('/venta-nota-pedido/abm/'); | 445 | $location.path('/venta-nota-pedido/abm/'); |
| 443 | }; | 446 | }; |
| 444 | $scope.crearPedido = function() { | 447 | $scope.crearPedido = function() { |
| 445 | crearHojaRutaService.clearHojaRuta(); | 448 | crearHojaRutaService.clearHojaRuta(); |
| 446 | $location.path('/venta-nota-pedido/abm/'); | 449 | $location.path('/venta-nota-pedido/abm/'); |
| 447 | }; | 450 | }; |
| 448 | } | 451 | } |
| 449 | ]); | 452 | ]); |
| 450 | 453 |
src/views/hoja-ruta.html
| 1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-hoja-ruta foca-crear one-row row"> |
| 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> |
| 3 | <div class="row"> | 3 | <div class="row"> |
| 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 col-lg-12"> |
| 5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row panel-informativo"> |
| 6 | <div class="col-12"> | 6 | <div class="col-12"> |
| 7 | <div class="row"> | 7 | <div class="row titulares"> |
| 8 | <div class="col-12 col-sm-4 nota-pedido"> | 8 | <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> |
| 9 | <h5>HOJA DE RUTA</h5> | 9 | <h5 class="mb-0">HOJA DE RUTA</h5> |
| 10 | </div> | 10 | </div> |
| 11 | <div class="col-5 col-sm-4 numero-pedido" | 11 | <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle" |
| 12 | >Nº {{puntoVenta}}-{{comprobante}} | 12 | >Nº {{puntoVenta}}-{{comprobante}} |
| 13 | </div> | 13 | </div> |
| 14 | <div class="col-7 col-sm-4 text-right"> | 14 | <div class="col-7 col-sm-3 border border-white align-middle"> |
| 15 | Fecha: | 15 | Fecha: |
| 16 | <span | 16 | <span |
| 17 | ng-show="!datepickerAbierto" | 17 | ng-show="!datepickerAbierto" |
| 18 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 18 | ng-bind="now | date:'dd/MM/yyyy'" |
| 19 | ng-click="datepickerAbierto = true" | 19 | ng-click="datepickerAbierto = true" |
| 20 | > | 20 | > |
| 21 | </span> | 21 | </span> |
| 22 | <input | 22 | <input |
| 23 | ng-show="datepickerAbierto" | 23 | ng-show="datepickerAbierto" |
| 24 | type="date" | 24 | type="date" |
| 25 | ng-model="now" | 25 | ng-model="now" |
| 26 | ng-change="datepickerAbierto = false" | 26 | ng-change="datepickerAbierto = false" |
| 27 | ng-blur="datepickerAbierto = false" | 27 | ng-blur="datepickerAbierto = false" |
| 28 | class="form-control form-control-sm col-8 float-right" | 28 | class="form-control form-control-sm col-8 float-right" |
| 29 | foca-focus="datepickerAbierto" | 29 | foca-focus="datepickerAbierto" |
| 30 | hasta-hoy | 30 | hasta-hoy |
| 31 | /> | 31 | /> |
| 32 | </div> | 32 | </div> |
| 33 | <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> | ||
| 34 | Hora: | ||
| 35 | <span | ||
| 36 | ng-show="!datepickerAbierto" | ||
| 37 | ng-bind="now | date:'HH:mm'" | ||
| 38 | ng-click="datepickerAbierto = true" | ||
| 39 | > | ||
| 40 | </span> | ||
| 41 | </div> | ||
| 33 | </div> | 42 | </div> |
| 34 | <div class="row"> | 43 | <div class="row py-2"> |
| 35 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 44 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
| 36 | <span class="label" ng-bind="cab.label"></span> | 45 | <span class="label" ng-bind="cab.label"></span> |
| 37 | <span class="valor" ng-bind="cab.valor"></span> | 46 | <span class="valor" ng-bind="cab.valor"></span> |
| 38 | </div> | 47 | </div> |
| 39 | <a | 48 | <a |
| 40 | class="btn col-12 btn-secondary d-sm-none" | 49 | class="btn col-12 btn-secondary d-sm-none" |
| 41 | ng-show="cabecera.length > 0" | 50 | ng-show="cabecera.length > 0" |
| 42 | ng-click="showCabecera = !showCabecera" | 51 | ng-click="showCabecera = !showCabecera" |
| 43 | > | 52 | > |
| 44 | <i | 53 | <i |
| 45 | class="fa fa-chevron-down" | 54 | class="fa fa-chevron-down" |
| 46 | ng-hide="showCabecera" | 55 | ng-hide="showCabecera" |
| 47 | aria-hidden="true" | 56 | aria-hidden="true" |
| 48 | > | 57 | > |
| 49 | </i> | 58 | </i> |
| 50 | <i | 59 | <i |
| 51 | class="fa fa-chevron-up" | 60 | class="fa fa-chevron-up" |
| 52 | ng-show="showCabecera" | 61 | ng-show="showCabecera" |
| 53 | aria-hidden="true"> | 62 | aria-hidden="true"> |
| 54 | </i> | 63 | </i> |
| 55 | </a> | 64 | </a> |
| 56 | </div> | 65 | </div> |
| 57 | </div> | 66 | </div> |
| 58 | </div> | 67 | </div> |
| 59 | <div class="row p-1 botonera-secundaria"> | 68 | |
| 69 | </div> | ||
| 70 | </div> | ||
| 71 | </form> | ||
| 72 | <div class="col-lg-12"> | ||
| 73 | <div class="row mt-4"> | ||
| 74 | <div class="col-12 col-md-10 border border-light rounded"> | ||
| 75 | <div class="row px-5 py-2 botonera-secundaria"> | ||
| 60 | <div class="col-12"> | 76 | <div class="col-12"> |
| 61 | <div class="row"> | 77 | <div class="row"> |
| 62 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 78 | <div |
| 79 | class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0" | ||
| 80 | ng-repeat="boton in botonera" | ||
| 81 | ng-class="{'d-none d-md-grid': boton.texto == ''}"> | ||
| 63 | <button | 82 | <button |
| 64 | type="button" | 83 | type="button" |
| 65 | class="btn btn-default btn-block btn-xs text-left py-2" | 84 | class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light" |
| 66 | ng-click="boton.accion()" | 85 | ng-click="boton.accion()" |
| 67 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 86 | ng-class="{'d-sm-block h-100': boton.texto == ''}" |
| 68 | > | 87 | > |
| 69 | <i | 88 | <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen"> |
| 70 | class="fa fa-arrow-circle-right" | 89 | <span>{{boton.texto}}</span> |
| 71 | ng-show="boton.texto != ''" | ||
| 72 | ></i> | ||
| 73 | | ||
| 74 | {{boton.texto}} | ||
| 75 | </button> | 90 | </button> |
| 76 | </div> | 91 | </div> |
| 77 | </div> | 92 | </div> |
| 78 | </div> | 93 | </div> |
| 79 | </div> | 94 | </div> |
| 80 | </div> | 95 | <!-- PC --> |
| 81 | </div> | 96 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
| 82 | </form> | 97 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
| 83 | <div class="row"> | 98 | <thead> |
| 84 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 99 | <tr class="d-flex"> |
| 85 | <!-- PC --> | 100 | <th class="col-auto">#</th> |
| 86 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 101 | <th class="col-2">Remito</th> |
| 87 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 102 | <th class="col">Cliente</th> |
| 88 | <thead> | 103 | <th class="col">Dirección</th> |
| 89 | <tr class="d-flex"> | 104 | <th class="text-right" style="width: 80px">Cantidad</th> |
| 90 | <th class="col-auto">#</th> | 105 | <th class="col-auto"> |
| 91 | <th class="col-2">Remito</th> | 106 | <button |
| 92 | <th class="col">Cliente</th> | 107 | class="btn btn-outline-secondary selectable" |
| 93 | <th class="col">Dirección</th> | 108 | ng-click="show = !show; masMenos()" |
| 94 | <th class="text-right" style="width: 80px">Cantidad</th> | ||
| 95 | <th class="col-auto"> | ||
| 96 | <button | ||
| 97 | class="btn btn-outline-secondary selectable" | ||
| 98 | ng-click="show = !show; masMenos()" | ||
| 99 | > | ||
| 100 | <i | ||
| 101 | class="fa fa-chevron-down" | ||
| 102 | ng-show="show" | ||
| 103 | aria-hidden="true" | ||
| 104 | > | 109 | > |
| 105 | </i> | 110 | <i |
| 106 | <i | 111 | class="fa fa-chevron-down" |
| 107 | class="fa fa-chevron-up" | 112 | ng-show="show" |
| 108 | ng-hide="show" | 113 | aria-hidden="true" |
| 109 | aria-hidden="true"> | 114 | > |
| 110 | </i> | 115 | </i> |
| 111 | </button> | 116 | <i |
| 112 | </th> | 117 | class="fa fa-chevron-up" |
| 113 | </th> | 118 | ng-hide="show" |
| 114 | </tr> | 119 | aria-hidden="true"> |
| 115 | </thead> | 120 | </i> |
| 116 | <tbody class="tabla-articulo-body"> | 121 | </button> |
| 117 | <tr | 122 | </th> |
| 118 | ng-repeat="(key, remito) in remitosTabla" | 123 | </th> |
| 119 | class="d-flex" | 124 | </tr> |
| 120 | ng-show="show || key == remitosTabla.length - 1" | 125 | </thead> |
| 121 | > | 126 | <tbody class="tabla-articulo-body"> |
| 122 | <td ng-bind="key + 1" class="col-auto"></td> | 127 | <tr |
| 123 | <td | 128 | ng-repeat="(key, remito) in remitosTabla" |
| 124 | class="col-2" | 129 | class="d-flex" |
| 125 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | 130 | ng-show="show || key == remitosTabla.length - 1" |
| 126 | ></td> | 131 | > |
| 127 | <th class="col" ng-bind="remito.cliente[0].NOM"></th> | 132 | <td ng-bind="key + 1" class="col-auto"></td> |
| 128 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 133 | <td |
| 129 | <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> | 134 | class="col-2" |
| 130 | <td class="text-center col-auto"> | 135 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" |
| 131 | <button | 136 | ></td> |
| 132 | class="btn btn-outline-secondary" | 137 | <th class="col" ng-bind="remito.cliente[0].NOM"></th> |
| 133 | ng-click="quitarArticulo(key)" | 138 | <th class="col" ng-bind="remito.domicilioStamp"></th> |
| 134 | > | 139 | <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> |
| 135 | <i class="fa fa-trash"></i> | 140 | <td class="text-center col-auto"> |
| 136 | </button> | 141 | <button |
| 137 | </td> | 142 | class="btn btn-outline-secondary" |
| 138 | </tr> | 143 | ng-click="quitarArticulo(key)" |
| 139 | </tbody> | 144 | > |
| 140 | <tfoot> | 145 | <i class="fa fa-trash"></i> |
| 141 | <tr class="d-flex"> | 146 | </button> |
| 142 | <td class="col-auto px-1"> | 147 | </td> |
| 143 | <strong>Remitos:</strong> | 148 | </tr> |
| 144 | <a ng-bind="remitosTabla.length"></a> | 149 | </tbody> |
| 145 | </td> | 150 | <tfoot> |
| 146 | <td class="col"></td> | 151 | <tr class="d-flex"> |
| 147 | <td class="col-auto px-1"> | 152 | <td class="col-auto px-1"> |
| 148 | <strong>Cantidad:</strong> | 153 | <strong>Remitos:</strong> |
| 149 | <a ng-bind="hojaRuta.litros"></a> | 154 | <a ng-bind="remitosTabla.length"></a> |
| 150 | </td> | 155 | </td> |
| 151 | </tr> | 156 | <td class="col"></td> |
| 152 | </tfoot> | 157 | <td class="col-auto px-1"> |
| 153 | </table> | 158 | <strong>Cantidad:</strong> |
| 154 | </div> | 159 | <a ng-bind="hojaRuta.litros"></a> |
| 155 | 160 | </td> | |
| 156 | <!-- MOBILE --> | 161 | </tr> |
| 157 | <div class="row d-sm-none"> | 162 | </tfoot> |
| 158 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | 163 | </table> |
| 159 | <thead> | 164 | </div> |
| 160 | <tr class="d-flex"> | 165 | |
| 161 | <th class="">#</th> | 166 | <!-- MOBILE --> |
| 162 | <th class="col px-0"> | 167 | <div class="row d-sm-none"> |
| 163 | <div class="d-flex"> | 168 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> |
| 164 | <div class="col-4 px-1">Código</div> | 169 | <thead> |
| 165 | <div class="col-8 px-1">Descripción</div> | 170 | <tr class="d-flex"> |
| 166 | </div> | 171 | <th class="">#</th> |
| 167 | <div class="d-flex"> | 172 | <th class="col px-0"> |
| 168 | <div class="col-3 px-1">Cantidad</div> | 173 | <div class="d-flex"> |
| 169 | <div class="col px-1 text-right">P. Uni.</div> | 174 | <div class="col-4 px-1">Código</div> |
| 170 | <div class="col px-1 text-right">Subtotal</div> | 175 | <div class="col-8 px-1">Descripción</div> |
| 171 | </div> | 176 | </div> |
| 172 | </th> | 177 | <div class="d-flex"> |
| 173 | <th class="text-center tamaño-boton"> | 178 | <div class="col-3 px-1">Cantidad</div> |
| 174 | | 179 | <div class="col px-1 text-right">P. Uni.</div> |
| 175 | </th> | 180 | <div class="col px-1 text-right">Subtotal</div> |
| 176 | </tr> | 181 | </div> |
| 177 | </thead> | 182 | </th> |
| 178 | <tbody> | 183 | <th class="text-center tamaño-boton"> |
| 179 | <tr | 184 | |
| 180 | ng-repeat="(key, articulo) in remitosTabla" | 185 | </th> |
| 181 | ng-show="show || key == remitosTabla.length - 1" | 186 | </tr> |
| 182 | > | 187 | </thead> |
| 183 | <td class="w-100 align-middle d-flex p-0"> | 188 | <tbody> |
| 184 | <div class="align-middle p-1"> | 189 | <tr |
| 185 | <span ng-bind="key+1" class="align-middle"></span> | 190 | ng-repeat="(key, articulo) in remitosTabla" |
| 186 | </div> | 191 | ng-show="show || key == remitosTabla.length - 1" |
| 187 | <div class="col px-0"> | 192 | > |
| 193 | <td class="w-100 align-middle d-flex p-0"> | ||
| 194 | <div class="align-middle p-1"> | ||
| 195 | <span ng-bind="key+1" class="align-middle"></span> | ||
| 196 | </div> | ||
| 197 | <div class="col px-0"> | ||
| 198 | <div class="d-flex"> | ||
| 199 | <div class="col-4 px-1"> | ||
| 200 | <span | ||
| 201 | ng-bind="articulo.sector + '-' + articulo.codigo" | ||
| 202 | ></span> | ||
| 203 | </div> | ||
| 204 | <div class="col-8 px-1"> | ||
| 205 | <span ng-bind="articulo.descripcion"></span> | ||
| 206 | </div> | ||
| 207 | </div> | ||
| 208 | <div class="d-flex"> | ||
| 209 | <div class="col-3 px-1"> | ||
| 210 | <span ng-bind="'x' + articulo.cantidad"></span> | ||
| 211 | </div> | ||
| 212 | <div class="col-3 px-1 text-right"> | ||
| 213 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | ||
| 214 | </div> | ||
| 215 | <div class="col px-1 text-right"> | ||
| 216 | <span | ||
| 217 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" | ||
| 218 | > | ||
| 219 | </span> | ||
| 220 | </div> | ||
| 221 | </div> | ||
| 222 | </div> | ||
| 223 | <div class="align-middle p-1"> | ||
| 224 | <button | ||
| 225 | class="btn btn-outline-secondary" | ||
| 226 | ng-click="quitarArticulo(key)" | ||
| 227 | > | ||
| 228 | <i class="fa fa-trash"></i> | ||
| 229 | </button> | ||
| 230 | </div> | ||
| 231 | </td> | ||
| 232 | </tr> | ||
| 233 | </tbody> | ||
| 234 | <tfoot> | ||
| 235 | <!-- CARGANDO ITEM --> | ||
| 236 | <tr ng-show="!cargando" class="d-flex"> | ||
| 237 | <td | ||
| 238 | class="align-middle p-1" | ||
| 239 | ng-bind="remitosTabla.length + 1" | ||
| 240 | ></td> | ||
| 241 | <td class="col p-0"> | ||
| 188 | <div class="d-flex"> | 242 | <div class="d-flex"> |
| 189 | <div class="col-4 px-1"> | 243 | <div class="col-4 px-1"> |
| 190 | <span | 244 | <span |
| 191 | ng-bind="articulo.sector + '-' + articulo.codigo" | 245 | ng-bind="articuloACargar.sectorCodigo" |
| 192 | ></span> | 246 | ></span> |
| 193 | </div> | 247 | </div> |
| 194 | <div class="col-8 px-1"> | 248 | <div class="col-8 px-1"> |
| 195 | <span ng-bind="articulo.descripcion"></span> | 249 | <span ng-bind="articuloACargar.descripcion"></span> |
| 196 | </div> | 250 | </div> |
| 197 | </div> | 251 | </div> |
| 198 | <div class="d-flex"> | 252 | <div class="d-flex"> |
| 199 | <div class="col-3 px-1"> | 253 | <div class="col-3 px-1 m-1"> |
| 200 | <span ng-bind="'x' + articulo.cantidad"></span> | 254 | <input |
| 255 | class="form-control p-1" | ||
| 256 | type="number" | ||
| 257 | min="1" | ||
| 258 | ng-model="articuloACargar.cantidad" | ||
| 259 | foca-focus="!cargando" | ||
| 260 | ng-keypress="agregarATabla($event.keyCode)" | ||
| 261 | style="height: auto; line-height: 1.1em" | ||
| 262 | > | ||
| 201 | </div> | 263 | </div> |
| 202 | <div class="col-3 px-1 text-right"> | 264 | <div class="col-3 px-1 text-right"> |
| 203 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | 265 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> |
| 204 | </div> | 266 | </div> |
| 205 | <div class="col px-1 text-right"> | 267 | <div class="col px-1 text-right"> |
| 206 | <span | 268 | <span |
| 207 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" | 269 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" |
| 208 | > | 270 | > |
| 209 | </span> | 271 | </span> |
| 210 | </div> | 272 | </div> |
| 211 | </div> | 273 | </div> |
| 212 | </div> | 274 | </td> |
| 213 | <div class="align-middle p-1"> | 275 | <td class="text-center align-middle"> |
| 214 | <button | 276 | <button |
| 215 | class="btn btn-outline-secondary" | 277 | class="btn btn-outline-secondary" |
| 216 | ng-click="quitarArticulo(key)" | 278 | ng-click="agregarATabla(13)" |
| 217 | > | 279 | > |
| 218 | <i class="fa fa-trash"></i> | 280 | <i class="fa fa-save"></i> |
| 219 | </button> | 281 | </button> |
| 220 | </div> | 282 | </td> |
| 221 | </td> | 283 | </tr> |
| 222 | </tr> | 284 | <!-- SELECCIONAR PRODUCTO --> |
| 223 | </tbody> | 285 | <tr ng-show="cargando" class="d-flex"> |
| 224 | <tfoot> | 286 | <td class="col-12"> |
| 225 | <!-- CARGANDO ITEM --> | 287 | <input |
| 226 | <tr ng-show="!cargando" class="d-flex"> | 288 | placeholder="Seleccione Articulo" |
| 227 | <td | 289 | class="form-control form-control-sm" |
| 228 | class="align-middle p-1" | 290 | readonly |
| 229 | ng-bind="remitosTabla.length + 1" | 291 | ng-click="seleccionarArticulo()" |
| 230 | ></td> | 292 | /> |
| 231 | <td class="col p-0"> | 293 | </td> |
| 232 | <div class="d-flex"> | 294 | </tr> |
| 233 | <div class="col-4 px-1"> | 295 | <!-- TOOGLE EXPANDIR --> |
| 234 | <span | 296 | <tr> |
| 235 | ng-bind="articuloACargar.sectorCodigo" | 297 | <td class="col"> |
| 236 | ></span> | 298 | <button |
| 237 | </div> | 299 | class="btn btn-outline-secondary selectable w-100" |
| 238 | <div class="col-8 px-1"> | 300 | ng-click="show = !show; masMenos()" |
| 239 | <span ng-bind="articuloACargar.descripcion"></span> | 301 | ng-show="remitosTabla.length > 0" |
| 240 | </div> | ||
| 241 | </div> | ||
| 242 | <div class="d-flex"> | ||
| 243 | <div class="col-3 px-1 m-1"> | ||
| 244 | <input | ||
| 245 | class="form-control p-1" | ||
| 246 | type="number" | ||
| 247 | min="1" | ||
| 248 | ng-model="articuloACargar.cantidad" | ||
| 249 | foca-focus="!cargando" | ||
| 250 | ng-keypress="agregarATabla($event.keyCode)" | ||
| 251 | style="height: auto; line-height: 1.1em" | ||
| 252 | > | ||
| 253 | </div> | ||
| 254 | <div class="col-3 px-1 text-right"> | ||
| 255 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | ||
| 256 | </div> | ||
| 257 | <div class="col px-1 text-right"> | ||
| 258 | <span | ||
| 259 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" | ||
| 260 | > | ||
| 261 | </span> | ||
| 262 | </div> | ||
| 263 | </div> | ||
| 264 | </td> | ||
| 265 | <td class="text-center align-middle"> | ||
| 266 | <button | ||
| 267 | class="btn btn-outline-secondary" | ||
| 268 | ng-click="agregarATabla(13)" | ||
| 269 | > | ||
| 270 | <i class="fa fa-save"></i> | ||
| 271 | </button> | ||
| 272 | </td> | ||
| 273 | </tr> | ||
| 274 | <!-- SELECCIONAR PRODUCTO --> | ||
| 275 | <tr ng-show="cargando" class="d-flex"> | ||
| 276 | <td class="col-12"> | ||
| 277 | <input | ||
| 278 | placeholder="Seleccione Articulo" | ||
| 279 | class="form-control form-control-sm" | ||
| 280 | readonly | ||
| 281 | ng-click="seleccionarArticulo()" | ||
| 282 | /> | ||
| 283 | </td> | ||
| 284 | </tr> | ||
| 285 | <!-- TOOGLE EXPANDIR --> | ||
| 286 | <tr> | ||
| 287 | <td class="col"> | ||
| 288 | <button | ||
| 289 | class="btn btn-outline-secondary selectable w-100" | ||
| 290 | ng-click="show = !show; masMenos()" | ||
| 291 | ng-show="remitosTabla.length > 0" |