@props([ 'structureFile', 'apiUrl', 'createUrl' => null, 'showUrl' => null, 'editUrl' => null, 'deleteUrl' => null, 'extraParams' => [], 'hiddenColumns' => [], 'caption' => null, ]) @php $structurePath = resource_path('active/' . $structureFile); $structure = file_exists($structurePath) ? json_decode(file_get_contents($structurePath), true) : ['columns' => [], 'actions' => []]; $hiddenColumnKeys = collect($hiddenColumns) ->map(fn ($key) => (string) $key) ->filter() ->values() ->all(); if (! empty($hiddenColumnKeys)) { $structure['columns'] = collect($structure['columns'] ?? []) ->reject(fn (array $column) => in_array((string) ($column['key'] ?? ''), $hiddenColumnKeys, true)) ->values() ->all(); } $tableId = 'smart-table-' . md5($structureFile . $apiUrl . uniqid('', true)); $routes = array_filter([ 'create' => $createUrl, 'show' => $showUrl, 'edit' => $editUrl, 'delete' => $deleteUrl, ]); $displayPreferences = app(\Kview\Visualization\Contracts\DisplayPreferences::class); $finance = app(\Kview\Visualization\FinanceFormatter::class); $targetCurrency = $displayPreferences->targetCurrency(); $amountUnitLabel = $finance->amountUnitLabel($targetCurrency); $tableCaption = $caption ?: \Illuminate\Support\Str::headline(pathinfo($structureFile, PATHINFO_FILENAME)).' '.__('kview-ui-data::table.smart.data_suffix'); $smartTablePageSizeOptions = app(\Kview\UiData\PaginationOptions::class)->smartTableSelectOptions(); $smartTranslations = [ 'actions' => __('kview-ui-data::table.smart.actions'), 'delete' => __('kview-ui-data::table.smart.delete'), 'deleteMessage' => __('kview-ui-data::table.smart.delete_message'), 'deleteRecord' => __('kview-ui-data::table.smart.delete_record'), 'edit' => __('kview-ui-data::table.smart.edit'), 'failed' => __('kview-ui-data::table.smart.failed'), 'failedMessage' => __('kview-ui-data::table.smart.failed_message'), 'failedTitle' => __('kview-ui-data::table.smart.failed_title'), 'items' => __('kview-ui-data::table.smart.items'), 'loading' => __('kview-ui-data::table.smart.loading'), 'nextPage' => __('kview-ui-data::table.smart.next_page'), 'noRecords' => __('kview-ui-data::table.smart.no_records'), 'page' => __('kview-ui-data::table.smart.page'), 'previousPage' => __('kview-ui-data::table.smart.previous_page'), 'sortBy' => __('kview-ui-data::table.smart.sort_by'), 'sortCurrent' => __('kview-ui-data::table.smart.sort_current'), 'view' => __('kview-ui-data::table.smart.view'), 'yes' => __('kview-ui-data::table.smart.yes'), 'no' => __('kview-ui-data::table.smart.no'), ]; @endphp
| {{ __('kview-ui-data::table.smart.loading') }} |