Becker Maxime
Becker Maxime
FFilament
Created by Becker Maxime on 6/28/2024 in #❓┊help
Form modification recovery problem
I can't retrieve changes from my edit form. Do you have a solution ?
protected function getSaveFormAction(): Action
{
dd($this->form->getState());
if (auth()->user()->artist->modify_number_invoice == 0) {
return Action::make('save')
->requiresConfirmation()
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->action(function ($data) {
// dd($this->form->getState());
$artist = auth()->user()->artist;
if ($artist->number_invoice != $data['number_invoice']) {
$artist->number_invoice = $data['number_invoice'];
$artist->save();
}
parent::save();
})
->modalHeading(
'Si vous confirmez, vous ne pourrez plus modifier le début de l\'indexation des numéros de la facture.'
)
->modalDescription(
'Êtes-vous sûr de vouloir utiliser ce numéro ?'
)
->form([
TextInput::make('number_invoice')
->label(__('artist-resource.field.number_invoice'))
->numeric()
->formatStateUsing(function () {
return auth()->user()->artist->number_invoice;
})
])
->submit(null)
->keyBindings(['mod+s']);
} else {
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s']);
}
}
protected function getSaveFormAction(): Action
{
dd($this->form->getState());
if (auth()->user()->artist->modify_number_invoice == 0) {
return Action::make('save')
->requiresConfirmation()
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->action(function ($data) {
// dd($this->form->getState());
$artist = auth()->user()->artist;
if ($artist->number_invoice != $data['number_invoice']) {
$artist->number_invoice = $data['number_invoice'];
$artist->save();
}
parent::save();
})
->modalHeading(
'Si vous confirmez, vous ne pourrez plus modifier le début de l\'indexation des numéros de la facture.'
)
->modalDescription(
'Êtes-vous sûr de vouloir utiliser ce numéro ?'
)
->form([
TextInput::make('number_invoice')
->label(__('artist-resource.field.number_invoice'))
->numeric()
->formatStateUsing(function () {
return auth()->user()->artist->number_invoice;
})
])
->submit(null)
->keyBindings(['mod+s']);
} else {
return Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s']);
}
}
2 replies
FFilament
Created by Becker Maxime on 11/15/2023 in #❓┊help
filepload display problem
My image is saved in storage/app/public but is not displayed in my component, whereas in v2 I had the preview. Is there any configuration to be done?
10 replies
FFilament
Created by Becker Maxime on 11/14/2023 in #❓┊help
reactive action
Hello, Is it possible with livewire v3 to simulate a page reload, i.e. to update a page action dynamically without reloading the page?
4 replies
FFilament
Created by Becker Maxime on 10/31/2023 in #❓┊help
Action update a component
Is it possible to update a component after an action? example :
EditRecord.php getHeaderActions():
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->url(fn($record): string => route('generate.payement.quote', ['id' => $record->id]))
->openUrlInNewTab()
->hidden(function ($record) {
return !is_numeric($record->artist->vat_rate)
|| !is_numeric($record->deposit_amount)
|| !$record->artist->key_stripe
|| $record->status == Quote::PAID;
}),
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->url(fn($record): string => route('generate.payement.quote', ['id' => $record->id]))
->openUrlInNewTab()
->hidden(function ($record) {
return !is_numeric($record->artist->vat_rate)
|| !is_numeric($record->deposit_amount)
|| !$record->artist->key_stripe
|| $record->status == Quote::PAID;
}),
Resource.php form():
Forms\Components\Select::make('status')
->disabled(function ($record) {
return $record?->invoice;
})
->options([
Quote::UNPAID => 'Non payé',
Quote::PENDING => 'En attente',
Quote::PAID => 'Payé',
])
->label(__('quote-resource.field.status')),
Forms\Components\Select::make('status')
->disabled(function ($record) {
return $record?->invoice;
})
->options([
Quote::UNPAID => 'Non payé',
Quote::PENDING => 'En attente',
Quote::PAID => 'Payé',
])
->label(__('quote-resource.field.status')),
I'd like my buttons to appear when I update my selection without having to reload the page. Is this possible?
2 replies
FFilament
Created by Becker Maxime on 10/27/2023 in #❓┊help
Update repeater
https://flareapp.io/share/VmeWKgz7
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
update
`artist_lead`
SET
`artist_id` = 16,
`artist_lead`.`updated_at` = 2023 -10 -27 13: 50: 46
WHERE
`` = 15
AND `` = 15
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
update
`artist_lead`
SET
`artist_id` = 16,
`artist_lead`.`updated_at` = 2023 -10 -27 13: 50: 46
WHERE
`` = 15
AND `` = 15
Repeater::make('leadArtists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artist_id')
->searchable()
->relationship('artist', 'name')
->getSearchResultsUsing(fn(string $search): array => Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
Repeater::make('leadArtists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artist_id')
->searchable()
->relationship('artist', 'name')
->getSearchResultsUsing(fn(string $search): array => Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
why my fields are empty ?
25 replies
FFilament
Created by Becker Maxime on 10/27/2023 in #❓┊help
Repeater pivot
Hi, I'm having a problem with the repeater. My problem: I've created a pivot table but I don't understand why it doesn't go into the pivot table but into the artist table, so it creates a new artist for me every time I add it, when my aim is for it to register only in my pivot table.
Repeater::make('artists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artists')
->searchable()
->getSearchResultsUsing(fn(string $search): array =>
Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
Repeater::make('artists')
->required()
->relationship()
->label(__('lead-resource.repeater.field.artists'))
->schema([
Forms\Components\Select::make('artists')
->searchable()
->getSearchResultsUsing(fn(string $search): array =>
Artist::where('name', 'like', "{$search}%")
->orWhere('first_name', 'like', "{$search}%")
->orWhere('zip_code', 'like', "{$search}%")
->select('id', 'name', 'first_name', 'zip_code')
->limit(50)
->get()
->mapWithKeys(fn($artist) => [$artist->id => "{$artist->first_name} {$artist->name} - {$artist->zip_code}"])
->toArray())
->getOptionLabelUsing(function ($value): ?string {
$artist = Artist::find($value);
return "{$artist->first_name} {$artist->name} - {$artist->zip_code}";
})
->label(__('lead-resource.repeater.field.name'))
->columnSpan(2),
7 replies
FFilament
Created by Becker Maxime on 10/23/2023 in #❓┊help
Error configure.php
I'd like to create a filament plugin, I've retrieved the "Filament Plugin Skeleton" template, but I get an error when I type php./configure.php PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /home/beckerm/Projects/customers-management/configure.php on line 139
13 replies
FFilament
Created by Becker Maxime on 10/12/2023 in #❓┊help
Widget Table
I'd like to create a modal that allows me to open the form. What can I do?
class TracksEvent extends TableWidget
{
protected static string $view = 'filament.resources.event-resource.widgets.tracks-event';

public ?Event $record = NULL;
protected int|string|array $columnSpan = "full";

public function addTracks()
{

}

protected function getTableHeaderActions(): array
{

return [
Action::make('import_playlist')
->label(__('event-resource.widget.tracks-event.action.import_playlist'))
->modalHeading("Ajouter des dates d'absences")
->requiresConfirmation()
->button()
->action('addTracks')
->form([
Select::make('tracks.playlist')
->relationship('tracks')
->required(),
]),
];
}
class TracksEvent extends TableWidget
{
protected static string $view = 'filament.resources.event-resource.widgets.tracks-event';

public ?Event $record = NULL;
protected int|string|array $columnSpan = "full";

public function addTracks()
{

}

protected function getTableHeaderActions(): array
{

return [
Action::make('import_playlist')
->label(__('event-resource.widget.tracks-event.action.import_playlist'))
->modalHeading("Ajouter des dates d'absences")
->requiresConfirmation()
->button()
->action('addTracks')
->form([
Select::make('tracks.playlist')
->relationship('tracks')
->required(),
]),
];
}
8 replies
FFilament
Created by Becker Maxime on 10/11/2023 in #❓┊help
Open a new tab
Is it possible to open this url in a new tab?
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->action(function ($record) {
$url = Quote::createStripeSession($record, $record->artist);
return redirect($url);
})
->hidden(function ($record) {
return (bool)$record->invoice;
}),
Action::make('paid_deposit_amount')
->label(__('quote-resource.action.paid_deposit_amount'))
->requiresConfirmation()
->action(function ($record) {
$url = Quote::createStripeSession($record, $record->artist);
return redirect($url);
})
->hidden(function ($record) {
return (bool)$record->invoice;
}),
11 replies
FFilament
Created by Becker Maxime on 10/10/2023 in #❓┊help
why use a relationship manager?
Hello, I've created a custom page but I can't make a ship relationship on my section. I get an error: Call to a member function quote() on null What can I do?
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
2 replies
FFilament
Created by Becker Maxime on 10/9/2023 in #❓┊help
need or not relation manager to display data in a custom page
Hello, I've created a custom page but I can't make a ship relationship on my section. I get an error: Call to a member function quote() on null What can I do?
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
<?php

namespace App\Filament\Resources\InvoiceResource\Pages;

use App\Filament\Resources\InvoiceResource;
use App\Models\Invoice;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Resources\Pages\Page;

class ViewInvoice extends Page
{
protected static string $resource = InvoiceResource::class;

protected static string $view = 'filament.resources.invoice-resource.pages.view-invoice';

public ?Invoice $record = NULL;

public function getTitle(): string
{
return __('invoice-resource.viewInvoice.title');
}

protected function getFormSchema(): array
{
$tab = array();
// if ($this->record->method_payment == Invoice::BANK_TRANSFER) {
$tab = [
Group::make()
->schema([
Section::make(__('invoice-resource.section.invoice_information'))
->relationship('quote', 'this')
->schema([
Select::make('name')
->options(function () {
dd($this->record->quote);
return $record->quote;
})
->label(__('artist-resource.field.name')),
])
])
];
// }
return $tab;
}
}
2 replies
FFilament
Created by Becker Maxime on 10/9/2023 in #❓┊help
text input relationShip
Hello, I can't get my quote via the form.
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Section::make(__('quote-resource.section.client_information'))
->schema([
Forms\Components\TextInput::make('quote.name')
->label(__('quote-resource.field.name'))
->required()
->maxLength(255),
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Section::make(__('quote-resource.section.client_information'))
->schema([
Forms\Components\TextInput::make('quote.name')
->label(__('quote-resource.field.name'))
->required()
->maxLength(255),
I'm in my resource, I don't understand why I can't get my quote since it works in my table.
9 replies
FFilament
Created by Becker Maxime on 10/5/2023 in #❓┊help
navigationGroups translate
Hello, I'd like to sort my groups by adding my translation. Is this possible?
8 replies
FFilament
Created by Becker Maxime on 8/29/2023 in #❓┊help
pop-up window when the account is about to be disconnected
I would like to display a pop-up window indicating that the user is about to be logged out.
3 replies
FFilament
Created by Becker Maxime on 8/29/2023 in #❓┊help
filter problem
I'm getting an error when I filter for my signed enrolments: nothing is displayed.
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
protected function getTableFilters(): array
{
return [
Filter::make('is_signed')->label('Archive')->query(function (Builder $query, array $data): Builder {
if ($data['isActive'] === true) {
return $query->where('is_signed', true);
}
return $query;
}),
];
}
16 replies
FFilament
Created by Becker Maxime on 8/14/2023 in #❓┊help
Update v3
I can't update the domain en domains, what should I do ? I've done a composer update and a filament:upgrade but it still doesn't update the HasRoutes folder.
27 replies
FFilament
Created by Becker Maxime on 8/14/2023 in #❓┊help
Table query from api
Is it possible to use the getTableQuery function via an api ? I use a mongoDB database but the laravelMongo extension is no longer maintained (laravel 9) so I was thinking of using a node.js proxy to make the connection between the laravel and the mongo. Is this possible ?
5 replies
FFilament
Created by Becker Maxime on 8/4/2023 in #❓┊help
Widgets v2 to v3
how to create a tablewidget or formwidget on v3 ?
8 replies
FFilament
Created by Becker Maxime on 7/24/2023 in #❓┊help
Is it possible to change the color of the text input value?
Hello, I'd like to know if it's possible to change the color of the text input's value. For example,
5 replies
FFilament
Created by Becker Maxime on 7/21/2023 in #❓┊help
Select multiple getSearchResultsUsing()
Hello, I have a problem when searching on a multiple select when I run it, it changes the intutile of the options by the ids and not the names. Select::make('skills')->required()->multiple()->searchable()->getSearchResultsUsing(fn(string $search) => AlternativeOccupation::where('name', 'like', "{$search}%")->limit(50)->pluck('name', 'id'))->getOptionLabelUsing(fn($value): ?string => AlternativeOccupation::find($value)?->name),
6 replies