Я работаю в Pos-системе laravel и хочу знать, как сделать раздел / строку таблицы скрытыми только тогда, когда она пуста, равна нулю или равна нулю с лезвием в laravel 5.4, особенно при печати чека?
Я уже пытался использовать операторы @if () @endif, но он не работает.
<table class="" style="width: 290px;">
<thead>
<tr>
<th>@lang('form.items')</th>
<th class="text-center">@lang('form.qty')</th>
<th class="text-center">@lang('form.price')</th>
<th class="text-right">@lang('form.total')</th>
</tr>
</thead>
<tbody>
@foreach($invoice->sold_items as $lineRow)
<tr>
<td class="first-column"><?php echo $lineRow->item->item_name ." - ". $lineRow->unit->unit_name ; ?> </td>
<td class="text-center"><?php echo $lineRow['quantity']; ?></td>
<td class="text-right"><?php echo format_currency($lineRow['unit_price']); ?></td>
<td class="text-right"><?php echo format_currency($lineRow['sub_total']); ?></td>
</tr>
<tr>
<td colspan="4"></td>
</tr>
@endforeach
</tbody>
<tfoot>
@if ($invoice->gross_total)
<tr>
<td colspan="3" class="text-right">@lang('form.gross_total')</td>
<td class="text-right">{{ format_currency( $invoice->gross_total) }}</td>
</tr>
@endif
@if ($invoice->discount_total)
<tr>
<td colspan="3" class="text-right" >@lang('form.discount')</td>
<td class="text-right">{{ format_currency( $invoice->discount_total) }}</td>
</tr>
@endif
@if ($invoice->tax_total)
<tr>
<td colspan="3" class="text-right">@lang('form.tax')</td>
<td class="text-right">{{ format_currency( $invoice->tax_total) }}</td>
</tr>
@endif
@if ($invoice->net_total)
<tr>
<td colspan="3" class="text-right">@lang('form.total')</td>
<td class="text-right">{{ format_currency( $invoice->net_total ) }}</td>
</tr>
@endif
@if ($invoice->cash_rounded_amount)
<tr>
<td colspan="3" class="text-right">@lang('form.cash_round')</td>
<td class="text-right">{{ format_currency( $invoice->cash_rounded_amount ) }}</td>
</tr>
@endif
@if ($invoice->balance)
<tr>
<td colspan="3" class="text-right">@lang('form.balance')</td>
<td class="text-right">{{ format_currency( $invoice->balance ) }}</td>
</tr>
@endif
<tr>
<td colspan="3" class="text-right">@lang('form.tendered')</td>
<td class="text-right">{{ format_currency( $invoice->amount_received ) }}</td>
</tr>
<tr>
<td colspan="3" class="text-right">@lang('form.change')</td>
<td class="text-right">{{ format_currency( $invoice->amount_received - $invoice->balance ) }}</td>
</tr>
</tfoot>
</table>
Я ожидаю, что строки Tax, Cash round и Discount будут невидимы, когда я закажу распечатку квитанции, но она все еще печатается. Я не вижу ошибок в коде в настоящее время. Выходные данные должны отображать поля или строки только тогда, когда они имеют действительную информацию.