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+
28+ < div class ="row ">
29+ < div class ="col ">
30+ <!-- Asset Selection -->
31+ < mat-form-field appearance ="fill " class ="full-width ">
32+ < mat-label > {{ t("transferRights.form.selectAsset") }}</ mat-label >
33+ < mat-select formControlName ="selectedAsset " [compareWith] ="compareAssets ">
34+ < mat-select-trigger >
35+ < span *ngIf ="selectedAsset ">
36+ {{ getSeedAlias(selectedAsset.asset.publicId) }}
37+ ({{ shortenAddress(selectedAsset.asset.publicId) }}) -
38+ {{ selectedAsset.totalAvailableBalance | number: '1.0-0' }}
39+ {{ selectedAsset.asset.assetName }}
40+ </ span >
41+ </ mat-select-trigger >
42+ < mat-option *ngFor ="let assetOption of assets " [value] ="assetOption ">
43+ {{ getSeedAlias(assetOption.asset.publicId) }} ({{ shortenAddress(assetOption.asset.publicId)
44+ }})< br />
45+ {{ assetOption.totalAvailableBalance | number: '1.0-0' }} {{ assetOption.asset.assetName }}
46+ </ mat-option >
47+ </ mat-select >
48+ < mat-error *ngIf ="transferRightsForm.get('selectedAsset')?.hasError('required') ">
49+ {{ t("transferRights.errors.assetRequired") }}
50+ </ mat-error >
51+ </ mat-form-field >
52+ </ div >
53+ </ div >
54+
55+ < div class ="row ">
56+ < div class ="col ">
57+ <!-- Source Contract Selection -->
58+ < mat-form-field appearance ="fill " class ="full-width ">
59+ < mat-label > {{ t("transferRights.form.sourceContract") }}</ mat-label >
60+ < mat-select formControlName ="sourceContract " [compareWith] ="compareContracts "
61+ [disabled] ="!selectedAsset ">
62+ < mat-select-trigger >
63+ < span *ngIf ="selectedSourceContract ">
64+ {{ selectedSourceContract.contractName }} - {{ selectedSourceContract.availableBalance | number:
65+ '1.0-0' }} {{ selectedSourceContract.asset.assetName }}
66+ </ span >
67+ </ mat-select-trigger >
68+ < mat-option *ngFor ="let contract of filteredSourceContracts " [value] ="contract ">
69+ < span > {{ contract.contractName }} - {{ contract.availableBalance | number: '1.0-0' }} {{
70+ contract.asset.assetName }}</ span >
71+ </ mat-option >
72+ </ mat-select >
73+ < mat-error *ngIf ="transferRightsForm.get('sourceContract')?.hasError('required') ">
74+ {{ t("transferRights.errors.sourceRequired") }}
75+ </ mat-error >
76+ </ mat-form-field >
77+ </ div >
78+ </ div >
79+
80+ < div class ="row ">
81+ < div class ="col ">
82+ <!-- Destination Contract Selection -->
83+ < mat-form-field appearance ="fill " class ="full-width ">
84+ < mat-label > {{ t("transferRights.form.destinationContract") }}</ mat-label >
85+ < mat-select formControlName ="destinationContract " [compareWith] ="compareContracts ">
86+ < mat-option *ngFor ="let contract of filteredDestinationContracts " [value] ="contract ">
87+ < div class ="contract-option ">
88+ < strong > {{ contract.contractName }}</ strong >
89+ </ div >
90+ </ mat-option >
91+ </ mat-select >
92+ < mat-error *ngIf ="transferRightsForm.get('destinationContract')?.hasError('required') ">
93+ {{ t("transferRights.errors.destinationRequired") }}
94+ </ mat-error >
95+ < mat-error *ngIf ="transferRightsForm.hasError('contractsEqual') ">
96+ {{ t("transferRights.errors.contractsEqual") }}
97+ </ mat-error >
98+ </ mat-form-field >
99+ </ div >
100+ </ div >
101+
102+ < div class ="row ">
103+ < div class ="col ">
104+ <!-- Number of Shares (equivalent to Amount field) -->
105+ < mat-form-field appearance ="fill " class ="full-width ">
106+ < mat-label > {{ t("transferRights.form.amount") }}</ mat-label >
107+ < input matInput type ="number " formControlName ="numberOfShares " min ="1 ">
108+ < button *ngIf ="transferRightsForm.controls['numberOfShares'].value " matSuffix mat-icon-button
109+ aria-label ="Clear " (click) ="transferRightsForm.controls['numberOfShares'].setValue(null) "
110+ type ="button ">
111+ < mat-icon > close</ mat-icon >
112+ </ button >
113+ < button *ngIf ="selectedSourceContract && selectedSourceContract.availableBalance > 0 " matSuffix
114+ mat-icon-button matTooltip ="{{ t('transferRights.form.maxButton') }} " (click) ="setMaxShares() "
115+ type ="button ">
116+ < mat-icon > all_inclusive</ mat-icon >
117+ </ button >
118+ < mat-error *ngIf ="transferRightsForm.get('numberOfShares')?.hasError('required') ">
119+ {{ t("transferRights.errors.amountRequired") }}
120+ </ mat-error >
121+ < mat-error *ngIf ="transferRightsForm.get('numberOfShares')?.hasError('min') ">
122+ {{ t("transferRights.errors.amountMin") }}
123+ </ mat-error >
124+ < mat-error *ngIf ="transferRightsForm.get('numberOfShares')?.hasError('max') ">
125+ {{ t("transferRights.errors.amountMax", { max: selectedSourceContract?.availableBalance }) }}
126+ </ mat-error >
127+ </ mat-form-field >
128+ </ div >
129+ < div class ="col ">
130+ <!-- Tick (matching Send Assets layout) -->
131+ < mat-form-field appearance ="fill " class ="full-width ">
132+ < mat-label > {{ t("transferRights.form.tick") }}</ mat-label >
133+ < input matInput type ="number " formControlName ="tick " [readonly] ="!tickOverwrite ">
134+ < button matSuffix mat-icon-button matTooltip ="{{ t('transferRights.form.tickOverwrite') }} "
135+ (click) ="tickOverwrite = !tickOverwrite " type ="button " [class] ="{tickOverwrite: tickOverwrite} ">
136+ < mat-icon > tune</ mat-icon >
137+ </ button >
138+ < mat-error *ngIf ="transferRightsForm.get('tick')?.hasError('required') ">
139+ {{ t("transferRights.errors.tickRequired") }}
140+ </ mat-error >
141+ < mat-error *ngIf ="transferRightsForm.get('tick')?.hasError('min') ">
142+ {{ t("transferRights.errors.tickMin", { min: currentTick }) }}
143+ </ mat-error >
144+ </ mat-form-field >
145+ </ div >
146+ </ div >
147+
148+ <!-- Balance and Fee Information -->
149+ < div class ="transaction-fee " *ngIf ="selectedSourceContract ">
150+ {{ t("transferRights.form.balance", { fee: getTransactionFee() | number: '1.0-0' }) }}
151+ {{ getBalanceAfterFees() | number: '1.0-0' }}
152+ {{ t("general.currency") }}
153+ </ div >
154+
155+ <!-- Error message for insufficient balance -->
156+ < div *ngIf ="selectedSourceContract && getBalanceAfterFees() < 0 " class ="error-message ">
157+ {{ t("transferRights.errors.insufficientBalance", { fee: getTransactionFee() | number: '1.0-0' }) }}
158+ </ div >
159+
160+ <!-- Form Actions -->
161+ < mat-card-actions class ="padding ">
162+ < button mat-raised-button type ="button " (click) ="goBack() " [disabled] ="isSubmitting ">
163+ {{ t("assetsComponent.form.buttons.cancel") }}
164+ </ button >
165+ < button *ngIf ="!walletService.privateKey " mat-raised-button color ="primary " type ="button "
166+ (click) ="loadKey() ">
167+ {{ t("paymentComponent.buttons.loadPrivateKey") }}
168+ </ button >
169+ < button *ngIf ="walletService.privateKey " mat-raised-button color ="primary " type ="submit "
170+ [disabled] ="!transferRightsForm.valid || isSubmitting || !canPayFees() ">
171+ < span *ngIf ="!isSubmitting "> {{ t("transferRights.form.submit") }}</ span >
172+ < mat-progress-spinner *ngIf ="isSubmitting " mode ="indeterminate " [diameter] ="20 ">
173+ </ mat-progress-spinner >
174+ </ button >
175+ </ mat-card-actions >
176+ </ form >
177+ </ mat-card-content >
178+ </ mat-card >
179+ </ div >
180+ </ ng-container >
0 commit comments