@php $title = $data['title'] ?? ''; $subtitle = $data['subtitle'] ?? ''; $tableTitle = $data['table_title'] ?? ''; $tableTitleBg = $data['table_title_bg_color'] ?? '#333333'; $tableTitleText = $data['table_title_text_color'] ?? '#ffffff'; $tableTitleAlign = $data['table_title_alignment'] ?? 'center'; $tableContent = $data['table_content'] ?? ''; $hasHeader = isset($data['has_header']) ? (bool)$data['has_header'] : true; $striped = isset($data['striped']) ? (bool)$data['striped'] : true; $showSearch = isset($data['show_search']) ? (bool)$data['show_search'] : true; $searchPosition = $data['search_position'] ?? 'right'; $textAlignment = $data['text_alignment'] ?? 'center'; $tableWidth = $data['table_width'] ?? '100%'; if ($tableWidth === 'custom') { $tableWidth = ($data['table_width_custom'] ?? '100') . '%'; } $colWidths = $data['column_widths'] ?? []; $sectionId = $section['id'] ?? uniqid(); // Processamento do conteúdo TSV com suporte a multi-linha (fgetcsv) $tableData = []; $stream = fopen('php://temp', 'r+'); fwrite($stream, $tableContent); rewind($stream); while (($row = fgetcsv($stream, 0, "\t")) !== false) { if (count($row) === 1 && $row[0] === null) continue; $tableData[] = $row; } fclose($stream); $alignClass = 'text-center'; if ($textAlignment === 'left') $alignClass = 'text-left'; if ($textAlignment === 'right') $alignClass = 'text-right'; $searchJustify = 'pull-right'; if ($searchPosition === 'left') $searchJustify = 'pull-left'; if ($searchPosition === 'center') $searchJustify = 'text-center'; // Função para converter URLs em links clicáveis de forma segura $linkify = function($text) { $text = e($text); // Escape XSS primeiro $pattern = '/(https?:\/\/[^\s]+)/i'; $replacement = '$1'; return preg_replace($pattern, $replacement, $text); }; @endphp @if($title || $subtitle) @if($title) {{ $title }} @endif @if($subtitle) {{ $subtitle }} @endif @endif @if($showSearch) Pesquisar na tabela de {{ $tableTitle ?: $title }} A tabela abaixo será filtrada automaticamente conforme você digita. @endif @if($tableTitle) {{ $tableTitle }} @endif @if(!$showSearch && !$tableTitle) @endif {{ $tableTitle ?: ($title ?: 'Tabela interativa') }} @if($hasHeader && count($tableData) > 0) @php $headerRow = array_shift($tableData); @endphp @foreach($headerRow as $cIdx => $col) @php $w = $colWidths[$cIdx] ?? null; @endphp {{ $col }} @endforeach @endif @forelse($tableData as $rowIndex => $rowData) @foreach($rowData as $cIdx => $col) @php $w = $colWidths[$cIdx] ?? null; @endphp {!! $linkify($col) !!} @endforeach @empty Nenhum dado disponível na tabela. @endforelse Nenhum registro encontrado para sua busca.
{{ $subtitle }}
Nenhum dado disponível na tabela.
Nenhum registro encontrado para sua busca.