|
|
@ -4,8 +4,11 @@ |
|
|
|
(keyup.enter)="activityForm.valid && onSubmit()" |
|
|
|
(ngSubmit)="onSubmit()" |
|
|
|
> |
|
|
|
<h1 *ngIf="data.activity.id" i18n mat-dialog-title>Update activity</h1> |
|
|
|
<h1 *ngIf="!data.activity.id" i18n mat-dialog-title>Add activity</h1> |
|
|
|
@if (data.activity.id) { |
|
|
|
<h1 i18n mat-dialog-title>Update activity</h1> |
|
|
|
} @else { |
|
|
|
<h1 i18n mat-dialog-title>Add activity</h1> |
|
|
|
} |
|
|
|
<div class="flex-grow-1 py-3" mat-dialog-content> |
|
|
|
<div class="mb-3"> |
|
|
|
<mat-form-field appearance="outline" class="w-100"> |
|
|
@ -81,25 +84,25 @@ |
|
|
|
> |
|
|
|
<mat-label i18n>Account</mat-label> |
|
|
|
<mat-select formControlName="accountId"> |
|
|
|
<mat-option |
|
|
|
*ngIf=" |
|
|
|
@if ( |
|
|
|
!activityForm.get('accountId').hasValidator(Validators.required) |
|
|
|
" |
|
|
|
[value]="null" |
|
|
|
/> |
|
|
|
<mat-option |
|
|
|
*ngFor="let account of data.accounts" |
|
|
|
[value]="account.id" |
|
|
|
> |
|
|
|
) { |
|
|
|
<mat-option [value]="null" /> |
|
|
|
} |
|
|
|
@for (account of data.accounts; track account) { |
|
|
|
<mat-option [value]="account.id"> |
|
|
|
<div class="d-flex"> |
|
|
|
@if (account.Platform?.url) { |
|
|
|
<gf-asset-profile-icon |
|
|
|
*ngIf="account.Platform?.url" |
|
|
|
class="mr-1" |
|
|
|
[tooltip]="account.Platform?.name" |
|
|
|
[url]="account.Platform?.url" |
|
|
|
/><span>{{ account.name }}</span> |
|
|
|
/> |
|
|
|
} |
|
|
|
<span>{{ account.name }}</span> |
|
|
|
</div> |
|
|
|
</mat-option> |
|
|
|
} |
|
|
|
</mat-select> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
@ -139,9 +142,9 @@ |
|
|
|
<mat-form-field appearance="outline" class="w-100"> |
|
|
|
<mat-label i18n>Currency</mat-label> |
|
|
|
<mat-select formControlName="currency"> |
|
|
|
<mat-option *ngFor="let currency of currencies" [value]="currency">{{ |
|
|
|
currency |
|
|
|
}}</mat-option> |
|
|
|
@for (currency of currencies; track currency) { |
|
|
|
<mat-option [value]="currency">{{ currency }}</mat-option> |
|
|
|
} |
|
|
|
</mat-select> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
@ -186,18 +189,24 @@ |
|
|
|
> |
|
|
|
<div class="align-items-start d-flex"> |
|
|
|
<mat-form-field appearance="outline" class="w-100"> |
|
|
|
<mat-label |
|
|
|
><ng-container [ngSwitch]="activityForm.get('type')?.value"> |
|
|
|
<ng-container *ngSwitchCase="'DIVIDEND'" i18n |
|
|
|
>Dividend</ng-container |
|
|
|
> |
|
|
|
<ng-container *ngSwitchCase="'INTEREST'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchCase="'ITEM'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchCase="'LIABILITY'" i18n |
|
|
|
>Value</ng-container |
|
|
|
> |
|
|
|
<ng-container *ngSwitchDefault i18n>Unit Price</ng-container> |
|
|
|
</ng-container> |
|
|
|
<mat-label> |
|
|
|
@switch (activityForm.get('type')?.value) { |
|
|
|
@case ('DIVIDEND') { |
|
|
|
<ng-container i18n>Dividend</ng-container> |
|
|
|
} |
|
|
|
@case ('INTEREST') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@case ('ITEM') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@case ('LIABILITY') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@default { |
|
|
|
<ng-container i18n>Unit Price</ng-container> |
|
|
|
} |
|
|
|
} |
|
|
|
</mat-label> |
|
|
|
<input |
|
|
|
formControlName="unitPriceInCustomCurrency" |
|
|
@ -210,18 +219,17 @@ |
|
|
|
[ngClass]="{ 'd-none': !activityForm.get('currency')?.value }" |
|
|
|
> |
|
|
|
<mat-select formControlName="currencyOfUnitPrice"> |
|
|
|
<mat-option |
|
|
|
*ngFor="let currency of currencies" |
|
|
|
[value]="currency" |
|
|
|
> |
|
|
|
@for (currency of currencies; track currency) { |
|
|
|
<mat-option [value]="currency"> |
|
|
|
{{ currency }} |
|
|
|
</mat-option> |
|
|
|
} |
|
|
|
</mat-select> |
|
|
|
</div> |
|
|
|
<mat-error |
|
|
|
*ngIf=" |
|
|
|
@if ( |
|
|
|
activityForm.get('unitPriceInCustomCurrency').hasError('invalid') |
|
|
|
" |
|
|
|
) { |
|
|
|
<mat-error |
|
|
|
><ng-container i18n |
|
|
|
>Oops! Could not get the historical exchange rate |
|
|
|
from</ng-container |
|
|
@ -230,13 +238,14 @@ |
|
|
|
activityForm.get('date')?.value | date: defaultDateFormat |
|
|
|
}}</mat-error |
|
|
|
> |
|
|
|
} |
|
|
|
</mat-form-field> |
|
|
|
<button |
|
|
|
*ngIf=" |
|
|
|
@if ( |
|
|
|
currentMarketPrice && |
|
|
|
(data.activity.type === 'BUY' || data.activity.type === 'SELL') && |
|
|
|
isToday(activityForm.get('date')?.value) |
|
|
|
" |
|
|
|
) { |
|
|
|
<button |
|
|
|
class="ml-2 mt-1 no-min-width" |
|
|
|
mat-button |
|
|
|
title="Apply current market price" |
|
|
@ -245,21 +254,32 @@ |
|
|
|
> |
|
|
|
<ion-icon class="text-muted" name="refresh-outline" /> |
|
|
|
</button> |
|
|
|
} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="d-none"> |
|
|
|
<mat-form-field appearance="outline" class="w-100"> |
|
|
|
<mat-label |
|
|
|
><ng-container [ngSwitch]="activityForm.get('type')?.value"> |
|
|
|
<ng-container *ngSwitchCase="'DIVIDEND'" i18n |
|
|
|
>Dividend</ng-container |
|
|
|
> |
|
|
|
<ng-container *ngSwitchCase="'FEE'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchCase="'INTEREST'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchCase="'ITEM'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchCase="'LIABILITY'" i18n>Value</ng-container> |
|
|
|
<ng-container *ngSwitchDefault i18n>Unit Price</ng-container> |
|
|
|
</ng-container> |
|
|
|
<mat-label> |
|
|
|
@switch (activityForm.get('type')?.value) { |
|
|
|
@case ('DIVIDEND') { |
|
|
|
<ng-container i18n>Dividend</ng-container> |
|
|
|
} |
|
|
|
@case ('FEE') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@case ('INTEREST') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@case ('ITEM') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@case ('LIABILITY') { |
|
|
|
<ng-container i18n>Value</ng-container> |
|
|
|
} |
|
|
|
@default { |
|
|
|
<ng-container i18n>Unit Price</ng-container> |
|
|
|
} |
|
|
|
} |
|
|
|
</mat-label> |
|
|
|
<input formControlName="unitPrice" matInput type="number" /> |
|
|
|
<span class="ml-2" matTextSuffix>{{ |
|
|
@ -286,15 +306,17 @@ |
|
|
|
> |
|
|
|
{{ activityForm.get('currencyOfUnitPrice').value }} |
|
|
|
</div> |
|
|
|
@if (activityForm.get('feeInCustomCurrency').hasError('invalid')) { |
|
|
|
<mat-error |
|
|
|
*ngIf="activityForm.get('feeInCustomCurrency').hasError('invalid')" |
|
|
|
><ng-container i18n |
|
|
|
>Oops! Could not get the historical exchange rate from</ng-container |
|
|
|
>Oops! Could not get the historical exchange rate |
|
|
|
from</ng-container |
|
|
|
> |
|
|
|
{{ |
|
|
|
activityForm.get('date')?.value | date: defaultDateFormat |
|
|
|
}}</mat-error |
|
|
|
> |
|
|
|
} |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
<div class="d-none"> |
|
|
@ -326,11 +348,11 @@ |
|
|
|
<mat-label i18n>Asset Class</mat-label> |
|
|
|
<mat-select formControlName="assetClass"> |
|
|
|
<mat-option [value]="null" /> |
|
|
|
<mat-option |
|
|
|
*ngFor="let assetClass of assetClasses" |
|
|
|
[value]="assetClass.id" |
|
|
|
>{{ assetClass.label }}</mat-option |
|
|
|
> |
|
|
|
@for (assetClass of assetClasses; track assetClass) { |
|
|
|
<mat-option [value]="assetClass.id">{{ |
|
|
|
assetClass.label |
|
|
|
}}</mat-option> |
|
|
|
} |
|
|
|
</mat-select> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
@ -342,11 +364,11 @@ |
|
|
|
<mat-label i18n>Asset Sub Class</mat-label> |
|
|
|
<mat-select formControlName="assetSubClass"> |
|
|
|
<mat-option [value]="null" /> |
|
|
|
<mat-option |
|
|
|
*ngFor="let assetSubClass of assetSubClasses" |
|
|
|
[value]="assetSubClass.id" |
|
|
|
>{{ assetSubClass.label }}</mat-option |
|
|
|
> |
|
|
|
@for (assetSubClass of assetSubClasses; track assetSubClass) { |
|
|
|
<mat-option [value]="assetSubClass.id">{{ |
|
|
|
assetSubClass.label |
|
|
|
}}</mat-option> |
|
|
|
} |
|
|
|
</mat-select> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
@ -354,8 +376,8 @@ |
|
|
|
<mat-form-field appearance="outline" class="w-100"> |
|
|
|
<mat-label i18n>Tags</mat-label> |
|
|
|
<mat-chip-grid #tagsChipList> |
|
|
|
@for (tag of activityForm.get('tags')?.value; track tag) { |
|
|
|
<mat-chip-row |
|
|
|
*ngFor="let tag of activityForm.get('tags')?.value" |
|
|
|
matChipRemove |
|
|
|
[removable]="true" |
|
|
|
(removed)="onRemoveTag(tag)" |
|
|
@ -363,6 +385,7 @@ |
|
|
|
{{ tag.name }} |
|
|
|
<ion-icon class="ml-2" matPrefix name="close-outline" /> |
|
|
|
</mat-chip-row> |
|
|
|
} |
|
|
|
<input |
|
|
|
#tagInput |
|
|
|
name="close-outline" |
|
|
@ -375,12 +398,11 @@ |
|
|
|
#autocompleteTags="matAutocomplete" |
|
|
|
(optionSelected)="onAddTag($event)" |
|
|
|
> |
|
|
|
<mat-option |
|
|
|
*ngFor="let tag of filteredTagsObservable | async" |
|
|
|
[value]="tag.id" |
|
|
|
> |
|
|
|
@for (tag of filteredTagsObservable | async; track tag) { |
|
|
|
<mat-option [value]="tag.id"> |
|
|
|
{{ tag.name }} |
|
|
|
</mat-option> |
|
|
|
} |
|
|
|
</mat-autocomplete> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|