Commit f9bebe19acf553584e99fa60814a736dc972e32c
1 parent
d10d80c2df
Exists in
master
boton cobrador en mobile
Showing
3 changed files
with
34 additions
and
19 deletions
Show diff stats
src/js/app.js
src/js/controller.js
... | ... | @@ -11,11 +11,29 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
11 | 11 | '$cookies', |
12 | 12 | 'focaSeguimientoService', |
13 | 13 | 'focaBotoneraLateralService', |
14 | + 'APP', | |
15 | + 'focaLoginService', | |
14 | 16 | function($scope, $rootScope, $timeout, $uibModal, $location, focaCrearCobranzaService, |
15 | - focaModalService, $filter, $cookies, focaSeguimientoService, focaBotoneraLateralService) | |
17 | + focaModalService, $filter, $cookies, focaSeguimientoService, | |
18 | + focaBotoneraLateralService, APP, loginService) | |
16 | 19 | { |
17 | 20 | |
18 | - $scope.botonera = focaCrearCobranzaService.getBotonera(); | |
21 | + if(APP === 'distribuidor') { | |
22 | + var idCobrador = loginService.getLoginData().vendedorCobrador; | |
23 | + $scope.botonera = focaCrearCobranzaService.getBotonera(idCobrador); | |
24 | + focaCrearCobranzaService.getVendedorById(idCobrador).then( | |
25 | + function(res) { | |
26 | + var cobrador = res.data; | |
27 | + $scope.$broadcast('addCabecera', { | |
28 | + label: 'Cobrador:', | |
29 | + valor: cobrador.NomVen | |
30 | + }); | |
31 | + $scope.cobranza.cobrador = cobrador; | |
32 | + } | |
33 | + ); | |
34 | + }else { | |
35 | + $scope.botonera = focaCrearCobranzaService.getBotonera(); | |
36 | + } | |
19 | 37 | $scope.datepickerAbierto = false; |
20 | 38 | $scope.cobroDeuda = true; |
21 | 39 | $scope.show = false; |
src/js/service.js
... | ... | @@ -13,17 +13,16 @@ angular.module('focaCrearCobranza') |
13 | 13 | guardarCobranza: function(cobranza) { |
14 | 14 | return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza); |
15 | 15 | }, |
16 | - getBotonera: function() { | |
17 | - return [ | |
16 | + getCobradorById: function(id) { | |
17 | + return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); | |
18 | + }, | |
19 | + getBotonera: function(idCobrador) { | |
20 | + var result = [ | |
18 | 21 | { |
19 | 22 | label: 'Cliente', |
20 | 23 | image: 'cliente.png' |
21 | 24 | }, |
22 | 25 | { |
23 | - label: 'Cobrador', | |
24 | - image: 'cobrador.png' | |
25 | - }, | |
26 | - { | |
27 | 26 | label: 'Comprobantes', |
28 | 27 | image: 'comprobante.png' |
29 | 28 | }, |
... | ... | @@ -36,6 +35,14 @@ angular.module('focaCrearCobranza') |
36 | 35 | image: 'moneda.png' |
37 | 36 | } |
38 | 37 | ]; |
38 | + if(!idCobrador) { | |
39 | + var cobradorBoton = { | |
40 | + label: 'Cobrador', | |
41 | + image: 'cobrador.png' | |
42 | + }; | |
43 | + result.unshift(cobradorBoton); | |
44 | + } | |
45 | + return result; | |
39 | 46 | } |
40 | 47 | }; |
41 | 48 | }]); |