ThatWebGuy
ThatWebGuy
FFilament
Created by ThatWebGuy on 9/16/2024 in #❓┊help
Reusable component with multiple form input fields
Thanks @toeknee . Any suggestions on how I can do a mutation on the data if it’s used? Similar to the above question, I’d like to only have to write the mutation once.
6 replies
FFilament
Created by ThatWebGuy on 4/3/2024 in #❓┊help
Update each repeater field 2 fields outside the repeater
public static function updateLineTotal(Get $get, Set $set): void {
$lineTotal = $get('items.qty') * $get('items.rate');
if($get('items.discount_type') === 'fixed') {
$lineTotal -= $get('items.discount');
} else {
$lineTotal -= ($get('items.discount') / 100 * $lineTotal);
}
$set('line_total', number_format($lineTotal, 2, '.', ''));
}

public static function updateTotals(Get $get, Set $set): void {
$lineItems = collect($get('items'))->filter(fn($item) => !empty($item['qty']) && !empty($item['title']));

$subtotal = $lineItems->reduce(function($subtotal, $item) {
$linetotal = ($item['qty'] * $item['rate']);
if($item['discount_type'] === 'fixed') {
$linetotal -= $item['discount'];
} else {
$linetotal -= ($item['discount'] / 100 * $subtotal);
}
return $subtotal + $linetotal;
}, 0);

$set('sub_total', number_format($subtotal, 2, '.', ''));
$set('total', number_format($subtotal - ($subtotal - ($get('discount'))) + ($subtotal * ($get('tax') / 100)), 2, '.', ''));

}
public static function updateLineTotal(Get $get, Set $set): void {
$lineTotal = $get('items.qty') * $get('items.rate');
if($get('items.discount_type') === 'fixed') {
$lineTotal -= $get('items.discount');
} else {
$lineTotal -= ($get('items.discount') / 100 * $lineTotal);
}
$set('line_total', number_format($lineTotal, 2, '.', ''));
}

public static function updateTotals(Get $get, Set $set): void {
$lineItems = collect($get('items'))->filter(fn($item) => !empty($item['qty']) && !empty($item['title']));

$subtotal = $lineItems->reduce(function($subtotal, $item) {
$linetotal = ($item['qty'] * $item['rate']);
if($item['discount_type'] === 'fixed') {
$linetotal -= $item['discount'];
} else {
$linetotal -= ($item['discount'] / 100 * $subtotal);
}
return $subtotal + $linetotal;
}, 0);

$set('sub_total', number_format($subtotal, 2, '.', ''));
$set('total', number_format($subtotal - ($subtotal - ($get('discount'))) + ($subtotal * ($get('tax') / 100)), 2, '.', ''));

}
2 replies
FFilament
Created by ThatWebGuy on 8/19/2023 in #❓┊help
Form fails when inside createOptionForm but works when it's on it's own page
This is the exact error I'm getting. "Call to a member function roles() on null"
4 replies
FFilament
Created by ThatWebGuy on 8/19/2023 in #❓┊help
Form fails when inside createOptionForm but works when it's on it's own page
This is the select for another form.
Select::make('primary_contact')
->label('Primary Contact')
->options(User::all()->pluck('name', 'id'))
->searchable()
->columnSpan(1)
->createOptionForm([
TextInput::make('name')
->required(),
TextInput::make('email')
->email()
->unique()
->required(),
Select::make('roles')
->multiple()
->relationship('roles', 'name'),
TextInput::make('password')
->password()
->required()
]),
Select::make('primary_contact')
->label('Primary Contact')
->options(User::all()->pluck('name', 'id'))
->searchable()
->columnSpan(1)
->createOptionForm([
TextInput::make('name')
->required(),
TextInput::make('email')
->email()
->unique()
->required(),
Select::make('roles')
->multiple()
->relationship('roles', 'name'),
TextInput::make('password')
->password()
->required()
]),
4 replies
FFilament
Created by ThatWebGuy on 8/19/2023 in #❓┊help
Form fails when inside createOptionForm but works when it's on it's own page
This is my User form...
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\TextInput::make('email')
->email()
->required(),
Forms\Components\Select::make('roles')
->multiple()
->relationship('roles', 'name'),
Forms\Components\TextInput::make('password')
->password()
->required(),
]);
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\TextInput::make('email')
->email()
->required(),
Forms\Components\Select::make('roles')
->multiple()
->relationship('roles', 'name'),
Forms\Components\TextInput::make('password')
->password()
->required(),
]);
4 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
I had typed static::getTemplateSchema instead of static::getTemplateSchemas
14 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
@pboivin Just wanted to let you know that I found my issue. It was a livewire issue, just a typo on my end.
14 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
Is there a place to report these kinds of issues? Is it something that I need to report?
14 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
Ahhh. Okay. Thanks for that info @pboivin
14 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
I get what appreas to be a small dump from livewire.
(el2) => {
if(isntElement(el2))
return;
return el2.hasAttribute(`wire:key`) ? el2.getAttribute(`wire.key`) : el2.hasAttribute(`wire:id`) ? el2.getAttribute(`wire:id`) : el2...
(el2) => {
if(isntElement(el2))
return;
return el2.hasAttribute(`wire:key`) ? el2.getAttribute(`wire.key`) : el2.hasAttribute(`wire:id`) ? el2.getAttribute(`wire:id`) : el2...
It cuts off where I put it.
14 replies
FFilament
Created by ThatWebGuy on 8/12/2023 in #❓┊help
CMS-Pages with Filament V3
@pboivin Thanks for the article. Unfortunately I get the same result with this setup. It just doesn't render in the page template content.
14 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
@Hugh Messenger Thanks for catching that. Late night programming at it's best. I've wanted to use Laravel Idea but it's only for PHPStorm which I don't own. Have a hard time paying yearly for an IDE when there's perfectly good ones that are free.
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
protected $fillable = ['name', 'contact_id', 'email', 'phone', 'fax', 'type'];
protected $fillable = ['name', 'contact_id', 'email', 'phone', 'fax', 'type'];
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: contact.client_id
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
This is the error I'm getting SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
Yes
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
Admin panel. Sorry about that @Hugh Messenger
17 replies
FFilament
Created by ThatWebGuy on 8/6/2023 in #❓┊help
Saving related items when editing/creating a resource
Okay, so I found my issue but I now have a new one. My related items have a client_id on them but when I save or edit, it doesn't populate the needed field.
17 replies