@foreach($headers as $header) @if( in_array($header['target'], [ '_view', '_edit', '_delete', '_archive', '_restore' ]) ) @else @endif @endforeach @foreach($data as $row ) @php # SELECT ROW ID (DEFAULT ID) $row_id = Arr::get($row, (@$rows_id ?: 'id') ); @endphp $value ) data-item-{{$key}}="{{ Arr::get($row, $value) }}" @endforeach @endif > @foreach($headers as $header) @switch($header['target']) @case('_view') @if( empty($row->viewable) ) @else @endif @break @case('_edit') @if( empty($row->editable) ) @else @endif @break @case('_archive') @if( empty($row->archivable) ) @else @endif @break @case('_restore') @if( empty($row->restorable) ) @else @endif @break @case('_delete') {{-- isset($row->deletable) && $row->deletable===false --}} @if( empty($row->deletable) ) {{-- PRODUCT CATEGORY ASSOCIATION CONSTRAIT WIL CAUSE AND ERROR ON DELETE IF PRODUCTS onclick="Table.remove(this)"--}} @else {{-- FOR LAYOUT COMPATIBILITY --}} @endif @break @case('_button') @case('_button1') @case ('_button2') {{-- BUTTON LAYOUT --}} @break @default @php $value = Arr::get($row, $header['target']); @endphp @endswitch @endforeach @endforeach @unless( empty($footers) ) @foreach($footers as $footer) @endforeach @endunless
{{ @$header['label'] }} {{ $header['label'] }}
@switch(true) @case( @$header['hclass']=='hidden' ) {{ $value }} @break @case( !isset($value) ) @if( isset($header['empty']) ) {{ $header['empty'] }} @else {{ @$row[$header['default']] ?: 'Undefined' }} @endif @break @default @if( empty($header['wclass']) ) {{ $value }} @else
{{ $value }}
@endif @endswitch
{{ $footer['label'] }}
{{-- # VIEW DATA 'id' => 'categoriesInput', // FORM ID 'static' => '0', // NOT DINAMIC JUST ALWAYS INS 'table' => 'categoriesRecord', // (ID) TABLE REF 'resource' => 'categories', // ! DB TABLE RESOURCE NAME (RESOURCE ID) ! 'wysihtml5' => true // TABLE CONFIG FORMAT jQuery(document).ready(function() { // INIT FORM {{ $id }}Table.init({ setup: { options: { // DATATABLE DEFS }, labels: { delete_question: "Some text to translate", delete_title: "Confirm", delete_action: "Delete", delete_cancel: "Cancel" }, components: function(selector){ // USE SELECTOR TO UPDATE BACK TRIGGER // console.log('Attempting to call triggers with', selector); $(selector).find('div.notes').popover({ html: true, trigger: 'hover', placement : 'left', animation : false, content :function(){ var text = $(this).text().trim(); if(text==''){ return '
Empty
'; } else { return `
${text}
`; } } }); // UPDATE ON CLICK $(selector).find('a.edit').off().on('click', function(e){ {{ $id }}Table.edit(e.target); }) // BIND DELETE FUNCTIONS $(selector).find('a.delete').off().on('click', function(e){ {{ $id }}Table.remove(e.target); }); }, onPreload: function(){ console.log('preloaded'); }, onComplete: function(){ console.log('completed'); }, onReload: function(){ console.log('reloaded'); }, successEdit: function(id){ console.log('loaded '+id); }, successUpdate: function(id){ console.log('updated '+id); }, successDelete: function(response){ console.log('success Delete'); }, } }); }); --}} @push('script') @endpush