zainalab
zainalab
FFilament
Created by zainalab on 8/7/2024 in #❓┊help
How to replace the original file, imageEditor
No description
1 replies
FFilament
Created by zainalab on 3/4/2024 in #❓┊help
Dynamic form for product prices
I want to apply a dynamic form to ProductResource based on the existing license list.
products
- id
- name
products
- id
- name
licenses
- id
- name
licenses
- id
- name
product_price
- id
- license_id
- product_id
- price
- promo_price
product_price
- id
- license_id
- product_id
- price
- promo_price
Table products hasMany to product_price, product_price(product_id) belongsTo to products, and also license_id belongTo to licenses. I want to create a form based on a list of licenses by entering price and promo_price in the product_price table I have tried but not achieved
Group::make(function(Livewire $livewire, ?Model $record) {
if ($livewire instanceof Pages\EditProduct) {
$productPrices = $record->productPrices;

return collect($productPrices)->map(function($price) {
$license = $price->license;

return Section::make($price->id)
->heading(str($license->name)->headline())
->id("data.productPrices.record-{$price->id}")
->schema([
Placeholder::make(json_encode($license)),
TextInput::make("record-{$price->id}.price")->numeric()->required(),
TextInput::make("record-{$price->id}.promo_price")->numeric()->required(),
]);
})->toArray();
} elseif ($livewire instanceof Pages\CreateProduct) {
return collect(License::all())->map(function($license) {
return Section::make(str($license->name)->headline())
->schema([
Placeholder::make(json_encode($license)),
TextInput::make('productPrices.price')->numeric()->required(),
TextInput::make('productPrices.promo_price')->numeric()->required(),
]);
})->toArray();
} else {
throw new \InvalidArgumentException('Unsupported $livewire instance.');
}
})->statePath('productPrices');
Group::make(function(Livewire $livewire, ?Model $record) {
if ($livewire instanceof Pages\EditProduct) {
$productPrices = $record->productPrices;

return collect($productPrices)->map(function($price) {
$license = $price->license;

return Section::make($price->id)
->heading(str($license->name)->headline())
->id("data.productPrices.record-{$price->id}")
->schema([
Placeholder::make(json_encode($license)),
TextInput::make("record-{$price->id}.price")->numeric()->required(),
TextInput::make("record-{$price->id}.promo_price")->numeric()->required(),
]);
})->toArray();
} elseif ($livewire instanceof Pages\CreateProduct) {
return collect(License::all())->map(function($license) {
return Section::make(str($license->name)->headline())
->schema([
Placeholder::make(json_encode($license)),
TextInput::make('productPrices.price')->numeric()->required(),
TextInput::make('productPrices.promo_price')->numeric()->required(),
]);
})->toArray();
} else {
throw new \InvalidArgumentException('Unsupported $livewire instance.');
}
})->statePath('productPrices');
4 replies
FFilament
Created by zainalab on 8/11/2023 in #❓┊help
In Mode Dark, Select Option not dark
6 replies
FFilament
Created by zainalab on 5/3/2023 in #❓┊help
I need appropriate to always show modal
i need something to always show modal to enter purchase code in all admin pages. example:
public function boot(): void
{
if ($license !== 'valid') {
// what is always to open modal?
}
}
public function boot(): void
{
if ($license !== 'valid') {
// what is always to open modal?
}
}
6 replies
FFilament
Created by zainalab on 4/7/2023 in #❓┊help
Fail, Upload zip file
20 replies
FFilament
Created by zainalab on 4/6/2023 in #❓┊help
How can i show modal on all admin pages?
I will create a function to display a modal form on all pages to ask the user, if there is a new user who has not completed the payment bill?
6 replies