Commit 59e0b69f87eccf0406bc912a24c5c4da84fbdaea
1 parent
353cd87214
Exists in
master
nuevo modal productos2
Showing
3 changed files
with
126 additions
and
24 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -116,7 +116,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
116 | 116 | .catch(function (e) { console.error(e); }); |
117 | 117 | }; |
118 | 118 | |
119 | - $scope.crearFactura = function () { | |
119 | + $scope.crearFactura = function () { | |
120 | 120 | |
121 | 121 | var save = { |
122 | 122 | factura: { |
... | ... | @@ -133,7 +133,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
133 | 133 | DTO: 0, |
134 | 134 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), |
135 | 135 | FEC_ANT: '19000101', |
136 | - FPA: 2, | |
136 | + FPA: 0, // 0 <- MĂșltiple formas de pago, 2 cta corriente | |
137 | 137 | IDEXCEPCION: 0, |
138 | 138 | IDLP: $scope.factura.cliente.mod.trim() || 0, |
139 | 139 | IDPERSONERIA: 0, |
... | ... | @@ -395,31 +395,23 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
395 | 395 | return; |
396 | 396 | } |
397 | 397 | |
398 | - var parametrosModal = { | |
399 | - titulo: 'Despachos ' + producto.DetArt, | |
400 | - data: producto.despachos, | |
401 | - columnas: [ | |
402 | - { | |
403 | - propiedad: 'FEC', | |
404 | - nombre: 'Fecha', | |
405 | - filtro: { | |
406 | - nombre: 'date', | |
407 | - parametro: 'dd/MM/yyyy HH:mm' | |
398 | + var modalInstance = $uibModal.open( | |
399 | + { | |
400 | + templateUrl: 'modal-combustibles.html', | |
401 | + controller: 'focaModalCombustiblesController', | |
402 | + resolve: { | |
403 | + parametros: function() { | |
404 | + return { | |
405 | + despachos: producto.despachos, | |
406 | + nombreProducto: producto.DetArt | |
407 | + } | |
408 | 408 | } |
409 | 409 | }, |
410 | - { | |
411 | - propiedad: 'IMP', | |
412 | - nombre: 'Importe' | |
413 | - }, | |
414 | - { | |
415 | - propiedad: 'LTS', | |
416 | - nombre: 'Litros' | |
417 | - } | |
418 | - ], | |
419 | - size: 'md' | |
420 | - }; | |
410 | + size: 'lg' | |
411 | + } | |
412 | + ); | |
421 | 413 | |
422 | - focaModalService.modal(parametrosModal).then(function(despacho) { | |
414 | + modalInstance.result.then(function(despacho) { | |
423 | 415 | |
424 | 416 | var articulo = { |
425 | 417 | TIP: $scope.factura.cliente.tipoFactura, |
src/js/controllerCombustibles.js
... | ... | @@ -0,0 +1,42 @@ |
1 | +angular.module('focaCrearFactura') | |
2 | + .controller('focaModalCombustiblesController', [ | |
3 | + '$filter', | |
4 | + '$scope', | |
5 | + '$uibModalInstance', | |
6 | + 'parametros', | |
7 | + function($filter, $scope, $uibModalInstance, parametros) { | |
8 | + | |
9 | + $scope.mangueras = []; | |
10 | + | |
11 | + var productosByMangera = []; | |
12 | + | |
13 | + parametros.despachos.forEach(function (despacho) { | |
14 | + | |
15 | + var findCsu = productosByMangera.filter(function (csu) { | |
16 | + return csu.csu == despacho.CSU.trim(); | |
17 | + })[0]; | |
18 | + | |
19 | + if (!findCsu) { | |
20 | + | |
21 | + var mangera = { | |
22 | + csu: despacho.CSU.trim(), | |
23 | + despachos: [despacho] | |
24 | + }; | |
25 | + | |
26 | + productosByMangera.unshift(mangera); | |
27 | + } else { | |
28 | + findCsu.despachos.push(despacho); | |
29 | + } | |
30 | + }); | |
31 | + | |
32 | + $scope.mangueras = productosByMangera; | |
33 | + | |
34 | + $scope.aceptar = function (despacho) { | |
35 | + $uibModalInstance.close(despacho); | |
36 | + }; | |
37 | + | |
38 | + $scope.cancel = function () { | |
39 | + $uibModalInstance.dismiss('cancel'); | |
40 | + }; | |
41 | + } | |
42 | + ]); |
src/views/modal-combustibles.html
... | ... | @@ -0,0 +1,68 @@ |
1 | +<div class="modal-header py-1"> | |
2 | + <div class="row w-100"> | |
3 | + <div class="col-lg-6"> | |
4 | + <h5 class="modal-title my-1">Despachos Disponibles</h5> | |
5 | + </div> | |
6 | + </div> | |
7 | +</div> | |
8 | +<div class="modal-body" id="modal-body"> | |
9 | + <div ng-repeat="(key, manguera) in mangueras"> | |
10 | + <strong> | |
11 | + Manguera {{manguera.csu}} | |
12 | + </strong> | |
13 | + <button type="button" class="btn" ng-click="manguera.show = !manguera.show"> | |
14 | + <i ng-show="manguera.show" class="fa fa-minus"></i> | |
15 | + <i ng-show="!manguera.show" class="fa fa-plus"></i> | |
16 | + </button> | |
17 | + <table class="table table-sm" ng-show="manguera.show"> | |
18 | + <tbody> | |
19 | + <tr ng-repeat="(key, despacho) in manguera.despachos"> | |
20 | + <td ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | |
21 | + <td ng-bind="despacho.LTS"></td> | |
22 | + <td ng-bind="despacho.IMP | currency: '$'"></td> | |
23 | + <td> | |
24 | + <button | |
25 | + type="button" | |
26 | + class="btn btn-xs p-1 float-right" | |
27 | + title="Seleccionar" | |
28 | + ng-click="aceptar(despacho)" | |
29 | + ><i class="fa fa-circle-thin" aria-hidden="true"></i> | |
30 | + </button> | |
31 | + </td> | |
32 | + </tr> | |
33 | + </tbody> | |
34 | + </table> | |
35 | + </div> | |
36 | + | |
37 | +</div> | |
38 | +<div class="modal-footer py-1"> | |
39 | + <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | |
40 | + <ul class="pagination pagination-sm mb-0"> | |
41 | + <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | |
42 | + <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | |
43 | + <span aria-hidden="true">«</span> | |
44 | + <span class="sr-only">Anterior</span> | |
45 | + </a> | |
46 | + </li> | |
47 | + <li | |
48 | + class="page-item" | |
49 | + ng-repeat="pagina in paginas" | |
50 | + ng-class="{'active': pagina == currentPage}" | |
51 | + > | |
52 | + <a | |
53 | + class="page-link" | |
54 | + href="javascript:void();" | |
55 | + ng-click="selectPage(pagina)" | |
56 | + ng-bind="pagina" | |
57 | + ></a> | |
58 | + </li> | |
59 | + <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | |
60 | + <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | |
61 | + <span aria-hidden="true">»</span> | |
62 | + <span class="sr-only">Siguiente</span> | |
63 | + </a> | |
64 | + </li> | |
65 | + </ul> | |
66 | + </nav> | |
67 | + <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | |
68 | +</div> |