Commit 8f5df4b190d9607f82819fe25997d703dc6335c5
Exists in
master
and in
1 other branch
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !4
Showing
4 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -68,7 +68,8 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 68 | 68 | domicilio: { dom: '' }, |
| 69 | 69 | moneda: {}, |
| 70 | 70 | cotizacion: $scope.cotizacionPorDefecto || {}, |
| 71 | - articulosFactura: [] | |
| 71 | + articulosFactura: [], | |
| 72 | + despachos: [] | |
| 72 | 73 | }; |
| 73 | 74 | |
| 74 | 75 | $scope.factura.articulosFactura = []; |
| ... | ... | @@ -115,7 +116,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 115 | 116 | .catch(function (e) { console.error(e); }); |
| 116 | 117 | }; |
| 117 | 118 | |
| 118 | - $scope.crearFactura = function () { | |
| 119 | + $scope.crearFactura = function () { | |
| 119 | 120 | |
| 120 | 121 | var save = { |
| 121 | 122 | factura: { |
| ... | ... | @@ -132,7 +133,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 132 | 133 | DTO: 0, |
| 133 | 134 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), |
| 134 | 135 | FEC_ANT: '19000101', |
| 135 | - FPA: 2, | |
| 136 | + FPA: 0, // 0 <- MĂșltiple formas de pago, 2 cta corriente | |
| 136 | 137 | IDEXCEPCION: 0, |
| 137 | 138 | IDLP: $scope.factura.cliente.mod.trim() || 0, |
| 138 | 139 | IDPERSONERIA: 0, |
| ... | ... | @@ -170,7 +171,8 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 170 | 171 | ZON: 1, // TODO |
| 171 | 172 | OBSERVACIONES: $scope.factura.observaciones |
| 172 | 173 | }, |
| 173 | - cuerpo: $scope.articulosFiltro() | |
| 174 | + cuerpo: $scope.articulosFiltro(), | |
| 175 | + despachos: $scope.factura.despachos | |
| 174 | 176 | }; |
| 175 | 177 | |
| 176 | 178 | crearFacturaService.guardarFactura(save).then(function(res) { |
| ... | ... | @@ -351,7 +353,6 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 351 | 353 | }); |
| 352 | 354 | }; |
| 353 | 355 | |
| 354 | - | |
| 355 | 356 | $scope.articulosFiltro = function () { |
| 356 | 357 | return $scope.factura.articulosFactura; |
| 357 | 358 | }; |
| ... | ... | @@ -394,31 +395,23 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 394 | 395 | return; |
| 395 | 396 | } |
| 396 | 397 | |
| 397 | - var parametrosModal = { | |
| 398 | - titulo: 'Despachos ' + producto.DetArt, | |
| 399 | - data: producto.despachos, | |
| 400 | - columnas: [ | |
| 401 | - { | |
| 402 | - propiedad: 'FEC', | |
| 403 | - nombre: 'Fecha', | |
| 404 | - filtro: { | |
| 405 | - nombre: 'date', | |
| 406 | - 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 | + } | |
| 407 | 408 | } |
| 408 | 409 | }, |
| 409 | - { | |
| 410 | - propiedad: 'IMP', | |
| 411 | - nombre: 'Importe' | |
| 412 | - }, | |
| 413 | - { | |
| 414 | - propiedad: 'LTS', | |
| 415 | - nombre: 'Litros' | |
| 416 | - } | |
| 417 | - ], | |
| 418 | - size: 'md' | |
| 419 | - }; | |
| 410 | + size: 'lg' | |
| 411 | + } | |
| 412 | + ); | |
| 420 | 413 | |
| 421 | - focaModalService.modal(parametrosModal).then(function(despacho) { | |
| 414 | + modalInstance.result.then(function(despacho) { | |
| 422 | 415 | |
| 423 | 416 | var articulo = { |
| 424 | 417 | TIP: $scope.factura.cliente.tipoFactura, |
| ... | ... | @@ -457,10 +450,23 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 457 | 450 | RTO: '' |
| 458 | 451 | }; |
| 459 | 452 | |
| 460 | - $scope.factura.articulosFactura.push(articulo); | |
| 453 | + crearFacturaService.setearDespachoOcupado({ | |
| 454 | + surtidor: despacho.SUR, | |
| 455 | + producto: despacho.PRO, | |
| 456 | + carga: despacho.CAR | |
| 457 | + }) | |
| 458 | + .then(function () { | |
| 459 | + $scope.factura.articulosFactura.push(articulo); | |
| 460 | + $scope.factura.despachos.push(despacho); | |
| 461 | + }) | |
| 462 | + .catch(function (err) { | |
| 463 | + | |
| 464 | + focaModalService.alert('El despacho esta en uso'); | |
| 465 | + }); | |
| 466 | + | |
| 461 | 467 | }) |
| 462 | 468 | .catch(function (err) { |
| 463 | - console.log(err) | |
| 469 | + console.log(err); | |
| 464 | 470 | }); |
| 465 | 471 | |
| 466 | 472 | }; |
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/js/service.js
| ... | ... | @@ -15,6 +15,9 @@ angular.module('focaCrearFactura') |
| 15 | 15 | getProductosByPlanilla: function (numeroPlanilla) { |
| 16 | 16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); |
| 17 | 17 | }, |
| 18 | + setearDespachoOcupado: function (parametros) { | |
| 19 | + return $http.post(route + '/turnos/despacho-en-uso', parametros); | |
| 20 | + }, | |
| 18 | 21 | getBotonera: function() { |
| 19 | 22 | return [ |
| 20 | 23 | { |
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> |