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\ServiceProvider;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\View\Factory as ViewFactory;
class Macro extends ServiceProvider class Macro extends ServiceProvider
{ {
@ -26,6 +27,15 @@ class Macro extends ServiceProvider
return $string; 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') }} {{ setting('company.name') }}
</th> </th>
</tr> </tr>
<tr> @if (setting('company.address'))
<th> <tr>
{!! nl2br(setting('company.address')) !!} <th>
</th> {!! nl2br(setting('company.address')) !!}
</tr> </th>
<tr> </tr>
<th> @endif
@if (setting('company.tax_number')) @if (setting('company.tax_number'))
<tr>
<th>
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }} {{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif </th>
</th> </tr>
</tr> @endif
<tr> @if (setting('company.phone'))
<th> <tr>
@if (setting('company.phone')) <th>
{{ setting('company.phone') }} {{ setting('company.phone') }}
@endif </th>
</th> </tr>
</tr> @endif
<tr> <tr>
<th> <th>
{{ setting('company.email') }} {{ setting('company.email') }}
@ -261,38 +263,50 @@
@stack('name_input_end') @stack('name_input_end')
</th> </th>
</tr> </tr>
<tr> @if ($invoice->contact_address || $__env->hasStack('address_input_start', 'address_input_end'))
<th> <tr>
@stack('address_input_start') <th>
{!! nl2br($invoice->contact_address) !!} @stack('address_input_start')
@stack('address_input_end') @if ($invoice->contact_address)
</th> {!! nl2br($invoice->contact_address) !!}
</tr> @endif
<tr> @stack('address_input_end')
<th> </th>
@stack('tax_number_input_start') </tr>
@if ($invoice->contact_tax_number) @endif
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }} @if ($invoice->contact_tax_number || $__env->hasStack('tax_number_input_start', 'tax_number_input_end'))
@endif <tr>
@stack('tax_number_input_end') <th>
</th> @stack('tax_number_input_start')
</tr> @if ($invoice->contact_tax_number)
<tr> {{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
<th> @endif
@stack('phone_input_start') @stack('tax_number_input_end')
@if ($invoice->contact_phone) </th>
{{ $invoice->contact_phone }} </tr>
@endif @endif
@stack('phone_input_end') @if ($invoice->contact_phone || $__env->hasStack('phone_input_start', 'phone_input_end'))
</th> <tr>
</tr> <th>
<tr> @stack('phone_input_start')
<th> @if ($invoice->contact_phone)
@stack('email_start') {{ $invoice->contact_phone }}
{{ $invoice->contact_email }} @endif
@stack('email_input_end') @stack('phone_input_end')
</th> </th>
</tr> </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> </tbody>
</table> </table>
</div> </div>