wip
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<x-menu-item title="{{ __('Manage Profile') }}" icon="o-user" link="{{ @route('profile.show') }}" />
|
||||
<x-menu-item title="{{ __('Import / Export Data') }}" icon="o-cloud-arrow-down" link="{{ @route('import-export') }}" />
|
||||
|
||||
<x-section-border />
|
||||
<x-section-border class="py-3" />
|
||||
|
||||
<x-menu-item title="{{ __('Log Out') }}" icon="o-power" onclick="event.preventDefault(); document.getElementById('logout').submit();" />
|
||||
<form id="logout" action="{{ route('logout') }}" method="POST" style="display: none;">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
<div class="hidden sm:block">
|
||||
<div {{ $attributes->merge(['class' => 'py-6']) }}>
|
||||
<div {{ $attributes->class(['py-6' => !$attributes->has('class')]) }}>
|
||||
|
||||
<div class="border-t border-gray-200 dark:border-gray-700"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
<x-app-layout>
|
||||
<div>
|
||||
<div x-data>
|
||||
|
||||
<x-ib-modal
|
||||
key="new-transaction"
|
||||
title="New Transaction"
|
||||
>
|
||||
@livewire('manage-transaction-form', [
|
||||
'portfolio' => $portfolio,
|
||||
'symbol' => $market_data->symbol,
|
||||
])
|
||||
|
||||
</x-ib-modal>
|
||||
|
||||
<x-ib-toolbar>
|
||||
<x-slot:title>
|
||||
@@ -7,6 +18,16 @@
|
||||
{{ $portfolio->title }}
|
||||
</a> » <span title="{{ __('Holding') }}">{{ $market_data->symbol }}</span>
|
||||
</x-slot:title>
|
||||
|
||||
<x-ib-flex-spacer />
|
||||
|
||||
<div>
|
||||
<x-button
|
||||
label="{{ __('Create Transaction') }}"
|
||||
class="btn-sm btn-primary"
|
||||
@click="$dispatch('toggle-new-transaction')"
|
||||
/>
|
||||
</div>
|
||||
</x-ib-toolbar>
|
||||
|
||||
<div class="mt-6 grid md:grid-cols-9 gap-5">
|
||||
@@ -93,7 +114,8 @@
|
||||
|
||||
@livewire('transactions-list', [
|
||||
'portfolio' => $holding->portfolio,
|
||||
'transactions' => $holding->transactions
|
||||
'transactions' => $holding->transactions,
|
||||
'shouldGoToHolding' => false
|
||||
])
|
||||
|
||||
</x-ib-card>
|
||||
@@ -104,9 +126,7 @@
|
||||
|
||||
<x-list-item :item="$dividend">
|
||||
<x-slot:value>
|
||||
|
||||
Purchased {{$dividend->purchased}}<br>
|
||||
Sold {{$dividend->sold}}<br>
|
||||
|
||||
@php
|
||||
$owned = ($dividend->purchased - $dividend->sold);
|
||||
@endphp
|
||||
|
||||
@@ -11,6 +11,7 @@ new class extends Component {
|
||||
public Collection $transactions;
|
||||
public ?Portfolio $portfolio;
|
||||
public ?Transaction $editingTransaction;
|
||||
public Bool $shouldGoToHolding = true;
|
||||
|
||||
protected $listeners = [
|
||||
'transaction-updated' => '$refresh',
|
||||
@@ -24,6 +25,11 @@ new class extends Component {
|
||||
$this->dispatch('toggle-manage-transaction');
|
||||
}
|
||||
|
||||
public function goToHolding($holding)
|
||||
{
|
||||
return $this->redirect(route('holding.show', ['portfolio' => $holding['portfolio_id'], 'symbol' => $holding['symbol']]));
|
||||
}
|
||||
|
||||
}; ?>
|
||||
|
||||
<div class="">
|
||||
@@ -36,6 +42,12 @@ new class extends Component {
|
||||
class="cursor-pointer"
|
||||
x-data="{ loading: false, timeout: null }"
|
||||
@click="
|
||||
if ($wire.shouldGoToHolding) {
|
||||
|
||||
$wire.goToHolding({{ $transaction }})
|
||||
|
||||
return;
|
||||
}
|
||||
timeout = setTimeout(() => { loading = true }, 200);
|
||||
$wire.showTransactionDialog('{{ $transaction->id }}').then(() => {
|
||||
clearTimeout(timeout);
|
||||
|
||||
@@ -24,12 +24,17 @@ new class extends Component {
|
||||
public array $headers;
|
||||
|
||||
// methods
|
||||
public function showTransactionDialog($transactionId)
|
||||
public function goToHolding($holding)
|
||||
{
|
||||
$this->editingTransaction = Transaction::findOrFail($transactionId);
|
||||
$this->dispatch('toggle-manage-transaction');
|
||||
return $this->redirect(route('holding.show', ['portfolio' => $holding['portfolio_id'], 'symbol' => $holding['symbol']]));
|
||||
}
|
||||
|
||||
// public function showTransactionDialog($transactionId)
|
||||
// {
|
||||
// $this->editingTransaction = Transaction::findOrFail($transactionId);
|
||||
// $this->dispatch('toggle-manage-transaction');
|
||||
// }
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->headers = [
|
||||
@@ -64,7 +69,8 @@ new class extends Component {
|
||||
x-data="{ loadingId: null, timeout: null }"
|
||||
@row-click="
|
||||
timeout = setTimeout(() => { loadingId = $event.detail.id }, 200);
|
||||
$wire.showTransactionDialog($event.detail.id).then(() => {
|
||||
{{-- $wire.showTransactionDialog($event.detail.id).then(() => { --}}
|
||||
$wire.goToHolding($event.detail).then(() => {
|
||||
clearTimeout(timeout);
|
||||
loadingId = null;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user