Commit b102d44a2e8e1594b98154bbec2640fd2d6db6bd
1 parent
91a4166523
Exists in
master
Documentacion
Showing
10 changed files
with
203 additions
and
57 deletions
Show diff stats
Documentacion/Documento ECO demo parqueadero.doc
No preview for this file type
Documentacion/requerimientos Demo parqueaderos.docx
No preview for this file type
config.xml
... | ... | @@ -2,10 +2,10 @@ |
2 | 2 | <widget id="com.ionicframework.demoaeropuerto610189" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> |
3 | 3 | <name>DemoAeropuerto</name> |
4 | 4 | <description> |
5 | - An Ionic Framework and Cordova project. | |
5 | + | |
6 | 6 | </description> |
7 | - <author email="hi@ionicframework" href="http://ionicframework.com/"> | |
8 | - Ionic Framework Team | |
7 | + <author email="cristian.garcia@ingeneo.com.co"> | |
8 | + Ingeneo SAS | |
9 | 9 | </author> |
10 | 10 | <content src="index.html"/> |
11 | 11 | <access origin="*"/> |
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <preference name="UIWebViewBounce" value="false"/> |
14 | 14 | <preference name="DisallowOverscroll" value="true"/> |
15 | 15 | <preference name="BackupWebStorage" value="none"/> |
16 | + <icon src="res/icon.png" /> | |
16 | 17 | <feature name="StatusBar"> |
17 | 18 | <param name="ios-package" value="CDVStatusBar" onload="true"/> |
18 | 19 | </feature> | ... | ... |
res/icon.png
15.7 KB
www/js/app.js
... | ... | @@ -14,7 +14,7 @@ angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']) |
14 | 14 | $http.defaults.headers.put['Content-Type'] = 'application/json'; |
15 | 15 | |
16 | 16 | $rootScope.imgHost = 'http://107.21.229.139/ccomerciales/'; |
17 | - | |
17 | +$rootScope.MensajesTotal = {}; | |
18 | 18 | $ionicPlatform.ready(function() { |
19 | 19 | // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard |
20 | 20 | // for form inputs) |
... | ... | @@ -25,6 +25,16 @@ $rootScope.imgHost = 'http://107.21.229.139/ccomerciales/'; |
25 | 25 | // org.apache.cordova.statusbar required |
26 | 26 | StatusBar.styleDefault(); |
27 | 27 | } |
28 | + | |
29 | + $rootScope.deviceID=''; | |
30 | + | |
31 | + try { | |
32 | + $rootScope.deviceID = device.uuid; | |
33 | + } | |
34 | + catch(err) { | |
35 | + $rootScope.deviceID = 'WEB'; | |
36 | + } | |
37 | + | |
28 | 38 | }); |
29 | 39 | }) |
30 | 40 | |
... | ... | @@ -87,6 +97,5 @@ $rootScope.imgHost = 'http://107.21.229.139/ccomerciales/'; |
87 | 97 | } |
88 | 98 | }); |
89 | 99 | // if none of the above states are matched, use this as the fallback |
90 | - $urlRouterProvider.otherwise('/app/playlists'); | |
100 | + $urlRouterProvider.otherwise('/app/parqueadero'); | |
91 | 101 | }); |
92 | - | ... | ... |
www/js/controllers.js
1 | 1 | angular.module('starter.controllers', []) |
2 | 2 | |
3 | -.controller('AppCtrl', function($scope, $ionicModal, $timeout,Mensajes) { | |
3 | +.controller('AppCtrl', function($scope, $ionicModal, $timeout,Mensajes,$rootScope) { | |
4 | 4 | // Form data for the login modal |
5 | 5 | $scope.loginData = {}; |
6 | 6 | |
... | ... | @@ -33,21 +33,92 @@ angular.module('starter.controllers', []) |
33 | 33 | }; |
34 | 34 | |
35 | 35 | |
36 | - $scope.mensajes = Mensajes.all($scope); | |
36 | + $scope.refreshMensajes = function() { | |
37 | + $rootScope.MensajesTotal = Mensajes.all($scope); | |
38 | + }; | |
39 | + | |
40 | + | |
37 | 41 | |
38 | 42 | |
39 | 43 | }) |
40 | 44 | |
41 | -.controller('parqueaderoCtrl', function($scope,Parqueadero,$ionicPopup,Registrar) { | |
45 | +.controller('parqueaderoCtrl', function($scope,Parqueadero,$ionicPopup,Registrar,Mensajes,$ionicModal,LeerMensaje,$rootScope,RegistrarCliente) { | |
42 | 46 | |
47 | + | |
48 | +$scope.mensajesParqueadero = {}; | |
49 | + $rootScope.MensajesTotal = $scope.mensajesParqueadero = Mensajes.all($scope,2); | |
43 | 50 | $scope.parqueadero = Parqueadero.all($scope); |
51 | + | |
52 | +// Create the login modal that we will use later | |
53 | + $ionicModal.fromTemplateUrl('templates/mensajesparqueaderos.html', { | |
54 | + scope: $scope | |
55 | + }).then(function(modal) { | |
56 | + $scope.modal = modal; | |
57 | + }); | |
58 | + | |
44 | 59 | |
45 | -$scope.popupMensaje= function(parqueadero) { | |
60 | +$scope.popupMensajeRegistrarCliente= function() { | |
61 | + | |
62 | +//$scope.myPopup.close(); | |
63 | + | |
64 | + $scope.myPopupMensajeCliente = $ionicPopup.show({ | |
65 | + template: '<label>Cedula</label> <input type="number" ng-model="Usuario.cedula"> <button class="button button-full button-light icon-left ion-edit" ng-click="registrarClienteParqueadero(Usuario)">Registrar</button> ', | |
66 | + title: 'Registrar Cliente', | |
67 | + scope: $scope, | |
68 | + buttons: [ | |
69 | + { text: 'Cancelar' }, | |
70 | + ] | |
71 | + }); | |
72 | + $scope.myPopupMensajeCliente.then(function(res) { | |
73 | + | |
74 | + }); | |
75 | + }; | |
76 | + | |
77 | + | |
78 | + | |
79 | +$scope.mostrarMensajeParqueadero= function() { | |
80 | + | |
81 | + $scope.mensajesParqueadero = Mensajes.all($scope,2); | |
82 | + | |
83 | + $scope.modal.show(); | |
84 | + | |
85 | + }; | |
86 | +// A confirm dialog | |
87 | + $scope.refresh = function() { | |
88 | + $rootScope.MensajesTotal = $scope.mensajesParqueadero = Mensajes.all($scope,2); | |
89 | + | |
90 | + }; | |
91 | + // Triggered in the login modal to close it | |
92 | + $scope.closeMensajes= function() { | |
93 | + $scope.modal.hide(); | |
94 | + }; | |
95 | + | |
96 | + $scope.showConfirmMensaje = function(mensaje) { | |
97 | + | |
98 | + //$scope.myPopupMensaje.close(); | |
99 | + | |
100 | + LeerMensaje.Leer(mensaje.mensaje_id); | |
101 | + $scope.mensajesParqueadero = Mensajes.all($scope,2); | |
102 | + | |
103 | + $scope.confirmPopupMensaje = $ionicPopup.confirm({ | |
104 | + title: 'El conductor: ' + mensaje.cedula_cliente, | |
105 | + template: mensaje.descripcion_mensaje | |
106 | + }); | |
107 | + $scope.confirmPopupMensaje.then(function(res) { | |
108 | + if(res) { | |
109 | + $scope.refresh(); | |
110 | + } else { | |
111 | + console.log('You are not sure'); | |
112 | + } | |
113 | + }); | |
114 | + }; | |
115 | + | |
116 | +$scope.popupMensaje= function() { | |
46 | 117 | |
47 | 118 | //$scope.myPopup.close(); |
48 | 119 | |
49 | 120 | $scope.myPopupMensaje = $ionicPopup.show({ |
50 | - 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> ', | |
121 | + template: '<label>Cedula</label> <input type="number" ng-model="Usuario.cedula"> <label>Mensaje</label><input type="text" ng-model="Usuario.mensaje"> <button class="button button-full button-light icon-left ion-email" ng-click="enviarMensaje(Usuario)">Enviar</button> ', | |
51 | 122 | title: 'Enviar Mensaje', |
52 | 123 | scope: $scope, |
53 | 124 | buttons: [ |
... | ... | @@ -59,9 +130,33 @@ $scope.popupMensaje= function(parqueadero) { |
59 | 130 | }); |
60 | 131 | }; |
61 | 132 | |
133 | +$scope.enviarMensaje = function(usuario) { | |
134 | + | |
135 | + Registrar.Enviar(usuario.cedula,usuario.mensaje,1); | |
136 | + | |
137 | + $scope.myPopupMensaje.close(); | |
138 | + $scope.myPopup.close(); | |
139 | + | |
140 | + //$scope.showConfirmMensaje(); | |
141 | + | |
142 | + | |
143 | + }; | |
144 | + | |
145 | + $scope.registrarClienteParqueadero = function(usuario) { | |
146 | + | |
147 | + RegistrarCliente.Enviar(usuario.cedula,$rootScope.deviceID); | |
148 | + | |
149 | + $scope.myPopupMensajeCliente.close(); | |
150 | + $scope.myPopup.close(); | |
151 | + | |
152 | + $scope.showConfirm(); | |
153 | + | |
154 | + }; | |
155 | + | |
156 | + | |
62 | 157 | $scope.popupMenu = function(parqueadero) { |
63 | 158 | $scope.myPopup = $ionicPopup.show({ |
64 | - 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>', | |
159 | + template: '<button class="button button-full button-light icon-left ion-edit" ng-click="popupMensajeRegistrarCliente()">Registar</button> <button class="button button-full button-light icon-left ion-email" ng-click="popupMensaje()">Enviar Mensaje</button>', | |
65 | 160 | title: parqueadero.nombre, |
66 | 161 | scope: $scope, |
67 | 162 | buttons: [ |
... | ... | @@ -91,37 +186,18 @@ $scope.popupMensaje= function(parqueadero) { |
91 | 186 | }); |
92 | 187 | }; |
93 | 188 | |
94 | -// A confirm dialog | |
95 | - $scope.showConfirmMensaje = function() { | |
96 | - | |
97 | - Registrar.Enviar($scope.Usuario.cedula,$scope.Usuario.mensaje); | |
98 | 189 | |
99 | - $scope.confirmPopupMensaje = $ionicPopup.confirm({ | |
100 | - title: 'Registro', | |
101 | - template: 'Mensaje Enviado Correctamente, ya uno de nuestros conductores va en camino.' | |
102 | - }); | |
103 | - $scope.confirmPopupMensaje.then(function(res) { | |
104 | - if(res) { | |
105 | - console.log('You are sure'); | |
106 | - } else { | |
107 | - console.log('You are not sure'); | |
108 | - } | |
109 | - }); | |
110 | - }; | |
111 | 190 | |
112 | 191 | |
113 | 192 | }) |
114 | 193 | |
115 | -.controller('MensajesCtrl', function($scope,$ionicPopup,Mensajes,LeerMensaje) { | |
194 | +.controller('MensajesCtrl', function($scope,$ionicPopup,Mensajes,LeerMensaje,$rootScope,Registrar) { | |
116 | 195 | |
117 | - $scope.mensajes = Mensajes.all($scope); | |
118 | - | |
119 | - | |
120 | - | |
196 | + $rootScope.MensajesTotal = $scope.mensajes = Mensajes.all($scope,1); | |
121 | 197 | |
122 | 198 | // A confirm dialog |
123 | 199 | $scope.refresh = function() { |
124 | - $scope.mensajes = Mensajes.all($scope); | |
200 | + $rootScope.MensajesTotal = $scope.mensajes = Mensajes.all($scope,1); | |
125 | 201 | |
126 | 202 | }; |
127 | 203 | |
... | ... | @@ -130,41 +206,64 @@ $scope.popupMensaje= function(parqueadero) { |
130 | 206 | |
131 | 207 | //$scope.myPopupMensaje.close(); |
132 | 208 | |
209 | + LeerMensaje.Leer(mensaje.mensaje_id); | |
210 | + | |
133 | 211 | $scope.confirmPopupMensaje = $ionicPopup.confirm({ |
134 | 212 | title: 'Cliente: ' + mensaje.cedula_cliente, |
135 | 213 | template: mensaje.descripcion_mensaje |
136 | 214 | }); |
137 | 215 | $scope.confirmPopupMensaje.then(function(res) { |
138 | 216 | if(res) { |
139 | - LeerMensaje.Leer(mensaje.mensaje_id); | |
217 | + | |
218 | + | |
219 | + $scope.confirmPopupMensaje.close(); | |
220 | + | |
221 | +$scope.popupMensaje(); | |
222 | + | |
223 | + $scope.refresh(); | |
140 | 224 | } else { |
141 | 225 | console.log('You are not sure'); |
142 | 226 | } |
143 | 227 | }); |
144 | 228 | }; |
229 | + | |
230 | +$scope.enviarMensaje = function(usuario) { | |
231 | + | |
232 | + Registrar.Enviar(usuario.cedula,usuario.mensaje,2); | |
233 | + | |
234 | + $scope.myPopupMensaje.close(); | |
235 | + | |
236 | + //$scope.showConfirmMensaje(); | |
237 | + | |
238 | + | |
239 | + }; | |
240 | + | |
241 | + $scope.popupMensaje= function() { | |
242 | + | |
243 | +//$scope.myPopup.close(); | |
244 | + | |
245 | + $scope.myPopupMensaje = $ionicPopup.show({ | |
246 | + template: '<label>Placa</label> <input type="text" ng-model="Usuario.cedula"> <label>Mensaje</label><input type="text" ng-model="Usuario.mensaje"> <button class="button button-full button-light icon-left ion-email" ng-click="enviarMensaje(Usuario)">Enviar</button> ', | |
247 | + title: 'Enviar Mensaje', | |
248 | + scope: $scope, | |
249 | + buttons: [ | |
250 | + { text: 'Cancelar' }, | |
251 | + ] | |
252 | + }); | |
253 | + $scope.myPopupMensaje.then(function(res) { | |
254 | + | |
255 | + }); | |
256 | + }; | |
257 | + | |
258 | + | |
259 | + | |
145 | 260 | }) |
146 | 261 | .controller('PlaylistsCtrl', function($scope,$ionicPopup) { |
147 | 262 | $scope.playlists = [ |
148 | 263 | { title: 'Mensaje Nuevo', id: 1 }, |
149 | 264 | ]; |
150 | 265 | |
151 | - // A confirm dialog | |
152 | - $scope.showConfirmMensaje = function() { | |
153 | - | |
154 | - //$scope.myPopupMensaje.close(); | |
155 | 266 | |
156 | - $scope.confirmPopupMensaje = $ionicPopup.confirm({ | |
157 | - title: 'Cliente: 121934234', | |
158 | - template: 'Estoy en el aeropuerto' | |
159 | - }); | |
160 | - $scope.confirmPopupMensaje.then(function(res) { | |
161 | - if(res) { | |
162 | - console.log('You are sure'); | |
163 | - } else { | |
164 | - console.log('You are not sure'); | |
165 | - } | |
166 | - }); | |
167 | - }; | |
168 | 267 | }) |
169 | 268 | |
170 | 269 | .controller('PlaylistCtrl', function($scope, $stateParams) { | ... | ... |
www/js/services.js
... | ... | @@ -30,9 +30,9 @@ angular.module('starter.services', []) |
30 | 30 | var thread = 0; |
31 | 31 | if (!mensajes) mensajes = {}; |
32 | 32 | return { |
33 | - all: function($scope) { | |
33 | + all: function($scope,tipo) { | |
34 | 34 | thread++; |
35 | - $http.get("http://107.21.229.139/ccomerciales/api/v1/mensajes") | |
35 | + $http.get("http://107.21.229.139/ccomerciales/api/v1/"+tipo+"/mensajes") | |
36 | 36 | .success(function(data, status, headers, config) { |
37 | 37 | mensajes = $scope.mensajes = data; |
38 | 38 | window.localStorage['mensajes'] = angular.toJson(data); |
... | ... | @@ -63,7 +63,7 @@ Leer:function(idmensaje) { |
63 | 63 | headers : {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'} |
64 | 64 | }).success(function(data, status, headers, config){ |
65 | 65 | |
66 | - | |
66 | + | |
67 | 67 | }); |
68 | 68 | } |
69 | 69 | } |
... | ... | @@ -72,9 +72,9 @@ Leer:function(idmensaje) { |
72 | 72 | |
73 | 73 | .factory('Registrar', function($http, $rootScope){ |
74 | 74 | return { |
75 | -Enviar:function(cedula,mensaje) { | |
75 | +Enviar:function(cedula,mensaje,tipo) { | |
76 | 76 | |
77 | - data = 'cedula='+ cedula ; | |
77 | + data = 'cedula='+ cedula + '&mensaje=' + mensaje + '&tipo=' + tipo; | |
78 | 78 | |
79 | 79 | $http({ |
80 | 80 | url:"http://107.21.229.139/ccomerciales/api/v1/registrar", |
... | ... | @@ -89,5 +89,23 @@ Enviar:function(cedula,mensaje) { |
89 | 89 | } |
90 | 90 | }) |
91 | 91 | |
92 | +.factory('RegistrarCliente', function($http, $rootScope){ | |
93 | + return { | |
94 | +Enviar:function(cedula,imei) { | |
95 | + | |
96 | + data = 'cedula='+ cedula + '&imei=' + imei ; | |
97 | + | |
98 | + $http({ | |
99 | + url:"http://107.21.229.139/ccomerciales/api/v1/registrarcliente", | |
100 | + data : data, | |
101 | + method : 'POST', | |
102 | + headers : {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'} | |
103 | + }).success(function(data, status, headers, config){ | |
104 | + | |
105 | + | |
106 | + }); | |
107 | + } | |
108 | + } | |
109 | +}) | |
92 | 110 | |
93 | 111 | ... | ... |
www/templates/mensajesparqueaderos.html
... | ... | @@ -0,0 +1,16 @@ |
1 | +<ion-view title="Mensajes"> | |
2 | + <ion-content class="has-header"> | |
3 | + <ion-list> | |
4 | + <ion-refresher | |
5 | + pulling-text="Pull to refresh..." | |
6 | + on-refresh="refresh()"> | |
7 | + </ion-refresher> | |
8 | + <a class="item item-icon-left card" ng-repeat="service in mensajesParqueadero" ng-click="showConfirmMensaje(service)"> | |
9 | + <h2>Mensaje del cliente: {{service.cedula_cliente}}</h2> | |
10 | + </a> | |
11 | + </ion-list> | |
12 | + <button class="button button-block button-stable" ng-click="closeMensajes()"> | |
13 | + Cerrar | |
14 | + </button> | |
15 | + </ion-content> | |
16 | +</ion-view> | ... | ... |
www/templates/menu.html
www/templates/parqueadero.html
... | ... | @@ -15,5 +15,9 @@ |
15 | 15 | <a>{{service}}</a> |
16 | 16 | </a> |
17 | 17 | </ion-list> |
18 | + <button class="button button-block button-stable" ng-click="mostrarMensajeParqueadero()"> | |
19 | + <span class="badge badge-assertive">{{mensajesParqueadero.length}}</span> | |
20 | + Mensajes | |
21 | + </button> | |
18 | 22 | </ion-content> |
19 | 23 | </ion-view> | ... | ... |