Fally
Fally
FFilament
Created by Fally on 9/20/2024 in #❓┊help
Help with opening modal in Page
Ok, apparently I solved it myself. Didn't add my scripts inside @script @endscript tag.
3 replies
FFilament
Created by Rolland on 3/8/2024 in #❓┊help
Unable to find component
Really helped me too, thanks
6 replies
FFilament
Created by Fally on 5/23/2024 in #❓┊help
Problem with dashboard loading all the widgets even those not defined in the panel provider
but i think i used them in resources not in custom pages
6 replies
FFilament
Created by Fally on 5/23/2024 in #❓┊help
Problem with dashboard loading all the widgets even those not defined in the panel provider
I don't remember this being an issue in v2 though
6 replies
FFilament
Created by Fally on 5/23/2024 in #❓┊help
Problem with dashboard loading all the widgets even those not defined in the panel provider
If I comment out that line, dashboard is fine but custom page complains about not finding a view for the widget.
6 replies
FFilament
Created by Fally on 11/9/2023 in #❓┊help
How to properly search encrypted columns in table
I will give it a shot. Thank you!
4 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
So i managed to fix this by setting the product search dropdown to reactive and adding to it afterStateUpdated where I use $set() to set the unit price. For some reason, using $set() inside the Group schema triggers that weird read only problem.
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
If i use reactive on the field as soon as i change anything in it it gets overriden by the $set value. I’ve tried it before
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
im using v2 not v3
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
Sorry but where do i need to use live() ? I can't find any reference in the docs and i tried it on the unit_price form field and the group
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
i'm sorry to tag you in this @Dan Harrin but is there anyway you can help here? I've tried everything, i don't know if this is a bug or not.
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
thanks for your help anyway
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
my point exactly, i even updated to the latest version but this seems like a bug to me
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
it's the initial value as well
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
on group it doesn't trigger
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
Forms\Components\TextInput::make('unit_price')
->afterStateUpdated(function ($context, $get, $set) {
if ($context == 'edit') {
dd($get('unit_price'));
}
})
Forms\Components\TextInput::make('unit_price')
->afterStateUpdated(function ($context, $get, $set) {
if ($context == 'edit') {
dd($get('unit_price'));
}
})
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
Unfortunately it still shows the initial value
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
Yes
27 replies
FFilament
Created by Fally on 9/13/2023 in #❓┊help
Dynamically created form schema setting other field value ignores what user changes as value
Hi @hugomyb , here's the dynamic form schema i'm creating
Forms\Components\Group::make()->schema(function ($get, $set, $context) {
$productId = $get('product_id');
if ($context === 'edit' && $get('type') !== OrderDetail::TYPE_PRODUCT) {
return [];
}
if ($productId) {
$product = Product::find($productId);
if (empty($product)) {
return [];
}


$set('unit_price', ListingHelper::getProductNumericPrice($product));

/* a lot of logic that builds the fields */
return $fields;
}
return [];
})
Forms\Components\Group::make()->schema(function ($get, $set, $context) {
$productId = $get('product_id');
if ($context === 'edit' && $get('type') !== OrderDetail::TYPE_PRODUCT) {
return [];
}
if ($productId) {
$product = Product::find($productId);
if (empty($product)) {
return [];
}


$set('unit_price', ListingHelper::getProductNumericPrice($product));

/* a lot of logic that builds the fields */
return $fields;
}
return [];
})
The problem is with the $set() line. I can't show all the code because discord has a character limit Here's where I check the data for updating.
Tables\Actions\EditAction::make()
->mutateFormDataUsing(function (array $data): array {
if (isset($data['variation'])) {
$data['product_id'] = $data['variation'];
$data['attributes'] = null;
}

return $data;
})
Tables\Actions\EditAction::make()
->mutateFormDataUsing(function (array $data): array {
if (isset($data['variation'])) {
$data['product_id'] = $data['variation'];
$data['attributes'] = null;
}

return $data;
})
27 replies