shared state with events
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PortfolioController extends Controller
|
||||
{
|
||||
@@ -23,5 +22,4 @@ class PortfolioController extends Controller
|
||||
{
|
||||
return view('portfolio.show', compact('portfolio'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@props(['id' => null, 'maxWidth' => null])
|
||||
|
||||
<x-modal :id="$id" :maxWidth="$maxWidth" {{ $attributes }}>
|
||||
<div class="bg-white dark:bg-gray-800 px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div class="mx-auto shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
|
||||
<svg class="h-6 w-6 text-red-600 dark:text-red-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
@@ -21,7 +21,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row justify-end px-6 py-4 bg-gray-100 dark:bg-gray-800 text-end">
|
||||
<div class="flex flex-row justify-end px-6 py-4 text-end">
|
||||
{{ $footer }}
|
||||
</div>
|
||||
</x-modal>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<x-app-layout>
|
||||
|
||||
<x-card class="bg-slate-100 dark:bg-base-200 rounded-lg mb-6">
|
||||
|
||||
@livewire('portfolio-performance-chart', [
|
||||
'name' => 'dashboard'
|
||||
])
|
||||
|
||||
</x-card>
|
||||
|
||||
<div class="grid md:grid-cols-5 gap-5">
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Market Gain/Loss"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Total Cost Basis"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Total Market Value"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Realized Gain/Loss"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Dividends Earned"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid md:grid-cols-7 gap-5">
|
||||
|
||||
<x-ib-card title="My portfolios" class="md:col-span-4">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Top performers" class="md:col-span-3">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Top headlines" class="md:col-span-3">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Recent activity" class="md:col-span-4">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
</div>
|
||||
|
||||
</x-app-layout>
|
||||
@@ -1,205 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Livewire\Attributes\{Title, Rule};
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
|
||||
public bool $showDrawer2 = false;
|
||||
public $scope = 'YTD';
|
||||
|
||||
public function changeScope ($scope)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
public function getScopeName ($scope)
|
||||
{
|
||||
return collect($this->options)->where('id', $scope)['name'];
|
||||
}
|
||||
|
||||
public $options = [
|
||||
['id' => '1M', 'name' => '1 month'],
|
||||
['id' => '2M', 'name' => '3 months'],
|
||||
['id' => 'YTD', 'name' => 'Year to date'],
|
||||
['id' => '1Y', 'name' => '1 year'],
|
||||
['id' => '3Y', 'name' => '3 years'],
|
||||
['id' => 'ALL', 'name' => 'All time']
|
||||
];
|
||||
|
||||
public ?Portfolio $portfolio;
|
||||
|
||||
|
||||
private function generateDateSeries($startDate, $endDate) {
|
||||
$dateArray = [];
|
||||
$currentDate = strtotime($startDate);
|
||||
$endDate = strtotime($endDate);
|
||||
|
||||
while ($currentDate <= $endDate) {
|
||||
// Generate a random integer
|
||||
$randomInt = rand(1000, 3000);
|
||||
|
||||
// Format the current date to 'Y-m-d'
|
||||
$formattedDate = date('Y-m-d', $currentDate);
|
||||
|
||||
// Append the date and random integer to the array
|
||||
$dateArray[] = [$formattedDate, $randomInt];
|
||||
|
||||
// Move to the next day
|
||||
$currentDate = strtotime("+1 day", $currentDate);
|
||||
}
|
||||
|
||||
return $dateArray;
|
||||
}
|
||||
|
||||
public array $myChart;
|
||||
|
||||
public function mount() {
|
||||
|
||||
$this->myChart = [
|
||||
'series' => [
|
||||
[
|
||||
'name' => 'Total Views',
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
[
|
||||
'name' => 'Second Views',
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}; ?>
|
||||
|
||||
<div x-data>
|
||||
|
||||
|
||||
<x-card class="bg-slate-100 dark:bg-base-200 rounded-lg mb-6">
|
||||
|
||||
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
|
||||
<div class="flex items-center">
|
||||
|
||||
<h2 class="text-xl mr-4">Performance</h2>
|
||||
<div id="chart-legend-dashboard" class="flex space-around"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<x-dropdown label="{{ $scope }}" class="btn-ghost btn-sm" >
|
||||
|
||||
<x-menu >
|
||||
@foreach($options as $option)
|
||||
|
||||
<x-menu-item
|
||||
title="{{ $option['name'] }}"
|
||||
x-on:click="$wire.changeScope('{{ $option['id'] }}')"
|
||||
/>
|
||||
|
||||
@endforeach
|
||||
</x-menu>
|
||||
</x-dropdown>
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="h-[280px] mb-5"
|
||||
>
|
||||
<x-ib-apex-chart :key="Str::uuid()" :series-data="$myChart" name="dashboard" />
|
||||
</div>
|
||||
|
||||
|
||||
</x-card>
|
||||
|
||||
<div class="grid md:grid-cols-5 gap-5">
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Market Gain/Loss"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Total Cost Basis"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Total Market Value"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Realized Gain/Loss"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Dividends Earned"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid md:grid-cols-7 gap-5">
|
||||
|
||||
<x-ib-card title="My portfolios" class="md:col-span-4">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Top performers" class="md:col-span-3">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Top headlines" class="md:col-span-3">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="Recent activity" class="md:col-span-4">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -9,20 +9,24 @@ use Mary\Traits\Toast;
|
||||
new class extends Component {
|
||||
use Toast;
|
||||
|
||||
public string $submit;
|
||||
// props
|
||||
public ?Portfolio $portfolio;
|
||||
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|boolean')]
|
||||
public ?bool $wishlist;
|
||||
#[Rule('sometimes|nullable|boolean')]
|
||||
public Bool $wishlist = false;
|
||||
|
||||
public function mount() {
|
||||
public Bool $confirmingPortfolioDeletion = false;
|
||||
|
||||
// methods
|
||||
public function mount()
|
||||
{
|
||||
|
||||
if (isset($this->portfolio)) {
|
||||
|
||||
@@ -32,11 +36,6 @@ new class extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
public function categories(): Collection
|
||||
{
|
||||
return Category::all();
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$this->portfolio->update($this->validate());
|
||||
@@ -69,29 +68,57 @@ new class extends Component {
|
||||
$this->success('Portfolio created', redirectTo: "/portfolio/{$portfolio->id}");
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
public function delete()
|
||||
{
|
||||
return [
|
||||
// 'categories' => $this->categories()
|
||||
];
|
||||
|
||||
$this->portfolio->delete();
|
||||
|
||||
$this->success('Portfolio deleted', redirectTo: "/dashboard");
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div class="grid lg:grid-cols-4 gap-10">
|
||||
<x-form wire:submit="{{ $submit }}" class="col-span-3">
|
||||
<x-form wire:submit="{{ $portfolio ? 'update' : 'save' }}" class="col-span-3">
|
||||
<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="Notes" wire:model="notes" rows="5" />
|
||||
|
||||
<x-toggle label="Wishlist" wire:model="wishlist" />
|
||||
|
||||
<x-slot:actions>
|
||||
@if (!$hideCancel)
|
||||
<x-button label="Cancel" link="{{ url()->previous() }}" />
|
||||
@if ($portfolio)
|
||||
<x-button
|
||||
class="ms-3 btn-error btn-outline text-white float-left"
|
||||
wire:click="$toggle('confirmingPortfolioDeletion')"
|
||||
wire:loading.attr="disabled"
|
||||
icon="o-trash"
|
||||
/>
|
||||
@endif
|
||||
<x-button label="{{ $submit == 'save' ? 'Create' : 'Update' }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
|
||||
|
||||
@if (!$hideCancel)
|
||||
<x-button label="Cancel" link="/dashboard" />
|
||||
@endif
|
||||
<x-button label="{{ $portfolio ? 'Update' : 'Create' }}" type="submit" icon="o-paper-airplane" class="btn-primary" spinner="save" />
|
||||
</x-slot:actions>
|
||||
</x-form>
|
||||
|
||||
<x-confirmation-modal wire:model.live="confirmingPortfolioDeletion">
|
||||
<x-slot name="title">
|
||||
{{ __('Delete Portfolio') }}
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="content">
|
||||
{{ __('Are you sure you want to delete this portfolio? Once a portfolio is deleted, all of its holdings and other data will be permanently deleted.') }}
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="footer">
|
||||
<x-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">
|
||||
{{ __('Delete Portfolio') }}
|
||||
</x-button>
|
||||
</x-slot>
|
||||
</x-confirmation-modal>
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Livewire\Attributes\{Title, Rule};
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
|
||||
// props
|
||||
public ?Portfolio $portfolio;
|
||||
public String $name = 'portfolio';
|
||||
public String $scope = 'YTD';
|
||||
public ?Int $value;
|
||||
public Array $options = [
|
||||
['id' => '1M', 'name' => '1 month'],
|
||||
['id' => '3M', 'name' => '3 months'],
|
||||
['id' => 'YTD', 'name' => 'Year to date'],
|
||||
['id' => '1Y', 'name' => '1 year'],
|
||||
['id' => '3Y', 'name' => '3 years'],
|
||||
['id' => 'ALL', 'name' => 'All time']
|
||||
];
|
||||
|
||||
protected $listeners = ['data-scope-updated' => 'test'];
|
||||
|
||||
public function test()
|
||||
{
|
||||
$this->value = 148;
|
||||
}
|
||||
|
||||
// methods
|
||||
public function mount()
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
}; ?>
|
||||
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Market Gain/Loss"
|
||||
:value="$value"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Livewire\Attributes\{Title, Rule};
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
|
||||
// props
|
||||
public ?Portfolio $portfolio;
|
||||
public String $name = 'portfolio';
|
||||
public String $scope = 'YTD';
|
||||
public Array $options = [
|
||||
['id' => '1M', 'name' => '1 month'],
|
||||
['id' => '3M', 'name' => '3 months'],
|
||||
['id' => 'YTD', 'name' => 'Year to date'],
|
||||
['id' => '1Y', 'name' => '1 year'],
|
||||
['id' => '3Y', 'name' => '3 years'],
|
||||
['id' => 'ALL', 'name' => 'All time']
|
||||
];
|
||||
|
||||
// data
|
||||
public Array $myChart;
|
||||
|
||||
// methods
|
||||
public function mount()
|
||||
{
|
||||
$this->myChart = [
|
||||
'series' => [
|
||||
[
|
||||
'name' => __('Total Views'),
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
[
|
||||
'name' => __('Second Views'),
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function changeScope($scope)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
|
||||
$this->dispatch('data-scope-updated', $scope);
|
||||
}
|
||||
|
||||
public function getScopeName($scope)
|
||||
{
|
||||
return collect($this->options)->where('id', $scope)['name'];
|
||||
}
|
||||
|
||||
private function generateDateSeries($startDate, $endDate)
|
||||
{
|
||||
$dateArray = [];
|
||||
$currentDate = strtotime($startDate);
|
||||
$endDate = strtotime($endDate);
|
||||
|
||||
while ($currentDate <= $endDate) {
|
||||
// Generate a random integer
|
||||
$randomInt = rand(1000, 3000);
|
||||
|
||||
// Format the current date to 'Y-m-d'
|
||||
$formattedDate = date('Y-m-d', $currentDate);
|
||||
|
||||
// Append the date and random integer to the array
|
||||
$dateArray[] = [$formattedDate, $randomInt];
|
||||
|
||||
// Move to the next day
|
||||
$currentDate = strtotime("+1 day", $currentDate);
|
||||
}
|
||||
|
||||
return $dateArray;
|
||||
}
|
||||
|
||||
}; ?>
|
||||
|
||||
<div>
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
|
||||
<div class="flex items-center">
|
||||
|
||||
<h2 class="text-xl mr-4">{{ __('Performance') }}</h2>
|
||||
<div id="chart-legend-{{ $name }}" class="flex space-between"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<x-dropdown label="{{ $scope }}" class="btn-ghost btn-sm">
|
||||
|
||||
<x-menu>
|
||||
@foreach($options as $option)
|
||||
|
||||
<x-menu-item
|
||||
title="{{ $option['name'] }}"
|
||||
x-on:click="$wire.changeScope('{{ $option['id'] }}')"
|
||||
/>
|
||||
|
||||
@endforeach
|
||||
</x-menu>
|
||||
</x-dropdown>
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="h-[280px] mb-5"
|
||||
>
|
||||
<x-ib-apex-chart :series-data="$myChart" :name="$name" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
<x-ib-toolbar title="Create Portfolio" />
|
||||
|
||||
@livewire('manage-portfolio-form', ['submit' => 'save'])
|
||||
@livewire('manage-portfolio-form')
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
@@ -1,78 +1,3 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Portfolio;
|
||||
use Livewire\Attributes\{Title, Rule};
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
|
||||
public bool $showDrawer2 = false;
|
||||
public $scope = 'YTD';
|
||||
|
||||
public function changeScope ($scope)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
public function getScopeName ($scope)
|
||||
{
|
||||
return collect($this->options)->where('id', $scope)['name'];
|
||||
}
|
||||
|
||||
public $options = [
|
||||
['id' => '1M', 'name' => '1 month'],
|
||||
['id' => '3M', 'name' => '3 months'],
|
||||
['id' => 'YTD', 'name' => 'Year to date'],
|
||||
['id' => '1Y', 'name' => '1 year'],
|
||||
['id' => '3Y', 'name' => '3 years'],
|
||||
['id' => 'ALL', 'name' => 'All time']
|
||||
];
|
||||
|
||||
public ?Portfolio $portfolio;
|
||||
|
||||
private function generateDateSeries($startDate, $endDate) {
|
||||
$dateArray = [];
|
||||
$currentDate = strtotime($startDate);
|
||||
$endDate = strtotime($endDate);
|
||||
|
||||
while ($currentDate <= $endDate) {
|
||||
// Generate a random integer
|
||||
$randomInt = rand(1000, 3000);
|
||||
|
||||
// Format the current date to 'Y-m-d'
|
||||
$formattedDate = date('Y-m-d', $currentDate);
|
||||
|
||||
// Append the date and random integer to the array
|
||||
$dateArray[] = [$formattedDate, $randomInt];
|
||||
|
||||
// Move to the next day
|
||||
$currentDate = strtotime("+1 day", $currentDate);
|
||||
}
|
||||
|
||||
return $dateArray;
|
||||
}
|
||||
|
||||
public array $myChart;
|
||||
|
||||
public function mount() {
|
||||
|
||||
$this->myChart = [
|
||||
'series' => [
|
||||
[
|
||||
'name' => 'Total Views',
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
[
|
||||
'name' => 'Second Views',
|
||||
'data' => $this->generateDateSeries('2024-01-01', '2024-08-01')
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<x-app-layout>
|
||||
<div x-data>
|
||||
|
||||
@@ -81,18 +6,21 @@ new class extends Component {
|
||||
title="{{ $portfolio->title }}"
|
||||
>
|
||||
|
||||
@livewire('manage-portfolio-form', ['portfolio' => $portfolio, 'submit' => "update", 'hideCancel' => true])
|
||||
@livewire('manage-portfolio-form', [
|
||||
'portfolio' => $portfolio,
|
||||
'hideCancel' => true
|
||||
])
|
||||
|
||||
</x-ib-drawer>
|
||||
|
||||
<x-ib-toolbar :title="$portfolio->title">
|
||||
|
||||
@if($portfolio->wishlist)
|
||||
<x-badge value="Wishlist" class="badge-primary mr-3" />
|
||||
<x-badge value="{{ __('Wishlist') }}" class="badge-primary mr-3" />
|
||||
@endif
|
||||
|
||||
<x-button
|
||||
title="Edit Portfolio"
|
||||
title="{{ __('Edit Portfolio') }}"
|
||||
icon="o-pencil"
|
||||
class="btn-circle btn-ghost btn-sm text-secondary"
|
||||
@click="$dispatch('toggle-manage-portfolio')"
|
||||
@@ -101,47 +29,21 @@ new class extends Component {
|
||||
|
||||
<x-card class="bg-slate-100 dark:bg-base-200 rounded-lg mb-6">
|
||||
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
|
||||
<div class="flex items-center">
|
||||
|
||||
<h2 class="text-xl mr-4">Performance</h2>
|
||||
<div id="chart-legend-portfolio-{{ $portfolio->id }}" class="flex space-around"></div>
|
||||
|
||||
</div>
|
||||
{{-- {{ $scope }} --}}
|
||||
<x-dropdown label="YTD" class="btn-ghost btn-sm" >
|
||||
|
||||
<x-menu >
|
||||
{{-- @foreach($options as $option)
|
||||
|
||||
<x-menu-item
|
||||
title="{{ $option['name'] }}"
|
||||
x-on:click="$wire.changeScope('{{ $option['id'] }}')"
|
||||
/>
|
||||
|
||||
@endforeach --}}
|
||||
</x-menu>
|
||||
</x-dropdown>
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="h-[280px] mb-5"
|
||||
|
||||
>
|
||||
{{-- <x-ib-apex-chart :series-data="$myChart" :key="Str::uuid()" name="portfolio-{{ $portfolio->id }}" /> --}}
|
||||
</div>
|
||||
@livewire('portfolio-performance-chart', [
|
||||
'name' => 'portfolio-'.$portfolio->id,
|
||||
'portfolio' => $portfolio
|
||||
])
|
||||
|
||||
</x-card>
|
||||
|
||||
<div class="grid md:grid-cols-5 gap-5">
|
||||
<x-stat
|
||||
@livewire('portfolio-performance-card')
|
||||
{{-- <x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Market Gain/Loss"
|
||||
value="22.124"
|
||||
icon="o-arrow-trending-up"
|
||||
/>
|
||||
/> --}}
|
||||
<x-stat
|
||||
class="bg-slate-100 dark:bg-base-200"
|
||||
title="Total Cost Basis"
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Livewire\Volt\Volt;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\PortfolioController;
|
||||
|
||||
@@ -10,7 +9,7 @@ Route::get('/', function () {
|
||||
|
||||
Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () {
|
||||
|
||||
Volt::route('/dashboard', 'dashboard')->name('dashboard');
|
||||
Route::view('/dashboard', 'dashboard')->name('dashboard');
|
||||
|
||||
Route::get('/portfolio/create', [PortfolioController::class, 'create'])->name('portfolio.create');
|
||||
Route::get('/portfolio/{portfolio}', [PortfolioController::class, 'show'])->name('portfolio.show');
|
||||
|
||||
Reference in New Issue
Block a user