Payment screen

This commit is contained in:
David Bomba 2019-09-05 15:04:52 +10:00
parent 374cc88c06
commit f5e19ece06
5 changed files with 47 additions and 21 deletions

View File

@ -116,13 +116,26 @@ class InvoiceController extends Controller
$invoices = Invoice::whereIn('id', $ids)
->whereClientId(auth()->user()->client->id)
->get()
->filter(function ($invoice){
->get();
$total = $invoices->sum('balance');
$invoices->filter(function ($invoice){
return $invoice->isPayable();
})->map(function ($invoice){
$invoice->balance = Number::formatMoney($invoice->balance, $invoice->client->currency(), $invoice->client->country, $invoice->client->getMergedSettings());
$invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
return $invoice;
});
$formatted_total = Number::formatMoney($total, auth()->user()->client->currency(), auth()->user()->client->country, auth()->user()->client->getMergedSettings());
$data = [
'invoices' => $invoices,
'formatted_total' => $formatted_total,
'total' => $total,
];
return view('portal.default.invoices.payment', $data);

View File

@ -35,6 +35,7 @@ class Invoice extends BaseModel
use MakesDates;
use PresentableTrait;
use MakesInvoiceValues;
protected $presenter = 'App\Models\Presenters\InvoicePresenter';
protected $hidden = [

View File

@ -11,6 +11,9 @@
namespace App\Models\Presenters;
use App\Utils\Number;
use App\Utils\Traits\MakesDates;
/**
* Class InvoicePresenter
*
@ -25,6 +28,7 @@ namespace App\Models\Presenters;
*/
class InvoicePresenter extends EntityPresenter
{
use MakesDates;
public function clientName()
{
@ -61,5 +65,4 @@ class InvoicePresenter extends EntityPresenter
return $this->company->present()->address();
}
}

View File

@ -17,9 +17,9 @@
<a class="list-group-item list-group-item-action flex-column align-items-start" href="javascript:void(0);">
<div class="d-flex w-100 justify-content-between">
<h5 class="mr-4"># {{ $invoice->invoice_number }}</h5>
<small>{{$invoice->due_date}}</small>
<small>{{ $invoice->due_date }}</small>
</div>
<p class="mb-1 pull-right">${{ $invoice->balance }}</p>
<p class="mb-1 pull-right">{{ $invoice->balance }}</p>
<small>
@if($invoice->po_number)
{{ $invoice->po_number }}
@ -36,16 +36,8 @@
<div class="py-md-5">
<ul class="list-group">
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center">{{ ctrans('texts.subtotal')}}
<span class="badge badge-primary badge-pill">$314.00</span>
</li>
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center">{{ ctrans('texts.taxes')}}
<span class="badge badge-primary badge-pill">$19.00</span>
</li>
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center">{{ ctrans('texts.fees')}}
<span class="badge badge-primary badge-pill">$2</span>
<li class="list-group-item d-flex list-group-item-action justify-content-between align-items-center"><strong>{{ ctrans('texts.total')}}</strong>
<span class="badge badge-primary badge-pill"><strong>$335.00</strong></span>
<h3><span class="badge badge-primary badge-pill"><strong>{{ $formatted_total }}</strong></span></h3>
</li>
</ul>
</div>

View File

@ -3,15 +3,32 @@
<main class="main">
<div class="container-fluid">
<div class="col-md-12 mt-4">
{!! Former::framework('TwitterBootstrap4'); !!}
{!! Former::horizontal_open()
->id('payment_form')
->route('client.invoices.bulk')
->method('POST'); !!}
{!! Former::hidden('hashed_ids')->id('hashed_ids')->value( $invoice->hashed_id ) !!}
{!! Former::hidden('action')->id('action')->value('payment') !!}
<div class="row mt-4">
<div class="col-md-12">
<div class="float-right">
<button class="btn btn-primary">{{ ctrans('texts.pay_now') }}</button>
</div>
</div>
</div>
<div class="col-md-12 mt-4">
{!! Former::close() !!}
<div class="row mt-4">
<div class="col-md-12">
<embed src="{{ asset($invoice->pdf_url()) }}#toolbar=1&navpanes=1&scrollbar=1" type="application/pdf" width="100%" height="1180px" />