From f8d998d935cbc84480a414972e48fe271244ed58 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 13 Feb 2020 22:18:20 +1100 Subject: [PATCH] Minor bug fixes rendering services and invoicing --- app/Models/Service.php | 14 ++++++++------ .../common/service/widget/invoice.blade.php | 4 ++-- .../u/service/widgets/information.blade.php | 2 +- resources/views/errors/500.blade.php | 2 -- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index 1462548..dcbef10 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -37,16 +37,16 @@ class Service extends Model 'status', ]; - protected $casts = [ - 'order_info'=>'array', - ]; - protected $dates = [ 'date_last_invoice', 'date_next_invoice', 'date_start', 'date_end', ]; + + protected $casts = [ + 'order_info'=>'array', + ]; public $dateFormat = 'U'; protected $table = 'ab_service'; @@ -334,7 +334,7 @@ class Service extends Model ? $last->addDay() : ($this->date_next_invoice ? $this->date_next_invoice->clone() : Carbon::now()); - return $date; + return request()->wantsJson() ? $date->format('Y-m-d') : $date; } /** @@ -803,7 +803,9 @@ class Service extends Model } // If the service is active, there will be service charges - if ($this->active OR $this->isPending()) { + if ((! $this->invoice_items->filter(function($item) { return $item->item_type==0 AND ! $item->exists; })->sum('total')) + AND ($this->active OR $this->isPending())) + { do { $o = new InvoiceItem; $o->active = TRUE; diff --git a/resources/theme/backend/adminlte/common/service/widget/invoice.blade.php b/resources/theme/backend/adminlte/common/service/widget/invoice.blade.php index f3a7e2f..1383829 100644 --- a/resources/theme/backend/adminlte/common/service/widget/invoice.blade.php +++ b/resources/theme/backend/adminlte/common/service/widget/invoice.blade.php @@ -1,9 +1,9 @@ - + - @foreach ($o->next_invoice_items() as $io) + @foreach ($x as $io) diff --git a/resources/theme/backend/adminlte/u/service/widgets/information.blade.php b/resources/theme/backend/adminlte/u/service/widgets/information.blade.php index e147ba4..eace789 100644 --- a/resources/theme/backend/adminlte/u/service/widgets/information.blade.php +++ b/resources/theme/backend/adminlte/u/service/widgets/information.blade.php @@ -34,7 +34,7 @@ - + diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php index 883a21b..a4461ba 100644 --- a/resources/views/errors/500.blade.php +++ b/resources/views/errors/500.blade.php @@ -5,12 +5,10 @@ @endsection @section('main-content') -

500

Oops! {{ trans('adminlte_lang::message.somethingwrong') }}

-

{{ trans($exception->getMessage()) }}

{{ trans('adminlte_lang::message.wewillwork') }} {{ trans('adminlte_lang::message.mainwhile') }} {{ trans('adminlte_lang::message.returndashboard') }}.

{{ $o->name }}${{ number_format($o->next_invoice_items()->sum('total'),2) }}{{ $o->name }}${{ number_format(($x=$o->next_invoice_items(TRUE))->sum('total'),2) }}
  {{ $io->item_type_name }}
Next Estimated Invoice${{ number_format($o->next_invoice_items()->sum('total'),2) }} *${{ number_format($o->next_invoice_items(TRUE)->sum('total'),2) }} *
Payment Method