Commit 4522626ef0ddc65d2ed59be50e5957c9332d170f
Exists in
master
Merge branch 'master' into 'master'
Nuevo diseño See merge request !8
Showing
7 changed files
Show diff stats
src/js/app.js
| 1 | angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap']); | 1 | angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); |
| 2 | 2 |
src/js/controller.js
| 1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
| 2 | .controller('focaAbmVehiculosController', [ | 2 | .controller('focaAbmVehiculosController', [ |
| 3 | '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', '$uibModal', | 3 | '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', |
| 4 | function($scope, focaAbmVehiculoService, $location, focaModalService, $uibModal) { | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', |
| 5 | $scope.buscar = function(idTransportista) { | 5 | function($scope, focaAbmVehiculoService, $location, focaModalService, |
| 6 | focaAbmVehiculoService | 6 | $uibModal, focaBotoneraLateralService, $timeout) { |
| 7 | .getVehiculosPorTransportista(idTransportista) | 7 | |
| 8 | .then(function(datos) { | 8 | $scope.now = new Date(); |
| 9 | $scope.vehiculos = datos.data; | 9 | $scope.botonera = ['Transportista']; |
| 10 | }); | 10 | |
| 11 | }; | 11 | //SETEO BOTONERA LATERAL |
| 12 | focaBotoneraLateralService.showSalir(true); | ||
| 13 | focaBotoneraLateralService.showPausar(false); | ||
| 14 | focaBotoneraLateralService.showCancelar(false); | ||
| 15 | focaBotoneraLateralService.showGuardar(false); | ||
| 16 | |||
| 17 | if(focaAbmVehiculoService.transportistaSeleccionado.COD) { | ||
| 18 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); | ||
| 19 | } | ||
| 20 | |||
| 12 | $scope.editar = function(id) { | 21 | $scope.editar = function(id) { |
| 13 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | 22 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); |
| 14 | }; | 23 | }; |
| 15 | $scope.solicitarConfirmacion = function(vehiculo) { | 24 | $scope.solicitarConfirmacion = function(vehiculo) { |
| 16 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | 25 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
| 17 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | 26 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
| 18 | function(data) { | 27 | function(data) { |
| 19 | if(data) { | 28 | if(data) { |
| 20 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); | 29 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
| 21 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 30 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
| 22 | } | 31 | } |
| 23 | } | 32 | } |
| 24 | ); | 33 | ); |
| 25 | }; | 34 | }; |
| 26 | $scope.seleccionarTransportista = function() { | 35 | $scope.seleccionarTransportista = function() { |
| 27 | var modalInstance = $uibModal.open( | 36 | var modalInstance = $uibModal.open( |
| 28 | { | 37 | { |
| 29 | ariaLabelledBy: 'Busqueda de Transportista', | 38 | ariaLabelledBy: 'Busqueda de Transportista', |
| 30 | templateUrl: 'modal-proveedor.html', | 39 | templateUrl: 'modal-proveedor.html', |
| 31 | controller: 'focaModalProveedorCtrl', | 40 | controller: 'focaModalProveedorCtrl', |
| 32 | size: 'lg', | 41 | size: 'lg', |
| 33 | resolve: { | 42 | resolve: { |
| 34 | transportista: function() { | 43 | transportista: function() { |
| 35 | return true; | 44 | return true; |
| 36 | } | 45 | } |
| 37 | } | 46 | } |
| 38 | } | 47 | } |
| 39 | ); | 48 | ); |
| 40 | modalInstance.result.then( | 49 | modalInstance.result.then( |
| 41 | function(transprotista) { | 50 | function(transportista) { |
| 42 | $scope.idTransportista = transprotista.COD; | 51 | elegirTransportista(transportista); |
| 43 | $scope.filtros = transprotista.NOM.trim(); | 52 | focaAbmVehiculoService.transportistaSeleccionado = transportista; |
| 44 | $scope.buscar(transprotista.COD); | ||
| 45 | }, function() { | 53 | }, function() { |
| 46 | 54 | ||
| 47 | } | 55 | } |
| 48 | ); | 56 | ); |
| 49 | }; | 57 | }; |
| 58 | |||
| 59 | function elegirTransportista(transportista) { | ||
| 60 | $scope.idTransportista = transportista.COD; | ||
| 61 | $scope.filtros = transportista.NOM.trim(); | ||
| 62 | $timeout(function() { | ||
| 63 | $scope.$broadcast('addCabecera', { | ||
| 64 | label: 'Transportista:', | ||
| 65 | valor: transportista.COD + ' - ' + transportista.NOM | ||
| 66 | }); | ||
| 67 | }); | ||
| 68 | buscar(transportista.COD); | ||
| 69 | } | ||
| 70 | |||
| 71 | function buscar(idTransportista) { | ||
| 72 | focaAbmVehiculoService | ||
| 73 | .getVehiculosPorTransportista(idTransportista) | ||
| 74 | .then(function(datos) { | ||
| 75 | $scope.vehiculos = datos.data; | ||
| 76 | }); | ||
| 77 | } | ||
| 50 | } | 78 | } |
| 51 | ]) | 79 | ]) |
| 52 | .controller('focaAbmVehiculoController', [ | 80 | .controller('focaAbmVehiculoController', [ |
| 53 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 81 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
| 54 | 'focaModalService', | 82 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', |
| 55 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 83 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 56 | focaModalService) { | 84 | focaModalService, $timeout, focaBotoneraLateralService) { |
| 57 | $scope.nuevo = $routeParams.idVehiculo == 0 ? true : false; | 85 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; |
| 86 | $scope.now = new Date(); | ||
| 87 | $scope.focused = 1; | ||
| 88 | |||
| 89 | $timeout(function() { | ||
| 90 | focaBotoneraLateralService.showSalir(false); | ||
| 91 | focaBotoneraLateralService.showPausar(false); | ||
| 92 | focaBotoneraLateralService.showCancelar(true); | ||
| 93 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | ||
| 94 | }); | ||
| 95 | |||
| 58 | if($scope.nuevo) { | 96 | if($scope.nuevo) { |
| 59 | focaAbmVehiculoService | 97 | focaAbmVehiculoService |
| 60 | .getTransportistaPorId($routeParams.idTransportista) | 98 | .getTransportistaPorId($routeParams.idTransportista) |
| 61 | .then(function(res) { | 99 | .then(function(res) { |
| 62 | $scope.vehiculo.idTransportista = res.data.COD; | 100 | $scope.vehiculo.idTransportista = res.data.COD; |
| 63 | $scope.vehiculo.transportista = res.data; | 101 | $scope.vehiculo.transportista = res.data; |
| 102 | $scope.$broadcast('addCabecera', { | ||
| 103 | label: 'Transportista:', | ||
| 104 | valor: res.data.COD + ' - ' + res.data.NOM | ||
| 105 | }); | ||
| 64 | }); | 106 | }); |
| 65 | } | 107 | } |
| 66 | $scope.vehiculo = {}; | 108 | $scope.vehiculo = {}; |
| 67 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | 109 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { |
| 68 | if(res.data) $scope.vehiculo = res.data; | 110 | if(res.data) { |
| 111 | $scope.vehiculo = res.data; | ||
| 112 | $scope.$broadcast('addCabecera', { | ||
| 113 | label: 'Transportista:', | ||
| 114 | valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM | ||
| 115 | }); | ||
| 116 | $scope.$broadcast('addCabecera', { | ||
| 117 | label: 'Unidad:', | ||
| 118 | valor: res.data.codigo | ||
| 119 | }); | ||
| 120 | } | ||
| 69 | }); | 121 | }); |
| 70 | focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) | 122 | focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) |
| 71 | .then(function(res) { | 123 | .then(function(res) { |
| 72 | $scope.cisternas = res.data; | 124 | $scope.cisternas = res.data; |
| 73 | }); | 125 | }); |
| 126 | $scope.next = function(key) { | ||
| 127 | if (key === 13) $scope.focused++; | ||
| 128 | }; | ||
| 74 | $scope.cancelar = function() { | 129 | $scope.cancelar = function() { |
| 75 | $location.path('/vehiculo'); | 130 | $location.path('/vehiculo'); |
| 76 | }; | 131 | }; |
| 77 | $scope.editar = function(id) { | 132 | $scope.editar = function(id) { |
| 78 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/' + id); | 133 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/' + id); |
| 79 | }; | 134 | }; |
| 80 | $scope.guardar = function() { | 135 | $scope.guardar = function() { |
| 81 | if(!$scope.vehiculo.transportista) { | 136 | if(!$scope.vehiculo.transportista) { |
| 82 | focaModalService.alert('Elija Transportista'); | 137 | focaModalService.alert('Elija Transportista'); |
| 83 | return; | 138 | return; |
| 84 | } | 139 | } |
| 85 | delete $scope.vehiculo.transportista; | 140 | delete $scope.vehiculo.transportista; |
| 86 | focaAbmVehiculoService.guerdarVehiculo($scope.vehiculo).then(function(res) { | 141 | focaAbmVehiculoService.guerdarVehiculo($scope.vehiculo).then(function(res) { |
| 87 | if($scope.nuevo) { | 142 | if($scope.nuevo) { |
| 88 | $location.path('/vehiculo/' + res.data.id + '/' + res.data.idTransportista); | 143 | $location.path('/vehiculo/' + res.data.id + '/' + res.data.idTransportista); |
| 89 | } else { | 144 | } else { |
| 90 | $location.path('/vehiculo'); | 145 | $location.path('/vehiculo'); |
| 91 | } | 146 | } |
| 92 | }); | 147 | }); |
| 93 | }; | 148 | }; |
| 94 | $scope.solicitarConfirmacionCisterna = function(cisterna) { | 149 | $scope.solicitarConfirmacionCisterna = function(cisterna) { |
| 95 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + | 150 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + |
| 96 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( | 151 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( |
| 97 | function(data) { | 152 | function(data) { |
| 98 | if(data) { | 153 | if(data) { |
| 99 | focaAbmVehiculoService.deleteCisterna(cisterna.id); | 154 | focaAbmVehiculoService.deleteCisterna(cisterna.id); |
| 100 | $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); | 155 | $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); |
| 101 | } | 156 | } |
| 102 | } | 157 | } |
| 103 | ); | 158 | ); |
| 104 | }; | 159 | }; |
| 105 | $scope.seleccionarTransportista = function() { | 160 | $scope.seleccionarTransportista = function() { |
| 106 | var modalInstance = $uibModal.open( | 161 | var modalInstance = $uibModal.open( |
| 107 | { | 162 | { |
| 108 | ariaLabelledBy: 'Busqueda de Transportista', | 163 | ariaLabelledBy: 'Busqueda de Transportista', |
| 109 | templateUrl: 'modal-proveedor.html', | 164 | templateUrl: 'modal-proveedor.html', |
| 110 | controller: 'focaModalProveedorCtrl', | 165 | controller: 'focaModalProveedorCtrl', |
| 111 | size: 'lg', | 166 | size: 'lg', |
| 112 | resolve: { | 167 | resolve: { |
| 113 | transportista: function() { | 168 | transportista: function() { |
| 114 | return true; | 169 | return true; |
| 115 | } | 170 | } |
| 116 | } | 171 | } |
| 117 | } | 172 | } |
| 118 | ); | 173 | ); |
| 119 | modalInstance.result.then( | 174 | modalInstance.result.then( |
| 120 | function(transprotista) { | 175 | function(transportista) { |
| 121 | $scope.vehiculo.idTransportista = transprotista.COD; | 176 | $scope.vehiculo.idTransportista = transportista.COD; |
| 122 | $scope.vehiculo.transportista = transprotista; | 177 | $scope.vehiculo.transportista = transportista; |
| 123 | }, function() { | 178 | }, function() { |
| 124 | 179 | ||
| 125 | } | 180 | } |
| 126 | ); | 181 | ); |
| 127 | }; | 182 | }; |
| 128 | } | 183 | } |
| 129 | ]); | 184 | ]); |
src/js/controllerCisterna.js
| 1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
| 2 | .controller('focaAbmVehiculoCisternaController', [ | 2 | .controller('focaAbmVehiculoCisternaController', [ |
| 3 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 3 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
| 4 | 'focaModalService', | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', |
| 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 6 | focaModalService) { | 6 | focaModalService, focaBotoneraLateralService, $timeout) { |
| 7 | $scope.editar = false; | 7 | $scope.editar = false; |
| 8 | $scope.now = new Date(); | ||
| 8 | $scope.cisterna = { | 9 | $scope.cisterna = { |
| 9 | cisternaCarga: { | 10 | cisternaCarga: { |
| 10 | articulo: {} | 11 | articulo: {} |
| 11 | } | 12 | } |
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 15 | $scope.focused = 1; | ||
| 16 | $scope.next = function(key) { | ||
| 17 | if (key === 13) $scope.focused++; | ||
| 18 | }; | ||
| 19 | |||
| 20 | //SETEO BOTONERA LATERAL | ||
| 21 | $timeout(function() { | ||
| 22 | focaBotoneraLateralService.showSalir(false); | ||
| 23 | focaBotoneraLateralService.showPausar(false); | ||
| 24 | focaBotoneraLateralService.showCancelar(true); | ||
| 25 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | ||
| 26 | }); | ||
| 27 | |||
| 14 | focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { | 28 | focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { |
| 15 | if(res.data) { | 29 | if(res.data) { |
| 16 | $scope.cisterna = res.data; | 30 | $scope.cisterna = res.data; |
| 17 | $scope.editar = true; | 31 | $scope.editar = true; |
| 18 | }else { | 32 | }else { |
| 19 | $scope.editar = false; | 33 | $scope.editar = false; |
| 20 | } | 34 | } |
| 21 | }); | 35 | }); |
| 36 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | ||
| 37 | $scope.$broadcast('addCabecera', { | ||
| 38 | label: 'Transportista:', | ||
| 39 | valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM | ||
| 40 | }); | ||
| 41 | $scope.$broadcast('addCabecera', { | ||
| 42 | label: 'Unidad:', | ||
| 43 | valor: res.data.codigo | ||
| 44 | }); | ||
| 45 | }); | ||
| 22 | $scope.cancelar = function() { | 46 | $scope.cancelar = function() { |
| 23 | $location.path('/vehiculo/' + $routeParams.idVehiculo); | 47 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 24 | console.log($routeParams.id); | ||
| 25 | }; | 48 | }; |
| 26 | $scope.guardar = function() { | 49 | $scope.guardar = function() { |
| 27 | if(!$scope.cisterna.unidadMedida) { | 50 | if(!$scope.cisterna.unidadMedida) { |
| 28 | focaModalService.alert('Ingrese unidad de medida'); | 51 | focaModalService.alert('Ingrese unidad de medida'); |
| 29 | return; | 52 | return; |
| 30 | } | 53 | } |
| 31 | if(!$scope.cisterna.cisternaCarga.articulo) { | 54 | if(!$scope.cisterna.cisternaCarga.articulo) { |
| 32 | focaModalService.alert('Ingrese producto'); | 55 | focaModalService.alert('Ingrese producto'); |
| 33 | return; | 56 | return; |
| 34 | } | 57 | } |
| 35 | $scope.cisterna.idVehiculo = $routeParams.idVehiculo; | 58 | $scope.cisterna.idVehiculo = $routeParams.idVehiculo; |
| 36 | delete $scope.cisterna.unidadMedida; | 59 | delete $scope.cisterna.unidadMedida; |
| 37 | delete $scope.cisterna.cisternaCarga.articulo; | 60 | delete $scope.cisterna.cisternaCarga.articulo; |
| 38 | focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function() { | 61 | focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function() { |
| 39 | $location.path('/vehiculo/' + $routeParams.idVehiculo); | 62 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 40 | }); | 63 | }); |
| 41 | }; | 64 | }; |
| 42 | 65 | ||
| 43 | // $scope.seleccionarArticulo = function() { | 66 | // $scope.seleccionarArticulo = function() { |
| 44 | // var modalInstance = $uibModal.open( | 67 | // var modalInstance = $uibModal.open( |
| 45 | // { | 68 | // { |
| 46 | // ariaLabelledBy: 'Busqueda de Productos', | 69 | // ariaLabelledBy: 'Busqueda de Productos', |
| 47 | // templateUrl: 'modal-busqueda-productos.html', | 70 | // templateUrl: 'modal-busqueda-productos.html', |
| 48 | // controller: 'modalBusquedaProductosCtrl', | 71 | // controller: 'modalBusquedaProductosCtrl', |
| 49 | // resolve: { | 72 | // resolve: { |
| 50 | // parametroProducto: { | 73 | // parametroProducto: { |
| 51 | // idLista: -1, | 74 | // idLista: -1, |
| 52 | // cotizacion: 1, | 75 | // cotizacion: 1, |
| 53 | // simbolo: '$' | 76 | // simbolo: '$' |
| 54 | // } | 77 | // } |
| 55 | // }, | 78 | // }, |
| 56 | // size: 'lg' | 79 | // size: 'lg' |
| 57 | // } | 80 | // } |
| 58 | // ); | 81 | // ); |
| 59 | // modalInstance.result.then( | 82 | // modalInstance.result.then( |
| 60 | // function(producto) { | 83 | // function(producto) { |
| 61 | // $scope.cisterna.cisternaCarga.idProducto = producto.id, | 84 | // $scope.cisterna.cisternaCarga.idProducto = producto.id, |
| 62 | // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion; | 85 | // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion; |
| 63 | // }, function() { | 86 | // }, function() { |
| 64 | // // funcion ejecutada cuando se cancela el modal | 87 | // // funcion ejecutada cuando se cancela el modal |
| 65 | // } | 88 | // } |
| 66 | // ); | 89 | // ); |
| 67 | // }; | 90 | // }; |
| 68 | 91 | ||
| 69 | $scope.seleccionarUnidadMedida = function() { | 92 | $scope.seleccionarUnidadMedida = function() { |
| 70 | var modalInstance = $uibModal.open( | 93 | var modalInstance = $uibModal.open( |
| 71 | { | 94 | { |
| 72 | ariaLabelledBy: 'Busqueda de Unidades de medida', | 95 | ariaLabelledBy: 'Busqueda de Unidades de medida', |
| 73 | templateUrl: 'modal-unidad-medida.html', | 96 | templateUrl: 'modal-unidad-medida.html', |
| 74 | controller: 'focaModalUnidadMedidaCtrl', | 97 | controller: 'focaModalUnidadMedidaCtrl', |
| 75 | size: 'lg' | 98 | size: 'lg' |
| 76 | } | 99 | } |
| 77 | ); | 100 | ); |
| 78 | modalInstance.result.then(function(unidaMedida) { | 101 | modalInstance.result.then(function(unidaMedida) { |
| 79 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; | 102 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; |
| 80 | $scope.cisterna.unidadMedida = unidaMedida; | 103 | $scope.cisterna.unidadMedida = unidaMedida; |
| 81 | }); | 104 | }); |
| 82 | } | 105 | }; |
| 83 | } | 106 | } |
| 84 | ]); | 107 | ]); |
src/js/service.js
| 1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
| 2 | .factory('focaAbmVehiculoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .factory('focaAbmVehiculoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
| 3 | return { | 3 | return { |
| 4 | getVehiculos: function() { | 4 | getVehiculos: function() { |
| 5 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); | 5 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); |
| 6 | }, | 6 | }, |
| 7 | getVehiculo: function(id) { | 7 | getVehiculo: function(id) { |
| 8 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); | 8 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); |
| 9 | }, | 9 | }, |
| 10 | getTransportistas: function() { | 10 | getTransportistas: function() { |
| 11 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 11 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
| 12 | }, | 12 | }, |
| 13 | guerdarVehiculo: function(vehiculo) { | 13 | guerdarVehiculo: function(vehiculo) { |
| 14 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); | 14 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); |
| 15 | }, | 15 | }, |
| 16 | deleteVehiculo: function(id) { | 16 | deleteVehiculo: function(id) { |
| 17 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); | 17 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); |
| 18 | }, | 18 | }, |
| 19 | getCisternadoPorVehiculo: function(idVehiculo) { | 19 | getCisternadoPorVehiculo: function(idVehiculo) { |
| 20 | return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); | 20 | return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); |
| 21 | }, | 21 | }, |
| 22 | getCisterna: function(id) { | 22 | getCisterna: function(id) { |
| 23 | return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); | 23 | return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); |
| 24 | }, | 24 | }, |
| 25 | guardarCisterna: function(cisterna) { | 25 | guardarCisterna: function(cisterna) { |
| 26 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); | 26 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); |
| 27 | }, | 27 | }, |
| 28 | deleteCisterna: function(id) { | 28 | deleteCisterna: function(id) { |
| 29 | return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); | 29 | return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); |
| 30 | }, | 30 | }, |
| 31 | getVehiculosPorTransportista: function(id) { | 31 | getVehiculosPorTransportista: function(id) { |
| 32 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); | 32 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); |
| 33 | }, | 33 | }, |
| 34 | getTransportistaPorId: function(id) { | 34 | getTransportistaPorId: function(id) { |
| 35 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); | 35 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); |
| 36 | } | 36 | }, |
| 37 | transportistaSeleccionado: {} | ||
| 37 | }; | 38 | }; |
| 38 | }]); | 39 | }]); |
| 39 | 40 |
src/views/foca-abm-cisterna-item.html
| 1 | <h4>Cisterna</h4> | 1 | <div class="row"> |
| 2 | <foca-cabecera-facturador | ||
| 3 | titulo="'Vehículo cisterna'" | ||
| 4 | fecha="now" | ||
| 5 | class="mb-0 col-lg-12" | ||
| 6 | ></foca-cabecera-facturador> | ||
| 7 | </div> | ||
| 8 | <div class="row"></div> | ||
| 2 | <form name="formCisterna"> | 9 | <form name="formCisterna"> |
| 3 | <div class="form-group row"> | 10 | <div class="form-group row"> |
| 4 | <label class="offset-sm-1 col-sm-2 col-form-label">Unidad</label> | 11 | <label class="offset-sm-1 col-sm-2 col-form-label">Código de cisterna</label> |
| 5 | <div class="col-sm-4"> | 12 | <div class="col-sm-4"> |
| 6 | <input | 13 | <input |
| 7 | class="form-control" | 14 | class="form-control" |
| 8 | type="text" | 15 | type="text" |
| 9 | teclado-virtual | ||
| 10 | ng-required="true" | 16 | ng-required="true" |
| 11 | ng-model="cisterna.codigo" | 17 | ng-model="cisterna.codigo" |
| 18 | ng-keypress="next($event.keyCode)" | ||
| 19 | foca-focus="focused == 1" | ||
| 20 | ng-focus="focused = 1" | ||
| 21 | teclado-virtual | ||
| 12 | /> | 22 | /> |
| 13 | </div> | 23 | </div> |
| 14 | </div> | 24 | </div> |
| 15 | <div class="form-group row"> | 25 | <div class="form-group row"> |
| 16 | <label class="offset-sm-1 col-sm-2 col-form-label">Capacidad</label> | 26 | <label class="offset-sm-1 col-sm-2 col-form-label">Capacidad</label> |
| 17 | <div class="col-sm-4"> | 27 | <div class="col-sm-4"> |
| 18 | <input | 28 | <input |
| 19 | class="form-control" | 29 | class="form-control" |
| 20 | type="text" | 30 | type="text" |
| 21 | teclado-virtual | 31 | teclado-virtual |
| 22 | foca-tipo-input | 32 | foca-tipo-input |
| 23 | ng-model="cisterna.capacidad" | 33 | ng-model="cisterna.capacidad" |
| 24 | ng-required="true" | 34 | ng-required="true" |
| 35 | ng-keypress="next($event.keyCode)" | ||
| 36 | foca-focus="focused == 2" | ||
| 37 | ng-focus="focused = 2" | ||
| 25 | /> | 38 | /> |
| 26 | </div> | 39 | </div> |
| 27 | </div> | 40 | </div> |
| 28 | <div class="form-group row"> | 41 | <div class="form-group row"> |
| 29 | <label class="offset-sm-1 col-sm-2 col-form-label">Unidad de medida</label> | 42 | <label class="offset-sm-1 col-sm-2 col-form-label">Unidad de medida</label> |
| 30 | <div class="col-sm-4 input-group"> | 43 | <div class="col-sm-4 input-group"> |
| 31 | <input | 44 | <input |
| 32 | ng-model="cisterna.unidadMedida.NOM" | 45 | ng-model="cisterna.unidadMedida.NOM" |
| 33 | class="form-control" | 46 | class="form-control" |
| 34 | readonly | 47 | readonly |
| 35 | /> | 48 | /> |
| 36 | <div class="input-group-append"> | 49 | <div class="input-group-append"> |
| 37 | <button | 50 | <button |
| 38 | ladda="searchLoading" | 51 | ladda="searchLoading" |
| 39 | class="btn btn-outline-secondary form-control" | 52 | class="btn btn-outline-secondary form-control" |
| 40 | type="button" | 53 | type="button" |
| 41 | ng-click="seleccionarUnidadMedida()" | 54 | ng-click="seleccionarUnidadMedida()" |
| 42 | ng-disabled="editar" | 55 | foca-focus="focused == 3" |
| 43 | > | 56 | > |
| 44 | <i class="fa fa-search" aria-hidden="true"></i> | 57 | <i class="fa fa-search" aria-hidden="true"></i> |
| 45 | </button> | 58 | </button> |
| 46 | </div> | 59 | </div> |
| 47 | </div> | 60 | </div> |
| 48 | </div> | 61 | </div> |
| 49 | <div class="form-group row"> | 62 | <div class="form-group row"> |
| 50 | <label class="offset-sm-1 col-sm-2 col-form-label">Carga</label> | 63 | <label class="offset-sm-1 col-sm-2 col-form-label">Carga</label> |
| 51 | <div class="col-sm-4"> | 64 | <div class="col-sm-4"> |
| 52 | <input | 65 | <input |
| 53 | class="form-control" | 66 | class="form-control" |
| 54 | foca-tipo-input | 67 | foca-tipo-input |
| 55 | teclado-virtual | 68 | teclado-virtual |
| 56 | ng-model="cisterna.cisternaCarga.cantidad" | 69 | ng-model="cisterna.cisternaCarga.cantidad" |
| 57 | readonly | 70 | readonly |
| 58 | /> | 71 | /> |
| 59 | </div> | 72 | </div> |
| 60 | </div> | 73 | </div> |
| 61 | <div class="form-group row"> | 74 | <div class="form-group row"> |
| 62 | <label class="offset-sm-1 col-sm-2 col-form-label">Producto</label> | 75 | <label class="offset-sm-1 col-sm-2 col-form-label">Producto</label> |
| 63 | <div class="col-sm-4 input-group"> | 76 | <div class="col-sm-4 input-group"> |
| 64 | <input | 77 | <input |
| 65 | ng-model="cisterna.cisternaCarga.articulo.DetArt" | 78 | ng-model="cisterna.cisternaCarga.articulo.DetArt" |
| 66 | class="form-control" | 79 | class="form-control" |
| 67 | readonly | 80 | readonly |
| 68 | /> | 81 | /> |
| 69 | <!-- <div class="input-group-append"> | 82 | <!-- <div class="input-group-append"> |
| 70 | <button | 83 | <button |
| 71 | ladda="searchLoading" | 84 | ladda="searchLoading" |
| 72 | class="btn btn-outline-secondary form-control" | 85 | class="btn btn-outline-secondary form-control" |
| 73 | type="button" | 86 | type="button" |
| 74 | ng-click="seleccionarArticulo(13)" | 87 | ng-click="seleccionarArticulo(13)" |
| 75 | ng-disabled="editar" | 88 | ng-disabled="editar" |
| 76 | > | 89 | > |
| 77 | <i class="fa fa-search" aria-hidden="true"></i> | 90 | <i class="fa fa-search" aria-hidden="true"></i> |
| 78 | </button> | 91 | </button> |
| 79 | </div> --> | 92 | </div> --> |
| 80 | </div> | 93 | </div> |
| 81 | </div> | 94 | </div> |
| 82 | <div class="form-group row"> |
src/views/foca-abm-vehiculos-item.html
| 1 | <h4>Vehiculo</h4> | 1 | <div class="row"> |
| 2 | <form name="formVehiculo"> | 2 | <foca-cabecera-facturador |
| 3 | <input type="hidden" name="id" ng-model="sector.id" /> | 3 | titulo="'Vehículo'" |
| 4 | <div class="form-group row"> | 4 | fecha="now" |
| 5 | <label class="offset-sm-1 col-sm-2 col-form-label">Transportista</label> | 5 | class="mb-0 col-lg-12" |
| 6 | <div class="col-sm-4 input-group"> | 6 | ></foca-cabecera-facturador> |
| 7 | <input | 7 | </div> |
| 8 | class="form-control" | 8 | <div class="row"> |
| 9 | type="text" | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
| 10 | ng-model="vehiculo.transportista.NOM" | 10 | <form name="formVehiculo" class="px-3"> |
| 11 | readonly | 11 | <input type="hidden" name="id" ng-model="sector.id" /> |
| 12 | /> | 12 | <div class="row mt-3"> |
| 13 | <!-- <div class="input-group-append"> | 13 | <div class="form-group d-flex mb-2 col-md-6"> |
| 14 | <button | 14 | <label class="col-form-label col-md-3">Transportista</label> |
| 15 | class="btn btn-outline-secondary form-control" | 15 | <div class="input-group col-md-9 pl-0"> |
| 16 | type="button" | 16 | <input |
| 17 | ng-click="seleccionarTransportista()"> | 17 | class="form-control" |
| 18 | <i class="fa fa-search" aria-hidden="true"></i> | 18 | type="text" |
| 19 | </button> | 19 | ng-model="vehiculo.transportista.NOM" |
| 20 | </div> --> | 20 | readonly |
| 21 | </div> | 21 | /> |
| 22 | </div> | 22 | </div> |
| 23 | <div class="form-group row"> | 23 | </div> |
| 24 | <label class="offset-sm-1 col-sm-2 col-form-label">Unidad</label> | 24 | <div class="form-group d-flex mb-2 col-md-6"> |
| 25 | <div class="col-sm-4"> | 25 | <label class="col-form-label col-md-3">Unidad</label> |
| 26 | <input | 26 | <div class="input-group col-md-9 pl-0"> |
| 27 | class="form-control" | 27 | <input |
| 28 | type="text" | 28 | class="form-control" |
| 29 | teclado-virtual | 29 | type="text" |
| 30 | ng-model="vehiculo.codigo" | 30 | teclado-virtual |
| 31 | /> | 31 | ng-model="vehiculo.codigo" |
| 32 | </div> | 32 | foca-focus="focused == 2" |
| 33 | </div> | 33 | ng-focus="focused = 2" |
| 34 | <div class="form-group row"> | 34 | ng-keypress="next($event.keyCode)" |
| 35 | <label class="offset-sm-1 col-sm-2 col-form-label">Dominio tractor</label> | 35 | /> |
| 36 | <div class="col-sm-4"> | 36 | </div> |
| 37 | <input | 37 | </div> |
| 38 | class="form-control" | 38 | <div class="form-group d-flex mb-2 col-md-6"> |
| 39 | type="text" | 39 | <label class="col-form-label col-md-4">Dominio tractor</label> |
| 40 | teclado-virtual | 40 | <div class="input-group col-md-8 pl-0"> |
| 41 | ng-model="vehiculo.tractor" | 41 | <input |
| 42 | ng-required="true" | 42 | class="form-control" |
| 43 | /> | 43 | type="text" |
| 44 | </div> | 44 | teclado-virtual |
| 45 | </div> | 45 | ng-model="vehiculo.tractor" |
| 46 | <div class="form-group row"> | 46 | ng-required="true" |
| 47 | <label class="offset-sm-1 col-sm-2 col-form-label">Dominio semi</label> | 47 | foca-focus="focused == 1" |
| 48 | <div class="col-sm-4"> | 48 | ng-focus="focused = 1" |
| 49 | <input | 49 | ng-keypress="next($event.keyCode)" |
| 50 | class="form-control" | 50 | /> |
| 51 | type="text" | 51 | </div> |
| 52 | teclado-virtual | 52 | </div> |
| 53 | ng-model="vehiculo.semi" | 53 | <div class="form-group d-flex mb-2 col-md-6"> |
| 54 | ng-required="true" | 54 | <label class="col-form-label col-md-4">Dominio semi</label> |
| 55 | /> | 55 | <div class="input-group col-md-8 pl-0"> |
| 56 | </div> | 56 | <input |
| 57 | </div> | 57 | class="form-control" |
| 58 | <div class="form-group row"> | 58 | type="text" |
| 59 | <div class="col-sm-7 text-right"> | 59 | teclado-virtual |
| 60 | <button | 60 | ng-model="vehiculo.semi" |
| 61 | class="btn btn-primary" | 61 | ng-required="true" |
| 62 | ng-click="guardar()" | 62 | foca-focus="focused == 3" |
| 63 | ng-disabled="!formVehiculo.$valid" | 63 | ng-focus="focused = 3" |
| 64 | >Guardar</button> | 64 | ng-keypress="next($event.keyCode)" |
| 65 | <button class="btn btn-default" ng-click="cancelar()">Cancelar</button> | 65 | /> |
| 66 | </div> | ||
| 67 | </div> | ||
| 68 | </div> | ||
| 69 | </form> | ||
| 70 | <div ng-show="!nuevo"> | ||
| 71 | <h5 class="pl-4 table-title">Cisternas</h5> | ||
| 72 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | ||
| 73 | <thead> | ||
| 74 | <tr> | ||
| 75 | <th class="px-5">Código</th> | ||
| 76 | <th class="text-right px-5">Capacidad</th> | ||
| 77 | <th class="px-5">Unidad de Medida</th> | ||
| 78 | <th class="text-right px-5">Carga</th> | ||
| 79 | <th class="text-center px-4"> | ||
| 80 | <button | ||
| 81 | class="btn btn-outline-debo boton-accion" | ||
| 82 | title="Agregar" | ||
| 83 | ng-click="editar(0)"> | ||
| 84 | <i class="fa fa-plus"></i> | ||
| 85 | </button> | ||
| 86 | </th> | ||
| 87 | </tr> | ||
| 88 | </thead> | ||
| 89 | <tbody> | ||
| 90 | <tr ng-repeat="cisterna in cisternas | filter:filtros"> | ||
| 91 | <td ng-bind="cisterna.codigo" class="px-5"></td> | ||
| 92 | <td ng-bind="cisterna.capacidad" class="text-right px-5"></td> | ||
| 93 | <td ng-bind="cisterna.unidadMedida.NOM" class="px-5"></td> | ||
| 94 | <td ng-bind="cisterna.cisternaCarga.cantidad || 0" class="text-right px-5"></td> | ||
| 95 | <td class="text-center px-4"> | ||
| 96 | <button | ||
| 97 | class="btn btn-outline-dark boton-accion" | ||
| 98 | title="Editar" | ||
| 99 | ng-click="editar(cisterna.id)" | ||
| 100 | > | ||
| 101 | <i class="fa fa-pencil"></i> | ||
| 102 | </button> | ||
| 103 | <button | ||
| 104 | class="btn btn-outline-dark boton-accion" | ||
| 105 | title="Eliminar" | ||
| 106 | ng-click="solicitarConfirmacionCisterna(cisterna)" | ||
| 107 | > | ||
| 108 | <i class="fa fa-trash"></i> | ||
| 109 | </button> | ||
| 110 | </td> | ||
| 111 | </tr> | ||
| 112 | </body> | ||
| 113 | </table> | ||
| 66 | </div> | 114 | </div> |
| 67 | </div> | 115 | </div> |
| 68 | </form> | ||
| 69 | <div class="col-12" ng-show="!nuevo"> |
src/views/foca-abm-vehiculos-listado.html
| 1 | <div class="col-12"> | 1 | <div class="row"> |
| 2 | <h4>Vehiculos</h4> | 2 | <foca-cabecera-facturador |
| 3 | <div class="col-4 form-group input-group"> | 3 | titulo="'Vehículos'" |
| 4 | <input | 4 | fecha="now" |
| 5 | class="form-control form-control-sm" | 5 | class="mb-0 col-lg-12" |
| 6 | ng-model="filtros" | 6 | ></foca-cabecera-facturador> |
| 7 | placeholder="Transportista" | 7 | </div> |
| 8 | /> | 8 | <div class="row"> |
| 9 | <div class="input-group-append"> | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
| 10 | <button | 10 | <div class="row px-5 py-2 botonera-secundaria"> |
| 11 | class="btn btn-outline-secondary form-control-sm" | 11 | <div class="col-12"> |
| 12 | ng-click="seleccionarTransportista()" | 12 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> |
| 13 | ><i class="fa fa-search" aria-hidden="true"></i></button> | 13 | </div> |
| 14 | </div> | 14 | </div> |
| 15 | <!-- <div class="col-6 form-group"> | ||
| 16 | <input seleccionarTransportista() | ||
| 17 | type="text" | ||
| 18 | teclado-virtual | ||
| 19 | class="form-control form-control-sm" | ||
| 20 | placeholder="Búsqueda" | ||
| 21 | ng-model="filtros" | ||
| 22 | /> | ||
| 23 | </div> --> | ||
| 24 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | ||
| 25 | <thead> | ||
| 26 | <tr> | ||
| 27 | <th class="text-center">Unidad</th> | ||
| 28 | <th>Dominio Tractor</th> | ||
| 29 | <th>Dominio Semi</th> | ||
| 30 | <th class="text-right">Capacidad</th> | ||
| 31 | <th class="text-center"> | ||
| 32 | <button | ||
| 33 | ng-disabled="!idTransportista" | ||
| 34 | class="btn btn-outline-debo boton-accion" | ||
| 35 | title="Agregar" | ||
| 36 | ng-click="editar(0)" | ||
| 37 | ><i class="fa fa-plus"></i> | ||
| 38 | </button> | ||
| 39 | </th> | ||
| 40 | </tr> | ||
| 41 | </thead> | ||
| 42 | <tbody> | ||
| 43 | <tr ng-repeat="vehiculo in vehiculos | filter:filtros"> | ||
| 44 | <td ng-bind="vehiculo.codigo" class="text-center"></td> | ||
| 45 | <td ng-bind="vehiculo.tractor"></td> | ||
| 46 | <td ng-bind="vehiculo.semi"></td> | ||
| 47 | <td ng-bind="vehiculo.capacidadTotalCisternas" class="text-right"></td> | ||
| 48 | <td class="text-center"> | ||
| 49 | <button | ||
| 50 | class="btn btn-outline-dark boton-accion" | ||
| 51 | title="Editar" | ||
| 52 | ng-click="editar(vehiculo.id)" | ||
| 53 | > | ||
| 54 | <i class="fa fa-pencil"></i> | ||
| 55 | </button> | ||
| 56 | <button | ||
| 57 | class="btn btn-outline-dark boton-accion" | ||
| 58 | title="Eliminar" | ||
| 59 | ng-click="solicitarConfirmacion(vehiculo)" | ||
| 60 | > | ||
| 61 | <i class="fa fa-trash"></i> | ||
| 62 | </button> | ||
| 63 | </td> | ||
| 64 | </tr> | ||
| 65 | </body> | ||
| 66 | </table> | ||
| 15 | </div> | 67 | </div> |
| 16 | <!-- <div class="col-6 form-group"> | ||
| 17 | <input | ||
| 18 | type="text" | ||
| 19 | teclado-virtual |