From 337beee7bfcdb64048a67869f4ace9c654a56864 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 10 Jul 2020 17:20:22 +1000 Subject: [PATCH] Fix account access for resellers, added invoices to user home --- app/Policies/UserPolicy.php | 2 +- .../common/invoice/widget/history.blade.php | 59 +++++++++++++++++++ .../theme/backend/adminlte/u/home.blade.php | 1 + .../layouts/partials/sidebarmenu.blade.php | 12 ++-- 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 resources/views/theme/backend/adminlte/common/invoice/widget/history.blade.php diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index cc9a4fd..d2aaf13 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -26,7 +26,7 @@ class UserPolicy OR $user->isWholesaler() // The user is the reseller - OR $user->all_accounts()->pluck('id')->search($o->id); + OR $user->all_clients()->pluck('id')->search($o->id); } /** diff --git a/resources/views/theme/backend/adminlte/common/invoice/widget/history.blade.php b/resources/views/theme/backend/adminlte/common/invoice/widget/history.blade.php new file mode 100644 index 0000000..7e26cca --- /dev/null +++ b/resources/views/theme/backend/adminlte/common/invoice/widget/history.blade.php @@ -0,0 +1,59 @@ +
+
+

Invoice History

+ +
+ + +
+
+ +
+ @if ($o->invoices->count()) + + + + + + + + + + + @foreach ($o->invoices as $io) + + + + + + @endforeach + + +
IDDateAmount
{{ $io->id }}{{ $io->due_date ? $io->due_date->format('Y-m-d') : ' ' }}{{ number_format($io->total,2) }}
+ @else +

No payments recorded

+ @endif +
+
+ +@section('page-scripts') + @css('//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css','jq-dt-css','jquery') + @js('//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js','jq-dt-js','jquery') + @css('//cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css','dt-responsive-css','jq-dt-css') + @js('//cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js','dt-responsive-js','jq-dt-js') + @css('/plugin/dataTables/dataTables.bootstrap4.css','dt-bootstrap4-css','jq-dt-css') + @js('/plugin/dataTables/dataTables.bootstrap4.js','dt-bootstrap4-js','jq-dt-js') + + +@append \ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/u/home.blade.php b/resources/views/theme/backend/adminlte/u/home.blade.php index f3d37e9..619e982 100644 --- a/resources/views/theme/backend/adminlte/u/home.blade.php +++ b/resources/views/theme/backend/adminlte/u/home.blade.php @@ -40,6 +40,7 @@
@include('common.invoice.widget.due') + @include('common.invoice.widget.history') @include('common.payment.widget.history')
diff --git a/resources/views/vendor/adminlte/layouts/partials/sidebarmenu.blade.php b/resources/views/vendor/adminlte/layouts/partials/sidebarmenu.blade.php index c1f484a..c947757 100644 --- a/resources/views/vendor/adminlte/layouts/partials/sidebarmenu.blade.php +++ b/resources/views/vendor/adminlte/layouts/partials/sidebarmenu.blade.php @@ -2,7 +2,7 @@