From 9c811cec6968d4bf555222972d69b8e45bb36334 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Tue, 6 Feb 2024 17:33:29 +0300 Subject: [PATCH] get the default format from `Infolist::$defaultDateDisplayFormat` --- .../views/errors/date-not-available.blade.php | 4 ++-- .../pages/browse-entry.blade.php | 2 +- .../pages/show-entry.blade.php | 2 +- .../themes/zeus/bolt/fill-forms.blade.php | 23 ++++++++++++------- .../themes/zeus/bolt/show-entry.blade.php | 2 +- src/Concerns/HasUpdates.php | 2 +- src/Contracts/Extension.php | 4 ++++ 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/resources/views/errors/date-not-available.blade.php b/resources/views/errors/date-not-available.blade.php index 59462360..7b1f0d23 100644 --- a/resources/views/errors/date-not-available.blade.php +++ b/resources/views/errors/date-not-available.blade.php @@ -18,9 +18,9 @@ {{ __('Start date') }}: - {{ $zeusForm->start_date->format(\Filament\Tables\Table::$defaultDateTimeDisplayFormat) }}, + {{ $zeusForm->start_date->format(\Filament\Infolists\Infolist::$defaultDateTimeDisplayFormat) }}, {{ __('End date') }}: - {{ $zeusForm->end_date->format(\Filament\Tables\Table::$defaultDateTimeDisplayFormat) }} + {{ $zeusForm->end_date->format(\Filament\Infolists\Infolist::$defaultDateTimeDisplayFormat) }} diff --git a/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php b/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php index 10f9002b..0a466a5f 100644 --- a/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php +++ b/resources/views/filament/resources/response-resource/pages/browse-entry.blade.php @@ -41,7 +41,7 @@ class="rounded-full" @endif

{{ __('created at') }}: - {{ $getRecord->created_at->format('Y.m/d') }}-{{ $getRecord->created_at->format('h:i a') }} + {{ $getRecord->created_at->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}-{{ $getRecord->created_at->format(\Filament\Infolists\Infolist::$defaultTimeDisplayFormat) }}

diff --git a/resources/views/filament/resources/response-resource/pages/show-entry.blade.php b/resources/views/filament/resources/response-resource/pages/show-entry.blade.php index 02a52bd8..57db925e 100644 --- a/resources/views/filament/resources/response-resource/pages/show-entry.blade.php +++ b/resources/views/filament/resources/response-resource/pages/show-entry.blade.php @@ -39,7 +39,7 @@ class="rounded-full" @endif

{{ __('created at') }}: - {{ $response->created_at->format('Y.m/d') }}-{{ $response->created_at->format('h:i a') }} + {{ $response->created_at->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}-{{ $response->created_at->format(\Filament\Infolists\Infolist::$defaultTimeDisplayFormat) }}

diff --git a/resources/views/themes/zeus/bolt/fill-forms.blade.php b/resources/views/themes/zeus/bolt/fill-forms.blade.php index 27700afe..5eb2a8c0 100644 --- a/resources/views/themes/zeus/bolt/fill-forms.blade.php +++ b/resources/views/themes/zeus/bolt/fill-forms.blade.php @@ -16,19 +16,26 @@
@svg('heroicon-o-calendar','h-4 w-4 inline-flex') {{ __('Available from') }}: - {{ optional($zeusForm->start_date)->format('Y/m/d') }}, + {{ optional($zeusForm->start_date)->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}, {{ __('to') }}: - {{ optional($zeusForm->end_date)->format('Y/m/d') }} + {{ optional($zeusForm->end_date)->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}
@endif @endif -
  • - {{ __('Forms') }} - @svg('iconpark-rightsmall-o','fill-current w-4 h-4 mx-3 rtl:rotate-180') -
  • + @if($zeusForm->extensions === null) +
  • + {{ __('Forms') }} + @svg('iconpark-rightsmall-o','fill-current w-4 h-4 mx-3 rtl:rotate-180') +
  • + @else +
  • + {{ \LaraZeus\Bolt\Facades\Extensions::init($zeusForm, 'label') }} + @svg('iconpark-rightsmall-o','fill-current w-4 h-4 mx-3 rtl:rotate-180') +
  • + @endif
  • {{ $zeusForm->name }}
  • @@ -63,9 +70,9 @@ class="bg-white rounded-full shadow-md shadow-custom-100 sm:w-24 object-cover" @svg('heroicon-o-calendar','h-5 w-5 inline-flex') {{ __('Available from') }}: - {{ optional($zeusForm->start_date)->format('Y/m/d') }}, + {{ optional($zeusForm->start_date)->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}, {{ __('to') }}: - {{ optional($zeusForm->end_date)->format('Y/m/d') }} + {{ optional($zeusForm->end_date)->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }} @endif diff --git a/resources/views/themes/zeus/bolt/show-entry.blade.php b/resources/views/themes/zeus/bolt/show-entry.blade.php index a033a0f5..def75eac 100644 --- a/resources/views/themes/zeus/bolt/show-entry.blade.php +++ b/resources/views/themes/zeus/bolt/show-entry.blade.php @@ -44,7 +44,7 @@

    {{ __('created at') }}: - {{ $response->created_at->format('Y.m/d') }}-{{ $response->created_at->format('h:i a') }} + {{ $response->created_at->format(\Filament\Infolists\Infolist::$defaultDateDisplayFormat) }}-{{ $response->created_at->format(\Filament\Infolists\Infolist::$defaultTimeDisplayFormat) }}

    diff --git a/src/Concerns/HasUpdates.php b/src/Concerns/HasUpdates.php index 6279d3ab..47b3a9c6 100644 --- a/src/Concerns/HasUpdates.php +++ b/src/Concerns/HasUpdates.php @@ -8,6 +8,6 @@ trait HasUpdates { public function getLastUpdatedAttribute(): string { - return '' . Carbon::parse($this->updated_at)->format(config('zeus.defaultDateFormat')) . ''; + return '' . Carbon::parse($this->updated_at)->format(\Filament\Infolists\Infolist::$defaultDateTimeDisplayFormat) . ''; } } diff --git a/src/Contracts/Extension.php b/src/Contracts/Extension.php index 824eb4e2..d03d686a 100644 --- a/src/Contracts/Extension.php +++ b/src/Contracts/Extension.php @@ -8,6 +8,10 @@ interface Extension { public function label(): string; + // the home page for your ext to use in the frontend, + // for example with thunder it is: route('thunder.offices.list') + public function route(): string; + /** * before displaying the form, do some checks * for example check if the $data['extensionSlug'] param is existed, or the user is logged in !