Commit 15849478c3a4598a3b07cf4a26e1620a529f013e
Exists in
master
and in
2 other branches
Merge branch 'master' into 'master'
Agrego foca-botonera-lateral See merge request !4
Showing
4 changed files
Show diff stats
src/js/app.js
| 1 | angular.module('focaAbmChofer', ['ngRoute', 'focaModal', 'ui.bootstrap']); | 1 | angular.module('focaAbmChofer', [ |
| 2 | 'ngRoute', | ||
| 3 | 'focaModal', | ||
| 4 | 'ui.bootstrap', | ||
| 5 | 'focaBotoneraLateral' | ||
| 6 | ]); | ||
| 2 | 7 |
src/js/controller.js
| 1 | angular.module('focaAbmChofer') | 1 | angular.module('focaAbmChofer') |
| 2 | .controller('focaAbmChoferesController', [ | 2 | .controller('focaAbmChoferesController', [ |
| 3 | '$scope', 'focaAbmChoferService', '$location', 'focaModalService', | 3 | '$scope', 'focaAbmChoferService', '$location', |
| 4 | function($scope, focaAbmChoferService, $location, focaModalService) { | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', |
| 5 | function($scope, focaAbmChoferService, $location, focaModalService, | ||
| 6 | focaBotoneraLateralService, $timeout) { | ||
| 5 | 7 | ||
| 6 | $scope.filters = ''; | 8 | $scope.filters = ''; |
| 7 | $scope.choferes = []; | 9 | $scope.choferes = []; |
| 8 | $scope.choferesFiltrados = []; | 10 | $scope.choferesFiltrados = []; |
| 9 | 11 | ||
| 10 | focaAbmChoferService.getChoferes().then(function(datos) { | 12 | focaAbmChoferService.getChoferes().then(function(datos) { |
| 11 | $scope.choferes = datos.data; | 13 | $scope.choferes = datos.data; |
| 12 | $scope.choferesFiltrados = $scope.choferes; | 14 | $scope.choferesFiltrados = $scope.choferes; |
| 13 | }); | 15 | }); |
| 14 | 16 | ||
| 15 | 17 | //SETEO BOTONERA LATERAL | |
| 18 | $timeout(function() { | ||
| 19 | focaBotoneraLateralService.showSalir(true); | ||
| 20 | focaBotoneraLateralService.showPausar(false); | ||
| 21 | focaBotoneraLateralService.showCancelar(false); | ||
| 22 | focaBotoneraLateralService.showGuardar(false); | ||
| 23 | }); | ||
| 16 | 24 | ||
| 17 | $scope.editar = function(id) { | 25 | $scope.editar = function(id) { |
| 18 | $location.path('/chofer/' + id); | 26 | $location.path('/chofer/' + id); |
| 19 | }; | 27 | }; |
| 20 | 28 | ||
| 21 | $scope.solicitarConfirmacion = function(chofer) { | 29 | $scope.solicitarConfirmacion = function(chofer) { |
| 22 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + | 30 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + |
| 23 | chofer.nombre + ' ?').then(function(confirmed) { | 31 | chofer.nombre + ' ?').then(function(confirmed) { |
| 24 | if(confirmed) { | 32 | if(confirmed) { |
| 25 | focaAbmChoferService.deleteChofer(chofer.id); | 33 | focaAbmChoferService.deleteChofer(chofer.id); |
| 26 | $scope.choferes.splice($scope.choferes.indexOf(chofer), 1); | 34 | $scope.choferes.splice($scope.choferes.indexOf(chofer), 1); |
| 27 | } | 35 | } |
| 28 | }); | 36 | }); |
| 29 | }; | 37 | }; |
| 30 | 38 | ||
| 31 | 39 | ||
| 32 | } | 40 | } |
| 33 | ]) | 41 | ]) |
| 34 | .controller('focaAbmChoferController', [ | 42 | .controller('focaAbmChoferController', [ |
| 35 | '$scope', 'focaAbmChoferService', '$routeParams', '$location', | 43 | '$scope', 'focaAbmChoferService', '$routeParams', |
| 36 | function($scope, focaAbmChoferService, $routeParams, $location) { | 44 | '$location', 'focaBotoneraLateralService', '$timeout', |
| 45 | function($scope, focaAbmChoferService, $routeParams, | ||
| 46 | $location, focaBotoneraLateralService, $timeout) { | ||
| 37 | 47 | ||
| 38 | $scope.chofer = {}; | 48 | $scope.chofer = {}; |
| 39 | $scope.transportistas = []; | 49 | $scope.transportistas = []; |
| 40 | 50 | ||
| 51 | //SETEO BOTONERA LATERAL | ||
| 52 | $timeout(function() { | ||
| 53 | focaBotoneraLateralService.showSalir(false); | ||
| 54 | focaBotoneraLateralService.showPausar(true); | ||
| 55 | focaBotoneraLateralService.showCancelar(true); | ||
| 56 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | ||
| 57 | }); | ||
| 58 | |||
| 41 | focaAbmChoferService.getChofer($routeParams.id).then(function(res) { | 59 | focaAbmChoferService.getChofer($routeParams.id).then(function(res) { |
| 42 | if(res.data) $scope.chofer = res.data; | 60 | if(res.data) $scope.chofer = res.data; |
| 43 | }); | 61 | }); |
| 44 | 62 | ||
| 45 | focaAbmChoferService.getTransportistas().then(function(res) { | 63 | focaAbmChoferService.getTransportistas().then(function(res) { |
| 46 | $scope.transportistas = res.data; | 64 | $scope.transportistas = res.data; |
| 47 | }); | 65 | }); |
| 48 | 66 | ||
| 49 | $scope.cancelar = function() { | 67 | $scope.cancelar = function() { |
| 50 | $location.path('/chofer'); | 68 | $location.path('/chofer'); |
| 51 | }; | 69 | }; |
| 52 | 70 | ||
| 53 | $scope.guardar = function() { | 71 | $scope.guardar = function() { |
| 54 | $scope.chofer.idTransportista = $scope.chofer.transportista.COD; | 72 | $scope.chofer.idTransportista = $scope.chofer.transportista.COD; |
| 55 | delete $scope.chofer.transportista; | 73 | delete $scope.chofer.transportista; |
| 56 | focaAbmChoferService.guardarChofer($scope.chofer).then(function() { | 74 | focaAbmChoferService.guardarChofer($scope.chofer).then(function() { |
| 57 | $location.path('/chofer'); | 75 | $location.path('/chofer'); |
| 58 | }); | 76 | }); |
| 59 | }; | 77 | }; |
| 60 | 78 | ||
| 61 | } | 79 | } |
| 62 | ]); | 80 | ]); |
| 63 | 81 |
src/views/foca-abm-choferes-item.html
| 1 | <h4 class="pt-4">Chofer</h4> | 1 | <h4 class="pt-4">Chofer</h4> |
| 2 | <form name="formChofer"> | 2 | <form name="formChofer"> |
| 3 | <input type="hidden" name="id" ng-model="chofer.id" /> | 3 | <input type="hidden" name="id" ng-model="chofer.id" /> |
| 4 | <div class="form-group row"> | 4 | <div class="form-group row"> |
| 5 | <label class="offset-sm-1 col-sm-2 col-form-label">Transportista</label> | 5 | <label class="offset-sm-1 col-sm-2 col-form-label">Transportista</label> |
| 6 | <div class="col-sm-4"> | 6 | <div class="col-sm-4"> |
| 7 | <select class="form-control" ng-model="chofer.transportista" | 7 | <select class="form-control" ng-model="chofer.transportista" |
| 8 | ng-options="transportista as transportista.NOM for transportista in transportistas" | 8 | ng-options="transportista as transportista.NOM for transportista in transportistas" |
| 9 | > | 9 | > |
| 10 | </select> | 10 | </select> |
| 11 | </div> | 11 | </div> |
| 12 | </div> | 12 | </div> |
| 13 | <div class="form-group row"> | 13 | <div class="form-group row"> |
| 14 | <label class="offset-sm-1 col-sm-2 col-form-label">Nombre</label> | 14 | <label class="offset-sm-1 col-sm-2 col-form-label">Nombre</label> |
| 15 | <div class="col-sm-4"> | 15 | <div class="col-sm-4"> |
| 16 | <input | 16 | <input |
| 17 | class="form-control" | 17 | class="form-control" |
| 18 | type="text" | 18 | type="text" |
| 19 | teclado-virtual | 19 | teclado-virtual |
| 20 | ng-model="chofer.nombre" | 20 | ng-model="chofer.nombre" |
| 21 | ng-required="true" | 21 | ng-required="true" |
| 22 | /> | 22 | /> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | <div class="form-group row"> | 25 | <div class="form-group row"> |
| 26 | <label class="offset-sm-1 col-sm-2 col-form-label">DNI</label> | 26 | <label class="offset-sm-1 col-sm-2 col-form-label">DNI</label> |
| 27 | <div class="col-sm-4"> | 27 | <div class="col-sm-4"> |
| 28 | <input | 28 | <input |
| 29 | class="form-control" | 29 | class="form-control" |
| 30 | type="text" | 30 | type="text" |
| 31 | teclado-virtual | 31 | teclado-virtual |
| 32 | ng-model="chofer.dni" | 32 | ng-model="chofer.dni" |
| 33 | ng-required="true" | 33 | ng-required="true" |
| 34 | /> | 34 | /> |
| 35 | </div> | 35 | </div> |
| 36 | </div> | 36 | </div> |
| 37 | <div class="form-group row"> | 37 | <div class="form-group row"> |
| 38 | <label class="offset-sm-1 col-sm-2 col-form-label">Teléfono</label> | 38 | <label class="offset-sm-1 col-sm-2 col-form-label">Teléfono</label> |
| 39 | <div class="col-sm-4"> | 39 | <div class="col-sm-4"> |
| 40 | <input | 40 | <input |
| 41 | class="form-control" | 41 | class="form-control" |
| 42 | type="text" | 42 | type="text" |
| 43 | teclado-virtual | 43 | teclado-virtual |
| 44 | ng-model="chofer.telefono" | 44 | ng-model="chofer.telefono" |
| 45 | ng-required="true" | 45 | ng-required="true" |
| 46 | /> | 46 | /> |
| 47 | </div> | 47 | </div> |
| 48 | </div> | 48 | </div> |
| 49 | <div class="form-group row"> | ||
| 50 | <div class="col-sm-7 text-right"> | ||
| 51 | <button | ||
| 52 | class="btn btn-primary" | ||
| 53 | ng-click="guardar()" | ||
| 54 | ng-disabled="!formChofer.$valid" | ||
| 55 | >Guardar</button> | ||
| 56 | <button class="btn btn-default" ng-click="cancelar()">Cancelar</button> | ||
| 57 | </div> | ||
| 58 | </div> | ||
| 59 | </form> | 49 | </form> |
| 60 | 50 |
src/views/foca-abm-choferes-listado.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <div class="col-12 col-md-10 pt-4 pr-4 pl-4"> | 2 | <div class="col-12 col-md-10 pt-4 pr-4 pl-4"> |
| 3 | <h4 class="mb-4">Choferes</h4> | 3 | <h4 class="mb-4">Choferes</h4> |
| 4 | <div class="form-group input-group"> | 4 | <div class="form-group input-group"> |
| 5 | <input | 5 | <input |
| 6 | type="text" | 6 | type="text" |
| 7 | class="form-control form-control-sm" | 7 | class="form-control form-control-sm" |
| 8 | id="search" | 8 | id="search" |
| 9 | placeholder="Búsqueda" | 9 | placeholder="Búsqueda" |
| 10 | ng-model="filters" | 10 | ng-model="filters" |
| 11 | teclado-virtual | 11 | teclado-virtual |
| 12 | ng-keypress="busquedaPress($event.keyCode)" | 12 | ng-keypress="busquedaPress($event.keyCode)" |
| 13 | /> | 13 | /> |
| 14 | <div class="input-group-append"> | 14 | <div class="input-group-append"> |
| 15 | <button | 15 | <button |
| 16 | ladda="searchLoading" | 16 | ladda="searchLoading" |
| 17 | class="btn btn-outline-secondary" | 17 | class="btn btn-outline-secondary" |
| 18 | type="button" | 18 | type="button" |
| 19 | ng-click="busquedaPress(13)" | 19 | ng-click="busquedaPress(13)" |
| 20 | > | 20 | > |
| 21 | <i class="fa fa-search" aria-hidden="true"></i> | 21 | <i class="fa fa-search" aria-hidden="true"></i> |
| 22 | </button> | 22 | </button> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | <table class="table table-sm table-striped table-dark mb-0"> | 25 | <table class="table table-sm table-striped table-dark mb-0"> |
| 26 | <thead> | 26 | <thead> |
| 27 | <tr> | 27 | <tr> |
| 28 | <th>Código</th> | 28 | <th>Código</th> |
| 29 | <th>Nombre</th> | 29 | <th>Nombre</th> |
| 30 | <th>DNI</th> | 30 | <th>DNI</th> |
| 31 | <th>Teléfono</th> | 31 | <th>Teléfono</th> |
| 32 | <th>Transportista</th> | 32 | <th>Transportista</th> |
| 33 | <th class="text-center"> | 33 | <th class="text-center"> |
| 34 | <button class="btn btn-default boton-accion" ng-click="editar(0)"> | 34 | <button class="btn btn-default boton-accion" ng-click="editar(0)"> |
| 35 | <i class="fa fa-plus"></i> | 35 | <i class="fa fa-plus"></i> |
| 36 | </button> | 36 | </button> |
| 37 | </th> | 37 | </th> |
| 38 | </tr> | 38 | </tr> |
| 39 | </thead> | 39 | </thead> |
| 40 | <tbody> | 40 | <tbody> |
| 41 | <tr ng-repeat="chofer in choferes | filter:filters"> | 41 | <tr ng-repeat="chofer in choferes | filter:filters"> |
| 42 | <td ng-bind="chofer.id"></td> | 42 | <td ng-bind="chofer.id"></td> |
| 43 | <td ng-bind="chofer.nombre"></td> | 43 | <td ng-bind="chofer.nombre"></td> |
| 44 | <td ng-bind="chofer.dni"></td> | 44 | <td ng-bind="chofer.dni"></td> |
| 45 | <td ng-bind="chofer.telefono"></td> | 45 | <td ng-bind="chofer.telefono"></td> |
| 46 | <td ng-bind="chofer.transportista.NOM || 'No tiene'"></td> | 46 | <td ng-bind="chofer.transportista.NOM || 'No tiene'"></td> |
| 47 | <td class="text-center"> | 47 | <td class="text-center"> |
| 48 | <button | 48 | <button |
| 49 | class="btn btn-default boton-accion" | 49 | class="btn btn-default boton-accion" |
| 50 | ng-click="editar(chofer.id)" | 50 | ng-click="editar(chofer.id)" |
| 51 | > | 51 | > |
| 52 | <i class="fa fa-pencil"></i> | 52 | <i class="fa fa-pencil"></i> |
| 53 | </button> | 53 | </button> |
| 54 | <button | 54 | <button |
| 55 | class="btn btn-default boton-accion" | 55 | class="btn btn-default boton-accion" |
| 56 | ng-click="solicitarConfirmacion(chofer)" | 56 | ng-click="solicitarConfirmacion(chofer)" |
| 57 | > | 57 | > |
| 58 | <i class="fa fa-trash"></i> | 58 | <i class="fa fa-trash"></i> |
| 59 | </button> | 59 | </button> |
| 60 | </td> | 60 | </td> |
| 61 | </tr> | 61 | </tr> |
| 62 | </body> | 62 | </body> |
| 63 | </table> | 63 | </table> |
| 64 | 64 | ||
| 65 | </div> | 65 | </div> |
| 66 | <div class="col-md-2 d-flex align-items-end"> | 66 | |
| 67 | <a href="#!/" title="Salir" | ||
| 68 | class="btn btn-secondary btn-block float-right"> | ||
| 69 | Salir | ||
| 70 | </a> | ||
| 71 | </div> | ||
| 72 | </div> | 67 | </div> |
| 73 | 68 |