Commit 25927158cf8856fb1069a2fc04ca27da28cd95e7

Authored by Jose Pinto
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !36
... ... @@ -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 ]
1   -angular.module('focaCrearCobranza', [
2   - 'ngRoute',
3   - 'ui.bootstrap',
4   - 'focaBotoneraLateral',
5   - 'focaModal',
6   - 'focaModalFactura',
7   - 'focaBusquedaCliente',
8   - 'focaDirectivas',
9   - 'focaModalMoneda',
10   - 'focaModalCotizacion'
11   -]);
  1 +angular.module('focaCrearCobranza', []);
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;
... ... @@ -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 }]);