Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-20 #21

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions resources/views/layouts/resource/detail-accordion.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div class="accordion my-1" id="accordion-detail">
<div class="accordion-item">
<h1 class="accordion-header" id="accordion-header-0">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-item-0"
aria-expanded="true" aria-controls="accordion-item-0">
@if (!empty($modelLabel))
@if (!empty($accordionlLabel))
{{ __(':model_label :accordion_label: :model_attribute', ['model_label' => $modelLabel, 'accordion_label' => $accordionlLabel, 'model_attribute' => $data->getAttributeValue($meta['info']['model_attribute'])]) }}
@else
{{ __(':model_label: :model_attribute', ['model_label' => $modelLabel, 'model_attribute' => $data->getAttributeValue($meta['info']['model_attribute'])]) }}
@endif
@endif
</button>
</h1>
<div id="accordion-item-0" class="accordion-collapse collapse show" aria-labelledby="accordion-header-0"
data-bs-parent="#accordion-detail">
<div class="accordion-body">
<div class="d-flex justify-content-end">
@include('playground::layouts.resource.detail-actions', ['css' => 'mb-3'])
</div>
@yield('detail-accordion-body-header')
@yield('detail-accordion-body')
@includeWhen($withInfo, 'playground::layouts.resource.detail-info')

@if ($withAccordionFlags)
<div class="col-sm-6 col-md-4 mb-3">
<div class="">
@yield('detail-information-flags')
</div>
</div>
@endif

@if ($withAccordionTimestamps)
<div class="col-sm-6 col-md-4 mb-3">
<div class="card">
@include('playground::layouts.resource.detail-timestamps')
</div>
</div>
@endif

@yield('detail-accordion-body-footer')
</div>
</div>
</div>
</div>
52 changes: 52 additions & 0 deletions resources/views/layouts/resource/detail-actions.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@if ($withDelete || $withEdit)
<div class="btn-group {{$css ?? 'float-end'}}" role="group"
aria-label="{{ __(':model_label Controls and Actions', ['model_label' => $meta['info']['model_label']]) }}">
<button id="detail-actions" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"
aria-expanded="false">
<span class="fas fa-gear"></span> {{ __('Actions') }}
</button>
<ul class="dropdown-menu" aria-labelledby="detail-actions">
@if($data->trashed())
<form method="POST" action="{{ $routeRestore }}" novalidate>
@csrf
@method('put')
<button class="dropdown-item text-success" role="button">
{{ __('Restore') }} <span class="fa-solid fa-recycle float-end"></span>
</button>
</form>
@else
@if(!$data->locked)
<a class="dropdown-item text-success" href="{{ $routeEdit }}" role="button">
{{ __('Edit') }} <span class="fas fa-edit float-end"></span>
</a>
@endif
@endif
@if($data->locked)
<form method="POST" action="{{ $routeUnlock }}" novalidate>
@csrf
@method('delete')
<button class="dropdown-item text-warning" role="button">
{{ __('Unlock') }} <span class="fa-solid fa-lock-open float-end"></span>
</button>
</form>
@else
@if(!$data->trashed())
<form method="POST" action="{{ $routeLock }}" novalidate>
@csrf
@method('put')
<button class="dropdown-item text-warning" role="button">
{{ __('Lock') }} <i class="fa-solid fa-lock float-end"></i>
</button>
</form>
<form method="POST" action="{{ $routeDelete }}" novalidate>
@csrf
@method('delete')
<button class="dropdown-item text-danger" role="button">
{{ __('Trash') }} <span class="fas fa-trash float-end"></span>
</button>
</form>
@endif
@endif
</ul>
</div>
@endif
34 changes: 34 additions & 0 deletions resources/views/layouts/resource/detail-card.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div class="card my-1">
@if($withCardHeader)
<div class="card-header">
@include('playground::layouts.resource.detail-actions')
<h1>{{ __($data->getAttributeValue($meta['info']['model_attribute'])) }}</h1>
</div>
@endif
@if ($withImage && $data && $data->image)
<div class="card-header">
<img class="card-img-top" src="{{ $data->image }}" alt="{{ __(':model_label Image', ['model_label' => $meta['info']['model_label']]) }}">
</div>
@endif
@if($withCardBody)
<div class="card-body">
@yield('detail-card-body-header')
@yield('detail-card-body')
@includeWhen($withInfo, 'playground::layouts.resource.detail-info')
@yield('detail-card-body-footer')
</div>
@endif

@if($withCardFlags)
<div class="card-footer">
@yield('detail-information-flags')
</div>
@endif

@if($withCardTimestamps)
<div class="card-footer">
@include('playground::layouts.resource.detail-timestamps')
</div>
@endif

</div>
17 changes: 17 additions & 0 deletions resources/views/layouts/resource/detail-flags.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@if(!empty($data) && $data->deleted_at)
<span class="badge text-bg-danger">
<i class="fas fa-trash"></i>
{{ __('Trashed') }}
</span>
@endif

@if(!empty($flags) && is_array($flags))
@foreach ($flags as $flagKey => $flagMeta)
@if ($data->getAttribute($flagKey))
<span class="badge {{$flagMeta['badge'] ?? 'text-bg-secondary'}}">
<i class="{{$flagMeta['icon'] ?? ''}}"></i>
{{ __($flagMeta['label']) }}
</span>
@endif
@endforeach
@endif
48 changes: 48 additions & 0 deletions resources/views/layouts/resource/detail-info.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<table class="table">
<tbody>
@yield('detail-info-table-header')
<tbody>
<tr>
<th scope="row">{{ __('Slug') }}</th>
<td>{{ $data->slug }}</td>
</tr>
@yield('detail-info-table-body')
@if ($parent)
<tr>
<th scope="row">{{ __('Parent ' . $meta['info']['model_label']) }}</th>
<td>
<a
href="{{ route(sprintf('%1$s.show', $meta['info']['model_route']), [$meta['info']['model_slug'] => $parent->id]) }}">
{{ __($parent->label) }}
</a>
</td>
</tr>
@endif
</tbody>
@yield('detail-info-table-header')
</tbody>
</table>

@if ($data->description)
<h4>{{ __('Description') }}</h4>

<div class="description">{{ $data->description }}</div>
@endif

@if ($data->introduction)
<h4>{{ __('Introduction') }}</h4>

<div class="introduction">{{ $data->introduction }}</div>
@endif

@if ($data->content)
<h4>{{ __('Content') }}</h4>

<div class="content">{!! $data->content !!}</div>
@endif

@if ($data->summary)
<h4>{{ __('Summary') }}</h4>

<div class="summary">{!! $data->summary !!}</div>
@endif
130 changes: 0 additions & 130 deletions resources/views/layouts/resource/detail-information.blade.php

This file was deleted.

45 changes: 45 additions & 0 deletions resources/views/layouts/resource/detail-tables.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@if ($hasTables)
@foreach ($dataDetail['tables'] as $table)
<div class="row" id="{{ sprintf('section-%1$s-%2$s', $meta['info']['model_slug'], $table) }}">
@php
$hasTable = is_string($table) && !empty($dataDetail[$table]) && !empty($dataDetail[$table]['label']) && !empty($$table) && is_object($$table);
@endphp
@continue(!$hasTable)
@php
if (!empty($dataDetail[$table]['table']) && is_array($dataDetail[$table]['table'])) {
$components_table = $dataDetail[$table]['table'];
$components_table['paginator'] = $$table;
} else {
$components_table = [
'columns' => [
$meta['info']['model_attribute'] => [
'label' => ucfirst($meta['info']['model_attribute']),
],
'slug' => [
// 'linkType' => 'slug',
// 'linkRoute' => 'slug',
'label' => 'Slug',
],
],
'modelActions' => true,
'routeEdit' => sprintf('%1$s.edit', $meta['info']['model_route']),
'paginator' => $$table,
'styling' => [
'header' => [
'class' => 'mt-3',
],
],
];
}
@endphp
<div class="row">
<div class="col-md-12">
@component(sprintf('%1$scomponents/table', $package_config['view']), $components_table)
{{ $dataDetail[$table]['label'] }}
@endcomponent
</div>
</div>

</div>
@endforeach
@endif
20 changes: 20 additions & 0 deletions resources/views/layouts/resource/detail-timestamps.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<ul class="list-group list-group-flush">
@if ($data->created_at)
<li class="list-group-item">
{{ __('Created') }}:
<time datetime="{{ $data['created_at']->toW3cString() }}">{{ $data['created_at']->toDayDateTimeString() }}</time>
</li>
@endif
@if ($data->updated_at)
<li class="list-group-item">
{{ __('Updated') }}:
<time datetime="{{ $data['updated_at']->toW3cString() }}">{{ $data['updated_at']->toDayDateTimeString() }}</time>
</li>
@endif
@if ($data->deleted_at)
<li class="list-group-item">
{{ __('Deleted') }}:
<time datetime="{{ $data['deleted_at']->toW3cString() }}">{{ $data['deleted_at']->toDayDateTimeString() }}</time>
</li>
@endif
</ul>
Loading
Loading