Frontend #190

Merged
kevinpauer merged 3 commits from frontend into main 2022-05-12 16:27:32 +00:00
5 changed files with 20 additions and 7 deletions

View File

@ -25,7 +25,7 @@
<!-- Time Column --> <!-- Time Column -->
<ng-container matColumnDef="isin"> <ng-container matColumnDef="isin">
<th mat-header-cell *matHeaderCellDef>ISIN</th> <th mat-header-cell *matHeaderCellDef>ISIN/Symbol</th>
<td mat-cell *matCellDef="let element">{{ element.isin }}</td> <td mat-cell *matCellDef="let element">{{ element.isin }}</td>
</ng-container> </ng-container>

View File

@ -53,7 +53,7 @@ export class DashboardComponent implements OnInit {
var data = JSON.parse(response); var data = JSON.parse(response);
this.depotCost = 0; this.depotCost = 0;
for (let i = 0; i < data.data.length; i++) { for (let i = 0; i < data.data.length; i++) {
this.depotCost += data.data[i].price; this.depotCost += data.data[i].price * data.data[i].count;
TRANSACTION_DATA.push({ TRANSACTION_DATA.push({
comment: data.data[i].comment, comment: data.data[i].comment,
isin: data.data[i].isin, isin: data.data[i].isin,
@ -98,7 +98,7 @@ export class DashboardComponent implements OnInit {
var data = JSON.parse(response); var data = JSON.parse(response);
this.depotCost = 0; this.depotCost = 0;
for (let i = 0; i < data.data.length; i++) { for (let i = 0; i < data.data.length; i++) {
this.depotCost += data.data[i].price; this.depotCost += data.data[i].price * data.data[i].count;
TRANSACTION_DATA.push({ TRANSACTION_DATA.push({
comment: data.data[i].comment, comment: data.data[i].comment,
isin: data.data[i].isin, isin: data.data[i].isin,

View File

@ -45,7 +45,7 @@
/> />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="count">Count</label> <label for="count">Count (negative for sale/positiv for buy)</label>
<input <input
type="number" type="number"
class="form-control" class="form-control"
@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="price">Price in €</label> <label for="price">Price in € per share</label>
<input <input
class="form-control" class="form-control"
name="price" name="price"

View File

@ -26,10 +26,10 @@ export class UserDialogComponent {
priceValid = true; priceValid = true;
onSubmit() { onSubmit() {
console.log(!isNaN(this.data.count));
if (!isNaN(this.data.count) && !isNaN(this.data.price)) { if (!isNaN(this.data.count) && !isNaN(this.data.price)) {
this.priceValid = true; this.priceValid = true;
this.countValid = true; this.countValid = true;
console.log(this.data.price);
console.log( console.log(
this.dataService this.dataService
.createTransaction( .createTransaction(

View File

@ -52,7 +52,10 @@ export class ProfileComponent implements OnInit {
}); });
} }
onSubmit() { /**
* Determines whether submit on
*/
onSubmit(): void {
if (this.userId != '') { if (this.userId != '') {
console.log(this.userId); console.log(this.userId);
this.profileService this.profileService
@ -63,6 +66,9 @@ export class ProfileComponent implements OnInit {
} }
} }
/**
* Updates user
*/
updateUser() { updateUser() {
if (this.form.password === this.form.passwordRepeat) { if (this.form.password === this.form.passwordRepeat) {
this.checkPasswordFailed = false; this.checkPasswordFailed = false;
@ -78,6 +84,10 @@ export class ProfileComponent implements OnInit {
} }
} }
/**
* Opens dialog
* @param action
*/
openDialog(action: string) { openDialog(action: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
width: '50vw', width: '50vw',
@ -95,6 +105,9 @@ export class ProfileComponent implements OnInit {
}); });
} }
/**
* Opens help
*/
openHelp() { openHelp() {
const dialogRef = this.dialog.open(HelpDialogComponent, { const dialogRef = this.dialog.open(HelpDialogComponent, {
width: '50vw', width: '50vw',