Update viewfield state with placeholder addition values
Hello everyone,
I wish update a viewfield state with dynamic placeholder values operation (the last line of the screenshot).
How can I afford this?
I wish update a viewfield state with dynamic placeholder values operation (the last line of the screenshot).
Forms\Components\Placeholder::make('vcpu_cost')
->content(fn (Get $get): string => Number::currency(
Vcpu::where('id', '=', $get('vcpu_id'))
->first()->price,
'EUR',
App::currentLocale())
),
Forms\Components\Placeholder::make('ram_cost')
->content(fn (Get $get): string => Number::currency(
Ram::where('id', '=', $get('ram_id'))
->first()->price,
'EUR',
App::currentLocale())
),
Forms\Components\Placeholder::make('disk_space_cost')
->content(fn (Get $get): string => Number::currency(
$get('disk_space_cost_per_go') * (int) $get('disk_space'),
'EUR',
App::currentLocale())
),
Forms\Components\ViewField::make('total_cost')
->label(__('vmc.total_cost'))
->disabled()
->inlineLabel()
->view('filament.forms.components.horizontal-label-price'),
// I think I have to add something here...Forms\Components\Placeholder::make('vcpu_cost')
->content(fn (Get $get): string => Number::currency(
Vcpu::where('id', '=', $get('vcpu_id'))
->first()->price,
'EUR',
App::currentLocale())
),
Forms\Components\Placeholder::make('ram_cost')
->content(fn (Get $get): string => Number::currency(
Ram::where('id', '=', $get('ram_id'))
->first()->price,
'EUR',
App::currentLocale())
),
Forms\Components\Placeholder::make('disk_space_cost')
->content(fn (Get $get): string => Number::currency(
$get('disk_space_cost_per_go') * (int) $get('disk_space'),
'EUR',
App::currentLocale())
),
Forms\Components\ViewField::make('total_cost')
->label(__('vmc.total_cost'))
->disabled()
->inlineLabel()
->view('filament.forms.components.horizontal-label-price'),
// I think I have to add something here...How can I afford this?
