controller.js
3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
angular.module('focaCrearLogin')
.controller('focaCrearLoginController', [
'$scope', '$timeout', '$uibModal', 'focaCrearLoginService','focaBotoneraLateralService',
function($scope, $timeout, $uibModal, focaCrearLoginService, focaBotoneraLateralService) {
config();
//METODOS
function init() {
$scope.now = new Date();
$scope.seleccionado = '';
$scope.cuentas = [];
$scope.$broadcast('removeCabecera', {
label: 'Selección:',
valor: $scope.seleccionado
});
}
function config() {
$scope.botonera = [
{
label: 'Transportista',
image: 'cliente.png'
},
{
label: 'Cobrador',
image: 'cliente.png'
},
{
label: 'Vendedor',
image: 'cliente.png'
}
];
$timeout(function() {
focaBotoneraLateralService.showSalir(true);
focaBotoneraLateralService.showPausar(false);
focaBotoneraLateralService.showCancelar(false);
focaBotoneraLateralService.showGuardar(false);
});
init();
}
$scope.seleccionarTransportista = function() {
$scope.seleccionado = 'Transportistas';
focaCrearLoginService.getListaChoferes().then(setearTabla);
};
$scope.seleccionarCobrador = function() {
$scope.seleccionado = 'Cobradores';
focaCrearLoginService.getListaCobradores().then(setearTabla);
};
$scope.seleccionarVendedor = function() {
$scope.seleccionado = 'Vendedores';
focaCrearLoginService.getListaVendedores().then(setearTabla);
};
$scope.openModalAcceso = function(cuenta) {
var parametros = {
cuenta: cuenta,
tipo: $scope.seleccionado
}
var modalInstance = $uibModal.open(
{
ariaLabelledBy: 'Configuracion de Logueo',
templateUrl: 'modal-login.html',
controller: 'focaModalLoginController',
size: 'md',
resolve: {
parametros: function() {
return parametros;
}
}
}
);
modalInstance.result.then(
function(result) {
init();
}, function() {}
);
}
function setearTabla(datos) {
$scope.cuentas = datos.data;
if ($scope.seleccionado == 'Cobradores' ||
$scope.seleccionado == 'Vendedores'
) {
for (var i = $scope.cuentas.length - 1; i >= 0; i--) {
$scope.cuentas[i].id = $scope.cuentas[i].CodVen;
$scope.cuentas[i].nombre = $scope.cuentas[i].NomVen;
$scope.cuentas[i].dni = $scope.cuentas[i].DNI;
$scope.cuentas[i].telefono = $scope.cuentas[i].TelVen;
}
}
$scope.$broadcast('removeCabecera', {
label: 'Selección:',
valor: $scope.seleccionado
});
}
}
]);