Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Ahora se elimina el botón "generar" y se muestra un botón que actuali…
Browse files Browse the repository at this point in the history
…za la pagina actual.
  • Loading branch information
nmarulo committed Feb 7, 2018
1 parent 2d36b56 commit b55167a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions App/Views/generating.ghost.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</div>
<div class="form-group">
<button id="btn-generate-receipt" class="btn btn-success" type="submit">Generar</button>
<a id="btn-generate-new-invoice" class="btn btn-warning hidden" href="{{url('/generating')}}">Generar nueva factura</a>
</div>
</form>
<div id="btn-group-actions-generate" class="hidden">
Expand Down
14 changes: 9 additions & 5 deletions public/assets/js/script-generating.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var modalFormSearchData = null;
var classModalFormSearchData = '';
var modalProducts = '';
var modalClients = '';
var btnGeneratingNewInvoice = null;
var btnGroupActionsGenerate = null;

(function () {
setVars();
Expand All @@ -46,6 +48,8 @@ function setVars() {
modalFormSearchData = $(classModalFormSearchData);
modalClients = $('#modal-clients');
modalProducts = $('#modal-products');
btnGeneratingNewInvoice = $('#btn-generate-new-invoice');
btnGroupActionsGenerate = $('#btn-group-actions-generate');

//Establece la información del producto seleccionado.
setProductInput = function (element) {
Expand Down Expand Up @@ -218,9 +222,8 @@ function setListSelectedProducts(listProductsIdAndUnits) {
}

function generatingReceipt() {
var data = formGenerateReceipt.serialize();

var generateAndGetLastReceipt = function (data) {
btnGenerateReceipt.remove();
includeMessages();
contentSelectedProducts.text('');
listProductsIdAndUnits = [];
Expand All @@ -238,13 +241,14 @@ function generatingReceipt() {
});

if (typeof data === 'boolean') {
btnGeneratingNewInvoice.removeClass('hidden');

return false;
}

btnGenerateReceipt.closest('div').addClass('hidden');
$('#btn-group-actions-generate').removeClass('hidden');
btnGroupActionsGenerate.removeClass('hidden');
generatePDF('generating/datapdf', data['receipt_id'], true);
};

callAjax('generating', 'POST', data, generateAndGetLastReceipt, true);
callAjax('generating', 'POST', formGenerateReceipt.serialize(), generateAndGetLastReceipt, true);
}

0 comments on commit b55167a

Please sign in to comment.