MOBILE-4292 base-profilefield: Use displayvalue instead of value
This commit is contained in:
		
							parent
							
								
									772864245e
								
							
						
					
					
						commit
						98d6733541
					
				| @ -1559,6 +1559,7 @@ export type AddonModAssignParticipant = { | |||||||
|     customfields?: { // User custom fields (also known as user profile fields).
 |     customfields?: { // User custom fields (also known as user profile fields).
 | ||||||
|         type: string; // The type of the custom field - text field, checkbox...
 |         type: string; // The type of the custom field - text field, checkbox...
 | ||||||
|         value: string; // The value of the custom field.
 |         value: string; // The value of the custom field.
 | ||||||
|  |         displayvalue: string; // @since 4.2.Formatted value of the custom field.
 | ||||||
|         name: string; // The name of the custom field.
 |         name: string; // The name of the custom field.
 | ||||||
|         shortname: string; // The shortname of the custom field - to be able to build the field class in the code.
 |         shortname: string; // The shortname of the custom field - to be able to build the field class in the code.
 | ||||||
|     }[]; |     }[]; | ||||||
|  | |||||||
| @ -2,7 +2,8 @@ | |||||||
| <ion-item *ngIf="!edit && field && field.name"> | <ion-item *ngIf="!edit && field && field.name"> | ||||||
|     <ion-label> |     <ion-label> | ||||||
|         <p class="item-heading">{{ field.name }}</p> |         <p class="item-heading">{{ field.name }}</p> | ||||||
|         <p>{{ valueNumber * 1000 | coreFormatDate }}</p> |         <p *ngIf="valueNumber">{{ valueNumber * 1000 | coreFormatDate }}</p> | ||||||
|  |         <p *ngIf="displayValue">{{ displayValue }}</p> | ||||||
|     </ion-label> |     </ion-label> | ||||||
| </ion-item> | </ion-item> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -36,7 +36,8 @@ export class AddonUserProfileFieldDatetimeComponent extends CoreUserProfileField | |||||||
|     format?: string; |     format?: string; | ||||||
|     min?: string; |     min?: string; | ||||||
|     max?: string; |     max?: string; | ||||||
|     valueNumber = 0; |     valueNumber?: number; | ||||||
|  |     displayValue?: string; | ||||||
|     monthNames?: string[]; |     monthNames?: string[]; | ||||||
|     displayTimezone?: string; |     displayTimezone?: string; | ||||||
| 
 | 
 | ||||||
| @ -46,6 +47,12 @@ export class AddonUserProfileFieldDatetimeComponent extends CoreUserProfileField | |||||||
|      * @param field Field to render. |      * @param field Field to render. | ||||||
|      */ |      */ | ||||||
|     protected initForNonEdit(field: CoreUserProfileField): void { |     protected initForNonEdit(field: CoreUserProfileField): void { | ||||||
|  |         if (field.displayvalue) { | ||||||
|  |             this.displayValue = field.displayvalue; | ||||||
|  | 
 | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         this.valueNumber = Number(field.value); |         this.valueNumber = Number(field.value); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -69,7 +69,7 @@ export abstract class CoreUserProfileFieldBaseComponent implements OnInit { | |||||||
|      * @param field Field to render. |      * @param field Field to render. | ||||||
|      */ |      */ | ||||||
|     protected initForNonEdit(field: CoreUserProfileField): void { |     protected initForNonEdit(field: CoreUserProfileField): void { | ||||||
|         this.value = field.value; |         this.value = field.displayvalue ?? field.value; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -892,6 +892,7 @@ export type CoreUserPreference = { | |||||||
| export type CoreUserProfileField = { | export type CoreUserProfileField = { | ||||||
|     type: string; // The type of the custom field - text field, checkbox...
 |     type: string; // The type of the custom field - text field, checkbox...
 | ||||||
|     value: string; // The value of the custom field.
 |     value: string; // The value of the custom field.
 | ||||||
|  |     displayvalue: string; // @since 4.2. Formatted value of the custom field.
 | ||||||
|     name: string; // The name of the custom field.
 |     name: string; // The name of the custom field.
 | ||||||
|     shortname: string; // The shortname of the custom field - to be able to build the field class in the code.
 |     shortname: string; // The shortname of the custom field - to be able to build the field class in the code.
 | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user