Remove empty spaces in show invoice view

This commit is contained in:
CTSoft 2020-08-09 11:45:40 +02:00
parent 8855b0582f
commit c4ff98febe
2 changed files with 73 additions and 49 deletions

View File

@ -4,6 +4,7 @@ namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\View\Factory as ViewFactory;
class Macro extends ServiceProvider
{
@ -26,6 +27,15 @@ class Macro extends ServiceProvider
return $string;
});
ViewFactory::macro('hasStack', function (...$sections) {
foreach ($sections as $section) {
if (isset($this->pushes[$section]) || isset($this->prepends[$section])) {
return true;
}
}
return false;
});
}
/**

View File

@ -216,25 +216,27 @@
{{ setting('company.name') }}
</th>
</tr>
@if (setting('company.address'))
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@endif
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
</th>
</tr>
@endif
@if (setting('company.phone'))
<tr>
<th>
{{ setting('company.phone') }}
</th>
</tr>
@endif
<tr>
<th>
{{ setting('company.email') }}
@ -261,13 +263,18 @@
@stack('name_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')
@ -277,6 +284,8 @@
@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')
@ -286,13 +295,18 @@
@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>