controllers.js
4.2 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope, $ionicModal, $timeout,Mensajes) {
// Form data for the login modal
$scope.loginData = {};
// Create the login modal that we will use later
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
// Triggered in the login modal to close it
$scope.closeLogin = function() {
$scope.modal.hide();
};
// Open the login modal
$scope.login = function() {
$scope.modal.show();
};
// Perform the login action when the user submits the login form
$scope.doLogin = function() {
console.log('Doing login', $scope.loginData);
// Simulate a login delay. Remove this and replace with your login
// code if using a login system
$timeout(function() {
$scope.closeLogin();
}, 1000);
};
$scope.mensajes = Mensajes.all($scope);
})
.controller('parqueaderoCtrl', function($scope,Parqueadero,$ionicPopup,Registrar) {
$scope.parqueadero = Parqueadero.all($scope);
$scope.popupMensaje= function(parqueadero) {
//$scope.myPopup.close();
$scope.myPopupMensaje = $ionicPopup.show({
template: '<input type="number" placeholder="cedula" ng-model="Usuario.cedula"> <input type="text" placeholder="mensaje" ng-model="Usuario.mensaje"> <button class="button button-full button-light icon-left ion-email" ng-click="showConfirmMensaje(Usuario)">Enviar</button> ',
title: 'Enviar Mensaje',
scope: $scope,
buttons: [
{ text: 'Cancelar' },
]
});
$scope.myPopupMensaje.then(function(res) {
});
};
$scope.popupMenu = function(parqueadero) {
$scope.myPopup = $ionicPopup.show({
template: '<button class="button button-full button-light icon-left ion-edit" ng-click="showConfirm()">Registar</button> <button class="button button-full button-light icon-left ion-email" ng-click="popupMensaje()">Enviar Mensaje</button>',
title: parqueadero.nombre,
scope: $scope,
buttons: [
{ text: 'Cancelar' },
]
});
$scope.myPopup.then(function(res) {
});
};
// A confirm dialog
$scope.showConfirm = function() {
//$scope.myPopup.close();
$scope.confirmPopup = $ionicPopup.confirm({
title: 'Registro',
template: 'Usuario Registado Correctamente'
});
$scope.confirmPopup.then(function(res) {
if(res) {
console.log('You are sure');
} else {
console.log('You are not sure');
}
});
};
// A confirm dialog
$scope.showConfirmMensaje = function() {
Registrar.Enviar($scope.Usuario.cedula,$scope.Usuario.mensaje);
$scope.confirmPopupMensaje = $ionicPopup.confirm({
title: 'Registro',
template: 'Mensaje Enviado Correctamente, ya uno de nuestros conductores va en camino.'
});
$scope.confirmPopupMensaje.then(function(res) {
if(res) {
console.log('You are sure');
} else {
console.log('You are not sure');
}
});
};
})
.controller('MensajesCtrl', function($scope,$ionicPopup,Mensajes,LeerMensaje) {
$scope.mensajes = Mensajes.all($scope);
// A confirm dialog
$scope.refresh = function() {
$scope.mensajes = Mensajes.all($scope);
};
// A confirm dialog
$scope.showConfirmMensaje = function(mensaje) {
//$scope.myPopupMensaje.close();
$scope.confirmPopupMensaje = $ionicPopup.confirm({
title: 'Cliente: ' + mensaje.cedula_cliente,
template: mensaje.descripcion_mensaje
});
$scope.confirmPopupMensaje.then(function(res) {
if(res) {
LeerMensaje.Leer(mensaje.mensaje_id);
} else {
console.log('You are not sure');
}
});
};
})
.controller('PlaylistsCtrl', function($scope,$ionicPopup) {
$scope.playlists = [
{ title: 'Mensaje Nuevo', id: 1 },
];
// A confirm dialog
$scope.showConfirmMensaje = function() {
//$scope.myPopupMensaje.close();
$scope.confirmPopupMensaje = $ionicPopup.confirm({
title: 'Cliente: 121934234',
template: 'Estoy en el aeropuerto'
});
$scope.confirmPopupMensaje.then(function(res) {
if(res) {
console.log('You are sure');
} else {
console.log('You are not sure');
}
});
};
})
.controller('PlaylistCtrl', function($scope, $stateParams) {
});