Feature/dividend (#547)

* Add dividend to order type

* Support dividend in transactions table

* Support dividend in transaction dialog

* Extend import file with dividend

* Add dividend to portfolio summary

* Update changelog

Co-authored-by: Fly Man <fly.man.opensim@gmail.com>
This commit is contained in:
Thomas Kaul
2021-12-28 21:12:12 +01:00
committed by GitHub
parent ff638adf03
commit 9e1a7fc981
13 changed files with 134 additions and 44 deletions

View File

@@ -169,4 +169,18 @@
></gf-value>
</div>
</div>
<div class="row">
<div class="col"><hr /></div>
</div>
<div class="row px-3 py-1">
<div class="d-flex flex-grow-1" i18n>Dividend</div>
<div class="d-flex justify-content-end">
<gf-value
class="justify-content-end"
[currency]="baseCurrency"
[locale]="locale"
[value]="isLoading ? undefined : summary?.dividend"
></gf-value>
</div>
</div>
</div>

View File

@@ -77,11 +77,15 @@
<td mat-cell *matCellDef="let element" class="px-1">
<div
class="d-inline-flex p-1 type-badge"
[ngClass]="element.type == 'BUY' ? 'buy' : 'sell'"
[ngClass]="{
buy: element.type === 'BUY',
dividend: element.type === 'DIVIDEND',
sell: element.type === 'SELL'
}"
>
<ion-icon
[name]="
element.type === 'BUY'
element.type === 'BUY' || element.type === 'DIVIDEND'
? 'arrow-forward-circle-outline'
: 'arrow-back-circle-outline'
"

View File

@@ -37,6 +37,10 @@
color: var(--green);
}
&.dividend {
color: var(--blue);
}
&.sell {
color: var(--orange);
}

View File

@@ -52,8 +52,9 @@
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Type</mat-label>
<mat-select name="type" required [(value)]="data.transaction.type">
<mat-option value="BUY" i18n> BUY </mat-option>
<mat-option value="SELL" i18n> SELL </mat-option>
<mat-option value="BUY" i18n>BUY</mat-option>
<mat-option value="DIVIDEND" i18n>DIVIDEND</mat-option>
<mat-option value="SELL" i18n>SELL</mat-option>
</mat-select>
</mat-form-field>
</div>
@@ -141,7 +142,7 @@
[(ngModel)]="data.transaction.unitPrice"
/>
<button
*ngIf="currentMarketPrice"
*ngIf="currentMarketPrice && (data.transaction.type === 'BUY' || data.transaction.type === 'SELL')"
mat-icon-button
matSuffix
title="Apply current market price"

View File

@@ -214,10 +214,15 @@ export class ImportTransactionsService {
for (const key of ImportTransactionsService.TYPE_KEYS) {
if (item[key]) {
if (item[key].toLowerCase() === 'buy') {
return Type.BUY;
} else if (item[key].toLowerCase() === 'sell') {
return Type.SELL;
switch (item[key].toLowerCase()) {
case 'buy':
return Type.BUY;
case 'dividend':
return Type.DIVIDEND;
case 'sell':
return Type.SELL;
default:
break;
}
}
}