Commit e202c4bf9769982fea33ee329f687074e7b09ad5

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master

See merge request modulos-npm/foca-crear-remito!7
... ... @@ -33,6 +33,7 @@
33 33 <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script>
34 34 <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script>
35 35 <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script>
  36 + <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script>
36 37  
37 38 <script src="src/js/app.js"></script>
38 39 <script src="src/js/controller.js"></script>
... ... @@ -29,10 +29,12 @@
29 29 },
30 30 "devDependencies": {
31 31 "angular": "^1.7.5",
  32 + "angular-cookies": "^1.7.5",
32 33 "angular-ladda": "^0.4.3",
33 34 "angular-route": "^1.7.5",
34 35 "bootstrap": "^4.1.3",
35 36 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
  37 + "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git",
36 38 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
37 39 "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git",
38 40 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
... ... @@ -46,7 +48,7 @@
46 48 "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git",
47 49 "font-awesome": "^4.7.0",
48 50 "gulp": "^3.9.1",
49   - "gulp-angular-templatecache": "^2.2.2",
  51 + "gulp-angular-templatecache": "^2.2.5",
50 52 "gulp-clean": "^0.4.0",
51 53 "gulp-concat": "^2.6.1",
52 54 "gulp-connect": "^5.6.1",
... ... @@ -63,8 +65,6 @@
63 65 "ladda": "1.0.6",
64 66 "pre-commit": "^1.2.2",
65 67 "pump": "^3.0.0",
66   - "ui-bootstrap4": "^3.0.5",
67   - "angular-cookies": "^1.7.5",
68   - "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git"
  68 + "ui-bootstrap4": "^3.0.5"
69 69 }
70 70 }
... ... @@ -14,5 +14,6 @@ angular.module(&#39;focaCrearRemito&#39;, [
14 14 'focaModalMoneda',
15 15 'focaModalCotizacion',
16 16 'focaConfiguracion',
17   - 'angular-ladda'
  17 + 'angular-ladda',
  18 + 'focaModalNotaPedido'
18 19 ]);
src/js/controller.js
... ... @@ -91,8 +91,78 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
91 91 }
92 92 );
93 93 modalInstance.result.then(
94   - {
95   - // TODO: Implementar nota de pedido
  94 + function(notaPedido) {
  95 + //añado cabeceras
  96 + removeCabecera('Moneda:');
  97 + removeCabecera('Fecha cotizacion:');
  98 + removeCabecera('Cotizacion:');
  99 + var cabeceras = [
  100 + {
  101 + label: 'Moneda',
  102 + valor: notaPedido.cotizacion[0].moneda[0].DETALLE
  103 + },
  104 + {
  105 + label: 'Fecha cotizacion',
  106 + valor: $filter('date')(notaPedido.cotizacion[0].FECHA,
  107 + 'dd/MM/yyyy')
  108 + },
  109 + {
  110 + label: 'Cotizacion',
  111 + valor: notaPedido.cotizacion[0].VENDEDOR
  112 + },
  113 + {
  114 + label: 'Cliente:',
  115 + valor: notaPedido.cliente[0].NOM
  116 + },
  117 + {
  118 + label: 'Vendedor:',
  119 + valor: notaPedido.vendedor[0].NomVen
  120 + },
  121 + {
  122 + label: 'Proveedor:',
  123 + valor: notaPedido.proveedor[0].NOM
  124 + },
  125 + {
  126 + label: 'Flete:',
  127 + valor: notaPedido.flete === 1 ? 'Si' : 'No'
  128 + },
  129 + {
  130 + label: 'FOB:',
  131 + valor: notaPedido.fob === 1 ? 'Si' : 'No'
  132 + },
  133 + {
  134 + label: 'Precio condicion:',
  135 + valor: valorPrecioCondicion()
  136 + }
  137 + ];
  138 + //TO DO CUANDO MOSTRAR PLAZOS
  139 + function valorPrecioCondicion() {
  140 + if(notaPedido.idPrecioCondicion > 0) {
  141 + return notaPedido.precioCondicion[0].nombre;
  142 + } else {
  143 + return 'Ingreso Manual';
  144 + }
  145 +
  146 + }
  147 +
  148 + if(notaPedido.flete === 1) {
  149 + var cabeceraBomba = {
  150 + label: 'Bomba',
  151 + valor: notaPedido.bomba === 1 ? 'Si' : 'No'
  152 + };
  153 + if(notaPedido.kilometros) {
  154 + var cabeceraKilometros = {
  155 + label: 'Kilometros',
  156 + valor: notaPedido.kilometros
  157 + };
  158 + cabeceras.push(cabeceraKilometros);
  159 + }
  160 + cabeceras.push(cabeceraBomba);
  161 + }
  162 + $scope.articulosTabla = notaPedido.articulosNotaPedido;
  163 + $scope.remito = notaPedido;
  164 + addArrayCabecera(cabeceras);
  165 +
96 166 }, function() {
97 167 // funcion ejecutada cuando se cancela el modal
98 168 }
... ... @@ -109,7 +179,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
109 179 }
110 180 );
111 181 modalInstance.result.then(
112   - function(remito) {
  182 + function() {
113 183 // TODO: Implementar carga remito
114 184 }, function() {
115 185 // funcion ejecutada cuando se cancela el modal
... ... @@ -611,6 +681,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
611 681 $scope.salir = function() {
612 682 $location.path('/');
613 683 };
  684 + function addArrayCabecera(array) {
  685 + for(var i = 0; i < array.length; i++) {
  686 + addCabecera(array[i].label, array[i].valor);
  687 + }
  688 + }
614 689  
615 690 function addCabecera(label, valor) {
616 691 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);