Commit 4522626ef0ddc65d2ed59be50e5957c9332d170f

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Nuevo diseño

See merge request !8
1   -angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap']);
  1 +angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']);
src/js/controller.js
1 1 angular.module('focaAbmVehiculo')
2 2 .controller('focaAbmVehiculosController', [
3   - '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', '$uibModal',
4   - function($scope, focaAbmVehiculoService, $location, focaModalService, $uibModal) {
5   - $scope.buscar = function(idTransportista) {
6   - focaAbmVehiculoService
7   - .getVehiculosPorTransportista(idTransportista)
8   - .then(function(datos) {
9   - $scope.vehiculos = datos.data;
10   - });
11   - };
  3 + '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService',
  4 + '$uibModal', 'focaBotoneraLateralService', '$timeout',
  5 + function($scope, focaAbmVehiculoService, $location, focaModalService,
  6 + $uibModal, focaBotoneraLateralService, $timeout) {
  7 +
  8 + $scope.now = new Date();
  9 + $scope.botonera = ['Transportista'];
  10 +
  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 21 $scope.editar = function(id) {
13 22 $location.path('/vehiculo/' + id + '/' + $scope.idTransportista);
14 23 };
... ... @@ -38,39 +47,85 @@ angular.module('focaAbmVehiculo')
38 47 }
39 48 );
40 49 modalInstance.result.then(
41   - function(transprotista) {
42   - $scope.idTransportista = transprotista.COD;
43   - $scope.filtros = transprotista.NOM.trim();
44   - $scope.buscar(transprotista.COD);
  50 + function(transportista) {
  51 + elegirTransportista(transportista);
  52 + focaAbmVehiculoService.transportistaSeleccionado = transportista;
45 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 80 .controller('focaAbmVehiculoController', [
53 81 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal',
54   - 'focaModalService',
  82 + 'focaModalService', '$timeout', 'focaBotoneraLateralService',
55 83 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal,
56   - focaModalService) {
57   - $scope.nuevo = $routeParams.idVehiculo == 0 ? true : false;
  84 + focaModalService, $timeout, focaBotoneraLateralService) {
  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 96 if($scope.nuevo) {
59 97 focaAbmVehiculoService
60 98 .getTransportistaPorId($routeParams.idTransportista)
61 99 .then(function(res) {
62 100 $scope.vehiculo.idTransportista = res.data.COD;
63 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 108 $scope.vehiculo = {};
67 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 122 focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo)
71 123 .then(function(res) {
72 124 $scope.cisternas = res.data;
73 125 });
  126 + $scope.next = function(key) {
  127 + if (key === 13) $scope.focused++;
  128 + };
74 129 $scope.cancelar = function() {
75 130 $location.path('/vehiculo');
76 131 };
... ... @@ -117,9 +172,9 @@ angular.module('focaAbmVehiculo')
117 172 }
118 173 );
119 174 modalInstance.result.then(
120   - function(transprotista) {
121   - $scope.vehiculo.idTransportista = transprotista.COD;
122   - $scope.vehiculo.transportista = transprotista;
  175 + function(transportista) {
  176 + $scope.vehiculo.idTransportista = transportista.COD;
  177 + $scope.vehiculo.transportista = transportista;
123 178 }, function() {
124 179  
125 180 }
src/js/controllerCisterna.js
1 1 angular.module('focaAbmVehiculo')
2 2 .controller('focaAbmVehiculoCisternaController', [
3 3 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal',
4   - 'focaModalService',
  4 + 'focaModalService', 'focaBotoneraLateralService', '$timeout',
5 5 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal,
6   - focaModalService) {
  6 + focaModalService, focaBotoneraLateralService, $timeout) {
7 7 $scope.editar = false;
  8 + $scope.now = new Date();
8 9 $scope.cisterna = {
9 10 cisternaCarga: {
10 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 28 focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) {
15 29 if(res.data) {
16 30 $scope.cisterna = res.data;
... ... @@ -19,9 +33,18 @@ angular.module('focaAbmVehiculo')
19 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 46 $scope.cancelar = function() {
23 47 $location.path('/vehiculo/' + $routeParams.idVehiculo);
24   - console.log($routeParams.id);
25 48 };
26 49 $scope.guardar = function() {
27 50 if(!$scope.cisterna.unidadMedida) {
... ... @@ -79,6 +102,6 @@ angular.module('focaAbmVehiculo')
79 102 $scope.cisterna.idUnidadMedida = unidaMedida.ID;
80 103 $scope.cisterna.unidadMedida = unidaMedida;
81 104 });
82   - }
  105 + };
83 106 }
84 107 ]);
... ... @@ -33,6 +33,7 @@ angular.module('focaAbmVehiculo')
33 33 },
34 34 getTransportistaPorId: function(id) {
35 35 return $http.get(API_ENDPOINT.URL + '/transportista/' + id);
36   - }
  36 + },
  37 + transportistaSeleccionado: {}
37 38 };
38 39 }]);
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 9 <form name="formCisterna">
3 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 12 <div class="col-sm-4">
6 13 <input
7 14 class="form-control"
8 15 type="text"
9   - teclado-virtual
10 16 ng-required="true"
11 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 23 </div>
14 24 </div>
... ... @@ -22,6 +32,9 @@
22 32 foca-tipo-input
23 33 ng-model="cisterna.capacidad"
24 34 ng-required="true"
  35 + ng-keypress="next($event.keyCode)"
  36 + foca-focus="focused == 2"
  37 + ng-focus="focused = 2"
25 38 />
26 39 </div>
27 40 </div>
... ... @@ -39,7 +52,7 @@
39 52 class="btn btn-outline-secondary form-control"
40 53 type="button"
41 54 ng-click="seleccionarUnidadMedida()"
42   - ng-disabled="editar"
  55 + foca-focus="focused == 3"
43 56 >
44 57 <i class="fa fa-search" aria-hidden="true"></i>
45 58 </button>
... ... @@ -79,14 +92,4 @@
79 92 </div> -->
80 93 </div>
81 94 </div>
82   - <div class="form-group row">
83   - <div class="col-sm-7 text-right">
84   - <button
85   - class="btn btn-primary"
86   - ng-click="guardar()"
87   - ng-disabled="!formCisterna.$valid"
88   - >Guardar</button>
89   - <button class="btn btn-default" ng-click="cancelar()">Cancelar</button>
90   - </div>
91   - </div>
92 95 </form>
src/views/foca-abm-vehiculos-item.html
1   -<h4>Vehiculo</h4>
2   -<form name="formVehiculo">
3   - <input type="hidden" name="id" ng-model="sector.id" />
4   - <div class="form-group row">
5   - <label class="offset-sm-1 col-sm-2 col-form-label">Transportista</label>
6   - <div class="col-sm-4 input-group">
7   - <input
8   - class="form-control"
9   - type="text"
10   - ng-model="vehiculo.transportista.NOM"
11   - readonly
12   - />
13   - <!-- <div class="input-group-append">
14   - <button
15   - class="btn btn-outline-secondary form-control"
16   - type="button"
17   - ng-click="seleccionarTransportista()">
18   - <i class="fa fa-search" aria-hidden="true"></i>
19   - </button>
20   - </div> -->
21   - </div>
22   - </div>
23   - <div class="form-group row">
24   - <label class="offset-sm-1 col-sm-2 col-form-label">Unidad</label>
25   - <div class="col-sm-4">
26   - <input
27   - class="form-control"
28   - type="text"
29   - teclado-virtual
30   - ng-model="vehiculo.codigo"
31   - />
32   - </div>
33   - </div>
34   - <div class="form-group row">
35   - <label class="offset-sm-1 col-sm-2 col-form-label">Dominio tractor</label>
36   - <div class="col-sm-4">
37   - <input
38   - class="form-control"
39   - type="text"
40   - teclado-virtual
41   - ng-model="vehiculo.tractor"
42   - ng-required="true"
43   - />
44   - </div>
45   - </div>
46   - <div class="form-group row">
47   - <label class="offset-sm-1 col-sm-2 col-form-label">Dominio semi</label>
48   - <div class="col-sm-4">
49   - <input
50   - class="form-control"
51   - type="text"
52   - teclado-virtual
53   - ng-model="vehiculo.semi"
54   - ng-required="true"
55   - />
56   - </div>
57   - </div>
58   - <div class="form-group row">
59   - <div class="col-sm-7 text-right">
60   - <button
61   - class="btn btn-primary"
62   - ng-click="guardar()"
63   - ng-disabled="!formVehiculo.$valid"
64   - >Guardar</button>
65   - <button class="btn btn-default" ng-click="cancelar()">Cancelar</button>
  1 +<div class="row">
  2 + <foca-cabecera-facturador
  3 + titulo="'Vehículo'"
  4 + fecha="now"
  5 + class="mb-0 col-lg-12"
  6 + ></foca-cabecera-facturador>
  7 +</div>
  8 +<div class="row">
  9 + <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded">
  10 + <form name="formVehiculo" class="px-3">
  11 + <input type="hidden" name="id" ng-model="sector.id" />
  12 + <div class="row mt-3">
  13 + <div class="form-group d-flex mb-2 col-md-6">
  14 + <label class="col-form-label col-md-3">Transportista</label>
  15 + <div class="input-group col-md-9 pl-0">
  16 + <input
  17 + class="form-control"
  18 + type="text"
  19 + ng-model="vehiculo.transportista.NOM"
  20 + readonly
  21 + />
  22 + </div>
  23 + </div>
  24 + <div class="form-group d-flex mb-2 col-md-6">
  25 + <label class="col-form-label col-md-3">Unidad</label>
  26 + <div class="input-group col-md-9 pl-0">
  27 + <input
  28 + class="form-control"
  29 + type="text"
  30 + teclado-virtual
  31 + ng-model="vehiculo.codigo"
  32 + foca-focus="focused == 2"
  33 + ng-focus="focused = 2"
  34 + ng-keypress="next($event.keyCode)"
  35 + />
  36 + </div>
  37 + </div>
  38 + <div class="form-group d-flex mb-2 col-md-6">
  39 + <label class="col-form-label col-md-4">Dominio tractor</label>
  40 + <div class="input-group col-md-8 pl-0">
  41 + <input
  42 + class="form-control"
  43 + type="text"
  44 + teclado-virtual
  45 + ng-model="vehiculo.tractor"
  46 + ng-required="true"
  47 + foca-focus="focused == 1"
  48 + ng-focus="focused = 1"
  49 + ng-keypress="next($event.keyCode)"
  50 + />
  51 + </div>
  52 + </div>
  53 + <div class="form-group d-flex mb-2 col-md-6">
  54 + <label class="col-form-label col-md-4">Dominio semi</label>
  55 + <div class="input-group col-md-8 pl-0">
  56 + <input
  57 + class="form-control"
  58 + type="text"
  59 + teclado-virtual
  60 + ng-model="vehiculo.semi"
  61 + ng-required="true"
  62 + foca-focus="focused == 3"
  63 + ng-focus="focused = 3"
  64 + ng-keypress="next($event.keyCode)"
  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 114 </div>
67 115 </div>
68   -</form>
69   -<div class="col-12" ng-show="!nuevo">
70   - <h4>Cisternas</h4>
71   - <table class="table table-sm table-striped table-dark">
72   - <thead>
73   - <tr>
74   - <th>Unidad</th>
75   - <th>Unidad de Medida</th>
76   - <th>Capacidad</th>
77   - <th>Carga</th>
78   - <th class="text-center">
79   - <button class="btn btn-default boton-accion" ng-click="editar(0)">
80   - <i class="fa fa-plus"></i>
81   - </button>
82   - </th>
83   - </tr>
84   - </thead>
85   - <tbody>
86   - <tr ng-repeat="cisterna in cisternas | filter:filtros">
87   - <td ng-bind="cisterna.id"></td>
88   - <td ng-bind="cisterna.unidadMedida.NOM"></td>
89   - <td ng-bind="cisterna.capacidad"></td>
90   - <td ng-bind="cisterna.cisternaCarga.cantidad || 0"></td>
91   - <td class="text-center">
92   - <button
93   - class="btn btn-default boton-accion"
94   - ng-click="editar(cisterna.id)"
95   - >
96   - <i class="fa fa-pencil"></i>
97   - </button>
98   - <button
99   - class="btn btn-default boton-accion"
100   - ng-click="solicitarConfirmacionCisterna(cisterna)"
101   - >
102   - <i class="fa fa-trash"></i>
103   - </button>
104   - </td>
105   - </tr>
106   - </body>
107   - </table>
108 116 </div>
src/views/foca-abm-vehiculos-listado.html
1   -<div class="col-12">
2   - <h4>Vehiculos</h4>
3   - <div class="col-4 form-group input-group">
4   - <input
5   - class="form-control form-control-sm"
6   - ng-model="filtros"
7   - placeholder="Transportista"
8   - />
9   - <div class="input-group-append">
10   - <button
11   - class="btn btn-outline-secondary form-control-sm"
12   - ng-click="seleccionarTransportista()"
13   - ><i class="fa fa-search" aria-hidden="true"></i></button>
  1 +<div class="row">
  2 + <foca-cabecera-facturador
  3 + titulo="'Vehículos'"
  4 + fecha="now"
  5 + class="mb-0 col-lg-12"
  6 + ></foca-cabecera-facturador>
  7 +</div>
  8 +<div class="row">
  9 + <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded">
  10 + <div class="row px-5 py-2 botonera-secundaria">
  11 + <div class="col-12">
  12 + <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador>
  13 + </div>
14 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 67 </div>
16   - <!-- <div class="col-6 form-group">
17   - <input
18   - type="text"
19   - teclado-virtual
20   - class="form-control form-control-sm"
21   - placeholder="Búsqueda"
22   - ng-model="filtros"
23   - />
24   - </div> -->
25   - <table class="table table-sm table-striped table-dark">
26   - <thead>
27   - <tr>
28   - <th>Unidad</th>
29   - <th>Dominio Tractor</th>
30   - <th>Dominio Semi</th>
31   - <th>Capacidad</th>
32   - <th class="text-center">
33   - <button
34   - ng-disabled="!idTransportista"
35   - class="btn btn-default boton-accion"
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"></td>
45   - <td ng-bind="vehiculo.tractor"></td>
46   - <td ng-bind="vehiculo.semi"></td>
47   - <td ng-bind="vehiculo.capacidadTotalCisternas"></td>
48   - <td class="text-center">
49   - <button
50   - class="btn btn-default boton-accion"
51   - ng-click="editar(vehiculo.id)"
52   - >
53   - <i class="fa fa-pencil"></i>
54   - </button>
55   - <button
56   - class="btn btn-default boton-accion"
57   - ng-click="solicitarConfirmacion(vehiculo)"
58   - >
59   - <i class="fa fa-trash"></i>
60   - </button>
61   - </td>
62   - </tr>
63   - </body>
64   - </table>
65   - <a href="#!/" title="Salir"
66   - class="btn btn-secondary btn-block float-right col-md-2"
67   - >
68   - Salir
69   - </a>
70 68 </div>