move to volt sfc

This commit is contained in:
hackerESQ
2024-08-01 20:44:41 -05:00
parent f0b66051bf
commit 395fa95eb5
6 changed files with 298 additions and 50 deletions
@@ -1,5 +1,16 @@
<x-app-layout>
<livewire:portfolio.manage-portfolio-form submit="save" />
<?php
</x-app-layout>
use App\Models\Portfolio;
use Livewire\Attributes\{Title, Rule};
use Livewire\Volt\Component;
new class extends Component {
public bool $showDrawer2 = false;
public ?Portfolio $portfolio;
}; ?>
<div>
<livewire:portfolio.manage-portfolio-form submit="save" />
</div>
@@ -1,8 +1,6 @@
<?php
use App\Models\Category;
use App\Models\Portfolio;
use App\Models\User;
use Illuminate\Support\Collection;
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
@@ -12,8 +10,8 @@ new class extends Component {
use Toast;
public string $submit;
public ?Portfolio $portfolio;
public Bool $hideCancel = false;
#[Rule('required|min:5')]
public string $title;
@@ -79,14 +77,16 @@ new class extends Component {
<div class="grid lg:grid-cols-4 gap-10">
<x-form wire:submit="{{ $submit }}" class="col-span-3">
<x-input label="Title" wire:model="title" />
<x-input label="Title" wire:model="title" required />
{{-- <x-select label="Category" wire:model="category_id" placeholder="Select a category" :options="$categories" /> --}}
<x-textarea label="Body" wire:model="notes" rows="5" />
<x-slot:actions>
@if (!$hideCancel)
<x-button label="Cancel" link="{{ url()->previous() }}" />
@endif
<x-button label="{{ $submit == 'save' ? 'Create' : 'Update' }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
</x-slot:actions>
</x-form>
@@ -1,5 +1,110 @@
<x-app-layout>
<livewire:portfolio.manage-portfolio-form :portfolio="$portfolio" submit="update" />
<?php
</x-app-layout>
use App\Models\Portfolio;
use Livewire\Attributes\{Title, Rule};
use Livewire\Volt\Component;
new class extends Component {
public bool $showDrawer2 = false;
public ?Portfolio $portfolio;
}; ?>
<div>
<div class="p-8 bg-base-200 rounded-md ">
<div class="flex justify-between mb-8">
<h1 class="text-2xl font-medium">{{ $portfolio->title }} </h1>
<x-button
title="Edit Portfolio"
icon="o-cog-8-tooth"
class="btn-circle btn-ghost btn-sm"
wire:click="$toggle('showDrawer2')"
/>
</div>
<div class="grid md:grid-cols-4 gap-5">
<x-stat
title="Realized Gain/Loss ($)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Realized Gain/Loss (%)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Market Gain/Loss ($)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Market Gain/Loss (%)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Total Cost Basis ($)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Total Market Value ($)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Number of Transactions"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
<x-stat
title="Dividends Earned ($)"
description="This month"
value="22.124"
icon="o-arrow-trending-up"
tooltip-bottom="There"
/>
</div>
<div class="grid md:grid-cols-3 gap-5">
@php
$users = App\Models\User::take(3)->get();
@endphp
@foreach($users as $user)
<x-list-item :item="$user" link="/docs/installation" />
@endforeach
</div>
</div>
<x-drawer
title="{{ $portfolio->title }}"
wire:model="showDrawer2"
class="w-11/12 lg:w-1/3"
with-close-button
close-on-escape
right
>
<livewire:portfolio.manage-portfolio-form :portfolio="$portfolio" submit="update" hide-cancel />
</x-drawer>
</div>