|
| 1 | +<ng-container *transloco="let t"> |
| 2 | + <div class="content_container"> |
| 3 | + <h1>{{ t("assetsComponent.title") }}</h1> |
| 4 | + <mat-card class="transfer-rights-card"> |
| 5 | + <mat-card-content> |
| 6 | + <!-- Loading State --> |
| 7 | + <div *ngIf="isLoading" class="loading-container"> |
| 8 | + <mat-spinner diameter="40"></mat-spinner> |
| 9 | + <p>{{ t("transferRights.loading") }}</p> |
| 10 | + </div> |
| 11 | + |
| 12 | + <!-- No Assets Message --> |
| 13 | + <div *ngIf="!isLoading && sourceContracts.length === 0" class="no-assets-message"> |
| 14 | + <mat-icon class="large-icon">info</mat-icon> |
| 15 | + <h3>{{ t("transferRights.noAssets.title") }}</h3> |
| 16 | + <p>{{ t("transferRights.noAssets.message") }}</p> |
| 17 | + <button mat-raised-button color="primary" (click)="goBack()"> |
| 18 | + {{ t("transferRights.noAssets.backButton") }} |
| 19 | + </button> |
| 20 | + </div> |
| 21 | + |
| 22 | + <!-- Transfer Rights Form --> |
| 23 | + <form *ngIf="!isLoading && sourceContracts.length > 0" [formGroup]="transferRightsForm" |
| 24 | + (ngSubmit)="submitTransferRights()"> |
| 25 | + |
| 26 | + <h2>{{ t("transferRights.title") }}</h2> |
| 27 | + <!-- Fee Information at the top --> |
| 28 | + <div class="transaction-fee" *ngIf="selectedSourceContract"> |
| 29 | + {{ t("transferRights.form.procedureFee") }}: {{ getTransactionFee() | number: '1.0-0' }} QUBIC |
| 30 | + </div> |
| 31 | + |
| 32 | + <div class="row"> |
| 33 | + <div class="col"> |
| 34 | + <!-- Source Contract Selection --> |
| 35 | + <mat-form-field appearance="fill" class="full-width"> |
| 36 | + <mat-label>{{ t("transferRights.form.sourceContract") }}</mat-label> |
| 37 | + <mat-select formControlName="sourceContract" [compareWith]="compareContracts"> |
| 38 | + <mat-select-trigger *ngIf="selectedSourceContract"> |
| 39 | + <div class="contract-trigger"> |
| 40 | + <span class="contract-name">{{ selectedSourceContract.contractName }}</span> |
| 41 | + <span class="asset-info"> |
| 42 | + {{ selectedSourceContract.availableBalance | number: '1.0-0' }} |
| 43 | + {{ selectedSourceContract.asset.assetName }} |
| 44 | + </span> |
| 45 | + <span class="owner-info"> |
| 46 | + {{ getSeedAlias(selectedSourceContract.asset.publicId) }} |
| 47 | + ({{ shortenAddress(selectedSourceContract.asset.publicId) }}) |
| 48 | + </span> |
| 49 | + </div> |
| 50 | + </mat-select-trigger> |
| 51 | + <mat-option *ngFor="let contract of sourceContracts" [value]="contract"> |
| 52 | + <div class="contract-option"> |
| 53 | + <strong>{{ contract.contractName }}</strong> |
| 54 | + <br> |
| 55 | + <small> |
| 56 | + {{ contract.availableBalance | number: '1.0-0' }} {{ contract.asset.assetName }} | |
| 57 | + {{ getSeedAlias(contract.asset.publicId) }} ({{ shortenAddress(contract.asset.publicId) }}) |
| 58 | + </small> |
| 59 | + </div> |
| 60 | + </mat-option> |
| 61 | + </mat-select> |
| 62 | + <mat-error *ngIf="transferRightsForm.get('sourceContract')?.hasError('required')"> |
| 63 | + {{ t("transferRights.errors.sourceRequired") }} |
| 64 | + </mat-error> |
| 65 | + </mat-form-field> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + |
| 69 | + <div class="row"> |
| 70 | + <div class="col"> |
| 71 | + <!-- Destination Contract Selection --> |
| 72 | + <mat-form-field appearance="fill" class="full-width"> |
| 73 | + <mat-label>{{ t("transferRights.form.destinationContract") }}</mat-label> |
| 74 | + <mat-select formControlName="destinationContract" [compareWith]="compareContracts"> |
| 75 | + <mat-option *ngFor="let contract of destinationContracts" [value]="contract"> |
| 76 | + <div class="contract-option"> |
| 77 | + <strong>{{ contract.contractName }}</strong> |
| 78 | + </div> |
| 79 | + </mat-option> |
| 80 | + </mat-select> |
| 81 | + <mat-error *ngIf="transferRightsForm.get('destinationContract')?.hasError('required')"> |
| 82 | + {{ t("transferRights.errors.destinationRequired") }} |
| 83 | + </mat-error> |
| 84 | + <mat-error *ngIf="transferRightsForm.hasError('contractsEqual')"> |
| 85 | + {{ t("transferRights.errors.contractsEqual") }} |
| 86 | + </mat-error> |
| 87 | + </mat-form-field> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + |
| 91 | + <div class="row"> |
| 92 | + <div class="col"> |
| 93 | + <!-- Number of Shares (equivalent to Amount field) --> |
| 94 | + <mat-form-field appearance="fill" class="full-width"> |
| 95 | + <mat-label>{{ t("transferRights.form.numberOfShares") }}</mat-label> |
| 96 | + <input matInput type="number" formControlName="numberOfShares" min="1"> |
| 97 | + <button *ngIf="transferRightsForm.controls['numberOfShares'].value" matSuffix mat-icon-button |
| 98 | + aria-label="Clear" (click)="transferRightsForm.controls['numberOfShares'].setValue(null)" type="button"> |
| 99 | + <mat-icon>close</mat-icon> |
| 100 | + </button> |
| 101 | + <button *ngIf="selectedSourceContract && selectedSourceContract.availableBalance > 0" matSuffix |
| 102 | + mat-icon-button matTooltip="{{ t('transferRights.form.maxButton') }}" (click)="setMaxShares()" |
| 103 | + type="button"> |
| 104 | + <mat-icon>all_inclusive</mat-icon> |
| 105 | + </button> |
| 106 | + <mat-error *ngIf="transferRightsForm.get('numberOfShares')?.hasError('required')"> |
| 107 | + {{ t("transferRights.errors.sharesRequired") }} |
| 108 | + </mat-error> |
| 109 | + <mat-error *ngIf="transferRightsForm.get('numberOfShares')?.hasError('min')"> |
| 110 | + {{ t("transferRights.errors.sharesMin") }} |
| 111 | + </mat-error> |
| 112 | + <mat-error *ngIf="transferRightsForm.get('numberOfShares')?.hasError('max')"> |
| 113 | + {{ t("transferRights.errors.sharesMax", { max: selectedSourceContract?.availableBalance }) }} |
| 114 | + </mat-error> |
| 115 | + <mat-hint *ngIf="selectedSourceContract" align="end">{{ |
| 116 | + transferRightsForm.controls['numberOfShares'].value | number: '1.0-0' }} / |
| 117 | + {{ selectedSourceContract.availableBalance | number: '1.0-0' }} shares</mat-hint> |
| 118 | + </mat-form-field> |
| 119 | + </div> |
| 120 | + <div class="col"> |
| 121 | + <!-- Tick (matching Send Assets layout) --> |
| 122 | + <mat-form-field appearance="fill" class="full-width"> |
| 123 | + <mat-label>{{ t("transferRights.form.tick") }}</mat-label> |
| 124 | + <input matInput type="number" formControlName="tick" [readonly]="!tickOverwrite"> |
| 125 | + <button matSuffix mat-icon-button matTooltip="{{ t('transferRights.form.tickOverwrite') }}" |
| 126 | + (click)="tickOverwrite = !tickOverwrite" type="button" [class]="{tickOverwrite: tickOverwrite}"> |
| 127 | + <mat-icon>tune</mat-icon> |
| 128 | + </button> |
| 129 | + <mat-error *ngIf="transferRightsForm.get('tick')?.hasError('required')"> |
| 130 | + {{ t("transferRights.errors.tickRequired") }} |
| 131 | + </mat-error> |
| 132 | + <mat-error *ngIf="transferRightsForm.get('tick')?.hasError('min')"> |
| 133 | + {{ t("transferRights.errors.tickMin", { min: currentTick }) }} |
| 134 | + </mat-error> |
| 135 | + </mat-form-field> |
| 136 | + </div> |
| 137 | + </div> |
| 138 | + |
| 139 | + <!-- Balance after fees warning --> |
| 140 | + <div *ngIf="selectedSourceContract && !canPayFees()" class="error-message"> |
| 141 | + {{ t("transferRights.errors.insufficientBalance") }} |
| 142 | + </div> |
| 143 | + |
| 144 | + <!-- Form Actions --> |
| 145 | + <mat-card-actions class="padding"> |
| 146 | + <button mat-raised-button type="button" (click)="goBack()" [disabled]="isSubmitting"> |
| 147 | + {{ t("assetsComponent.form.buttons.cancel") }} |
| 148 | + </button> |
| 149 | + <button *ngIf="!walletService.privateKey" mat-raised-button color="primary" type="button" (click)="loadKey()"> |
| 150 | + {{ t("paymentComponent.buttons.loadPrivateKey") }} |
| 151 | + </button> |
| 152 | + <button *ngIf="walletService.privateKey" mat-raised-button color="primary" type="submit" |
| 153 | + [disabled]="!transferRightsForm.valid || isSubmitting || !canPayFees()"> |
| 154 | + <span *ngIf="!isSubmitting">{{ t("transferRights.form.submit") }}</span> |
| 155 | + <mat-progress-spinner *ngIf="isSubmitting" mode="indeterminate" [diameter]="20"> |
| 156 | + </mat-progress-spinner> |
| 157 | + </button> |
| 158 | + </mat-card-actions> |
| 159 | + </form> |
| 160 | + </mat-card-content> |
| 161 | + </mat-card> |
| 162 | + </div> |
| 163 | +</ng-container> |
0 commit comments