Commit 8f5c2df345a91c40c6cd82edbc1e1adbd9ee5f68
Exists in
master
Merge remote-tracking branch 'upstream/master'
Showing
4 changed files
Show diff stats
gulpfile.js
... | ... | @@ -43,9 +43,6 @@ gulp.task('uglify', ['templates'], function() { |
43 | 43 | gulp.dest(paths.tmp), |
44 | 44 | rename('foca-crear-cobranza.min.js'), |
45 | 45 | uglify(), |
46 | - replace('"ngRoute","ui.bootstrap","focaBotoneraLateral",'+ | |
47 | - '"focaModal","focaModalFactura","focaBusquedaCliente",'+ | |
48 | - '"focaDirectivas","focaModalMoneda","focaModalCotizacion"', ''), | |
49 | 46 | gulp.dest(paths.dist) |
50 | 47 | |
51 | 48 | ] |
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 === 'cobranza') { | |
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 | }]); |