Skip to content

Commit

Permalink
FEATURE ✨ Improvements with templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeblauw committed Nov 26, 2024
1 parent e56a135 commit 2a4b328
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 6 deletions.
2 changes: 1 addition & 1 deletion resources/views/generic/flux/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-ba-admin-layout title="Edit {{$config->name_to_use}} {{$model->id}}" :titleShow="false">
<x-ba-admin-layout title="Edit {{$config->name_to_use}} {{$model->id}}" :showTitle="false">

@if($errors->count() > 0) @ray($errors) @endif

Expand Down
2 changes: 1 addition & 1 deletion resources/views/generic/flux/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-ba-admin-layout title="{{$config->name_to_use}}" :titleShow="false">
<x-ba-admin-layout title="{{$config->name_to_use}}" :showTitle="false">

<style>
#indexTable_filter input[type="search"] {
Expand Down
49 changes: 49 additions & 0 deletions resources/views/generic/flux/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<x-ba-admin-layout title="Details for {{$model->title ?? $model->name}}">

<div class="bg-white shadow overflow-hidden sm:rounded-b-lg border-t-2 border-{{$config->color ?? 'blue-500'}}">

{{-- Card Top Header --}}
<div class="px-4 py-5 sm:px-6 flex justify-between bg-gray-50">
<div>
<h3 class="text-lg leading-6 font-medium text-gray-900">
{{__('Details for')}} <span class="font-bold">{{$model->title}}</span>
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
{{ __('Record of type') }} {{$config->name_to_use}}
</p>
</div>
<div class="my-auto flex gap-x-2">
@if( View::exists('admin.'.$config->modelsname().'._form'))
<x-ba-admin-button href="{{$config->getEditUrl($model->getKey())}}" class="py-1 bg-blue-500">Edit</x-ba-admin-button>
@endif
<x-ba-delete-button action="{{$config->getDestroyUrl($model->getKey()) }}" />
</div>

</div>

<div class="border-t border-gray-200 px-4 py-5 sm:p-0">
<dl class="sm:divide-y sm:divide-gray-200">
@foreach($attributesToShow as $attribute)
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-5 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">
{{$attribute}}
</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-4">
@if($model->$attribute === true) <i class="fad fa-check-square text-green-300"></i> @endif
@if($model->$attribute === false) <i class="fal fa-square"></i> @endif
{{ is_object($model->$attribute) ? 'Object - cannot show details' : $model->$attribute }}
</dd>
</div>
@endforeach

</dl>
</div>
<div class="text-sm text-gray-400 px-6 float-right">
Last updated <span class="font-bold">{{$model->updated_at->diffForHumans()}}</span> ({{$model->updated_at}})
<span class="text-blue-300">|</span>
Created <span class="font-bold">{{$model->created_at->diffForHumans()}}</span> ({{$model->created_at}})
</div>
</div>


</x-ba-admin-layout>
5 changes: 2 additions & 3 deletions resources/views/layouts/flux/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
@endif

{{-- Auto generated navlist from informatio in defined menu --}}
@if( !isset($navlist) && $sidebar )
@if($showSidebar && !isset($navlist) && $sidebar )
<div class="w-full md:w-[220px] shrink-0 pb-4 mr-10">
<flux:navlist>
@foreach($sidebar as $label => $link)
Expand All @@ -94,9 +94,8 @@
@endif

<div class="flex-1 max-md:pt-6 self-stretch mb-6">
{{ is_array($sidebar) ? implode(',', $sidebar) : $sidebar }}

@if($titleShow && $title)
@if($showTitle && $title)
<flux:heading size="xl" level="1">{{$title}}</flux:heading>

@if($subtitle)
Expand Down
3 changes: 2 additions & 1 deletion src/View/Components/Adminlayout/AdminLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class AdminLayout extends Component
public function __construct(
public ?string $title = null,
public ?string $subtitle = null,
public ?bool $titleShow = true,
public ?bool $showTitle = true,
public ?bool $showSidebar = true,
) {}

public function render()
Expand Down

0 comments on commit 2a4b328

Please sign in to comment.