Jerome V
Jerome V
FFilament
Created by Jerome V on 12/20/2024 in #❓┊help
Create & create another button is still enabled
Problem description I have two observation If the internet is slow and you upload a video and when it's still not 100% uploaded the Create button is clickable If you upload a video and while it's uploading in progress the Create & create another button is clickable Expected behavior On the slow internet connection if the video is not 100% in progress the create button should still be disabled and display error instead that the internet is slow and cannot be uploaded On uploading video while in progress the Create & create another button should be disabled same on the create button Steps to reproduce Just used the typical file upload entry Forms\Components\FileUpload::make('new_advertisement') ->label('New Video') ->maxSize(80000) ->acceptedFileTypes([ 'video/mp4', 'video/mpeg' ]) ->storeFiles(false) ->moveFiles(),
2 replies
FFilament
Created by Jerome V on 12/6/2024 in #❓┊help
Is this possible in dashboard? instead using Date picker I will use tab?
Tabs::make('Date Range') ->tabs([ Tabs\Tab::make('Yesterday') ->label('Yesterday') ->icon('heroicon-o-calendar') ->schema([ // Apply logic for "Yesterday" Select::make('dateFilter') ->default('yesterday') ->hidden() ->afterStateUpdated(fn () => $this->applyDateFilter('yesterday')), ]), Tabs\Tab::make('This Week') ->label('This Week') ->icon('heroicon-o-calendar') ->schema([ // Apply logic for "This Week" Select::make('dateFilter') ->default('this_week') ->hidden() ->afterStateUpdated(fn () => $this->applyDateFilter('this_week')), ]), Tabs\Tab::make('Last 30 Days') ->label('Last 30 Days') ->icon('heroicon-o-calendar') ->schema([ // Apply logic for "Last 30 Days" Select::make('dateFilter') ->default('last_30_days') ->hidden() ->afterStateUpdated(fn () => $this->applyDateFilter('last_30_days')), ]), ])->columnSpanFull(),
3 replies
FFilament
Created by Jerome V on 12/5/2024 in #❓┊help
How to prevent the select in filter?
The case is I want to select the platform first and get the value and map it in another select. The problem is there is no platform column it just a based on the select type which is in Settings example if select platform "web". I want to fetch it in the Type select and in there I want to get the key and value ->filters([ Tables\Filters\SelectFilter::make('platform') ->options(Platform::class) ->searchable() ->optionsLimit(10), Tables\Filters\SelectFilter::make('type') ->options(function ($get) { $platform = $get('platform'); if (!$platform) { return []; } // Fetch the settings key based on the selected platform $settingsKey = "{$platform}_report_types"; $reportTypes = Setting::where('key', $settingsKey)->value('value'); if ($reportTypes) { return collect(json_decode($reportTypes, true))->mapWithKeys(function ($value, $key) { return [$key => $value]; // Format as [key => value] })->toArray(); } return []; }) ->searchable() ->optionsLimit(10), ])
2 replies
FFilament
Created by Jerome V on 12/3/2024 in #❓┊help
No data on textarea, input and select on modal when update or view
I have same issue with this https://github.com/filamentphp/filament/discussions/13488 The case is in my local it's ok but on prod there is no data and got error
Uncaught ReferenceError: state is not defined
Uncaught ReferenceError: state is not defined
How to fix this when you want to use view action or even custom action either of the two is not working on prod and even local from another dev
Tables\Actions\ViewAction::make()
->color('primary'),

or

Action::make('view_form')
->label('View Report')
->modalHeading('Report Details')
->form(fn ($record) => [
Forms\Components\Textarea::make('reason')
->label('Reason')
->readOnly()
->default($record->reason),
Forms\Components\Select::make('status')
->label('Status')
->disabled()
->options(Status::adminActions())
->default($record->status),
Forms\Components\Textarea::make('remarks')
->label('Remarks')
->readOnly()
->default($record->remarks),
])
->action(function (array $data): void {
})
->color('primary')
->icon('heroicon-o-eye'),
Tables\Actions\ViewAction::make()
->color('primary'),

or

Action::make('view_form')
->label('View Report')
->modalHeading('Report Details')
->form(fn ($record) => [
Forms\Components\Textarea::make('reason')
->label('Reason')
->readOnly()
->default($record->reason),
Forms\Components\Select::make('status')
->label('Status')
->disabled()
->options(Status::adminActions())
->default($record->status),
Forms\Components\Textarea::make('remarks')
->label('Remarks')
->readOnly()
->default($record->remarks),
])
->action(function (array $data): void {
})
->color('primary')
->icon('heroicon-o-eye'),
6 replies
FFilament
Created by Jerome V on 11/28/2024 in #❓┊help
How to add additional stacked bar widget?
Since there are default widgets Bar chart - Chart.js documentation Bubble chart - Chart.js documentation Doughnut chart - Chart.js documentation Line chart - Chart.js documentation Pie chart - Chart.js documentation Polar area chart - Chart.js documentation Radar chart - Chart.js documentation Scatter chart - Chart.js documentation how to add additional staked bar chart?
4 replies
FFilament
Created by Jerome V on 11/27/2024 in #❓┊help
How to make navigation in cluster to topNavigation?
I have cluster for advertisement and they want to make the cluster navigation top instead of the usuall left menu.. <?php namespace App\Filament\Clusters; use Filament\Clusters\Cluster; class Advertisement extends Cluster { protected static ?string $navigationIcon = 'heroicon-o-squares-2x2'; }
7 replies
FFilament
Created by Jerome V on 11/4/2024 in #❓┊help
How to add a button inside a section in form?
I want to add unset button to to photo and video Example
Forms\Components\Section::make('Photo')
->schema([
Placeholder::make('photo')
->content(fn ($record) => self::getImageContent($record) )
->visibleOn('edit')
->hidden(fn (?Advertisement $record, Forms\Get $get) =>
($record === null) || (!!$get('new_photo'))
),
Forms\Components\FileUpload::make('new_photo')
->image()
->storeFiles(false)
->moveFiles()
->imageEditor(),
Forms\Components\Button::make('unset_video')
->label('Unset Video')
->color('danger')
->action(fn () => $this->unsetVideo()),
])
->columns(2)
->collapsible()
->collapsed(),

public $unsetPhoto = false;
public $unsetVideo = false;

public function unsetPhoto()
{
$this->unsetPhoto = true;
}

public function unsetVideo()
{
$this->unsetVideo = true;
}
Forms\Components\Section::make('Photo')
->schema([
Placeholder::make('photo')
->content(fn ($record) => self::getImageContent($record) )
->visibleOn('edit')
->hidden(fn (?Advertisement $record, Forms\Get $get) =>
($record === null) || (!!$get('new_photo'))
),
Forms\Components\FileUpload::make('new_photo')
->image()
->storeFiles(false)
->moveFiles()
->imageEditor(),
Forms\Components\Button::make('unset_video')
->label('Unset Video')
->color('danger')
->action(fn () => $this->unsetVideo()),
])
->columns(2)
->collapsible()
->collapsed(),

public $unsetPhoto = false;
public $unsetVideo = false;

public function unsetPhoto()
{
$this->unsetPhoto = true;
}

public function unsetVideo()
{
$this->unsetVideo = true;
}
The case is to store temporary boolean value to update column after save in edit
7 replies
FFilament
Created by Jerome V on 10/31/2024 in #❓┊help
Cannot store select options data in another table
Good day, in some modules it's working... but in this module is not working,, I want to add gender of the user but the userDetails is separate from users table code Resource
Forms\Components\Select::make('detail.gender')
->label('Gender')
->required()
->options(Gender::array())
->placeholder('Select Gender'),
Forms\Components\Select::make('detail.gender')
->label('Gender')
->required()
->options(Gender::array())
->placeholder('Select Gender'),
user model
public function detail(): HasOne
{
return $this->hasOne(UserDetail::class, 'id');
}
public function detail(): HasOne
{
return $this->hasOne(UserDetail::class, 'id');
}
UserDetail
<?php

namespace App\Models;

use App\Cache\UserDetail\UserDetailById;
use App\Enums\UserDetail\Gender;
use App\Models\Contracts\Cacheable;
use App\Observers\UserDetailObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[ObservedBy([UserDetailObserver::class])]
class UserDetail extends Model implements Cacheable
{
use HasFactory;

protected $fillable = ['birthdate','gender'];

protected function casts(): array
{
return [
'birthdate' => 'date',
'gender' => Gender::class,
];
}

public function clearCache(): void
{
(new UserDetailById($this->id))->invalidate();
}
}
<?php

namespace App\Models;

use App\Cache\UserDetail\UserDetailById;
use App\Enums\UserDetail\Gender;
use App\Models\Contracts\Cacheable;
use App\Observers\UserDetailObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[ObservedBy([UserDetailObserver::class])]
class UserDetail extends Model implements Cacheable
{
use HasFactory;

protected $fillable = ['birthdate','gender'];

protected function casts(): array
{
return [
'birthdate' => 'date',
'gender' => Gender::class,
];
}

public function clearCache(): void
{
(new UserDetailById($this->id))->invalidate();
}
}
4 replies
FFilament
Created by Jerome V on 10/2/2024 in #❓┊help
Custom JS is not working in custom view page in RelationshipManager
So the case is this 1. We use video js using CDN What I did on my adminPanelProvider I register the CDN
public function boot(): void
{
FilamentAsset::register([
Js::make('video-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/video.min.js'),
Js::make('videojs-contrib-eme', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-eme.min.js'),
Css::make('video-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.min.css'),
]);

}
public function boot(): void
{
FilamentAsset::register([
Js::make('video-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/video.min.js'),
Js::make('videojs-contrib-eme', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-eme.min.js'),
Css::make('video-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.min.css'),
]);

}
and on the custom view for (EpisodesRelationManger) infolist, I want to include the custom scripts
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
View::make('filament.pages.series.episodes.video')
->columnSpanFull()
->viewData(['drmData' => $this->drmData])
]);
}
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
View::make('filament.pages.series.episodes.video')
->columnSpanFull()
->viewData(['drmData' => $this->drmData])
]);
}
This the custom view video.blade.php (The below scripts is not seen in devtools elements)
@if($getRecord())

<div class="h-screen flex justify-center gap-3 w-full">
<div class="h-screen aspect-video ">
<video id="video-player" class="video-js vjs-default-skin vjs-16-9" controls data-setup="{}" />
</div>
</div>
@push('scripts')
<script>
var drmData = {!! json_encode($drmData, JSON_HEX_TAG) !!};
</script>
<script type="text/javascript" src="{{ asset('js/pallycon-helper.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/video-player.js') }}"></script>
@endpush
@endif
@if($getRecord())

<div class="h-screen flex justify-center gap-3 w-full">
<div class="h-screen aspect-video ">
<video id="video-player" class="video-js vjs-default-skin vjs-16-9" controls data-setup="{}" />
</div>
</div>
@push('scripts')
<script>
var drmData = {!! json_encode($drmData, JSON_HEX_TAG) !!};
</script>
<script type="text/javascript" src="{{ asset('js/pallycon-helper.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/video-player.js') }}"></script>
@endpush
@endif
1 replies
FFilament
Created by Jerome V on 10/1/2024 in #❓┊help
How to register CDN in Laravel-Filament?
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/video.min.js"></script> <script src="https://cdn.tailwindcss.com"></script> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-eme.min.js"></script> I tried to include it in app.blade.php but when I check it in dev tools elements it's not there
8 replies
FFilament
Created by Jerome V on 9/7/2024 in #❓┊help
Is it possible to make custom infolist entry for video?
I have this advertisement management, but in the view only the banner is displayed but in the advertisement videos is not since there is no video in infolist...
6 replies
FFilament
Created by Jerome V on 8/10/2024 in #❓┊help
How to put action on toggleColumn?
Is it possible to do like this? I want to use the toggle to block user the case is the blocked_at = timestamp blocked_by = unsignedBigInt
Tables\Columns\ToggleColumn::make('blocked_at')
->label('Block')
->sortable()
->onColor('success')
->offColor('danger')
->action(function ($record, $state) {

$blocked_at = $state ? now() : null;
$blocked_by = $state ? auth()->id() : null;

$record->update([
'blocked_at' => $blocked_at,
'blocked_by' => $blocked_by,
]);
}),
Tables\Columns\ToggleColumn::make('blocked_at')
->label('Block')
->sortable()
->onColor('success')
->offColor('danger')
->action(function ($record, $state) {

$blocked_at = $state ? now() : null;
$blocked_by = $state ? auth()->id() : null;

$record->update([
'blocked_at' => $blocked_at,
'blocked_by' => $blocked_by,
]);
}),
5 replies
FFilament
Created by Jerome V on 8/8/2024 in #❓┊help
How to handle image preview on edit if the image is from relationship
No description
1 replies
FFilament
Created by Jerome V on 8/7/2024 in #❓┊help
How to add table inside the tab content?
I have a task to create a view page on users. The scope is every tab content is different page/component so that it will not load heavily.. All the tabs are tables content example.. in my UserResource I created infolist for tab
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Users')
->icon('heroicon-m-user-group')
->schema([

]),
Tabs\Tab::make('Subscriptions')
->schema([
// ...
]),
Tabs\Tab::make('Favorites')
->schema([
// ...
]),
])
]);
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Users')
->icon('heroicon-m-user-group')
->schema([

]),
Tabs\Tab::make('Subscriptions')
->schema([
// ...
]),
Tabs\Tab::make('Favorites')
->schema([
// ...
]),
])
]);
}
How to attached/make users table in the user tab? I want to test this first and follow other tabs 1. by inserting directy the table? or 2. make a livewire component then render ?
9 replies