1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4780 from beganovich/v5-2701-payable-draft-invoices

(v5) (wip) Allow payments of draft invoices
This commit is contained in:
Benjamin Beganović 2021-01-28 15:44:32 +01:00 committed by GitHub
commit 5048aa2997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 20 deletions

View File

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

View File

@ -106,7 +106,7 @@ class PaymentController extends Controller
if ($payable_invoices->count() == 0) { if ($payable_invoices->count() == 0) {
return redirect() return redirect()
->route('client.invoices.index') ->route('client.invoices.index')
->with(['warning' => 'No payable invoices selected.']); ->with(['message' => 'No payable invoices selected.']);
} }
$settings = auth()->user()->client->getMergedSettings(); $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", "/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/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1", "/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'); 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. * Remove flashing message div after 3 seconds.
@ -35,5 +21,5 @@ window.processingOverlay = (show) => {
document.querySelectorAll('.disposable-alert').forEach((element) => { document.querySelectorAll('.disposable-alert').forEach((element) => {
setTimeout(() => { setTimeout(() => {
element.remove(); element.remove();
}, 3000); }, 5000);
}); });

View File

@ -3383,5 +3383,6 @@ return [
'create_webhook_failure' => 'Failed to create Webhook', 'create_webhook_failure' => 'Failed to create Webhook',
'number' => 'Number', 'number' => 'Number',
'payment_message_extended' => 'Thank you for your payment of :amount for :invoice', '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.',
'payment_token_not_found' => 'Payment token not found, please try again. If an issue still persist, try with another payment method', 'payment_token_not_found' => 'Payment token not found, please try again. If an issue still persist, try with another payment method',
]; ];

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"> <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') }} {{ \App\Models\CompanyGateway::find($payment_method['company_gateway_id'])->firstOrFail()->getConfigField('name') }}
</a> </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"> <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'] }} {{ $payment_method['label'] }}
</a> </a>
@ -151,6 +151,10 @@
</div> </div>
</div> </div>
@endforeach @endforeach
@if(intval($total) == 0)
<small>* {{ ctrans('texts.online_payments_minimum_note') }}</small>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@ -69,6 +69,12 @@
@include('portal.ninja2020.components.primary-color') @include('portal.ninja2020.components.primary-color')
<body class="antialiased {{ $custom_body_class ?? '' }}"> <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') @yield('body')
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script> <script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>