@php $id = 'orderPayments'; # LIST COMPONENTS $id_form = "{$id}Insert"; $id_table = "{$id}Records"; $payments = []; $order_id = 0; if( !empty($order) ){ // IT SOULD CONTAIN BOTH REQUIRED ID & PRODUCTS $order_id = $order['id']; $through = "{$order_id}/payments"; $payments = $order['payments']; } $headers = [ [ 'label' => __('table.header.id'), 'target' => 'id', ], [ 'label' => __('table.header.code'), 'target' => 'code', ], [ 'label' => __('table.header.payment'), 'target' => 'label', 'dclass' => 'lefted', ], [ 'label' => __('table.header.cash'), 'target' => 'cash', 'hclass' => 'money', ], [ 'label' => __('table.header.cheque'), 'target' => 'cheque', 'hclass' => 'money', ], [ 'label' => __('table.header.bancomat'), 'target' => 'bancomat', 'hclass' => 'money', ], [ 'label' => __('table.header.transfer'), 'target' => 'transfer', ], [ 'label' => __('table.header.payed'), 'target' => 'created_at', ], [ 'label' => __('table.header.subtotal'), 'target' => 'subtotal', ], [ 'label' => __('table.header.notes'), 'target' => 'notes', 'wclass' => 'notes', 'hclass' => 'notes', 'dclass' => 'notes', ], [ 'label' => __('table.header.delete'), 'target' => '_delete' ], ]; // GET HEADERS TARGETS $col = array_flip( array_column($headers, 'target') ); @endphp @push('style') @endpush {{-- @extends('master') --}}
@include('components.table', [ 'id' => $id_table, // INPUT ID BIND 'class' => 'table cell-border hover order-payments', 'resource' => 'payments', // FORM RESOURCE TARGET 'method' => config('const.crud.delete'), // RESOURCE METHOD AVAILABLE 'through' => false, // THROUGH SPEC 'rows_id' => "id", // ROWS ID FIELD SPEC (DEFAULT ID) 'data' => $payments, // PASS DATA IF ANY 'headers' => $headers, 'footers' => [ [ 'attrs' => 'class="total" colspan="4" style="text-align:right"', 'label' => 'Total' ] ], ])
@push('script') @endpush