Vazaios
Vazaios
FFilament
Created by Vazaios on 7/7/2024 in #❓┊help
Is it not possible to have 2 forms inside a resource form?
A really strange bug occurs when having more than one custom livewire component in the resource form. After an update that makes the form rerender the custom component (the first one in my case) is being destroyed. Console throws exception Uncaught Snapshot missing on Livewire component with id: KVKGAH43Jg6EEsDT4839 Note: I have passed a key() to each component
8 replies
FFilament
Created by Vazaios on 6/30/2024 in #❓┊help
Custom Livewire component that sets a new item to the repeater component inside the resource's form
I have an OrderResource form. Inside that form I use the Repeater component to handle the orderlines entries for the Order Model. Each Orderline item inside the Repeater has a SELECT Input for product_id, quantity, overwrite prices inputs etc. I have made another custom component called Scanner that uses a scanner library for qrcodes. I have made all the logic to find a product and now I am stuck on how to interacts with the form's state and specifically with the repeaters state to set a new entry class Scanner extends Component { public bool $scannerOpen = false; #[On('scanQRCode')] public function addQRProduct($qrcode) { $product = Product::where('qrcode', $qrcode)->first(); if ($product) { Notification::make() ->title('Βρέθηκε το ' . __('Product.label') . ' ' . $qrcode) ->success() ->send(); $newOrderline = [ // product_id // quantity // tax_amount // .... ]; // Update repeaters state... } } }
3 replies
FFilament
Created by Vazaios on 5/9/2024 in #❓┊help
Modify Relation Manager query and get data that are not only related to ownerRecord
I am making an application where I have a Category, Product, Variation models. A category can have many variations and the product can have many variations as well. So we are talking about a morphMany relationship. Inside the ProductResource I have a VariationRelationManager which by default works just fine. However I want to modify the query and also get the variations that belong to the categories the Product belongs to. I face 2 problems here: a) The soft delete scope as well as the search do not work because of an orWhere statement in my query b) When I click on a record to edit, always the first record of the table is being selected for edit - it's like that the is not key identification on the records of the table. Here is how my Table method looks like ->modifyQueryUsing(function (Builder $query) { $categoriesIds = $this->getOwnerRecord()->getAllParentCategoriesIds(); // Recursively get parent categories ids $overrideIds = $this->getOwnerRecord()->variations()->whereNotNull('override_id')->pluck('override_id'); return $query ->where('variant_type', VariantType::Base->value) ->orWhere(function ($query) use ($categoriesIds, $overrideIds) { return $query->where('variationable_type', Category::class) ->whereIn('variationable_id', $categoriesIds) ->whereNotIn('id', $overrideIds) ->where('variant_type', VariantType::Base->value); }); })
3 replies
FFilament
Created by Vazaios on 2/6/2024 in #❓┊help
$dispatch or $wire object are undefined to send an event from JavaScript.
I have made a custom Livewire component that's being used on a custom Filament Page. I am struggling firing an event from inside the JavaScript using either the $wire object or $dispatch one (AlpineJS). I keep getting that both of those are undefined
1 replies
FFilament
Created by Vazaios on 1/30/2024 in #❓┊help
Trigger the collapse of a Form Section component when an input is filled
No description
1 replies