Commit c6682e7fd80098fba05f1838b192938c50665c89
1 parent
669972d07c
Exists in
master
rename crear remito
Showing
1 changed file
with
1 additions
and
2 deletions
 
Show diff stats
src/js/service.js
| 1 | angular.module('focaCrearHojaRuta') | 1 | angular.module('focaCrearHojaRuta') | 
| 2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', '$cookies', | 2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', '$cookies', | 
| 3 | function($http, API_ENDPOINT, $cookies) { | 3 | function($http, API_ENDPOINT, $cookies) { | 
| 4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; | 
| 5 | return { | 5 | return { | 
| 6 | idUsuario: $cookies.get('vendedorCobrador'), | 6 | idUsuario: $cookies.get('vendedorCobrador'), | 
| 7 | crearHojaRuta: function(hojaRuta) { | 7 | crearHojaRuta: function(hojaRuta) { | 
| 8 | return $http.post(route + '/hoja-ruta', hojaRuta); | 8 | return $http.post(route + '/hoja-ruta', hojaRuta); | 
| 9 | }, | 9 | }, | 
| 10 | crearRemito: function(remito) { | 10 | crearRemito: function(remito) { | 
| 11 | console.log('Crear remito-----: ', remito); | ||
| 12 | // TODO: Cambiar para usar el servicio /remito | 11 | // TODO: Cambiar para usar el servicio /remito | 
| 13 | return $http.post(route + '/remito', remito); | 12 | return $http.post(route + '/remito/guardar', remito); | 
| 14 | }, | 13 | }, | 
| 15 | obtenerHojaRuta: function() { | 14 | obtenerHojaRuta: function() { | 
| 16 | return $http.get(route +'/hoja-ruta'); | 15 | return $http.get(route +'/hoja-ruta'); | 
| 17 | }, | 16 | }, | 
| 18 | setHojaRuta: function(hojaRuta) { | 17 | setHojaRuta: function(hojaRuta) { | 
| 19 | this.hojaRuta = hojaRuta; | 18 | this.hojaRuta = hojaRuta; | 
| 20 | }, | 19 | }, | 
| 21 | clearHojaRuta: function() { | 20 | clearHojaRuta: function() { | 
| 22 | this.hojaRuta = undefined; | 21 | this.hojaRuta = undefined; | 
| 23 | }, | 22 | }, | 
| 24 | getHojaRuta: function() { | 23 | getHojaRuta: function() { | 
| 25 | return this.hojaRuta; | 24 | return this.hojaRuta; | 
| 26 | }, | 25 | }, | 
| 27 | getArticulosByIdHojaRuta: function(id) { | 26 | getArticulosByIdHojaRuta: function(id) { | 
| 28 | return $http.get(route+'/articulos/hoja-ruta/'+id); | 27 | return $http.get(route+'/articulos/hoja-ruta/'+id); | 
| 29 | }, | 28 | }, | 
| 30 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { | 29 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { | 
| 31 | return $http.post(route + '/articulos/remito', | 30 | return $http.post(route + '/articulos/remito', | 
| 32 | {articuloRemito: articuloHojaRuta}); | 31 | {articuloRemito: articuloHojaRuta}); | 
| 33 | }, | 32 | }, | 
| 34 | getDomiciliosByIdHojaRuta: function(id) { | 33 | getDomiciliosByIdHojaRuta: function(id) { | 
| 35 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); | 34 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); | 
| 36 | }, | 35 | }, | 
| 37 | getDomiciliosByIdCliente: function(id) { | 36 | getDomiciliosByIdCliente: function(id) { | 
| 38 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 37 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 
| 39 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 38 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 
| 40 | }, | 39 | }, | 
| 41 | getPrecioCondicion: function() { | 40 | getPrecioCondicion: function() { | 
| 42 | return $http.get(route + '/precio-condicion'); | 41 | return $http.get(route + '/precio-condicion'); | 
| 43 | }, | 42 | }, | 
| 44 | getPrecioCondicionById: function(id) { | 43 | getPrecioCondicionById: function(id) { | 
| 45 | return $http.get(route + '/precio-condicion/' + id); | 44 | return $http.get(route + '/precio-condicion/' + id); | 
| 46 | }, | 45 | }, | 
| 47 | getPlazoPagoByPrecioCondicion: function(id) { | 46 | getPlazoPagoByPrecioCondicion: function(id) { | 
| 48 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); | 47 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); | 
| 49 | }, | 48 | }, | 
| 50 | crearFlete: function(flete) { | 49 | crearFlete: function(flete) { | 
| 51 | return $http.post(route + '/flete', {flete : flete}); | 50 | return $http.post(route + '/flete', {flete : flete}); | 
| 52 | }, | 51 | }, | 
| 53 | crearPlazosParaHojaRuta: function(plazos) { | 52 | crearPlazosParaHojaRuta: function(plazos) { | 
| 54 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); | 53 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); | 
| 55 | }, | 54 | }, | 
| 56 | getCotizacionByIdMoneda: function(id) { | 55 | getCotizacionByIdMoneda: function(id) { | 
| 57 | return $http.get(route + '/moneda/' + id); | 56 | return $http.get(route + '/moneda/' + id); | 
| 58 | }, | 57 | }, | 
| 59 | crearEstadoParaHojaRuta: function(estado) { | 58 | crearEstadoParaHojaRuta: function(estado) { | 
| 60 | return $http.post(route + '/estado', {estado: estado}); | 59 | return $http.post(route + '/estado', {estado: estado}); | 
| 61 | }, | 60 | }, | 
| 62 | getNumeroHojaRuta: function() { | 61 | getNumeroHojaRuta: function() { | 
| 63 | return $http.get(route + '/hoja-ruta/numero-siguiente'); | 62 | return $http.get(route + '/hoja-ruta/numero-siguiente'); | 
| 64 | }, | 63 | }, | 
| 65 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { | 64 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { | 
| 66 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; | 65 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; | 
| 67 | return $http.get(route + '/vehiculo/obtener/remitos/' + | 66 | return $http.get(route + '/vehiculo/obtener/remitos/' + | 
| 68 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); | 67 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); | 
| 69 | }, | 68 | }, | 
| 70 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { | 69 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { | 
| 71 | return $http.post(route + '/vehiculo/desasociar-remitos', | 70 | return $http.post(route + '/vehiculo/desasociar-remitos', | 
| 72 | { | 71 | { | 
| 73 | idsRemitos: idsRemitos, | 72 | idsRemitos: idsRemitos, | 
| 74 | idVehiculo: idVehiculo, | 73 | idVehiculo: idVehiculo, | 
| 75 | vehiculoSinRemitos: sinRemitos | 74 | vehiculoSinRemitos: sinRemitos | 
| 76 | }); | 75 | }); | 
| 77 | }, | 76 | }, | 
| 78 | getParametros: function() { | 77 | getParametros: function() { | 
| 79 | return $http.get(API_ENDPOINT.URL + '/parametros/hojaRuta'); | 78 | return $http.get(API_ENDPOINT.URL + '/parametros/hojaRuta'); | 
| 80 | }, | 79 | }, | 
| 81 | getBotonera: function() { | 80 | getBotonera: function() { | 
| 82 | return [ | 81 | return [ | 
| 83 | { | 82 | { | 
| 84 | label: 'Fecha Entrega', | 83 | label: 'Fecha Entrega', | 
| 85 | image: 'FechaEntrega.png' | 84 | image: 'FechaEntrega.png' | 
| 86 | }, | 85 | }, | 
| 87 | { | 86 | { | 
| 88 | label: 'Transportista', | 87 | label: 'Transportista', | 
| 89 | image: 'transportista.png' | 88 | image: 'transportista.png' | 
| 90 | }, | 89 | }, | 
| 91 | { | 90 | { | 
| 92 | label: 'Chofer', | 91 | label: 'Chofer', | 
| 93 | image: 'chofer.png' | 92 | image: 'chofer.png' | 
| 94 | }, | 93 | }, | 
| 95 | { | 94 | { | 
| 96 | label: 'Vehiculo', | 95 | label: 'Vehiculo', | 
| 97 | image: 'vehiculos.png' | 96 | image: 'vehiculos.png' | 
| 98 | }, | 97 | }, | 
| 99 | { | 98 | { | 
| 100 | label: 'Tarifario', | 99 | label: 'Tarifario', | 
| 101 | image: 'tarifario.png' | 100 | image: 'tarifario.png' | 
| 102 | }, | 101 | }, | 
| 103 | { | 102 | { | 
| 104 | label: 'Remitos', | 103 | label: 'Remitos', | 
| 105 | image: 'remito.png' | 104 | image: 'remito.png' | 
| 106 | }, | 105 | }, | 
| 107 | { | 106 | { | 
| 108 | label: 'Vehiculos precargados', | 107 | label: 'Vehiculos precargados', | 
| 109 | image: 'vehiculos.png' | 108 | image: 'vehiculos.png' | 
| 110 | }, | 109 | }, | 
| 111 | { | 110 | { | 
| 112 | label: 'Datos extra', | 111 | label: 'Datos extra', | 
| 113 | image: 'tarifario.png' | 112 | image: 'tarifario.png' | 
| 114 | } | 113 | } | 
| 115 | ]; | 114 | ]; | 
| 116 | }, | 115 | }, | 
| 117 | getBotones: function () { | 116 | getBotones: function () { | 
| 118 | return [ | 117 | return [ | 
| 119 | { | 118 | { | 
| 120 | label: 'Precargados', | 119 | label: 'Precargados', | 
| 121 | image: 'vehiculos.png' | 120 | image: 'vehiculos.png' | 
| 122 | }, | 121 | }, | 
| 123 | { | 122 | { | 
| 124 | label: 'Cargar Remitos', | 123 | label: 'Cargar Remitos', | 
| 125 | image: 'remito.png' | 124 | image: 'remito.png' | 
| 126 | }, | 125 | }, | 
| 127 | { | 126 | { | 
| 128 | label: 'Remito Abierto', | 127 | label: 'Remito Abierto', | 
| 129 | image: 'remitoabierto.png' | 128 | image: 'remitoabierto.png' | 
| 130 | } | 129 | } | 
| 131 | ]; | 130 | ]; | 
| 132 | }, | 131 | }, | 
| 133 | getRemitoAbierto: function () { | 132 | getRemitoAbierto: function () { | 
| 134 | return [ | 133 | return [ | 
| 135 | { | 134 | { | 
| 136 | label: 'Fecha Entrega', | 135 | label: 'Fecha Entrega', | 
| 137 | image: 'FechaEntrega.png' | 136 | image: 'FechaEntrega.png' | 
| 138 | }, | 137 | }, | 
| 139 | { | 138 | { | 
| 140 | label: 'Transportista', | 139 | label: 'Transportista', | 
| 141 | image: 'transportista.png' | 140 | image: 'transportista.png' | 
| 142 | }, | 141 | }, | 
| 143 | { | 142 | { | 
| 144 | label: 'Vehiculo', | 143 | label: 'Vehiculo', | 
| 145 | image: 'vehiculos.png' | 144 | image: 'vehiculos.png' | 
| 146 | }, | 145 | }, | 
| 147 | { | 146 | { | 
| 148 | label: 'Chofer', | 147 | label: 'Chofer', | 
| 149 | image: 'chofer.png' | 148 | image: 'chofer.png' | 
| 150 | }, | 149 | }, | 
| 151 | { | 150 | { | 
| 152 | label: 'Proveedor', | 151 | label: 'Proveedor', | 
| 153 | image: 'proveedor.png' | 152 | image: 'proveedor.png' | 
| 154 | }, | 153 | }, | 
| 155 | { | 154 | { | 
| 156 | label: 'Tarifario', | 155 | label: 'Tarifario', | 
| 157 | image: 'tarifario.png' | 156 | image: 'tarifario.png' | 
| 158 | }, | 157 | }, | 
| 159 | { | 158 | { | 
| 160 | label: 'Cliente', | 159 | label: 'Cliente', | 
| 161 | image: 'cliente.png' | 160 | image: 'cliente.png' | 
| 162 | }, | 161 | }, | 
| 163 | { | 162 | { | 
| 164 | label: 'Detalle de Carga', | 163 | label: 'Detalle de Carga', | 
| 165 | image: 'detalleDeCarga.png' | 164 | image: 'detalleDeCarga.png' | 
| 166 | } | 165 | } | 
| 167 | ]; | 166 | ]; | 
| 168 | }, | 167 | }, | 
| 169 | getArticulos : function () { | 168 | getArticulos : function () { | 
| 170 | return $http.get(API_ENDPOINT.URL + '/articulos'); | 169 | return $http.get(API_ENDPOINT.URL + '/articulos'); | 
| 171 | }, | 170 | }, | 
| 172 | getVendedorById : function (idVendedor) { | 171 | getVendedorById : function (idVendedor) { | 
| 173 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + idVendedor); | 172 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + idVendedor); | 
| 174 | }, | 173 | }, | 
| 175 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 174 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 
| 176 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 175 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 
| 177 | idDomicilio + '/' + idCliente); | 176 | idDomicilio + '/' + idCliente); | 
| 178 | }, | 177 | }, | 
| 179 | getBotonFecha : function () { | 178 | getBotonFecha : function () { | 
| 180 | return [ | 179 | return [ | 
| 181 | { | 180 | { | 
| 182 | label: 'Fecha Entrega', | 181 | label: 'Fecha Entrega', | 
| 183 | image: 'FechaEntrega.png' | 182 | image: 'FechaEntrega.png' | 
| 184 | }, | 183 | }, | 
| 185 | ]; | 184 | ]; | 
| 186 | }, | 185 | }, | 
| 187 | getBotoneraPrecargado: function () { | 186 | getBotoneraPrecargado: function () { | 
| 188 | return [ | 187 | return [ | 
| 189 | 188 | ||
| 190 | { | 189 | { | 
| 191 | label: 'Transportista', | 190 | label: 'Transportista', | 
| 192 | image: 'transportista.png' | 191 | image: 'transportista.png' | 
| 193 | }, | 192 | }, | 
| 194 | { | 193 | { | 
| 195 | label: 'Chofer', | 194 | label: 'Chofer', | 
| 196 | image: 'chofer.png' | 195 | image: 'chofer.png' | 
| 197 | }, | 196 | }, | 
| 198 | { | 197 | { | 
| 199 | label: 'Vehiculo', | 198 | label: 'Vehiculo', | 
| 200 | image: 'vehiculos.png' | 199 | image: 'vehiculos.png' | 
| 201 | }, | 200 | }, | 
| 202 | { | 201 | { | 
| 203 | label: 'Tarifario', | 202 | label: 'Tarifario', | 
| 204 | image: 'tarifario.png' | 203 | image: 'tarifario.png' | 
| 205 | }, | 204 | }, | 
| 206 | { | 205 | { | 
| 207 | label: 'Datos extra', | 206 | label: 'Datos extra', | 
| 208 | image: 'tarifario.png' | 207 | image: 'tarifario.png' | 
| 209 | } | 208 | } | 
| 210 | ]; | 209 | ]; | 
| 211 | }, | 210 | }, | 
| 212 | getBotoneraCargarRemito: function () { | 211 | getBotoneraCargarRemito: function () { | 
| 213 | return [ | 212 | return [ | 
| 214 | { | 213 | { | 
| 215 | label: 'Transportista', | 214 | label: 'Transportista', | 
| 216 | image: 'transportista.png' | 215 | image: 'transportista.png' | 
| 217 | }, | 216 | }, | 
| 218 | { | 217 | { | 
| 219 | label: 'Chofer', | 218 | label: 'Chofer', | 
| 220 | image: 'chofer.png' | 219 | image: 'chofer.png' | 
| 221 | }, | 220 | }, | 
| 222 | { | 221 | { | 
| 223 | label: 'Vehiculo', | 222 | label: 'Vehiculo', | 
| 224 | image: 'flete.png' | 223 | image: 'flete.png' | 
| 225 | }, | 224 | }, | 
| 226 | { | 225 | { | 
| 227 | label: 'Remitos', | 226 | label: 'Remitos', | 
| 228 | image: 'remito.png' | 227 | image: 'remito.png' | 
| 229 | }, | 228 | }, | 
| 230 | { | 229 | { | 
| 231 | label: 'Tarifario', | 230 | label: 'Tarifario', | 
| 232 | image: 'tarifario.png' | 231 | image: 'tarifario.png' | 
| 233 | }, | 232 | }, | 
| 234 | { | 233 | { | 
| 235 | label: 'Datos extra', | 234 | label: 'Datos extra', | 
| 236 | image: 'tarifario.png' | 235 | image: 'tarifario.png' | 
| 237 | } | 236 | } | 
| 238 | ]; | 237 | ]; | 
| 239 | }, | 238 | }, | 
| 240 | guardarCisternas: function(cisterna, idRemito) { | 239 | guardarCisternas: function(cisterna, idRemito) { | 
| 241 | 240 | ||
| 242 | cisterna.cisternaMovimientos.forEach(function(cisternaMovimiento) { | 241 | cisterna.cisternaMovimientos.forEach(function(cisternaMovimiento) { | 
| 243 | cisternaMovimiento.idRemito = idRemito; | 242 | cisternaMovimiento.idRemito = idRemito; | 
| 244 | }); | 243 | }); | 
| 245 | 244 | ||
| 246 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + | 245 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + | 
| 247 | this.idUsuario + '/' + idRemito, cisterna); | 246 | this.idUsuario + '/' + idRemito, cisterna); | 
| 248 | }, | 247 | }, | 
| 249 | crearArticulosParaRemito: function(articuloRemito) { | 248 | crearArticulosParaRemito: function(articuloRemito) { | 
| 250 | return $http.post(route + '/articulos/remito', | 249 | return $http.post(route + '/articulos/remito', | 
| 251 | {articuloRemito: articuloRemito}); | 250 | {articuloRemito: articuloRemito}); | 
| 252 | } | 251 | } | 
| 253 | }; | 252 | }; | 
| 254 | }]); | 253 | }]); | 
| 255 | 254 |