@php
$id = 'productImages';
if(!isset($product_id)) $product_id = 0;
$headers = [
[
'label' => __('table.header.id'),
'target' => 'id',
],
[
'label' => __('table.header.preview'),
'target' => 'url',
'dclass' => 'display-hide',
],
[
'label' => __('table.header.file'),
'hclass' => 'media-filename',
'dclass' => 'lefted',
'target' => 'name',
],
[
'label' => __('table.header.type'),
'target' => 'type',
'dclass' => 'lefted',
],
[
'label' => __('table.header.size'),
'target' => 'size.readable',
],
[
'label' => __('table.header.uploaded'),
'target' => 'uploaded',
],
[
'label' => __('table.header.download'),
'class' => 'btn btn-success download',
'hclass' => 'handle',
'icon' => 'fa fa-download',
'target' => '_button'
],
[
'label' => __('table.header.delete'),
'target' => '_delete'
]
];
// GET HEADERS TARGETS
$col = array_flip( array_column($headers, 'target') );
@endphp
@include('components.media', [
'id' => $id, // INPUT ID BIND
'tabs' => [
'active' => 'all_imgs',
'records' => [
'id' => 'all_imgs',
'title' => __('label.media.files')
],
'upload' => [
'id' => 'add_imgs',
'title' => __('label.media.add-files')
],
],
'config' => @$config,
'through' => empty($config) ? "{$product_id}/images" : true,
'target' => @$route ?? 'product.images.store',
'resource' => 'products',
'headers' => $headers,
'records' => empty($config) ? $records : [],
])
{{-- TRACK IF REQUEST FROM SERVICE--}}
@if(@$config)
@push('style')
@endpush
@push('ready')
@endpush
@endif