test dashboard data
This commit is contained in:
hackerESQ
2024-08-06 22:59:17 -05:00
parent 38e07cadd7
commit eb260b2990
10 changed files with 205 additions and 227 deletions
@@ -42,7 +42,7 @@ new class extends Component {
// $this->portfolio->owner_id = auth()->user()->id;
$this->portfolio->save();
$this->success('Portfolio updated', redirectTo: "/portfolio/{$this->portfolio->id}");
$this->success(__('Portfolio updated'), redirectTo: "/portfolio/{$this->portfolio->id}");
}
public function save()
@@ -65,7 +65,7 @@ new class extends Component {
// $portfolio->owner_id = auth()->user()->id;
$portfolio->save();
$this->success('Portfolio created', redirectTo: "/portfolio/{$portfolio->id}");
$this->success(__('Portfolio created'), redirectTo: "/portfolio/{$portfolio->id}");
}
public function delete()
@@ -73,17 +73,17 @@ new class extends Component {
$this->portfolio->delete();
$this->success('Portfolio deleted', redirectTo: "/dashboard");
$this->success(__('Portfolio deleted'), redirectTo: "/dashboard");
}
}; ?>
<div class="grid lg:grid-cols-4 gap-10">
<x-form wire:submit="{{ $portfolio ? 'update' : 'save' }}" class="col-span-3">
<x-input label="Title" wire:model="title" required />
<x-input label="{{ __('Title') }}" wire:model="title" required />
<x-textarea label="Notes" wire:model="notes" rows="5" />
<x-textarea label="{{ __('Notes') }}" wire:model="notes" rows="5" />
<x-toggle label="Wishlist" wire:model="wishlist" />
<x-toggle label="{{ __('Wishlist') }}" wire:model="wishlist" />
<x-slot:actions>
@if ($portfolio)
@@ -96,7 +96,7 @@ new class extends Component {
@endif
@if (!$hideCancel)
<x-button label="Cancel" link="/dashboard" />
<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>
@@ -1,44 +0,0 @@
<?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"
/>
@@ -38,6 +38,8 @@ new class extends Component {
],
];
// $this->marketGainLoss = rand(-200, 3999);
}
public function changeScope($scope)
@@ -77,7 +79,7 @@ new class extends Component {
}; ?>
<div>
<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">
@@ -109,4 +111,4 @@ new class extends Component {
<x-ib-apex-chart :series-data="$myChart" :name="$name" />
</div>
</div>
</x-card>