@props(['header' => false, 'values', 'mode']) @php if (!function_exists('getFieldHtml')) { function getFieldHtml(array $args, string $field, bool $header, string $mode): string { $type = $args['type']; $value = $args['value'] ?? ($type === 'int' ? 0 : ''); $rowType = 'div'; $classes = ['p-3 border-opacity-40 border-' . env('ACCENT_COLOR') . ' grow basis-0 border min-w-[6rem]', ($type === 'int' ? 'text-right' : 'text-left'), ($mode === 'tableVertical' ? 'max-w-[8rem] min-h-[5rem]' : ''), ($header ? 'font-bold' : '')]; $html = '<' . $rowType . ' class="' . implode(' ', $classes) . '">'; $valueHtml = match ($type) { 'string' => $value, 'int' => $value . ($args['unit'] ?? ''), 'image' => '' }; if (!empty($args['link'])) { $html .= '' . $valueHtml . ''; } else { $html .= $valueHtml; } $html .= '' . $rowType . '>'; return $html; } } @endphp