@php $cols = $config['cols']; $rows = $config['rows']; $perPage = $cols * $rows; $totalLabels = count($labels); $totalPages = ceil($totalLabels / $perPage); $idx = 0; @endphp @for($page = 0; $page < $totalPages; $page++) @if($page > 0)
@endif
@for($row = 0; $row < $rows && $idx < $totalLabels; $row++)
@for($col = 0; $col < $cols && $idx < $totalLabels; $col++) @php $label = $labels[$idx]; $idx++; @endphp
@if(in_array('name', $showFields) || in_array('company', $showFields))
@if(in_array('name', $showFields)) {{ \Illuminate\Support\Str::limit($label['name'], 20, '') }} @endif @if(in_array('company', $showFields)) {{ $label['company'] }} @endif
@endif @if(in_array('barcode', $showFields) && !empty($label['barcode']))
{!! \Modules\Inventory\Http\Controllers\BarcodePrintController::barcodeSvg($label['barcode'], $config['label_w'] - 8, $config['barcode_h']) !!}
{{ $label['barcode'] }}
@endif @if(in_array('sp', $showFields) || in_array('mrp', $showFields))
@if(in_array('sp', $showFields)) SP: {{ number_format($label['sale_price'], 0) }} @endif @if(in_array('mrp', $showFields)) MRP: {{ number_format($label['mrp'], 0) }} @endif
@endif @if(in_array('packing_date', $showFields) || in_array('best_before', $showFields))
@if(in_array('packing_date', $showFields) && !empty($label['packing_date'])) PD: {{ \Carbon\Carbon::parse($label['packing_date'])->format('d/m/Y') }} @endif @if(in_array('best_before', $showFields) && !empty($label['best_before'])) Best before {{ $label['best_before'] }} @endif
@endif
@endfor
@endfor
@endfor