Fix last few bugs

This commit is contained in:
Kevin Pauer 2022-05-10 21:41:59 +02:00
parent bed97bb3d6
commit bf99a78d44
3 changed files with 9 additions and 10 deletions

View File

@ -33,7 +33,7 @@
<ng-container matColumnDef="current_price">
<th mat-header-cell *matHeaderCellDef>Price</th>
<td mat-cell *matCellDef="let element">
{{ element.current_price }}$
{{ element.current_price }}
</td>
</ng-container>
@ -84,18 +84,18 @@
<div class="row">
<div class="col-6 col-sm-4">
<mat-icon>savings</mat-icon
><span class="money">{{ depotCurrentValue.toFixed(2) }}$</span>
><span class="money">{{ depotCurrentValue.toFixed(2) }}</span>
</div>
<div class="col-6 col-sm-4">
<mat-icon>paid</mat-icon
><span class="money">{{ depotCost.toFixed(2) }}$</span>
><span class="money">{{ depotCost.toFixed(2) }}</span>
</div>
<div class="col-6 col-sm-4">
<mat-icon>account_balance</mat-icon
><span
class="money"
[ngClass]="{ green: profit >= 0, red: profit < 0 }"
>{{ profit.toFixed(2) }}$</span
>{{ profit.toFixed(2) }}</span
>
</div>
</div>

View File

@ -63,8 +63,6 @@ export class DashboardComponent implements OnInit {
});
}
this.dataSourceTransactions = TRANSACTION_DATA;
//TODO move to helper service
this.profit = this.depotCurrentValue - this.depotCost;
});
}
@ -78,7 +76,8 @@ export class DashboardComponent implements OnInit {
console.log(data);
this.depotCurrentValue = 0;
for (let i = 0; i < data.data.length; i++) {
this.depotCurrentValue = data.data[i].current_price;
this.depotCurrentValue +=
data.data[i].current_price * data.data[i].count;
STOCK_DATA.push({
count: data.data[i].count,
comment: data.data[i].comment,

View File

@ -20,7 +20,7 @@
/>
</div>
<div class="form-group">
<label for="isin">isin</label>
<label for="isin">ISIN/Symbol</label>
<input
type="text"
class="form-control"
@ -29,7 +29,7 @@
required
isin
#isin="ngModel"
placeholder="ex. US02079K3059"
placeholder="ex. US02079K3059 / AAPL"
/>
</div>
<div class="form-group">
@ -61,7 +61,7 @@
</div>
</div>
<div class="form-group">
<label for="price">Price in $</label>
<label for="price">Price in </label>
<input
class="form-control"
name="price"