Commit 3113efb7e5ee634801a55f23254b71263c93c4d5
1 parent
ab459df5d7
Exists in
master
and in
2 other branches
Agregado modales para seleccionar chofer, vendedor y cobrador en los seguimiento…
…s de hoja de ruta, nota pedido y cobranza.
Showing
2 changed files
with
104 additions
and
28 deletions
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [ |
2 | 2 | '$scope', '$timeout', 'focaAdminSeguimientoService', '$uibModal', |
3 | - 'focaBotoneraLateralService', '$location', '$routeParams', | |
3 | + 'focaBotoneraLateralService', '$location', '$routeParams', 'focaModalService', | |
4 | 4 | function ($scope, $timeout, focaAdminSeguimientoService, $uibModal, |
5 | - focaBotoneraLateralService, $location, $routeParams) { | |
5 | + focaBotoneraLateralService, $location, $routeParams, focaModalService) { | |
6 | 6 | $scope.actividad = ''; |
7 | 7 | $scope.titulo = ''; |
8 | 8 | var cabecera = ''; |
... | ... | @@ -205,5 +205,93 @@ angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoControlle |
205 | 205 | }); |
206 | 206 | }); |
207 | 207 | } |
208 | + $scope.openModal = function () { | |
209 | + let parametrosModal = {}; | |
210 | + switch ($routeParams.parametro) { | |
211 | + case 'nota-pedido': | |
212 | + parametrosModal = { | |
213 | + titulo: 'Búsqueda vendedores', | |
214 | + query: '/vendedor', | |
215 | + columnas: [ | |
216 | + { | |
217 | + propiedad: 'NUM', | |
218 | + nombre: 'Código', | |
219 | + filtro: { | |
220 | + nombre: 'rellenarDigitos', | |
221 | + parametro: 3 | |
222 | + } | |
223 | + }, | |
224 | + { | |
225 | + propiedad: 'NOM', | |
226 | + nombre: 'Nombre' | |
227 | + } | |
228 | + ], | |
229 | + size: 'md' | |
230 | + }; | |
231 | + break; | |
232 | + case 'hoja-ruta': | |
233 | + parametrosModal = { | |
234 | + titulo: 'Búsqueda de Transportista', | |
235 | + query: '/transportista', | |
236 | + columnas: [ | |
237 | + { | |
238 | + nombre: 'Código', | |
239 | + propiedad: 'COD' | |
240 | + }, | |
241 | + { | |
242 | + nombre: 'Nombre', | |
243 | + propiedad: 'NOM' | |
244 | + }, | |
245 | + { | |
246 | + nombre: 'CUIT', | |
247 | + propiedad: 'CUIT' | |
248 | + } | |
249 | + ], | |
250 | + size: 'md' | |
251 | + }; | |
252 | + break; | |
253 | + case 'cobranza': | |
254 | + parametrosModal = { | |
255 | + titulo: 'Búsqueda de cobradores', | |
256 | + query: '/cobrador', | |
257 | + columnas: [ | |
258 | + { | |
259 | + propiedad: 'NUM', | |
260 | + nombre: 'Codigo', | |
261 | + filtro: { | |
262 | + nombre: 'rellenarDigitos', | |
263 | + parametro: 3 | |
264 | + } | |
265 | + }, | |
266 | + { | |
267 | + propiedad: 'NOM', | |
268 | + nombre: 'Nombre' | |
269 | + } | |
270 | + ], | |
271 | + size: 'md' | |
272 | + }; | |
273 | + break; | |
274 | + default: | |
275 | + break; | |
276 | + } | |
277 | + focaModalService.modal(parametrosModal) | |
278 | + .then( | |
279 | + function (vendedor) { | |
280 | + $scope.idUsuario = $scope.idUsuarioInput = vendedor.NOM; | |
281 | + getSeguimiento(); | |
282 | + if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) { | |
283 | + focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario) | |
284 | + .then(function (res) { | |
285 | + var remitos = []; | |
286 | + for (var i = 0; i < res.data.length; i++) { | |
287 | + remitos = remitos.concat(res.data[i].remitos); | |
288 | + } | |
289 | + $scope.remitosVehiculo = remitos; | |
290 | + }); | |
291 | + } | |
292 | + } | |
293 | + ) | |
294 | + .catch(function (e) { console.log(e) }); | |
295 | + } | |
208 | 296 | } |
209 | 297 | ]); |
src/views/foca-admin-seguimiento.html
... | ... | @@ -42,36 +42,24 @@ |
42 | 42 | ng-click="individual()" |
43 | 43 | >Individual</button> |
44 | 44 | <div class="form-group my-1" ng-show="idUsuario != 0"> |
45 | - <input | |
46 | - type="text" | |
47 | - placeholder="Vendedor" | |
48 | - class="form-control" | |
49 | - ng-model="idUsuarioInput" | |
50 | - ng-keypress="search($event.keyCode)" | |
45 | + <button | |
46 | + class="btn btn-primary" | |
51 | 47 | foca-focus="idUsuario == -1" |
52 | 48 | ng-show="actividad == 'Nota de pedido'" |
53 | - teclado-virtual | |
54 | - > | |
55 | - <input | |
56 | - type="text" | |
57 | - placeholder="Vehiculo" | |
58 | - class="form-control" | |
59 | - ng-model="idUsuarioInput" | |
60 | - ng-keypress="search($event.keyCode)" | |
61 | - foca-focus="idUsuario == -1" | |
49 | + ng-click="openModal()" | |
50 | + >Seleccionar vendedor</button> | |
51 | + <button | |
52 | + class="btn btn-primary" | |
53 | + foca-focus="idUsuario == -1" | |
62 | 54 | ng-show="actividad == 'Entrega de producto'" |
63 | - teclado-virtual | |
64 | - > | |
65 | - <input | |
66 | - type="text" | |
67 | - placeholder="Cobrador" | |
68 | - class="form-control" | |
69 | - ng-model="idUsuarioInput" | |
70 | - ng-keypress="search($event.keyCode)" | |
71 | - foca-focus="idUsuario == -1" | |
55 | + ng-click="openModal()" | |
56 | + >Seleccionar transportista</button> | |
57 | + <button | |
58 | + class="btn btn-primary" | |
59 | + foca-focus="idUsuario == -1" | |
72 | 60 | ng-show="actividad == 'Cobranza'" |
73 | - teclado-virtual | |
74 | - > | |
61 | + ng-click="openModal()" | |
62 | + >Seleccionar cobrador</button> | |
75 | 63 | </div> |
76 | 64 | <button |
77 | 65 | type="button" |