Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

phone-builder.blade.php 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. @php
  2. use Filament\Forms\Components\Actions\Action;
  3. use Filament\Support\Enums\Alignment;
  4. $containers = $getChildComponentContainers();
  5. $blockPickerBlocks = $getBlockPickerBlocks();
  6. $blockPickerColumns = $getBlockPickerColumns();
  7. $blockPickerWidth = $getBlockPickerWidth();
  8. $hasBlockPreviews = $hasBlockPreviews();
  9. $hasInteractiveBlockPreviews = $hasInteractiveBlockPreviews();
  10. $addAction = $getAction($getAddActionName());
  11. $addBetweenAction = $getAction($getAddBetweenActionName());
  12. $cloneAction = $getAction($getCloneActionName());
  13. $collapseAllAction = $getAction($getCollapseAllActionName());
  14. $editAction = $getAction($getEditActionName());
  15. $expandAllAction = $getAction($getExpandAllActionName());
  16. $deleteAction = $getAction($getDeleteActionName());
  17. $moveDownAction = $getAction($getMoveDownActionName());
  18. $moveUpAction = $getAction($getMoveUpActionName());
  19. $reorderAction = $getAction($getReorderActionName());
  20. $extraItemActions = $getExtraItemActions();
  21. $isAddable = $isAddable();
  22. $isCloneable = $isCloneable();
  23. $isCollapsible = $isCollapsible();
  24. $isDeletable = $isDeletable();
  25. $isReorderableWithButtons = $isReorderableWithButtons();
  26. $isReorderableWithDragAndDrop = $isReorderableWithDragAndDrop();
  27. $collapseAllActionIsVisible = $isCollapsible && $collapseAllAction->isVisible();
  28. $expandAllActionIsVisible = $isCollapsible && $expandAllAction->isVisible();
  29. $statePath = $getStatePath();
  30. @endphp
  31. <x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
  32. <div
  33. x-data="{}"
  34. {{
  35. $attributes
  36. ->merge($getExtraAttributes(), escape: false)
  37. ->class(['fi-fo-builder grid gap-y-4'])
  38. }}
  39. >
  40. @if ($collapseAllActionIsVisible || $expandAllActionIsVisible)
  41. <div
  42. @class([
  43. 'flex gap-x-3',
  44. 'hidden' => count($containers) < 2,
  45. ])
  46. >
  47. @if ($collapseAllActionIsVisible)
  48. <span
  49. x-on:click="$dispatch('builder-collapse', '{{ $statePath }}')"
  50. >
  51. {{ $collapseAllAction }}
  52. </span>
  53. @endif
  54. @if ($expandAllActionIsVisible)
  55. <span
  56. x-on:click="$dispatch('builder-expand', '{{ $statePath }}')"
  57. >
  58. {{ $expandAllAction }}
  59. </span>
  60. @endif
  61. </div>
  62. @endif
  63. @if (count($containers))
  64. <ul
  65. x-sortable
  66. data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}"
  67. wire:end.stop="{{ 'mountFormComponentAction(\'' . $statePath . '\', \'reorder\', { items: $event.target.sortable.toArray() })' }}"
  68. class="space-y-6"
  69. >
  70. @php
  71. $hasBlockLabels = $hasBlockLabels();
  72. $hasBlockIcons = $hasBlockIcons();
  73. $hasBlockNumbers = $hasBlockNumbers();
  74. @endphp
  75. @foreach ($containers as $uuid => $item)
  76. @php
  77. $visibleExtraItemActions = array_filter(
  78. $extraItemActions,
  79. fn (Action $action): bool => $action(['item' => $uuid])->isVisible(),
  80. );
  81. $cloneAction = $cloneAction(['item' => $uuid]);
  82. $cloneActionIsVisible = $isCloneable && $cloneAction->isVisible();
  83. $deleteAction = $deleteAction(['item' => $uuid]);
  84. $deleteActionIsVisible = $isDeletable && $deleteAction->isVisible();
  85. $editAction = $editAction(['item' => $uuid]);
  86. $editActionIsVisible = $hasBlockPreviews && $editAction->isVisible();
  87. $moveDownAction = $moveDownAction(['item' => $uuid])->disabled($loop->last);
  88. $moveDownActionIsVisible = $isReorderableWithButtons && $moveDownAction->isVisible();
  89. $moveUpAction = $moveUpAction(['item' => $uuid])->disabled($loop->first);
  90. $moveUpActionIsVisible = $isReorderableWithButtons && $moveUpAction->isVisible();
  91. $reorderActionIsVisible = $isReorderableWithDragAndDrop && $reorderAction->isVisible();
  92. @endphp
  93. <li
  94. wire:key="{{ $this->getId() }}.{{ $item->getStatePath() }}.{{ $field::class }}.item"
  95. x-sortable-item="{{ $uuid }}"
  96. class="flex items-center gap-x-4"
  97. >
  98. <!-- Input Field -->
  99. <div class="w-full">
  100. {{ $item }}
  101. </div>
  102. <!-- Delete Action -->
  103. @if ($deleteActionIsVisible)
  104. <div class="mt-6">
  105. {{ $deleteAction }}
  106. </div>
  107. @endif
  108. </li>
  109. @if (! $loop->last)
  110. @if ($isAddable && $addBetweenAction(['afterItem' => $uuid])->isVisible())
  111. <li class="relative -top-2 !mt-0 h-0">
  112. <div
  113. class="flex w-full justify-center opacity-0 transition duration-75 hover:opacity-100"
  114. >
  115. <div
  116. class="fi-fo-builder-block-picker-ctn rounded-lg bg-white dark:bg-gray-900"
  117. >
  118. <x-filament-forms::builder.block-picker
  119. :action="$addBetweenAction"
  120. :after-item="$uuid"
  121. :columns="$blockPickerColumns"
  122. :blocks="$blockPickerBlocks"
  123. :state-path="$statePath"
  124. :width="$blockPickerWidth"
  125. >
  126. <x-slot name="trigger">
  127. {{ $addBetweenAction(['afterItem' => $uuid]) }}
  128. </x-slot>
  129. </x-filament-forms::builder.block-picker>
  130. </div>
  131. </div>
  132. </li>
  133. @elseif (filled($labelBetweenItems = $getLabelBetweenItems()))
  134. <li
  135. class="relative border-t border-gray-200 dark:border-white/10"
  136. >
  137. <span
  138. class="absolute -top-3 left-3 px-1 text-sm font-medium"
  139. >
  140. {{ $labelBetweenItems }}
  141. </span>
  142. </li>
  143. @endif
  144. @endif
  145. @endforeach
  146. </ul>
  147. @endif
  148. @if ($isAddable && $addAction->isVisible())
  149. <x-filament-forms::builder.block-picker
  150. :action="$addAction"
  151. :blocks="$blockPickerBlocks"
  152. :columns="$blockPickerColumns"
  153. :state-path="$statePath"
  154. :width="$blockPickerWidth"
  155. @class([
  156. 'flex',
  157. match ($getAddActionAlignment()) {
  158. Alignment::Start, Alignment::Left => 'justify-start',
  159. Alignment::Center, null => 'justify-center',
  160. Alignment::End, Alignment::Right => 'justify-end',
  161. default => $alignment,
  162. },
  163. ])
  164. >
  165. <x-slot name="trigger">
  166. {{ $addAction }}
  167. </x-slot>
  168. </x-filament-forms::builder.block-picker>
  169. @endif
  170. </div>
  171. </x-dynamic-component>