From 3e9be29060e4dd438f7f4679ffb8f4cc12dc02db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Fri, 5 Jun 2020 16:18:46 +0300 Subject: [PATCH 1/4] fix hardcoded customer role id --- app/Jobs/Common/CreateContact.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Common/CreateContact.php b/app/Jobs/Common/CreateContact.php index b136766b3..2cf3710bc 100644 --- a/app/Jobs/Common/CreateContact.php +++ b/app/Jobs/Common/CreateContact.php @@ -4,6 +4,7 @@ namespace App\Jobs\Common; use App\Abstracts\Job; use App\Models\Auth\User; +use App\Models\Auth\Role; use App\Models\Common\Contact; class CreateContact extends Job @@ -48,11 +49,14 @@ class CreateContact extends Job $data = $this->request->all(); $data['locale'] = setting('default.locale', 'en-GB'); - $user = User::create($data); - $user->roles()->attach(['3']); - $user->companies()->attach([session('company_id')]); + $customer_role = Role::all()->filter(function ($role) { + return $role->hasPermission('read-client-portal'); + })->first(); + + $user = User::create($data); + $user->roles()->attach($customer_role); + $user->companies()->attach(session('company_id')); - // St user id to request $this->request['user_id'] = $user->id; } } From 92e07fc20646839513bfebfdf8ff307186c06caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 6 Jun 2020 11:48:20 +0300 Subject: [PATCH 2/4] hide lines w/o money in reports --- .../views/partials/reports/table.blade.php | 2 +- .../partials/reports/table/footer.blade.php | 24 ++++++++++++------- .../partials/reports/table/rows.blade.php | 18 +++++++------- .../profit_loss/table/footer.blade.php | 24 ++++++++++++------- .../tax_summary/table/footer.blade.php | 24 ++++++++++++------- 5 files changed, 55 insertions(+), 37 deletions(-) diff --git a/resources/views/partials/reports/table.blade.php b/resources/views/partials/reports/table.blade.php index a3794a43a..5366b369d 100644 --- a/resources/views/partials/reports/table.blade.php +++ b/resources/views/partials/reports/table.blade.php @@ -9,7 +9,7 @@ @else -
{{ trans('general.no_records') }}
+
{{ trans('general.no_records') }}
@endif diff --git a/resources/views/partials/reports/table/footer.blade.php b/resources/views/partials/reports/table/footer.blade.php index ba6e3260a..8443fd1ba 100644 --- a/resources/views/partials/reports/table/footer.blade.php +++ b/resources/views/partials/reports/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans_choice('general.totals', 1) }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans_choice('general.totals', 1) }} + @foreach($class->footer_totals[$table] as $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif diff --git a/resources/views/partials/reports/table/rows.blade.php b/resources/views/partials/reports/table/rows.blade.php index 51832cc90..35f8c5cfc 100644 --- a/resources/views/partials/reports/table/rows.blade.php +++ b/resources/views/partials/reports/table/rows.blade.php @@ -1,9 +1,9 @@ -@php $row_total = 0; @endphp - - {{ $class->row_names[$table][$id] }} - @foreach($rows as $row) - @php $row_total += $row; @endphp - @money($row, setting('default.currency'), true) - @endforeach - @money($row_total, setting('default.currency'), true) - +@if ($row_total = array_sum($rows)) + + {{ $class->row_names[$table][$id] }} + @foreach($rows as $row) + @money($row, setting('default.currency'), true) + @endforeach + @money($row_total, setting('default.currency'), true) + +@endif diff --git a/resources/views/reports/profit_loss/table/footer.blade.php b/resources/views/reports/profit_loss/table/footer.blade.php index 5cae13c0c..8554a37fb 100644 --- a/resources/views/reports/profit_loss/table/footer.blade.php +++ b/resources/views/reports/profit_loss/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans_choice('general.totals', 1) }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $date => $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans_choice('general.totals', 1) }} + @foreach($class->footer_totals[$table] as $date => $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif diff --git a/resources/views/reports/tax_summary/table/footer.blade.php b/resources/views/reports/tax_summary/table/footer.blade.php index 17b2c7bd9..9804cec3f 100644 --- a/resources/views/reports/tax_summary/table/footer.blade.php +++ b/resources/views/reports/tax_summary/table/footer.blade.php @@ -1,11 +1,17 @@ - - {{ trans('reports.net') }} - @php $grand_total = 0; @endphp - @foreach($class->footer_totals[$table] as $total) - @php $grand_total += $total; @endphp - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - + @if ($grand_total = array_sum($class->footer_totals[$table])) + + {{ trans('reports.net') }} + @foreach($class->footer_totals[$table] as $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + + @else + + +
{{ trans('general.no_records') }}
+ + + @endif From 6bd58444445ce2744b17db38eb1723631d82fb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 6 Jun 2020 14:32:44 +0300 Subject: [PATCH 3/4] styling reports --- app/Abstracts/Report.php | 5 ---- app/Reports/ProfitLoss.php | 5 ---- app/Reports/TaxSummary.php | 5 ---- resources/views/layouts/print.blade.php | 2 -- resources/views/partials/print/head.blade.php | 1 - .../views/partials/reports/print.blade.php | 5 ++-- .../partials/reports/table/footer.blade.php | 24 +++++++------------ .../profit_loss/content/footer.blade.php | 2 +- .../profit_loss/table/footer.blade.php | 24 +++++++------------ .../tax_summary/content/header.blade.php | 6 ++--- .../tax_summary/table/footer.blade.php | 24 +++++++------------ .../tax_summary/table/header.blade.php | 2 +- 12 files changed, 35 insertions(+), 70 deletions(-) diff --git a/app/Abstracts/Report.php b/app/Abstracts/Report.php index d4206499f..b98450aef 100644 --- a/app/Abstracts/Report.php +++ b/app/Abstracts/Report.php @@ -47,11 +47,6 @@ abstract class Report public $loaded = false; - public $indents = [ - 'table_header' => '0px', - 'table_rows' => '24px', - ]; - public $chart = [ 'line' => [ 'width' => '0', diff --git a/app/Reports/ProfitLoss.php b/app/Reports/ProfitLoss.php index f96aac242..cf55d9f27 100644 --- a/app/Reports/ProfitLoss.php +++ b/app/Reports/ProfitLoss.php @@ -16,11 +16,6 @@ class ProfitLoss extends Report public $icon = 'fa fa-heart'; - public $indents = [ - 'table_header' => '0px', - 'table_rows' => '48px', - ]; - public function setViews() { parent::setViews(); diff --git a/app/Reports/TaxSummary.php b/app/Reports/TaxSummary.php index 15baa5679..f9dc3dca9 100644 --- a/app/Reports/TaxSummary.php +++ b/app/Reports/TaxSummary.php @@ -21,11 +21,6 @@ class TaxSummary extends Report public $icon = 'fa fa-percent'; - public $indents = [ - 'table_header' => '0px', - 'table_rows' => '48px', - ]; - public function setViews() { parent::setViews(); diff --git a/resources/views/layouts/print.blade.php b/resources/views/layouts/print.blade.php index 2dc203b99..3f5601fd4 100644 --- a/resources/views/layouts/print.blade.php +++ b/resources/views/layouts/print.blade.php @@ -1,5 +1,4 @@ - @include('partials.print.head') @@ -9,5 +8,4 @@ @stack('body_end') - diff --git a/resources/views/partials/print/head.blade.php b/resources/views/partials/print/head.blade.php index a3d2460b9..e9de5521f 100644 --- a/resources/views/partials/print/head.blade.php +++ b/resources/views/partials/print/head.blade.php @@ -20,7 +20,6 @@ } - @stack('css') @stack('stylesheet') diff --git a/resources/views/partials/reports/print.blade.php b/resources/views/partials/reports/print.blade.php index 6324a0e57..04e6f094a 100644 --- a/resources/views/partials/reports/print.blade.php +++ b/resources/views/partials/reports/print.blade.php @@ -1,12 +1,13 @@ @extends('layouts.print') -@section('content') +@section('title', $class->model->name) +@section('content')

{{ $class->model->name }}

{{ setting('company.name') }} - @if(!empty($class->model->settings->chart)) + @if (!empty($class->model->settings->chart)) @include($class->views['chart']) @endif diff --git a/resources/views/partials/reports/table/footer.blade.php b/resources/views/partials/reports/table/footer.blade.php index 8443fd1ba..26c39de50 100644 --- a/resources/views/partials/reports/table/footer.blade.php +++ b/resources/views/partials/reports/table/footer.blade.php @@ -1,17 +1,11 @@ +@php $grand_total = array_sum($class->footer_totals[$table]); @endphp + - @if ($grand_total = array_sum($class->footer_totals[$table])) - - {{ trans_choice('general.totals', 1) }} - @foreach($class->footer_totals[$table] as $total) - @money($total, setting('default.currency'), true) - @endforeach - @money($grand_total, setting('default.currency'), true) - - @else - - -
{{ trans('general.no_records') }}
- - - @endif + + {{ trans_choice('general.totals', 1) }} + @foreach($class->footer_totals[$table] as $total) + @money($total, setting('default.currency'), true) + @endforeach + @money($grand_total, setting('default.currency'), true) + diff --git a/resources/views/reports/profit_loss/content/footer.blade.php b/resources/views/reports/profit_loss/content/footer.blade.php index 286aeb58f..2b4b4728a 100644 --- a/resources/views/reports/profit_loss/content/footer.blade.php +++ b/resources/views/reports/profit_loss/content/footer.blade.php @@ -2,7 +2,7 @@ - + @foreach($class->net_profit as $profit) @endforeach diff --git a/resources/views/reports/profit_loss/table/footer.blade.php b/resources/views/reports/profit_loss/table/footer.blade.php index 8554a37fb..a83bd574e 100644 --- a/resources/views/reports/profit_loss/table/footer.blade.php +++ b/resources/views/reports/profit_loss/table/footer.blade.php @@ -1,17 +1,11 @@ +@php $grand_total = array_sum($class->footer_totals[$table]); @endphp + - @if ($grand_total = array_sum($class->footer_totals[$table])) - - - @foreach($class->footer_totals[$table] as $date => $total) - - @endforeach - - - @else - - - - @endif + + + @foreach($class->footer_totals[$table] as $total) + + @endforeach + + diff --git a/resources/views/reports/tax_summary/content/header.blade.php b/resources/views/reports/tax_summary/content/header.blade.php index b658d1847..cec2e60d3 100644 --- a/resources/views/reports/tax_summary/content/header.blade.php +++ b/resources/views/reports/tax_summary/content/header.blade.php @@ -1,10 +1,10 @@ -
+
{{ trans('reports.net_profit') }}{{ trans('reports.net_profit') }}@money($profit, setting('default.currency'), true)
{{ trans_choice('general.totals', 1) }}@money($total, setting('default.currency'), true)@money($grand_total, setting('default.currency'), true)
-
{{ trans('general.no_records') }}
-
{{ trans_choice('general.totals', 1) }}@money($total, setting('default.currency'), true)@money($grand_total, setting('default.currency'), true)
- + @foreach($class->dates as $date) - + @endforeach diff --git a/resources/views/reports/tax_summary/table/footer.blade.php b/resources/views/reports/tax_summary/table/footer.blade.php index 9804cec3f..c88fa5aee 100644 --- a/resources/views/reports/tax_summary/table/footer.blade.php +++ b/resources/views/reports/tax_summary/table/footer.blade.php @@ -1,17 +1,11 @@ +@php $grand_total = array_sum($class->footer_totals[$table]); @endphp + - @if ($grand_total = array_sum($class->footer_totals[$table])) - - - @foreach($class->footer_totals[$table] as $total) - - @endforeach - - - @else - - - - @endif + + + @foreach($class->footer_totals[$table] as $total) + + @endforeach + + diff --git a/resources/views/reports/tax_summary/table/header.blade.php b/resources/views/reports/tax_summary/table/header.blade.php index d35424d7c..61579aee4 100644 --- a/resources/views/reports/tax_summary/table/header.blade.php +++ b/resources/views/reports/tax_summary/table/header.blade.php @@ -1,4 +1,4 @@ - +
{{ $date }}{{ $date }}{{ trans_choice('general.totals', 1) }}
{{ trans('reports.net') }}@money($total, setting('default.currency'), true)@money($grand_total, setting('default.currency'), true)
-
{{ trans('general.no_records') }}
-
{{ trans('reports.net') }}@money($total, setting('default.currency'), true)@money($grand_total, setting('default.currency'), true)

{{ $table }}

From 1b8941b9d46b74b048c4a076f5427ce04f1fbc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 6 Jun 2020 15:42:08 +0300 Subject: [PATCH 4/4] display models in debugbar --- config/debugbar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/debugbar.php b/config/debugbar.php index 01116a0c5..a0d80cef2 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -122,7 +122,7 @@ return [ 'files' => false, // Show the included files 'config' => false, // Display config settings 'cache' => false, // Display cache events - 'models' => false, // Display models + 'models' => true, // Display models ], /*