1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-06 03:02:34 +01:00

Client portal improvements: (#3595)

-  Hide Create Payment Method if no gateways exist
- Payment Screen, add $amount
- Fix breadcrumbs
This commit is contained in:
Benjamin Beganović 2020-04-06 23:23:05 +02:00 committed by GitHub
parent 8cffccb3bc
commit 28cc7d5e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 6 deletions

View File

@ -13,6 +13,7 @@ namespace App\Http\Controllers\ClientPortal;
use App\Events\Payment\Methods\MethodDeleted; use App\Events\Payment\Methods\MethodDeleted;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\CreatePaymentMethodRequest;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -45,7 +46,7 @@ class PaymentMethodController extends Controller
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function create() public function create(CreatePaymentMethodRequest $request)
{ {
$gateway = auth()->user()->client->getCreditCardGateway(); $gateway = auth()->user()->client->getCreditCardGateway();

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\ClientPortal;
use Illuminate\Foundation\Http\FormRequest;
class CreatePaymentMethodRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return auth()->user()->client->getCreditCardGateway() ? true : false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -3194,4 +3194,5 @@ return [
'open_in_new_tab' => 'Open in new tab', 'open_in_new_tab' => 'Open in new tab',
'complete_your_payment' => 'Complete payment', 'complete_your_payment' => 'Complete payment',
'authorize_for_future_use' => 'Authorize payment method for future use',
]; ];

View File

@ -3,7 +3,7 @@
<div class="flex items-center h-16 flex-shrink-0 px-4 bg-blue-900"> <div class="flex items-center h-16 flex-shrink-0 px-4 bg-blue-900">
<a href="{{ route('client.dashboard') }}"> <a href="{{ route('client.dashboard') }}">
<img class="h-6 w-auto" <img class="h-6 w-auto"
src="{!! $settings->company_logo ?: 'https://www.invoiceninja.com/wp-content/themes/invoice-ninja/images/logo.png' !!}" src="{!! $settings->company_logo ?: asset('images/invoiceninja-white-logo.png') !!}"
alt="{{ config('app.name') }}"/> alt="{{ config('app.name') }}"/>
</a> </a>
</div> </div>

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="flex-shrink-0 flex items-center px-4"> <div class="flex-shrink-0 flex items-center px-4">
<img class="h-6 w-auto" <img class="h-6 w-auto"
src="{!! $settings->company_logo ?: 'https://www.invoiceninja.com/wp-content/themes/invoice-ninja/images/logo.png' !!}" src="{!! $settings->company_logo ?: asset('images/invoiceninja-white-logo.png') !!}"
alt="{{ config('app.name') }}"/> alt="{{ config('app.name') }}"/>
</div> </div>
<div class="mt-5 flex-1 h-0 overflow-y-auto"> <div class="mt-5 flex-1 h-0 overflow-y-auto">

View File

@ -7,7 +7,7 @@
@endpush @endpush
@section('header') @section('header')
Insert breadcrumbs.. {{ Breadcrumbs::render('invoices.pay_now') }}
@endsection @endsection
@section('body') @section('body')

View File

@ -99,6 +99,14 @@
@endif @endif
</dd> </dd>
</div> </div>
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm leading-5 font-medium text-gray-500">
{{ ctrans('texts.amount') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
</dd>
</div>
</dl> </dl>
</div> </div>
</div> </div>

View File

@ -21,7 +21,9 @@
<div class="inline-flex rounded-md shadow-sm"> <div class="inline-flex rounded-md shadow-sm">
<input type="hidden" name="hashed_ids"> <input type="hidden" name="hashed_ids">
<input type="hidden" name="action" value="payment"> <input type="hidden" name="action" value="payment">
@if(auth()->user()->client->getCreditCardGateway())
<a href="{{ route('client.payment_methods.create') }}" class="button button-primary">@lang('texts.add_payment_method')</a> <a href="{{ route('client.payment_methods.create') }}" class="button button-primary">@lang('texts.add_payment_method')</a>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@ -89,6 +89,12 @@ Breadcrumbs::for('credits.show', function ($trail, $credit) {
$trail->push(sprintf('%s: %s', ctrans('texts.credits'), $credit->hashed_id), route('client.credits.index', $credit->hashed_id)); $trail->push(sprintf('%s: %s', ctrans('texts.credits'), $credit->hashed_id), route('client.credits.index', $credit->hashed_id));
}); });
// Invoices > Payment
Breadcrumbs::for('invoices.pay_now', function ($trail) {
$trail->parent('invoices');
$trail->push(ctrans('texts.pay_now'));
});
// Dashboard > Client // Dashboard > Client
Breadcrumbs::for('clients', function ($trail) { Breadcrumbs::for('clients', function ($trail) {
$trail->parent('dashboard'); $trail->parent('dashboard');