Flash message

This commit is contained in:
David Bomba 2019-10-08 12:03:40 +10:00
parent 091673a7ac
commit accbbcf67b
5 changed files with 56 additions and 39 deletions

View File

@ -120,9 +120,14 @@ class InvoiceController extends Controller
$total = $invoices->sum('balance');
$invoices->filter(function ($invoice){
$invoices = $invoices->filter(function ($invoice){
return $invoice->isPayable();
})->map(function ($invoice){
});
if($invoices->count() == 0)
return back()->with(['warning' => 'No payable invoices selected']);
$invoices->map(function ($invoice){
$invoice->balance = Number::formatMoney($invoice->balance, $invoice->client);
$invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
return $invoice;

View File

@ -192,14 +192,25 @@ class Invoice extends BaseModel
return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24));
}
public function markViewed()
public function markViewed() :void
{
$this->last_viewed = Carbon::now()->format('Y-m-d H:i');
$this->save();
}
public function isPayable()
public function isPayable() : bool
{
return ($this->status === Invoice::STATUS_UNPAID || $this->status === Invoice::STATUS_OVERDUE);
if($this->status_id == Invoice::STATUS_SENT && $this->due_date > Carbon::now())
return true;
else if($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date > Carbon::now())
return true;
else if($this->status_id == Invoice::STATUS_SENT && $this->due_date < Carbon::now())
return true;
else if($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date < Carbon::now())
return true;
else
return false;
}
public static function badgeForStatus(int $status)

View File

@ -1,38 +1,40 @@
@if ($message = Session::get('success'))
<div class="alert alert-success alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
<div class="justify-content-center align-items-center pd-10 pm-10">
@if ($message = Session::get('success'))
<div class="alert alert-success alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('error'))
<div class="alert alert-danger alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('error'))
<div class="alert alert-danger alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('warning'))
<div class="alert alert-warning alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('warning'))
<div class="alert alert-warning alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('info'))
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($message = Session::get('info'))
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
Please check the form below for errors
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
Please check the form below for errors
</div>
@endif
</div>

View File

@ -21,7 +21,8 @@
{!! Former::close() !!}
<div class="row" style="padding-top: 30px;">
@include('portal.default.flash-message')
<div class="col-lg-12" style="padding-bottom: 10px;">
<div class="pull-left">

View File

@ -46,12 +46,10 @@
.nav {min-height: calc(100% - 55px);}
</style>
@stack('css')
@yield('head')
@yield('head')
</head>
@include('portal.default.header')
@yield('header')
@include('portal.default.flash-message')
@include('portal.default.sidebar')
@yield('sidebar')
@section('body')