From 844d5098345a4b0e1cf75ec1d0565637cd01e6c1 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 6 Jul 2024 19:28:14 +1000 Subject: [PATCH] Move invoice blades around. Added invoices in credit view --- app/Models/Account.php | 3 +- .../widget/admin}/list.blade.php | 0 .../account/widget/invoice_due.blade.php | 2 +- .../theme/backend/adminlte/home.blade.php | 2 +- .../invoice/widget/admin/credit.blade.php | 58 +++++++++++++++++++ .../widget/admin}/due.blade.php | 3 +- .../adminlte/invoice/widget/due.blade.php | 12 ++-- .../adminlte/r/home/widget/home.blade.php | 11 ---- .../widget/admin}/movement.blade.php | 0 .../adminlte/widget/admin/reseller.blade.php | 24 ++++++++ 10 files changed, 93 insertions(+), 22 deletions(-) rename resources/views/theme/backend/adminlte/{r/account/widgets => account/widget/admin}/list.blade.php (100%) create mode 100644 resources/views/theme/backend/adminlte/invoice/widget/admin/credit.blade.php rename resources/views/theme/backend/adminlte/{r/invoice/widgets => invoice/widget/admin}/due.blade.php (78%) delete mode 100644 resources/views/theme/backend/adminlte/r/home/widget/home.blade.php rename resources/views/theme/backend/adminlte/{r/service/widget => service/widget/admin}/movement.blade.php (100%) create mode 100644 resources/views/theme/backend/adminlte/widget/admin/reseller.blade.php diff --git a/app/Models/Account.php b/app/Models/Account.php index 0c6fc04..c3b7ed5 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -281,7 +281,7 @@ class Account extends Model implements IDs DB::raw('SUM(amount) AS payments'), DB::raw('SUM(fees_amt) AS payment_fees'), ]) - ->join('payment_items',['payment_items.payment_id'=>'payments.id']) + ->leftjoin('payment_items',['payment_items.payment_id'=>'payments.id']) ->where('payments.active',TRUE) ->where('payment_items.active',TRUE) ->groupBy(['payment_items.invoice_id']) @@ -299,6 +299,7 @@ class Account extends Model implements IDs ->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id']) ->rightjoin('invoices',['invoices.id'=>'invoice_items.invoice_id']) ->where('invoice_items.active',TRUE) + ->where('invoice_item_taxes.active',TRUE) ->where('invoices.active',TRUE) ->groupBy(['invoice_items.invoice_id']), ),'p') diff --git a/resources/views/theme/backend/adminlte/r/account/widgets/list.blade.php b/resources/views/theme/backend/adminlte/account/widget/admin/list.blade.php similarity index 100% rename from resources/views/theme/backend/adminlte/r/account/widgets/list.blade.php rename to resources/views/theme/backend/adminlte/account/widget/admin/list.blade.php diff --git a/resources/views/theme/backend/adminlte/account/widget/invoice_due.blade.php b/resources/views/theme/backend/adminlte/account/widget/invoice_due.blade.php index 12e7de6..14aa456 100644 --- a/resources/views/theme/backend/adminlte/account/widget/invoice_due.blade.php +++ b/resources/views/theme/backend/adminlte/account/widget/invoice_due.blade.php @@ -7,7 +7,7 @@
@if(($list=$o->invoiceSummaryDue()->get())->count()) - @include('theme.backend.adminlte.invoice.widget.due') + @include('theme.backend.adminlte.invoice.widget.due',['type'=>'account']) @else

No invoice due

diff --git a/resources/views/theme/backend/adminlte/home.blade.php b/resources/views/theme/backend/adminlte/home.blade.php index a228e61..5d1a04d 100644 --- a/resources/views/theme/backend/adminlte/home.blade.php +++ b/resources/views/theme/backend/adminlte/home.blade.php @@ -96,7 +96,7 @@ @if($o==$user) @canany('reseller','wholesaler')
- @include('theme.backend.adminlte.r.home.widget.home') + @include('theme.backend.adminlte.widget.admin.reseller')
@endcanany @endif diff --git a/resources/views/theme/backend/adminlte/invoice/widget/admin/credit.blade.php b/resources/views/theme/backend/adminlte/invoice/widget/admin/credit.blade.php new file mode 100644 index 0000000..1fc1fb0 --- /dev/null +++ b/resources/views/theme/backend/adminlte/invoice/widget/admin/credit.blade.php @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + @foreach($list as $oo) + + + + + + + + + + + @endforeach + +
Account#DueItemsDiscountsTotalPaymentsBalance
{{ $oo->account->name }}{{ $oo->lid }}{{ $oo->due_at->format('Y-m-d') }}${{ number_format($oo->_item+$oo->_tax,2) }}${{ number_format($oo->_discount,2) }}${{ number_format($oo->_total,2) }}${{ number_format($oo->_payment,2) }}${{ number_format($oo->_balance,2) }}
+ +@section('page-styles') + @css(datatables,bootstrap4|rowgroup) +@append + +@section('page-scripts') + @js(datatables,bootstrap4|rowgroup) + + +@append \ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php b/resources/views/theme/backend/adminlte/invoice/widget/admin/due.blade.php similarity index 78% rename from resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php rename to resources/views/theme/backend/adminlte/invoice/widget/admin/due.blade.php index e773737..c2b1ee2 100644 --- a/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php +++ b/resources/views/theme/backend/adminlte/invoice/widget/admin/due.blade.php @@ -1,4 +1,3 @@ -
@@ -7,7 +6,7 @@
@if(($list=\App\Models\Account::InvoicesDue())->count()) - @include('theme.backend.adminlte.invoice.widget.due') + @include('theme.backend.adminlte.invoice.widget.due',['type'=>'all']) @else

No invoice due

diff --git a/resources/views/theme/backend/adminlte/invoice/widget/due.blade.php b/resources/views/theme/backend/adminlte/invoice/widget/due.blade.php index 2bddfc1..c91d863 100644 --- a/resources/views/theme/backend/adminlte/invoice/widget/due.blade.php +++ b/resources/views/theme/backend/adminlte/invoice/widget/due.blade.php @@ -1,6 +1,6 @@ - + - +
@@ -12,8 +12,8 @@ - @foreach ($list as $oo) - due_at->isPast()) class="table-danger" @endif> + @foreach($list as $oo) + due_at->isPast()) class="table-danger" @endif> @@ -32,9 +32,9 @@ @js(datatables,bootstrap4|rowgroup)
Account
{{ $oo->account->name }} {{ $oo->lid }} {{ $oo->due_at->format('Y-m-d') }}