Commit fbbc020e5887355bcb28e63c37e4b3178de753ab

Authored by Pablo Marco del Pont
1 parent 780a9f584b
Exists in master

- Agregué confirmación al borrar plazo pago.

- Agregué funcionalidad para borrar plazo pago.
- Agregué servicio para borrar plazo pago.
Showing 2 changed files with 34 additions and 2 deletions   Show diff stats
src/js/controller.js
... ... @@ -27,10 +27,10 @@ angular.module('focaAbmPreciosCondiciones')
27 27 ])
28 28 .controller('focaAbmPrecioCondicionController', [
29 29 '$scope', 'focaAbmPreciosCondicionesService',
30   - '$routeParams', '$location',
  30 + '$routeParams', '$location', '$uibModal',
31 31 function(
32 32 $scope, focaAbmPreciosCondicionesService,
33   - $routeParams, $location
  33 + $routeParams, $location, $uibModal
34 34 ) {
35 35 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id)
36 36 .then(function(datos) {
... ... @@ -65,6 +65,23 @@ angular.module('focaAbmPreciosCondiciones')
65 65 '/plazo-pago/' + id
66 66 );
67 67 };
  68 + $scope.solicitarConfirmacionPlazoPago = function(plazoPago) {
  69 + $uibModal.open({
  70 + templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html',
  71 + controller: 'focaAbmPlazosPagosModalConfirmarController',
  72 + animation: false,
  73 + backdrop: false,
  74 + resolve: {plazoPago: function(){return plazoPago;}}
  75 + })
  76 + .result.then(function(plazoPago){
  77 + console.log(plazoPago);
  78 + console.log($scope.precioCondicion);
  79 + focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id);
  80 + $scope.precioCondicion.plazos.splice(
  81 + $scope.precioCondicion.plazos.indexOf(plazoPago), 1
  82 + );
  83 + });
  84 + }
68 85 }
69 86 ])
70 87 .controller('focaAbmPreciosCondicionesModalConfirmarController', [
... ... @@ -78,4 +95,16 @@ angular.module('focaAbmPreciosCondiciones')
78 95 $uibModalInstance.close(precioCondicion);
79 96 };
80 97 }
  98 + ])
  99 + .controller('focaAbmPlazosPagosModalConfirmarController', [
  100 + '$uibModalInstance', '$scope', 'plazoPago',
  101 + function($uibModalInstance, $scope, plazoPago) {
  102 + $scope.plazoPago = plazoPago;
  103 + $scope.cancelar = function() {
  104 + $uibModalInstance.dismiss();
  105 + };
  106 + $scope.borrar = function() {
  107 + $uibModalInstance.close(plazoPago);
  108 + };
  109 + }
81 110 ]);
... ... @@ -22,6 +22,9 @@ angular.module('focaAbmPreciosCondiciones')
22 22 return $http.get(
23 23 API_ENDPOINT.URL + '/plazo-pago/precio-condicion/' + idPrecioCondicion
24 24 );
  25 + },
  26 + borrarPlazoPago: function(id) {
  27 + return $http.delete(API_ENDPOINT.URL + '/plazo-pago/' + id);
25 28 }
26 29 };
27 30 }