Prevente duplicate quote approvals

This commit is contained in:
Hillel Coren 2017-12-14 13:38:50 +02:00
parent 679c1c85c9
commit 980c382f79

View File

@ -163,7 +163,7 @@
@if ($invoice->isQuote()) @if ($invoice->isQuote())
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}   {!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}  
@if ($showApprove) @if ($showApprove)
{!! Button::success(trans('texts.approve'))->asLinkTo(URL::to('/approve/' . $invitation->invitation_key))->large() !!} {!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()'])->large() !!}
@endif @endif
@elseif ( ! $invoice->canBePaid()) @elseif ( ! $invoice->canBePaid())
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!} {!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
@ -289,6 +289,11 @@
$('#authorizationModal').modal('show'); $('#authorizationModal').modal('show');
} }
function onApproveClick() {
$('#approveButton').prop('disabled', true);
location.href = "{{ url('/approve/' . $invitation->invitation_key) }}";
}
function onDownloadClick() { function onDownloadClick() {
try { try {
var doc = generatePDF(invoice, invoice.invoice_design.javascript, true); var doc = generatePDF(invoice, invoice.invoice_design.javascript, true);