Skip to content

Commit

Permalink
Remove empty spaces in show invoice view
Browse files Browse the repository at this point in the history
  • Loading branch information
CTSoft committed Aug 9, 2020
1 parent 8855b05 commit c4ff98f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 49 deletions.
10 changes: 10 additions & 0 deletions app/Providers/Macro.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\View\Factory as ViewFactory;

class Macro extends ServiceProvider
{
Expand All @@ -26,6 +27,15 @@ public function boot()

return $string;
});

ViewFactory::macro('hasStack', function (...$sections) {
foreach ($sections as $section) {
if (isset($this->pushes[$section]) || isset($this->prepends[$section])) {
return true;
}
}
return false;
});
}

/**
Expand Down
112 changes: 63 additions & 49 deletions resources/views/sales/invoices/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,27 @@
{{ setting('company.name') }}
</th>
</tr>
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@if (setting('company.tax_number'))
@if (setting('company.address'))
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
@endif
@if (setting('company.tax_number'))
<tr>
<th>
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
</th>
</tr>
@endif
@if (setting('company.phone'))
<tr>
<th>
{{ setting('company.phone') }}
@endif
</th>
</tr>
</th>
</tr>
@endif
<tr>
<th>
{{ setting('company.email') }}
Expand All @@ -261,38 +263,50 @@
@stack('name_input_end')
</th>
</tr>
<tr>
<th>
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}
@stack('address_input_end')
</th>
</tr>
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
@stack('tax_number_input_end')
</th>
</tr>
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
<tr>
<th>
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')
</th>
</tr>
@if ($invoice->contact_address || $__env->hasStack('address_input_start', 'address_input_end'))
<tr>
<th>
@stack('address_input_start')
@if ($invoice->contact_address)
{!! nl2br($invoice->contact_address) !!}
@endif
@stack('address_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_tax_number || $__env->hasStack('tax_number_input_start', 'tax_number_input_end'))
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
@stack('tax_number_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_phone || $__env->hasStack('phone_input_start', 'phone_input_end'))
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_email || $__env->hasStack('email_start', 'email_input_end'))
<tr>
<th>
@stack('email_start')
@if ($invoice->contact_email)
{{ $invoice->contact_email }}
@endif
@stack('email_input_end')
</th>
</tr>
@endif
</tbody>
</table>
</div>
Expand Down

0 comments on commit c4ff98f

Please sign in to comment.