Chore: Upgrade to Laravel 12 + remove Mary and Jetstream dependencies (#141)
* docs: remove requirement for setting APP_KEY manually * optimize date picker * clean up modals * spot light working * reorganization * add lazy load * wip * remove filament * styling
This commit is contained in:
@@ -1,33 +1,34 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Illuminate\Support\Collection;
|
||||
use App\Traits\Toast;
|
||||
use App\Traits\WithTrimStrings;
|
||||
use Livewire\Attributes\Rule;
|
||||
use Livewire\Volt\Component;
|
||||
use Mary\Traits\Toast;
|
||||
use App\Traits\WithTrimStrings;
|
||||
|
||||
new class extends Component {
|
||||
new class extends Component
|
||||
{
|
||||
use Toast;
|
||||
use WithTrimStrings;
|
||||
|
||||
// props
|
||||
public ?Portfolio $portfolio;
|
||||
public Bool $hideCancel = false;
|
||||
|
||||
public bool $hideCancel = false;
|
||||
|
||||
#[Rule('required|min:5')]
|
||||
public String $title;
|
||||
public string $title;
|
||||
|
||||
#[Rule('sometimes|nullable')]
|
||||
public ?String $notes;
|
||||
public ?string $notes;
|
||||
|
||||
#[Rule('sometimes|nullable|boolean')]
|
||||
public Bool $wishlist = false;
|
||||
public bool $wishlist = false;
|
||||
|
||||
public Bool $confirmingPortfolioDeletion = false;
|
||||
public bool $confirmingPortfolioDeletion = false;
|
||||
|
||||
// methods
|
||||
public function mount()
|
||||
public function mount()
|
||||
{
|
||||
if (isset($this->portfolio)) {
|
||||
|
||||
@@ -49,7 +50,7 @@ new class extends Component {
|
||||
|
||||
public function save()
|
||||
{
|
||||
$portfolio = (new Portfolio())->fill($this->validate());
|
||||
$portfolio = (new Portfolio)->fill($this->validate());
|
||||
|
||||
$portfolio->save();
|
||||
|
||||
@@ -68,24 +69,24 @@ new class extends Component {
|
||||
|
||||
<div class="w-full md:w-3/4">
|
||||
|
||||
<x-ib-form wire:submit="{{ $portfolio ? 'update' : 'save' }}" >
|
||||
<x-input label="{{ __('Title') }}" wire:model="title" required />
|
||||
<x-ui.form wire:submit="{{ $portfolio ? 'update' : 'save' }}" >
|
||||
<x-ui.input label="{{ __('Title') }}" wire:model="title" required />
|
||||
|
||||
<x-ib-textarea class="mt-1" label="{{ __('Notes') }}" wire:model="notes" rows="4" />
|
||||
<x-ui.textarea class="mt-1" label="{{ __('Notes') }}" wire:model="notes" rows="4" />
|
||||
|
||||
@if (isset($this->portfolio))
|
||||
@livewire('share-portfolio-form', ['portfolio' => $portfolio])
|
||||
@endif
|
||||
|
||||
<x-toggle label="{{ __('Wishlist') }}" wire:model="wishlist" >
|
||||
<x-ui.toggle label="{{ __('Wishlist') }}" wire:model="wishlist" >
|
||||
<x-slot:hint>
|
||||
{{ __('Treat this portfolio as a "wishlist" (holdings will be excluded from realized gains, unrealized gains, and dividends)') }}
|
||||
</x-slot:hint>
|
||||
</x-toggle>
|
||||
</x-ui.toggle>
|
||||
|
||||
<x-slot:actions>
|
||||
@if ($portfolio)
|
||||
<x-button
|
||||
<x-ui.button
|
||||
wire:click="$toggle('confirmingPortfolioDeletion')"
|
||||
wire:loading.attr="disabled"
|
||||
class="btn text-error"
|
||||
@@ -95,13 +96,13 @@ new class extends Component {
|
||||
@endif
|
||||
|
||||
@if (!$hideCancel)
|
||||
<x-button label="{{ __('Cancel') }}" link="/dashboard" />
|
||||
<x-ui.button label="{{ __('Cancel') }}" link="/dashboard" />
|
||||
@endif
|
||||
<x-button label="{{ $portfolio ? __('Update') : __('Create') }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
|
||||
<x-ui.button label="{{ $portfolio ? __('Update') : __('Create') }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
|
||||
</x-slot:actions>
|
||||
</x-ib-form>
|
||||
</x-ui.form>
|
||||
|
||||
<x-confirmation-modal wire:model.live="confirmingPortfolioDeletion">
|
||||
<x-ui.confirmation-modal wire:model.live="confirmingPortfolioDeletion">
|
||||
<x-slot name="title">
|
||||
{{ __('Delete Portfolio') }}
|
||||
</x-slot>
|
||||
@@ -111,13 +112,13 @@ new class extends Component {
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="footer">
|
||||
<x-button class="btn-outline" wire:click="$toggle('confirmingPortfolioDeletion')" wire:loading.attr="disabled">
|
||||
<x-ui.button class="btn-outline" wire:click="$toggle('confirmingPortfolioDeletion')" wire:loading.attr="disabled">
|
||||
{{ __('Cancel') }}
|
||||
</x-secondary-button>
|
||||
|
||||
<x-button class="ms-3 btn-error text-white" wire:click="delete" wire:loading.attr="disabled">
|
||||
<x-ui.button class="ms-3 btn-error text-white" wire:click="delete" wire:loading.attr="disabled">
|
||||
{{ __('Delete Portfolio') }}
|
||||
</x-button>
|
||||
</x-ui.button>
|
||||
</x-slot>
|
||||
</x-confirmation-modal>
|
||||
</x-ui.confirmation-modal>
|
||||
</div>
|
||||
Reference in New Issue
Block a user