Commit 443e05cbae1cccb59b049a85298a5dabff631bef
1 parent
9374474ca0
Exists in
master
ok package json, ok idVisita
Showing
3 changed files
with
7 additions
and
5 deletions
Show diff stats
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-activar-hoja-ruta", | 2 | "name": "foca-agendar-visita", |
| 3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
| 4 | "description": "", | 4 | "description": "", |
| 5 | "main": "index.js", | 5 | "main": "index.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
| 8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
| 9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git git+ssh://git@debonline.dyndns.org:npm/foca-modal-remito.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git git+ssh://git@debonline.dyndns.org:npm/foca-modal-remito.git" |
| 12 | }, | 12 | }, |
| 13 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | ||
| 17 | "type": "git", | ||
| 18 | "url": "http://git.focasoftware.com/npm/foca-agendar-visita.git" | ||
| 19 | }, | ||
| 16 | "author": "", | 20 | "author": "", |
| 17 | "license": "ISC", | 21 | "license": "ISC", |
| 18 | "devDependencies": { | 22 | "devDependencies": { |
| 19 | "gulp": "^3.9.1", | 23 | "gulp": "^3.9.1", |
| 20 | "gulp-angular-templatecache": "^2.2.6", | 24 | "gulp-angular-templatecache": "^2.2.6", |
| 21 | "gulp-clean": "^0.4.0", | 25 | "gulp-clean": "^0.4.0", |
| 22 | "gulp-connect": "^5.7.0", | 26 | "gulp-connect": "^5.7.0", |
| 23 | "gulp-htmlmin": "^5.0.1", | 27 | "gulp-htmlmin": "^5.0.1", |
| 24 | "gulp-jshint": "^2.1.0", | 28 | "gulp-jshint": "^2.1.0", |
| 25 | "gulp-rename": "^1.4.0", | 29 | "gulp-rename": "^1.4.0", |
| 26 | "gulp-replace": "^1.0.0", | 30 | "gulp-replace": "^1.0.0", |
| 27 | "gulp-uglify": "^3.0.1", | 31 | "gulp-uglify": "^3.0.1", |
| 28 | "jshint": "^2.9.7", | 32 | "jshint": "^2.9.7", |
| 29 | "pre-commit": "^1.2.2", | 33 | "pre-commit": "^1.2.2", |
| 30 | "pump": "^3.0.0" | 34 | "pump": "^3.0.0" |
| 31 | } | 35 | } |
| 32 | } | 36 | } |
| 33 | 37 |
src/js/controller.js
| 1 | angular.module('focaAgendarVisita') | 1 | angular.module('focaAgendarVisita') |
| 2 | .controller('focaAgendarVisitaController', [ | 2 | .controller('focaAgendarVisitaController', [ |
| 3 | '$scope', 'focaAgendarVisitaService', '$location', '$timeout', | 3 | '$scope', 'focaAgendarVisitaService', '$location', '$timeout', |
| 4 | '$uibModal', 'focaBotoneraLateralService', '$filter', 'focaLoginService', | 4 | '$uibModal', 'focaBotoneraLateralService', '$filter', 'focaLoginService', |
| 5 | 'focaModalService', 'focaSeguimientoService', | 5 | 'focaModalService', 'focaSeguimientoService', |
| 6 | function($scope, focaAgendarVisitaService, $location, $timeout, | 6 | function($scope, focaAgendarVisitaService, $location, $timeout, |
| 7 | $uibModal, focaBotoneraLateralService, $filter, focaLoginService, | 7 | $uibModal, focaBotoneraLateralService, $filter, focaLoginService, |
| 8 | focaModalService, focaSeguimientoService | 8 | focaModalService, focaSeguimientoService |
| 9 | ) { | 9 | ) { |
| 10 | $scope.focused = 0; | 10 | $scope.focused = 0; |
| 11 | $scope.rol = 1; | 11 | $scope.rol = 1; |
| 12 | $scope.visita = {}; | 12 | $scope.visita = {}; |
| 13 | $scope.now = new Date(); | 13 | $scope.now = new Date(); |
| 14 | $scope.botonera = [ | 14 | $scope.botonera = [ |
| 15 | { | 15 | { |
| 16 | label: 'Agendar', | 16 | label: 'Agendar', |
| 17 | image: 'precios-condiciones.png' | 17 | image: 'precios-condiciones.png' |
| 18 | } | 18 | } |
| 19 | ]; | 19 | ]; |
| 20 | $timeout(function() { | 20 | $timeout(function() { |
| 21 | focaBotoneraLateralService.showSalir(true); | 21 | focaBotoneraLateralService.showSalir(true); |
| 22 | focaBotoneraLateralService.showPausar(true); | 22 | focaBotoneraLateralService.showPausar(true); |
| 23 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 23 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 24 | }); | 24 | }); |
| 25 | 25 | ||
| 26 | $scope.seleccionarCliente = function() { | 26 | $scope.seleccionarCliente = function() { |
| 27 | var modalInstance = $uibModal.open( | 27 | var modalInstance = $uibModal.open( |
| 28 | { | 28 | { |
| 29 | ariaLabelledBy: 'Busqueda de Cliente', | 29 | ariaLabelledBy: 'Busqueda de Cliente', |
| 30 | templateUrl: 'foca-busqueda-cliente-modal.html', | 30 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 31 | controller: 'focaBusquedaClienteModalController', | 31 | controller: 'focaBusquedaClienteModalController', |
| 32 | resolve: { | 32 | resolve: { |
| 33 | vendedor: function() { return null; } | 33 | vendedor: function() { return null; } |
| 34 | }, | 34 | }, |
| 35 | size: 'lg' | 35 | size: 'lg' |
| 36 | } | 36 | } |
| 37 | ); | 37 | ); |
| 38 | modalInstance.result.then( | 38 | modalInstance.result.then( |
| 39 | function(cliente) { | 39 | function(cliente) { |
| 40 | $scope.visita.cliente = cliente; | 40 | $scope.visita.cliente = cliente; |
| 41 | } | 41 | } |
| 42 | ); | 42 | ); |
| 43 | }; | 43 | }; |
| 44 | $scope.seleccionarVisitante = function() { | 44 | $scope.seleccionarVisitante = function() { |
| 45 | var parametrosModal = { | 45 | var parametrosModal = { |
| 46 | query: '/vendedor-cobrador', | 46 | query: '/vendedor-cobrador', |
| 47 | columnas: [ | 47 | columnas: [ |
| 48 | { | 48 | { |
| 49 | propiedad: 'NUM', | 49 | propiedad: 'NUM', |
| 50 | nombre: 'Codigo', | 50 | nombre: 'Codigo', |
| 51 | filtro: { | 51 | filtro: { |
| 52 | nombre: 'rellenarDigitos', | 52 | nombre: 'rellenarDigitos', |
| 53 | parametro: 3 | 53 | parametro: 3 |
| 54 | } | 54 | } |
| 55 | }, | 55 | }, |
| 56 | { | 56 | { |
| 57 | propiedad: 'NOM', | 57 | propiedad: 'NOM', |
| 58 | nombre: 'Nombre' | 58 | nombre: 'Nombre' |
| 59 | } | 59 | } |
| 60 | ], | 60 | ], |
| 61 | titulo:'Búsqueda de vendedores y cobradores', | 61 | titulo:'Búsqueda de vendedores y cobradores', |
| 62 | size: 'md' | 62 | size: 'md' |
| 63 | }; | 63 | }; |
| 64 | focaModalService.modal(parametrosModal).then(function(vendedorCobrador) { | 64 | focaModalService.modal(parametrosModal).then(function(vendedorCobrador) { |
| 65 | $scope.visita.visitante = vendedorCobrador; | 65 | $scope.visita.visitante = vendedorCobrador; |
| 66 | }); | 66 | }); |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | $scope.next = function(key) { | 69 | $scope.next = function(key) { |
| 70 | if (key === 13) $scope.focused ++; | 70 | if (key === 13) $scope.focused ++; |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | $scope.guardar = function() { | 73 | $scope.guardar = function() { |
| 74 | var rol; | 74 | var rol; |
| 75 | if ($scope.visita.visitante.rol === 1) { | 75 | if ($scope.visita.visitante.rol === 1) { |
| 76 | rol = 'Nota de pedido'; | 76 | rol = 'Nota de pedido'; |
| 77 | } else if ($scope.visita.visitante.rol === 2) { | 77 | } else if ($scope.visita.visitante.rol === 2) { |
| 78 | rol = 'Cobranza'; | 78 | rol = 'Cobranza'; |
| 79 | } else { | 79 | } else { |
| 80 | rol = ($scope.rol === 1) ? 'Nota de pedido' : 'Cobranza'; | 80 | rol = ($scope.rol === 1) ? 'Nota de pedido' : 'Cobranza'; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | focaAgendarVisitaService | 83 | focaAgendarVisitaService |
| 84 | .guardarVisita({ | 84 | .guardarVisita({ |
| 85 | idVisitante: $scope.visita.visitante.NUM, | 85 | idVisitante: $scope.visita.visitante.NUM, |
| 86 | tipoVisitante: ($scope.visita.visitante.rol !== 3) ? | ||
| 87 | $scope.visita.visitante.rol : $scope.rol, | ||
| 88 | idCliente: $scope.visita.cliente.cod | 86 | idCliente: $scope.visita.cliente.cod |
| 89 | }) | 87 | }) |
| 90 | .then(function(data) { | 88 | .then(function(data) { |
| 91 | focaSeguimientoService.guardarPosicion( | 89 | focaSeguimientoService.guardarPosicion( |
| 92 | rol, | 90 | rol, |
| 93 | data.data.id, | 91 | data.data.id, |
| 94 | $scope.visita.observacion, | 92 | $scope.visita.observacion, |
| 95 | true | 93 | data.data.id |
| 96 | ); | 94 | ); |
| 97 | }) | 95 | }) |
| 98 | .then(function() { | 96 | .then(function() { |
| 99 | $location.path('/'); | 97 | $location.path('/'); |
| 100 | }); | 98 | }); |
| 101 | }; | 99 | }; |
| 102 | } | 100 | } |
| 103 | ]); | 101 | ]); |
| 104 | 102 |
src/views/agendar-visita.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
| 3 | titulo="'Agendar visita'" | 3 | titulo="'Agendar visita'" |
| 4 | fecha="now" | 4 | fecha="now" |
| 5 | class="mb-0 col-lg-12" | 5 | class="mb-0 col-lg-12" |
| 6 | ></foca-cabecera-facturador> | 6 | ></foca-cabecera-facturador> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="row"> | 8 | <div class="row"> |
| 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 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"> | 10 | <form class="row py-2 mt-3 botonera-secundaria"> |
| 11 | <div class="col-md-6"> | 11 | <div class="col-md-6"> |
| 12 | <div class="form-group mb-2 col-md-12 d-md-flex"> | 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> | 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"> | 14 | <div class="input-group col-md-8 col-12 pl-0"> |
| 15 | <input | 15 | <input |
| 16 | class="form-control" | 16 | class="form-control" |
| 17 | type="text" | 17 | type="text" |
| 18 | teclado-virtual | 18 | teclado-virtual |
| 19 | ng-model="visita.cliente.nom" | 19 | ng-model="visita.cliente.nom" |
| 20 | foca-focus="focused == 1" | 20 | foca-focus="focused == 1" |
| 21 | ng-focus="focused = 1" | 21 | ng-focus="focused = 1" |
| 22 | ng-keypress="next($event.keyCode)" | 22 | ng-keypress="next($event.keyCode)" |
| 23 | disabled> | 23 | disabled> |
| 24 | <div class="input-group-append"> | 24 | <div class="input-group-append"> |
| 25 | <button | 25 | <button |
| 26 | class="btn btn-outline-secondary form-control" | 26 | class="btn btn-outline-secondary form-control" |
| 27 | title="Buscar" | 27 | title="Buscar" |
| 28 | type="button" | 28 | type="button" |
| 29 | ng-click="seleccionarCliente()"> | 29 | ng-click="seleccionarCliente()"> |
| 30 | <i class="fa fa-search" aria-hidden="true"></i> | 30 | <i class="fa fa-search" aria-hidden="true"></i> |
| 31 | </button> | 31 | </button> |
| 32 | </div> | 32 | </div> |
| 33 | </div> | 33 | </div> |
| 34 | </div> | 34 | </div> |
| 35 | <div class="form-group mb-2 col-md-12 d-md-flex"> | 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> | 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"> | 37 | <div class="input-group col-md-8 col-12 pl-0"> |
| 38 | <input | 38 | <input |
| 39 | class="form-control" | 39 | class="form-control" |
| 40 | type="text" | 40 | type="text" |
| 41 | teclado-virtual | 41 | teclado-virtual |
| 42 | ng-model="visita.visitante.NOM" | 42 | ng-model="visita.visitante.NOM" |
| 43 | foca-focus="focused == 1" | 43 | foca-focus="focused == 1" |
| 44 | ng-focus="focused = 1" | 44 | ng-focus="focused = 1" |
| 45 | ng-keypress="next($event.keyCode)" | 45 | ng-keypress="next($event.keyCode)" |
| 46 | disabled> | 46 | disabled> |
| 47 | <div class="input-group-append"> | 47 | <div class="input-group-append"> |
| 48 | <button | 48 | <button |
| 49 | class="btn btn-outline-secondary form-control" | 49 | class="btn btn-outline-secondary form-control" |
| 50 | title="Buscar" | 50 | title="Buscar" |
| 51 | type="button" | 51 | type="button" |
| 52 | ng-click="seleccionarVisitante()"> | 52 | ng-click="seleccionarVisitante()"> |
| 53 | <i class="fa fa-search" aria-hidden="true"></i> | 53 | <i class="fa fa-search" aria-hidden="true"></i> |
| 54 | </button> | 54 | </button> |
| 55 | </div> | 55 | </div> |
| 56 | </div> | 56 | </div> |
| 57 | </div> | 57 | </div> |
| 58 | <div | 58 | <div |
| 59 | class="form-group mb-2 col-md-12 d-md-flex" | 59 | class="form-group mb-2 col-md-12 d-md-flex" |
| 60 | ng-show="visita.visitante.rol === 3"> | 60 | ng-show="visita.visitante.rol === 3"> |
| 61 | <label class="col-form-label col-md-4 col-12">Tipo</label> | 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"> | 62 | <div class="input-group col-md-8 col-12 pl-0"> |
| 63 | <select class="form-control" ng-model="rol"> | 63 | <select class="form-control" ng-model="rol"> |
| 64 | <option value="1">Vendedor</option> | 64 | <option value="1">Vendedor</option> |
| 65 | <option value="2">Cobrador</option> | 65 | <option value="2">Cobrador</option> |
| 66 | </select> | 66 | </select> |
| 67 | </div> | 67 | </div> |
| 68 | </div> | 68 | </div> |
| 69 | </div> | 69 | </div> |
| 70 | <div class="form-group mb-2 col-md-6 d-md-flex"> | 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> | 71 | <label class="col-form-label col-md-4 col-12">Observaciones</label> |
| 72 | <div class="input-group col-md-8 col-12 pl-0"> | 72 | <div class="input-group col-md-8 col-12"> |
| 73 | <textarea | 73 | <textarea |
| 74 | rows="5" | 74 | rows="5" |
| 75 | class="form-control" | 75 | class="form-control" |
| 76 | teclado-virtual | 76 | teclado-virtual |
| 77 | ng-model="visita.observacion" | 77 | ng-model="visita.observacion" |
| 78 | foca-focus="focused == 1" | 78 | foca-focus="focused == 1" |
| 79 | ng-focus="focused = 1" | 79 | ng-focus="focused = 1" |
| 80 | ng-keypress="next($event.keyCode)"> | 80 | ng-keypress="next($event.keyCode)"> |
| 81 | </div> | 81 | </div> |
| 82 | </div> | 82 | </div> |
| 83 | </form> | 83 | </form> |
| 84 | </div> | 84 | </div> |
| 85 | </div> | 85 | </div> |
| 86 | 86 |