Commit 05f7ff0a7c414b3f19c3b38938f2c6caa5d6ceb0
Exists in
demo
Merge branch 'facturador' into 'demo'
Facturador(mpuebla) See merge request !26
Showing
5 changed files
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaLogin') |
2 | 2 | .controller('focaLoginController', [ |
3 | - '$scope', 'focaLoginService', '$location', '$cookies', 'focaModalService', 'md5', 'APP', | |
4 | - function ($scope, focaLoginService, $location, $cookies, focaModalService, md5, APP) { | |
3 | + '$scope', 'focaLoginService', '$location', '$cookies', 'focaModalService', 'md5', 'APP', '$uibModal', | |
4 | + function ($scope, focaLoginService, $location, $cookies, focaModalService, md5, APP, $uibModal) { | |
5 | + | |
5 | 6 | $scope.paso = 1; |
6 | 7 | $scope.hidePassword = true; |
8 | + $scope.timer = 0; | |
9 | + | |
7 | 10 | $scope.enviar = function () { |
11 | + | |
8 | 12 | angular.element('#password').blur(); |
9 | 13 | focaLoginService.login({ |
10 | 14 | idUsuario: $scope.usuario.idUsuario, |
11 | 15 | clave: APP != 'facturador' ? md5.createHash($scope.usuario.clave) : |
12 | 16 | $scope.usuario.clave |
13 | 17 | }).then(function (datos) { |
18 | + | |
14 | 19 | if (datos.data.chofer && datos.data.chofer.id) { |
15 | 20 | $cookies.put('chofer', datos.data.chofer.id); |
16 | 21 | $cookies.put('nombreUsuario', datos.data.chofer.nombre); |
... | ... | @@ -24,12 +29,11 @@ angular.module('focaLogin') |
24 | 29 | focaModalService.alert('Existe un error con el usuario ingresado'); |
25 | 30 | return; |
26 | 31 | } |
27 | - | |
28 | - console.info(datos.data); | |
29 | 32 | $cookies.put('token', datos.data.token); |
30 | 33 | $location.path('/'); |
31 | 34 | $scope.$emit('blur'); |
32 | 35 | }, function (error) { |
36 | + | |
33 | 37 | if (error.status === 401) { |
34 | 38 | focaModalService |
35 | 39 | .alert('El usuario o la contraseña han sido mal introducidos'); |
... | ... | @@ -41,14 +45,31 @@ angular.module('focaLogin') |
41 | 45 | } |
42 | 46 | }); |
43 | 47 | }; |
48 | + | |
44 | 49 | $scope.irPaso = function (numeroPaso) { |
50 | + | |
45 | 51 | $scope.paso = numeroPaso; |
46 | 52 | }; |
53 | + | |
54 | + $scope.abrirModalConfiguracion = function () { | |
55 | + | |
56 | + $scope.timer++; | |
57 | + if ($scope.timer < 5) { return; } | |
58 | + $scope.timer = 0; | |
59 | + | |
60 | + $uibModal.open({ | |
61 | + templateUrl: 'modal-configuracion.html', | |
62 | + controller: 'focaModalConfiguracionController', | |
63 | + size: 'md', | |
64 | + backdrop: false, | |
65 | + }); | |
66 | + }; | |
47 | 67 | } |
48 | 68 | ]) |
49 | 69 | .controller('focaLogoutController', [ |
50 | 70 | '$cookies', '$location', |
51 | 71 | function ($cookies, $location) { |
72 | + | |
52 | 73 | $cookies.remove('chofer'); |
53 | 74 | $cookies.remove('vendedorCobrador'); |
54 | 75 | $cookies.remove('vendedorPlaya'); |
src/js/controllerConfiguracion.js
... | ... | @@ -0,0 +1,45 @@ |
1 | +angular.module('focaLogin') | |
2 | + .controller('focaModalConfiguracionController', [ | |
3 | + '$scope', '$uibModalInstance', 'focaLoginService', '$timeout', '$localStorage', | |
4 | + function ($scope, $uibModalInstance, focaLoginService, $timeout, $localStorage) { | |
5 | + | |
6 | + $scope.puntosVenta = []; | |
7 | + $scope.impresoras = []; | |
8 | + $scope.selectedPuntoVenta = localStorage.pve ? localStorage.pve : null; | |
9 | + $scope.selectedImpresora = $localStorage.impresoraPVE ? $localStorage.impresoraPVE : null; | |
10 | + $scope.usePlanillaPropia = false; | |
11 | + | |
12 | + init(); | |
13 | + | |
14 | + function init() { | |
15 | + | |
16 | + var promisePuntosVenta = focaLoginService.getAllPuntoVenta(); | |
17 | + var promiseImpresoras = focaLoginService.getAllImpresoras(); | |
18 | + | |
19 | + Promise.all([promisePuntosVenta, promiseImpresoras]) | |
20 | + .then(function (res) { | |
21 | + | |
22 | + $timeout(function () { | |
23 | + | |
24 | + $scope.puntosVenta = res[0].data; | |
25 | + $scope.impresoras = res[1].data; | |
26 | + }); | |
27 | + }) | |
28 | + .catch(function (err) { | |
29 | + console.error(err); | |
30 | + }); | |
31 | + } | |
32 | + | |
33 | + $scope.cancel = function () { | |
34 | + | |
35 | + $uibModalInstance.dismiss('cancel'); | |
36 | + }; | |
37 | + | |
38 | + $scope.acept = function () { | |
39 | + | |
40 | + $localStorage.pve = $scope.selectedPuntoVenta ? parseInt($scope.selectedPuntoVenta) : null; | |
41 | + $localStorage.impresoraPVE = $scope.selectedImpresora ? parseInt($scope.selectedImpresora) : null; | |
42 | + $scope.cancel(); | |
43 | + } | |
44 | + } | |
45 | + ]); |
src/js/service.js
1 | 1 | angular.module('focaLogin') |
2 | 2 | .factory('focaLoginService', [ |
3 | 3 | '$http', 'API_ENDPOINT', 'APP', '$cookies', |
4 | - function($http, API_ENDPOINT, APP, $cookies) { | |
4 | + function ($http, API_ENDPOINT, APP, $cookies) { | |
5 | 5 | return { |
6 | - login: function(usuario) { | |
7 | - var param = ''; | |
6 | + login: function (usuario) { | |
8 | 7 | |
9 | - if (APP) { | |
10 | - param = '/' + APP; | |
11 | - } | |
12 | - | |
13 | - return $http.post(API_ENDPOINT.URL + '/usuario/login' + param , usuario); | |
8 | + var param = APP ? '/' + APP : ''; | |
9 | + return $http.post(API_ENDPOINT.URL + '/usuario/login' + param, usuario); | |
14 | 10 | }, |
15 | - getLoginData: function() { | |
11 | + getLoginData: function () { | |
12 | + | |
16 | 13 | if ($cookies.get('chofer')) { |
17 | - return {chofer: $cookies.get('chofer')}; | |
14 | + return { chofer: $cookies.get('chofer') }; | |
18 | 15 | } |
19 | 16 | |
20 | 17 | if ($cookies.get('vendedorCobrador')) { |
21 | - return {vendedorCobrador: $cookies.get('vendedorCobrador')}; | |
18 | + return { vendedorCobrador: $cookies.get('vendedorCobrador') }; | |
22 | 19 | } |
23 | 20 | |
24 | 21 | if ($cookies.get('vendedorPlaya')) { |
25 | - return {vendedorPlaya: $cookies.get('vendedorPlaya')}; | |
22 | + return { vendedorPlaya: $cookies.get('vendedorPlaya') }; | |
26 | 23 | } |
27 | - } | |
24 | + }, | |
25 | + getAllPuntoVenta: function () { | |
26 | + | |
27 | + return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/puntos-venta'); | |
28 | + }, | |
29 | + getAllImpresoras: function () { | |
30 | + | |
31 | + return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/impresoras'); | |
32 | + }, | |
33 | + getByIdPuntoVenta: function (id) { | |
34 | + | |
35 | + return $http.get(API_ENDPOINT.URL_AUTOSERVICIO + '/get/punto-venta/' + id); | |
36 | + }, | |
28 | 37 | }; |
29 | 38 | } |
30 | 39 | ]); |
src/views/foca-login.html
1 | -<div class="row justify-content-center align-items-center"> | |
2 | - <div class="col-12 my-2"> | |
3 | - <img src="img/logo.png" class="img-login mx-auto d-block"> | |
1 | +<div class="row m-0 justify-content-center align-items-center"> | |
2 | + <div class="col-12 p-0 my-2"> | |
3 | + <img | |
4 | + draggable="false" | |
5 | + ondragstart="return false;" | |
6 | + (contextmenu)="false" | |
7 | + on-mouse-hold="abrirModalConfiguracion" | |
8 | + ng-mouseup="timer = 0" | |
9 | + src="img/logo.png" | |
10 | + class="img-login mx-auto d-block disable-user-select"> | |
4 | 11 | </div> |
5 | - <div class="col-8 col-sm-6 col-md-4 col-lg-3 my-2 align-self-stretch"> | |
6 | - <div class="bg-gradient-login border-0 rounded shadow-sm text-center"> | |
12 | + <div class="col-8 col-sm-6 col-md-4 col-lg-3 p-0 my-2 align-self-stretch"> | |
13 | + <div class="bg-gradient-login border-0 rounded-lg shadow text-center"> | |
7 | 14 | <form class="p-3 m-0" name="login"> |
8 | - <div class="pt-3 pb-2 mb-3 border-bottom border-white"> | |
9 | - <span>Ingreso de usuario</span> | |
10 | - </div> | |
11 | 15 | <!-- USUARIO --> |
12 | - <label | |
13 | - for="user" | |
14 | - class="login-small-text m-0"> | |
15 | - Usuario | |
16 | - </label> | |
17 | - <div class="input-group mb-2"> | |
16 | + <div class="input-group mt-5 mb-4"> | |
18 | 17 | <input |
19 | 18 | class="form-control form-control-sm rounded-pill text-transform-none" |
20 | 19 | type="text" |
20 | + placeholder="Ingrese su usuario" | |
21 | 21 | id="user" |
22 | 22 | ng-model="usuario.idUsuario" |
23 | 23 | ng-focus="paso = 1" |
... | ... | @@ -28,16 +28,12 @@ |
28 | 28 | /> |
29 | 29 | </div> |
30 | 30 | <!-- CONTRASEÑA --> |
31 | - <label | |
32 | - for="password" | |
33 | - class="login-small-text m-0"> | |
34 | - Contraseña | |
35 | - </label> | |
36 | - <div class="input-group mb-2"> | |
31 | + <div class="input-group mb-4"> | |
37 | 32 | <input |
38 | 33 | class="form-control form-control-sm rounded-pill text-transform-none pr-5" |
39 | 34 | id="password" |
40 | 35 | type="{{hidePassword ? 'password' : 'text'}}" |
36 | + placeholder="Ingrese su contraseña" | |
41 | 37 | ng-model="usuario.clave" |
42 | 38 | foca-focus="paso == 2" |
43 | 39 | ng-keyup="$event.keyCode == 13 && enviar()" |
... | ... | @@ -56,13 +52,15 @@ |
56 | 52 | <button |
57 | 53 | type="button" |
58 | 54 | ng-click="enviar()" |
59 | - class="btn btn-primary btn-block my-3" | |
55 | + class="btn btn-primary btn-sm btn-block mb-3" | |
60 | 56 | ladda="loginLoading"> |
61 | 57 | Ingresar |
62 | 58 | </button> |
63 | - <img | |
64 | - src="img/logofoca.png" | |
65 | - class="w-50 rounded mx-auto py-2 d-block"> | |
59 | + <a href="https://www.focasoftware.com.ar" target="_blank"> | |
60 | + <img | |
61 | + src="img/logofoca.png" | |
62 | + class="w-50 rounded mx-auto py-2 d-block"> | |
63 | + </a> | |
66 | 64 | </form> |
67 | 65 | </div> |
68 | 66 | </div> |
src/views/modal-configuracion.html
... | ... | @@ -0,0 +1,71 @@ |
1 | +<div class="modal-header"> | |
2 | + <div class="row w-100"> | |
3 | + <div class="col-lg-6"> | |
4 | + <h5 class="modal-title my-1"><b>Configuración</b></h5> | |
5 | + </div> | |
6 | + </div> | |
7 | +</div> | |
8 | + | |
9 | +<form class="modal-body" id="modal-body"> | |
10 | + | |
11 | + <div class="row"> | |
12 | + <div class="col-12"> | |
13 | + | |
14 | + <p>¿Este punto de venta trabaja con planilla propia?</p> | |
15 | + | |
16 | + <!-- RADIO BUTTONS --> | |
17 | + <div class="text-center"> | |
18 | + <div class="disabled form-check form-check-inline"> | |
19 | + <input | |
20 | + class="form-check-input" | |
21 | + type="radio" | |
22 | + id="radio1" | |
23 | + ng-model="usePlanillaPropia" | |
24 | + ng-value="true"> | |
25 | + <label class="form-check-label" for="radio1">Si</label> | |
26 | + </div> | |
27 | + <div class="form-check form-check-inline"> | |
28 | + <input | |
29 | + class="form-check-input" | |
30 | + type="radio" | |
31 | + id="radio2" | |
32 | + ng-model="usePlanillaPropia" | |
33 | + ng-value="false"> | |
34 | + <label class="form-check-label" for="radio2">No</label> | |
35 | + </div> | |
36 | + </div> | |
37 | + <div class="form-group"> | |
38 | + <select | |
39 | + ng-model="selectedPuntoVenta" | |
40 | + class="form-control form-control-sm w-50 mx-auto mt-2"> | |
41 | + <option ng-value="null" selected disabled>Seleccione una opción</option> | |
42 | + <option ng-repeat="ptoVenta in puntosVenta" value="{{ptoVenta.ID}}"> | |
43 | + {{ptoVenta.ID}} {{ptoVenta.NOM}} | |
44 | + </option> | |
45 | + </select> | |
46 | + </div> | |
47 | + </div> | |
48 | + </div> | |
49 | + | |
50 | + <div class="row"> | |
51 | + <div class="col-12"> | |
52 | + <p>Salida de impresión de comprobantes</p> | |
53 | + <select | |
54 | + ng-model="selectedImpresora" | |
55 | + class="form-control form-control-sm w-50 mx-auto mt-2"> | |
56 | + <option ng-value="null" selected disabled>Seleccione una opción</option> | |
57 | + <option ng-repeat="imp in impresoras" value="{{imp.PVE}}"> | |
58 | + {{imp.PVE}} {{imp.DES}} | |
59 | + </option> | |
60 | + </select> | |
61 | + </div> | |
62 | + </div> | |
63 | + | |
64 | +</form> | |
65 | + | |
66 | +<div class="modal-footer py-1"> | |
67 | + <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar | |
68 | + </button> | |
69 | + <button class="btn btn-sm btn-primary" type="button" ng-click="acept()">Aceptar | |
70 | + </button> | |
71 | +</div> |