1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Allow payments of draft invoices:

- Remove processing overlay scripts
- Add flash message to clean layout
- Remove $balance > 0 check from filtered invoices
- Only show the payment methods if total is bigger than 0
- Change flash message from "warning" to "message"
- Show message for $1 payments
This commit is contained in:
Benjamin Beganović 2021-01-27 14:10:24 +01:00
parent 0c7ae3bca8
commit 615ef1e780
8 changed files with 17 additions and 21 deletions

View File

@ -90,7 +90,7 @@ class InvoiceController extends Controller
//filter invoices which are payable
$invoices = $invoices->filter(function ($invoice) {
return $invoice->isPayable() && $invoice->balance > 0;
return $invoice->isPayable();
});
//return early if no invoices.

View File

@ -106,7 +106,7 @@ class PaymentController extends Controller
if ($payable_invoices->count() == 0) {
return redirect()
->route('client.invoices.index')
->with(['warning' => 'No payable invoices selected.']);
->with(['message' => 'No payable invoices selected.']);
}
$settings = auth()->user()->client->getMergedSettings();

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=a33a5a58bfc6e2174841",
"/js/app.js": "/js/app.js?id=1ee684e58f9f6eb754d5",
"/css/app.css": "/css/app.css?id=599b11149976e86c83a3",
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",

16
resources/js/app.js vendored
View File

@ -14,20 +14,6 @@ window.axios = require('axios');
*/
window.valid = require('card-validator');
/**
* Toggle processing overlay.
*/
window.processingOverlay = (show) => {
if (show) {
return document
.getElementById('processing-overlay')
.classList.remove('hidden');
}
return document
.getElementById('processing-overlay')
.classList.add('hidden');
};
/**
* Remove flashing message div after 3 seconds.
@ -35,5 +21,5 @@ window.processingOverlay = (show) => {
document.querySelectorAll('.disposable-alert').forEach((element) => {
setTimeout(() => {
element.remove();
}, 3000);
}, 5000);
});

View File

@ -3383,5 +3383,5 @@ return [
'create_webhook_failure' => 'Failed to create Webhook',
'number' => 'Number',
'payment_message_extended' => 'Thank you for your payment of :amount for :invoice',
'online_payments_minimum_note' => 'Note: Online payments are supported only if amount is bigger than $1 or currency equivalent.',
];

View File

@ -40,7 +40,7 @@
<a href="#" @click="{ open = false }" data-company-gateway-id="{{ $payment_method['company_gateway_id'] }}" data-gateway-type-id="{{ $payment_method['gateway_type_id'] }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 dropdown-gateway-button hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" data-cy="payment-method">
{{ \App\Models\CompanyGateway::find($payment_method['company_gateway_id'])->firstOrFail()->getConfigField('name') }}
</a>
@else
@elseif($total > 0)
<a href="#" @click="{ open = false }" data-company-gateway-id="{{ $payment_method['company_gateway_id'] }}" data-gateway-type-id="{{ $payment_method['gateway_type_id'] }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 dropdown-gateway-button hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" data-cy="payment-method">
{{ $payment_method['label'] }}
</a>
@ -151,6 +151,10 @@
</div>
</div>
@endforeach
@if(intval($total) == 0)
<small>* {{ ctrans('texts.online_payments_minimum_note') }}</small>
@endif
</div>
</div>
</div>

View File

@ -69,6 +69,12 @@
@include('portal.ninja2020.components.primary-color')
<body class="antialiased {{ $custom_body_class ?? '' }}">
@if(session()->has('message'))
<div class="py-1 text-sm text-center text-white bg-primary disposable-alert">
{{ session('message') }}
</div>
@endif
@yield('body')
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>