@php use Filament\Forms\Components\Actions\Action; use Filament\Support\Enums\Alignment; use Filament\Support\Enums\MaxWidth; $containers = $getChildComponentContainers(); $addAction = $getAction($getAddActionName()); $cloneAction = $getAction($getCloneActionName()); $deleteAction = $getAction($getDeleteActionName()); $moveDownAction = $getAction($getMoveDownActionName()); $moveUpAction = $getAction($getMoveUpActionName()); $reorderAction = $getAction($getReorderActionName()); $isReorderableWithButtons = $isReorderableWithButtons(); $extraItemActions = $getExtraItemActions(); $extraActions = $getExtraActions(); $visibleExtraItemActions = []; $visibleExtraActions = []; $headers = $getHeaders(); $renderHeader = $shouldRenderHeader(); $stackAt = $getStackAt(); $hasContainers = count($containers) > 0; $emptyLabel = $getEmptyLabel(); $streamlined = $isStreamlined(); $statePath = $getStatePath(); foreach ($extraActions as $extraAction) { $visibleExtraActions = array_filter( $extraActions, fn (Action $action): bool => $action->isVisible(), ); } foreach ($extraItemActions as $extraItemAction) { $visibleExtraItemActions = array_filter( $extraItemActions, fn (Action $action): bool => $action->isVisible(), ); } $hasActions = $reorderAction->isVisible() || $cloneAction->isVisible() || $deleteAction->isVisible() || $moveUpAction->isVisible() || $moveDownAction->isVisible() || filled($visibleExtraItemActions); @endphp
merge($getExtraAttributes())->class([ 'table-repeater-component space-y-6 relative', 'streamlined' => $streamlined, match ($stackAt) { 'sm', MaxWidth::Small => 'break-point-sm', 'lg', MaxWidth::Large => 'break-point-lg', 'xl', MaxWidth::ExtraLarge => 'break-point-xl', '2xl', MaxWidth::TwoExtraLarge => 'break-point-2xl', default => 'break-point-md', } ]) }} > @if (count($containers) || $emptyLabel !== false)
! $renderHeader, 'table-repeater-header rounded-t-xl overflow-hidden border-b border-gray-950/5 dark:border-white/20' => $renderHeader, ])> @foreach ($headers as $key => $header) @endforeach @if ($hasActions && count($containers)) @endif @if (count($containers)) @foreach ($containers as $uuid => $row) @php $visibleExtraItemActions = array_filter( $extraItemActions, fn (Action $action): bool => $action(['item' => $uuid])->isVisible(), ); $isRepeatedRow = $row->getRawState()['is_repeated_row'] ?? false; $materialCode = $row->getRawState()['material_code'] ?? ''; $colors = [ 'orange', 'blue', 'green', 'yellow', 'red', 'purple', 'gray', 'pink', 'brown', 'black', 'white', ]; // Track used material codes and assign consistent colors static $materialColors = []; if ($isRepeatedRow) { if (!isset($materialColors[$materialCode])) { // Assign next available color to this material code $materialColors[$materialCode] = $colors[count($materialColors) % count($colors)]; } $borderColor = $materialColors[$materialCode]; } else { $borderColor = null; } @endphp @php($counter = 0) @foreach($row->getComponents() as $cell) @if($cell instanceof \Filament\Forms\Components\Hidden || $cell->isHidden()) {{ $cell }} @else @endif @endforeach @if ($hasActions) @endif @if($row->getRawState()['has_hint'] ?? false) @endif @endforeach @else @endif
getAlignment()) { 'center', Alignment::Center => 'text-center', 'right', 'end', Alignment::Right, Alignment::End => 'text-end', default => 'text-start' } ]) style="width: {{ $header->getWidth() }}" > {{ $header->getLabel() }} @if ($header->isRequired()) * @endif {{ trans('table-repeater::components.repeater.row_actions.label') }}
! $streamlined, 'has-hidden-label' => $cell->isLabelHidden(), match($headers[$counter++]->getAlignment()) { 'center', Alignment::Center => 'text-center', 'right', 'end', Alignment::Right, Alignment::End => 'text-end', default => 'text-start' }, ]) style="width: {{ $cell->getMaxWidth() ?? 'auto' }}" > {{ $cell }}
    @foreach ($visibleExtraItemActions as $extraItemAction)
  • {{ $extraItemAction(['item' => $uuid]) }}
  • @endforeach @if ($reorderAction->isVisible())
  • {{ $reorderAction }}
  • @endif @if ($isReorderableWithButtons) @if (! $loop->first)
  • {{ $moveUpAction(['item' => $uuid]) }}
  • @endif @if (! $loop->last)
  • {{ $moveDownAction(['item' => $uuid]) }}
  • @endif @endif @if ($cloneAction->isVisible())
  • {{ $cloneAction(['item' => $uuid]) }}
  • @endif @if ($deleteAction->isVisible())
  • {{ $deleteAction(['item' => $uuid]) }}
  • @endif
Nepakankamas saugojamos žaliavos kiekis, daliai žaliavos taikoma maržinė kaina
{{ $emptyLabel ?: trans('table-repeater::components.repeater.empty.label') }}
@endif @if ($addAction->isVisible() || filled($visibleExtraActions)) @endif