Files
investbrain/resources/views/livewire/holding-options-form.blade.php
T
hackerESQ d1dbf3af62 fix:improve access controls and language
also adds improved dialogs / modals
2024-10-22 16:48:53 -05:00

65 lines
1.4 KiB
PHP

<?php
use App\Models\Holding;
use Illuminate\Support\Collection;
use Livewire\Attributes\{Computed};
use Livewire\Volt\Component;
use Mary\Traits\Toast;
use Illuminate\Validation\Rule;
new class extends Component {
use Toast;
// props
public Holding $holding;
public Bool $reinvest_dividends = false;
// methods
public function rules()
{
return [
'reinvest_dividends' => ['required', 'boolean'],
];
}
public function mount()
{
$this->reinvest_dividends = $this->holding?->reinvest_dividends ?? false;
}
public function save()
{
$this->holding->update($this->validate());
$this->success(__('Holding options saved'));
$this->dispatch('toggle-holding-options');
}
}; ?>
<div class="" x-data="{ }"> {{-- grid lg:grid-cols-4 gap-10 --}}
<x-ib-form wire:submit="save" class=""> {{-- col-span-3 --}}
<x-toggle
label="{{ __('Reinvest Dividends') }}"
wire:model="reinvest_dividends"
right
hint="{{ __('Automatically generate buy transactions for any dividends earned.') }}"
/>
<x-slot:actions>
<x-button
label="{{ __('Save') }}"
type="submit"
icon="o-paper-airplane"
class="btn-primary"
spinner="save"
/>
</x-slot:actions>
</x-ib-form>
</div>