karim charfaoui
karim charfaoui
FFilament
Created by karim charfaoui on 6/26/2024 in #❓┊help
How to import form schema
resoleved
9 replies
FFilament
Created by karim charfaoui on 6/26/2024 in #❓┊help
How to import form schema
yes i see thanks a lot
9 replies
FFilament
Created by karim charfaoui on 6/26/2024 in #❓┊help
How to import form schema
@awcodes and how can i resolve it please
public static function form(Form $form): Form
{
return $form
->schema([
ArticleForm::Schema
])->colums(3)
}
public static function form(Form $form): Form
{
return $form
->schema([
ArticleForm::Schema
])->colums(3)
}
ArticleForm
class ArticleForm
{
public static function schema():array
{
return [
Forms\Components\TextInput::make('name')
->label('Libellé')
->unique(ignoreRecord: true)
->required()
->maxLength(255),
Forms\Components\TextInput::make('code')
->label('Code')
->required()
->unique(ignoreRecord: true)
->maxLength(255),
Forms\Components\Textarea::make('description')
->label('Description')
->columnSpanFull(),
];
}
}
class ArticleForm
{
public static function schema():array
{
return [
Forms\Components\TextInput::make('name')
->label('Libellé')
->unique(ignoreRecord: true)
->required()
->maxLength(255),
Forms\Components\TextInput::make('code')
->label('Code')
->required()
->unique(ignoreRecord: true)
->maxLength(255),
Forms\Components\Textarea::make('description')
->label('Description')
->columnSpanFull(),
];
}
}
Thanks for your help
9 replies
FFilament
Created by karim charfaoui on 6/22/2024 in #❓┊help
Fill repeater on createView
No description
10 replies
FFilament
Created by karim charfaoui on 6/22/2024 in #❓┊help
Fill repeater on createView
plz any help commande mean order
10 replies
FFilament
Created by karim charfaoui on 6/22/2024 in #❓┊help
Fill repeater on createView
an this my repeater on InvoiceResource
Repeater::make('commandeItems')
->label('Articles')
->relationship('commandeItems')
->schema([
Forms\Components\Select::make('article_id')
->options(Article::all()->pluck('name', 'id'))
->searchable(),
Forms\Components\TextInput::make('quantity')
->required()
->numeric(),
Forms\Components\TextInput::make('unit_price_ht')
->required()
->numeric(),
Forms\Components\Select::make('tva')
->required()
->enum(TvaEnum::class)
->options(TvaEnum::class),
Forms\Components\Hidden::make('unit_price_ttc')
->required(),
Forms\Components\TextInput::make('total_price_ht')
->readOnly()
->numeric(),
Forms\Components\TextInput::make('total_price_ttc')
->readOnly()
->required()
->numeric(),
])
Repeater::make('commandeItems')
->label('Articles')
->relationship('commandeItems')
->schema([
Forms\Components\Select::make('article_id')
->options(Article::all()->pluck('name', 'id'))
->searchable(),
Forms\Components\TextInput::make('quantity')
->required()
->numeric(),
Forms\Components\TextInput::make('unit_price_ht')
->required()
->numeric(),
Forms\Components\Select::make('tva')
->required()
->enum(TvaEnum::class)
->options(TvaEnum::class),
Forms\Components\Hidden::make('unit_price_ttc')
->required(),
Forms\Components\TextInput::make('total_price_ht')
->readOnly()
->numeric(),
Forms\Components\TextInput::make('total_price_ttc')
->readOnly()
->required()
->numeric(),
])
10 replies
FFilament
Created by karim charfaoui on 6/22/2024 in #❓┊help
Fill repeater on createView
an dthis my mapCommandeItemsForm()
protected function mapCommandeItemsForForm(): array
{
if (!$this->commande || !$this->commande->commandeItems) {
return [];
}

return $this->commande->commandeItems->map(function ($commandeItem) {
return [
'article_id' => $commandeItem->article_id,
'quantity' => $commandeItem->quantity,
'unit_price_ht' => $commandeItem->unit_price_ht,
'unit_price_ttc' => $commandeItem->unit_price_ttc,
'total_price_ht' => $commandeItem->total_price_ht,
'total_price_ttc' => $commandeItem->total_price_ttc,
'tva' => $commandeItem->tva,
];
})->toArray();
}
protected function mapCommandeItemsForForm(): array
{
if (!$this->commande || !$this->commande->commandeItems) {
return [];
}

return $this->commande->commandeItems->map(function ($commandeItem) {
return [
'article_id' => $commandeItem->article_id,
'quantity' => $commandeItem->quantity,
'unit_price_ht' => $commandeItem->unit_price_ht,
'unit_price_ttc' => $commandeItem->unit_price_ttc,
'total_price_ht' => $commandeItem->total_price_ht,
'total_price_ttc' => $commandeItem->total_price_ttc,
'tva' => $commandeItem->tva,
];
})->toArray();
}
thenks for your help
10 replies
FFilament
Created by karim charfaoui on 1/14/2024 in #❓┊help
Move Tenant Selector
@Rajunda keep me touch ty
7 replies
FFilament
Created by karim charfaoui on 1/14/2024 in #❓┊help
Move Tenant Selector
ty
7 replies
FFilament
Created by karim charfaoui on 1/14/2024 in #❓┊help
Move Tenant Selector
??
7 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
done thank you
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
@justlasse thanks a lot it's work
Tables\Columns\TextColumn::make('schools')
->badge()
->formatStateUsing(fn($state) => $state->commercial_name)
->color(fn(User $record, $state) => ($state->id == $record->current_school_id) ? 'success': 'primary')
->separator(',')
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('schools')
->badge()
->formatStateUsing(fn($state) => $state->commercial_name)
->color(fn(User $record, $state) => ($state->id == $record->current_school_id) ? 'success': 'primary')
->separator(',')
->sortable()
->searchable(),
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
thanks
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
I will think of another approach perhaps with ->state()
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
ok
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
how can i do that ??
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
No description
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
i need that the badge of the current school be success else primary
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
public function currentSchool(): BelongsTo
{
return $this->belongsTo(School::class, 'current_school_id');
}
public function currentSchool(): BelongsTo
{
return $this->belongsTo(School::class, 'current_school_id');
}
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
@justlasse return true
37 replies