Pull request #324: RED-3115

Merge in RED/ui from RED-3115 to master

* commit '02e14fded84b73b6079c2ed47b9cd6e9fbcce541':
  update configuration.initializer
  trim time from date
  refactored get valid() and removed / from input and img
  changed input date format
  changed placeholder and attributes reload
This commit is contained in:
Eduard Cziszter 2021-12-22 09:24:13 +01:00 committed by Dan Percic
commit fa6106151d
4 changed files with 20 additions and 16 deletions

View File

@ -16,12 +16,16 @@
class="iqser-input-group"
>
<label>{{ attr.label }}</label>
<input
<ng-container
*ngIf="isSpecificType(attr, dossierAttributeConfigTypes.NUMBER) || isSpecificType(attr, dossierAttributeConfigTypes.TEXT)"
[formControlName]="attr.id"
[name]="attr.id"
[type]="isSpecificType(attr, dossierAttributeConfigTypes.NUMBER) ? 'number' : 'text'"
/>
>
<input
[formControlName]="attr.id"
[name]="attr.id"
[type]="isSpecificType(attr, dossierAttributeConfigTypes.NUMBER) ? 'number' : 'text'"
/>
</ng-container>
<ng-container *ngIf="isSpecificType(attr, dossierAttributeConfigTypes.DATE)">
<input [formControlName]="attr.id" [matDatepicker]="picker" placeholder="dd/mm/yy" />

View File

@ -53,7 +53,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
}
get valid(): boolean {
return this.form.valid;
return !!this.form?.valid;
}
async ngOnInit() {
@ -66,7 +66,9 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
async save(): EditDossierSaveResult {
const dossierAttributeList = this.attributes.map(attr => ({
dossierAttributeConfigId: attr.id,
value: this.currentAttrValue(attr),
value: this.isSpecificType(attr, DossierAttributeConfigTypes.DATE)
? moment(this.currentAttrValue(attr)).format('YYYY-MM-DD')
: this.currentAttrValue(attr),
}));
try {
await this._dossierAttributesService.setAttributes(this.dossier, dossierAttributeList).toPromise();

View File

@ -68,12 +68,9 @@ export class UserPreferenceService extends GenericService<UserAttributes> {
window.location.reload();
}
reload(): Promise<void> {
return this.getAll<UserAttributes>()
.toPromise()
.then(attributes => {
this._userAttributes = attributes ?? {};
});
async reload(): Promise<void> {
const attributes = await this.getAll<UserAttributes>().toPromise();
this._userAttributes = attributes ?? {};
}
@Validate()

View File

@ -1,4 +1,4 @@
import { catchError, filter, mergeMapTo, switchMap, take, tap } from 'rxjs/operators';
import { catchError, filter, mergeMap, switchMap, take, tap } from 'rxjs/operators';
import { ConfigService } from '@services/config.service';
import { Title } from '@angular/platform-browser';
import { from, of, throwError } from 'rxjs';
@ -21,9 +21,10 @@ export function configurationInitializer(
filter(event => event.type === KeycloakEventType.OnReady),
switchMap(() => from(keycloakService.isLoggedIn())),
switchMap(loggedIn => (!loggedIn ? throwError('Not Logged In') : of({}))),
mergeMapTo(generalSettingsService.getGeneralConfigurations()),
mergeMap(() => generalSettingsService.getGeneralConfigurations()),
tap(configuration => configService.updateDisplayName(configuration.displayName)),
tap(() => userPreferenceService.reload().then(() => languageService.chooseAndSetInitialLanguage())),
switchMap(() => userPreferenceService.reload()),
tap(() => languageService.chooseAndSetInitialLanguage()),
catchError(() => {
title.setTitle('RedactManager');
return of({});