Commit 33ca34fb10e196820a4d05732353b65ccd151d5f
1 parent
443e05cbae
Exists in
master
correccion diseño
Showing
4 changed files
with
126 additions
and
84 deletions
Show diff stats
src/js/controller.js
| 1 | 1 | angular.module('focaAgendarVisita') |
| 2 | 2 | .controller('focaAgendarVisitaController', [ |
| 3 | 3 | '$scope', 'focaAgendarVisitaService', '$location', '$timeout', |
| 4 | - '$uibModal', 'focaBotoneraLateralService', '$filter', 'focaLoginService', | |
| 4 | + '$uibModal', 'focaBotoneraLateralService', '$filter', | |
| 5 | 5 | 'focaModalService', 'focaSeguimientoService', |
| 6 | 6 | function($scope, focaAgendarVisitaService, $location, $timeout, |
| 7 | - $uibModal, focaBotoneraLateralService, $filter, focaLoginService, | |
| 7 | + $uibModal, focaBotoneraLateralService, $filter, | |
| 8 | 8 | focaModalService, focaSeguimientoService |
| 9 | 9 | ) { |
| 10 | 10 | $scope.focused = 0; |
| 11 | 11 | $scope.rol = 1; |
| 12 | 12 | $scope.visita = {}; |
| 13 | 13 | $scope.now = new Date(); |
| 14 | - $scope.botonera = [ | |
| 15 | - { | |
| 16 | - label: 'Agendar', | |
| 17 | - image: 'precios-condiciones.png' | |
| 18 | - } | |
| 19 | - ]; | |
| 14 | + $scope.botonera = focaAgendarVisitaService.getBotonera(); | |
| 20 | 15 | $timeout(function() { |
| 21 | 16 | focaBotoneraLateralService.showSalir(true); |
| 22 | 17 | focaBotoneraLateralService.showPausar(true); |
| ... | ... | @@ -38,6 +33,11 @@ angular.module('focaAgendarVisita') |
| 38 | 33 | modalInstance.result.then( |
| 39 | 34 | function(cliente) { |
| 40 | 35 | $scope.visita.cliente = cliente; |
| 36 | + $scope.$broadcast('addCabecera', { | |
| 37 | + label: 'Cliente:', | |
| 38 | + valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + | |
| 39 | + cliente.nom | |
| 40 | + }); | |
| 41 | 41 | } |
| 42 | 42 | ); |
| 43 | 43 | }; |
| ... | ... | @@ -62,9 +62,45 @@ angular.module('focaAgendarVisita') |
| 62 | 62 | size: 'md' |
| 63 | 63 | }; |
| 64 | 64 | focaModalService.modal(parametrosModal).then(function(vendedorCobrador) { |
| 65 | - $scope.visita.visitante = vendedorCobrador; | |
| 65 | + if (vendedorCobrador.rol === 3) { | |
| 66 | + $uibModal.open( | |
| 67 | + { | |
| 68 | + ariaLabelledBy: 'Seleccionar tipo de visita', | |
| 69 | + templateUrl: 'modal-tipo-visita.html', | |
| 70 | + controller: 'focaModalTipoVisita', | |
| 71 | + resolve: {}, | |
| 72 | + size: 'md' | |
| 73 | + } | |
| 74 | + ) | |
| 75 | + .result | |
| 76 | + .then(function(res) { | |
| 77 | + $scope.rol = res; | |
| 78 | + $scope.visita.visitante = vendedorCobrador; | |
| 79 | + $scope.$broadcast('addCabecera', { | |
| 80 | + label: 'Vendedor:', | |
| 81 | + valor: $filter('rellenarDigitos')(vendedorCobrador.NUM, 3) + ' - ' + | |
| 82 | + vendedorCobrador.NOM | |
| 83 | + }); | |
| 84 | + }); | |
| 85 | + | |
| 86 | + } else { | |
| 87 | + $scope.visita.visitante = vendedorCobrador; | |
| 88 | + $scope.$broadcast('addCabecera', { | |
| 89 | + label: 'Vendedor:', | |
| 90 | + valor: $filter('rellenarDigitos')(vendedorCobrador.NUM, 3) + ' - ' + | |
| 91 | + vendedorCobrador.NOM | |
| 92 | + }); | |
| 93 | + } | |
| 94 | + | |
| 66 | 95 | }); |
| 67 | 96 | }; |
| 97 | + $scope.seleccionarObservaciones = function() { | |
| 98 | + focaModalService | |
| 99 | + .prompt('Ingrese observaciones', $scope.visita.observacion, true) | |
| 100 | + .then(function(observacion) { | |
| 101 | + $scope.visita.observacion = observacion; | |
| 102 | + }); | |
| 103 | + }; | |
| 68 | 104 | |
| 69 | 105 | $scope.next = function(key) { |
| 70 | 106 | if (key === 13) $scope.focused ++; |
| ... | ... | @@ -98,4 +134,15 @@ angular.module('focaAgendarVisita') |
| 98 | 134 | }); |
| 99 | 135 | }; |
| 100 | 136 | } |
| 137 | + ]) | |
| 138 | + .controller('focaModalTipoVisita', ['$uibModalInstance', '$scope', | |
| 139 | + function($uibModalInstance, $scope) { | |
| 140 | + $scope.cancel = function() { | |
| 141 | + $uibModalInstance.dismiss(); | |
| 142 | + }; | |
| 143 | + | |
| 144 | + $scope.select = function(val) { | |
| 145 | + $uibModalInstance.close(val); | |
| 146 | + }; | |
| 147 | + } | |
| 101 | 148 | ]); |
src/js/service.js
| ... | ... | @@ -3,6 +3,22 @@ angular.module('focaAgendarVisita') |
| 3 | 3 | return { |
| 4 | 4 | guardarVisita: function(visita) { |
| 5 | 5 | return $http.post(API_ENDPOINT.URL + '/visita', {visita: visita}); |
| 6 | + }, | |
| 7 | + getBotonera: function() { | |
| 8 | + return [ | |
| 9 | + { | |
| 10 | + label: 'Cliente', | |
| 11 | + image: 'precios-condiciones.png' | |
| 12 | + }, | |
| 13 | + { | |
| 14 | + label: 'Visitante', | |
| 15 | + image: 'precios-condiciones.png' | |
| 16 | + }, | |
| 17 | + { | |
| 18 | + label: 'Observaciones', | |
| 19 | + image: 'precios-condiciones.png' | |
| 20 | + } | |
| 21 | + ] | |
| 6 | 22 | } |
| 7 | 23 | }; |
| 8 | 24 | }]); |
src/views/agendar-visita.html
| ... | ... | @@ -4,82 +4,15 @@ |
| 4 | 4 | fecha="now" |
| 5 | 5 | class="mb-0 col-lg-12" |
| 6 | 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 class="row py-2 mt-3 botonera-secundaria"> | |
| 11 | - <div class="col-md-6"> | |
| 12 | - <div class="form-group mb-2 col-md-12 d-md-flex"> | |
| 13 | - <label class="col-form-label col-md-4 col-12">Cliente</label> | |
| 14 | - <div class="input-group col-md-8 col-12 pl-0"> | |
| 15 | - <input | |
| 16 | - class="form-control" | |
| 17 | - type="text" | |
| 18 | - teclado-virtual | |
| 19 | - ng-model="visita.cliente.nom" | |
| 20 | - foca-focus="focused == 1" | |
| 21 | - ng-focus="focused = 1" | |
| 22 | - ng-keypress="next($event.keyCode)" | |
| 23 | - disabled> | |
| 24 | - <div class="input-group-append"> | |
| 25 | - <button | |
| 26 | - class="btn btn-outline-secondary form-control" | |
| 27 | - title="Buscar" | |
| 28 | - type="button" | |
| 29 | - ng-click="seleccionarCliente()"> | |
| 30 | - <i class="fa fa-search" aria-hidden="true"></i> | |
| 31 | - </button> | |
| 32 | - </div> | |
| 33 | - </div> | |
| 34 | - </div> | |
| 35 | - <div class="form-group mb-2 col-md-12 d-md-flex"> | |
| 36 | - <label class="col-form-label col-md-4 col-12">Visitante</label> | |
| 37 | - <div class="input-group col-md-8 col-12 pl-0"> | |
| 38 | - <input | |
| 39 | - class="form-control" | |
| 40 | - type="text" | |
| 41 | - teclado-virtual | |
| 42 | - ng-model="visita.visitante.NOM" | |
| 43 | - foca-focus="focused == 1" | |
| 44 | - ng-focus="focused = 1" | |
| 45 | - ng-keypress="next($event.keyCode)" | |
| 46 | - disabled> | |
| 47 | - <div class="input-group-append"> | |
| 48 | - <button | |
| 49 | - class="btn btn-outline-secondary form-control" | |
| 50 | - title="Buscar" | |
| 51 | - type="button" | |
| 52 | - ng-click="seleccionarVisitante()"> | |
| 53 | - <i class="fa fa-search" aria-hidden="true"></i> | |
| 54 | - </button> | |
| 55 | - </div> | |
| 7 | + <div class="col-lg-12"> | |
| 8 | + <div class="row"> | |
| 9 | + <div class="col-12 col-md-10 col-lg-10 mt-4 border border-light rounded"> | |
| 10 | + <div class="row py-2 botonera-secundaria"> | |
| 11 | + <div class="col-12 foca-facturador-px"> | |
| 12 | + <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | |
| 56 | 13 | </div> |
| 57 | 14 | </div> |
| 58 | - <div | |
| 59 | - class="form-group mb-2 col-md-12 d-md-flex" | |
| 60 | - ng-show="visita.visitante.rol === 3"> | |
| 61 | - <label class="col-form-label col-md-4 col-12">Tipo</label> | |
| 62 | - <div class="input-group col-md-8 col-12 pl-0"> | |
| 63 | - <select class="form-control" ng-model="rol"> | |
| 64 | - <option value="1">Vendedor</option> | |
| 65 | - <option value="2">Cobrador</option> | |
| 66 | - </select> | |
| 67 | - </div> | |
| 68 | - </div> | |
| 69 | - </div> | |
| 70 | - <div class="form-group mb-2 col-md-6 d-md-flex"> | |
| 71 | - <label class="col-form-label col-md-4 col-12">Observaciones</label> | |
| 72 | - <div class="input-group col-md-8 col-12"> | |
| 73 | - <textarea | |
| 74 | - rows="5" | |
| 75 | - class="form-control" | |
| 76 | - teclado-virtual | |
| 77 | - ng-model="visita.observacion" | |
| 78 | - foca-focus="focused == 1" | |
| 79 | - ng-focus="focused = 1" | |
| 80 | - ng-keypress="next($event.keyCode)"> | |
| 81 | - </div> | |
| 82 | 15 | </div> |
| 83 | - </form> | |
| 16 | + </div> | |
| 84 | 17 | </div> |
| 85 | 18 | -</div> |
| 19 | +</div> | |
| 86 | 20 | \ No newline at end of file |
src/views/modal-tipo-visita.html
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +<div class="modal-header py-1"> | |
| 2 | + <div class="row w-100"> | |
| 3 | + <div class="col-12"> | |
| 4 | + <h5 class="modal-title my-1">Seleccionar tipo de visita</h5> | |
| 5 | + </div> | |
| 6 | + </div> | |
| 7 | +</div> | |
| 8 | +<div class="modal-body" id="modal-body"> | |
| 9 | + <table class="table table-striped table-sm"> | |
| 10 | + <thead> | |
| 11 | + <tr> | |
| 12 | + <th>Tipo</th> | |
| 13 | + <th></th> | |
| 14 | + </tr> | |
| 15 | + </thead> | |
| 16 | + <tbody> | |
| 17 | + <tr> | |
| 18 | + <td>Nota de pedido</td> | |
| 19 | + <td> | |
| 20 | + <button | |
| 21 | + type="button" | |
| 22 | + class="btn btn-secondary btn-xs p-1 float-right" | |
| 23 | + ng-click="select(1)" | |
| 24 | + > | |
| 25 | + <i class="fa fa-circle-thin" aria-hidden="true"></i> | |
| 26 | + </button> | |
| 27 | + </td> | |
| 28 | + </tr> | |
| 29 | + <tr> | |
| 30 | + <td>Cobranza</td> | |
| 31 | + <td> | |
| 32 | + <button | |
| 33 | + type="button" | |
| 34 | + class="btn btn-secondary btn-xs p-1 float-right" | |
| 35 | + ng-click="select(2)" | |
| 36 | + > | |
| 37 | + <i class="fa fa-circle-thin" aria-hidden="true"></i> | |
| 38 | + </button> | |
| 39 | + </td> | |
| 40 | + </tr> | |
| 41 | + </tbody> | |
| 42 | + </table> | |
| 43 | +</div> | |
| 44 | +<div class="modal-footer py-1"> | |
| 45 | + <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | |
| 46 | +</div> |