Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
# Conflicts: # dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.ts
This commit is contained in:
commit
28f8df5a36
|
@ -13,13 +13,13 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^18.0.1",
|
"@angular/animations": "^18.0.2",
|
||||||
"@angular/common": "^18.0.1",
|
"@angular/common": "^18.0.2",
|
||||||
"@angular/compiler": "^18.0.1",
|
"@angular/compiler": "^18.0.2",
|
||||||
"@angular/core": "^18.0.1",
|
"@angular/core": "^18.0.2",
|
||||||
"@angular/forms": "^18.0.1",
|
"@angular/forms": "^18.0.2",
|
||||||
"@angular/material-moment-adapter": "^18.0.1",
|
"@angular/material-moment-adapter": "^18.0.2",
|
||||||
"@angular/platform-browser": "^18.0.1",
|
"@angular/platform-browser": "^18.0.2",
|
||||||
"@kolkov/angular-editor": "^2.1.0",
|
"@kolkov/angular-editor": "^2.1.0",
|
||||||
"@ngx-translate/core": "^15.0.0",
|
"@ngx-translate/core": "^15.0.0",
|
||||||
"@ngx-translate/http-loader": "^8.0.0",
|
"@ngx-translate/http-loader": "^8.0.0",
|
||||||
|
@ -33,6 +33,8 @@
|
||||||
"keycloak-js": "^24.0.5",
|
"keycloak-js": "^24.0.5",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"moment-timezone": "^0.5.45",
|
"moment-timezone": "^0.5.45",
|
||||||
|
"@mat-datetimepicker/core": "^13.0.2",
|
||||||
|
"@mat-datetimepicker/moment": "^13.0.2",
|
||||||
"ng-dialog-animation": "^9.0.4",
|
"ng-dialog-animation": "^9.0.4",
|
||||||
"ng2-dragula": "^5.1.0",
|
"ng2-dragula": "^5.1.0",
|
||||||
"ngx-colors": "^3.6.0",
|
"ngx-colors": "^3.6.0",
|
||||||
|
@ -44,25 +46,25 @@
|
||||||
"rxjs": "^7.4.0",
|
"rxjs": "^7.4.0",
|
||||||
"tinymce": "^6.7.0",
|
"tinymce": "^6.7.0",
|
||||||
"ts-simple-nameof": "^1.3.1",
|
"ts-simple-nameof": "^1.3.1",
|
||||||
"tslib": "^2.6.2",
|
"tslib": "^2.6.3",
|
||||||
"zone.js": "~0.14.4"
|
"zone.js": "~0.14.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^18.0.2",
|
"@angular-devkit/build-angular": "^18.0.3",
|
||||||
"@angular/cdk": "^18.0.1",
|
"@angular/cdk": "^18.0.2",
|
||||||
"@angular/cli": "18.0.2",
|
"@angular/cli": "18.0.3",
|
||||||
"@angular/compiler-cli": "^18.0.1",
|
"@angular/compiler-cli": "^18.0.2",
|
||||||
"@angular/language-service": "^18.0.1",
|
"@angular/language-service": "^18.0.2",
|
||||||
"@angular/material": "^18.0.1",
|
"@angular/material": "^18.0.2",
|
||||||
"@angular/platform-browser-dynamic": "^18.0.1",
|
"@angular/platform-browser-dynamic": "^18.0.2",
|
||||||
"@angular/router": "^18.0.1",
|
"@angular/router": "^18.0.2",
|
||||||
"@types/dragula": "^3.7.5",
|
"@types/dragula": "^3.7.5",
|
||||||
"@types/file-saver": "^2.0.7",
|
"@types/file-saver": "^2.0.7",
|
||||||
"@types/moment-timezone": "^0.5.13",
|
"@types/moment-timezone": "^0.5.13",
|
||||||
"@types/node": "^20.14.1",
|
"@types/node": "^20.14.2",
|
||||||
"codelyzer": "^6.0.2",
|
"codelyzer": "^6.0.2",
|
||||||
"ts-node": "~10.9.2",
|
"ts-node": "~10.9.2",
|
||||||
"tslint": "~6.1.0",
|
"tslint": "~6.1.0",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,11 +270,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||||
this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------- UNCOMMENT TO ADD AGAIN GRANTS --------
|
|
||||||
// goToGrants() {
|
|
||||||
// this.router.navigate(['/grants'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
|
||||||
// }
|
|
||||||
|
|
||||||
initializeServices() {
|
initializeServices() {
|
||||||
this.translate.setDefaultLang(this.language.getDefaultLanguagesCode());
|
this.translate.setDefaultLang(this.language.getDefaultLanguagesCode());
|
||||||
this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileCulture() ? this.cultureService.cultureSelected(this.authentication.getUserProfileCulture()) : this.cultureService.cultureSelected(this.configurationService.defaultCulture);
|
this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileCulture() ? this.cultureService.cultureSelected(this.authentication.getUserProfileCulture()) : this.cultureService.cultureSelected(this.configurationService.defaultCulture);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
||||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
|
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
|
||||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldDefaultOptions } from '@angular/material/form-field';
|
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||||
import { BrowserModule, Title } from '@angular/platform-browser';
|
import { BrowserModule, Title } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { AppRoutingModule } from '@app/app-routing.module';
|
import { AppRoutingModule } from '@app/app-routing.module';
|
||||||
|
@ -12,16 +12,19 @@ import { AppComponent } from '@app/app.component';
|
||||||
import { CoreServiceModule } from '@app/core/core-service.module';
|
import { CoreServiceModule } from '@app/core/core-service.module';
|
||||||
import { NotificationModule } from '@app/library/notification/notification.module';
|
import { NotificationModule } from '@app/library/notification/notification.module';
|
||||||
import { LoginModule } from '@app/ui/auth/login/login.module';
|
import { LoginModule } from '@app/ui/auth/login/login.module';
|
||||||
// import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
|
|
||||||
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
||||||
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
||||||
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
||||||
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
|
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
|
||||||
|
import { MomentUtcDateTimeAdapter } from '@common/date/moment-utc-date-time.adapter';
|
||||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||||
import { CommonHttpModule } from '@common/http/common-http.module';
|
import { CommonHttpModule } from '@common/http/common-http.module';
|
||||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||||
|
import { DatetimeAdapter } from '@mat-datetimepicker/core';
|
||||||
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreNotificationServiceModule } from '@notification-service/services/core-service.module';
|
||||||
|
import { CoreAnnotationServiceModule } from 'annotation-service/services/core-service.module';
|
||||||
import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
|
import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
|
||||||
import { DragulaModule } from 'ng2-dragula';
|
import { DragulaModule } from 'ng2-dragula';
|
||||||
import { CookieService } from 'ngx-cookie-service';
|
import { CookieService } from 'ngx-cookie-service';
|
||||||
|
@ -34,14 +37,12 @@ import { CultureService } from './core/services/culture/culture-service';
|
||||||
import { LanguageHttpService } from './core/services/language/language.http.service';
|
import { LanguageHttpService } from './core/services/language/language.http.service';
|
||||||
import { LanguageService } from './core/services/language/language.service';
|
import { LanguageService } from './core/services/language/language.service';
|
||||||
import { TranslateServerLoader } from './core/services/language/server.loader';
|
import { TranslateServerLoader } from './core/services/language/server.loader';
|
||||||
import { MatomoService } from './core/services/matomo/matomo-service';
|
|
||||||
import { GuidedTourModule } from './library/guided-tour/guided-tour.module';
|
|
||||||
import { OpenDMPCustomTranslationCompiler } from './utilities/translate/opendmp-custom-translation-compiler';
|
|
||||||
import { CoreAnnotationServiceModule } from 'annotation-service/services/core-service.module';
|
|
||||||
import { CoreNotificationServiceModule } from '@notification-service/services/core-service.module';
|
|
||||||
import { DepositOauth2DialogModule } from './ui/misc/deposit-oauth2-dialog/deposit-oauth2-dialog.module';
|
|
||||||
import { AnalyticsService } from './core/services/matomo/analytics-service';
|
import { AnalyticsService } from './core/services/matomo/analytics-service';
|
||||||
|
import { MatomoService } from './core/services/matomo/matomo-service';
|
||||||
import { TenantHandlingService } from './core/services/tenant/tenant-handling.service';
|
import { TenantHandlingService } from './core/services/tenant/tenant-handling.service';
|
||||||
|
import { GuidedTourModule } from './library/guided-tour/guided-tour.module';
|
||||||
|
import { DepositOauth2DialogModule } from './ui/misc/deposit-oauth2-dialog/deposit-oauth2-dialog.module';
|
||||||
|
import { OpenDMPCustomTranslationCompiler } from './utilities/translate/opendmp-custom-translation-compiler';
|
||||||
|
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
export function HttpLoaderFactory(languageHttpService: LanguageHttpService) {
|
export function HttpLoaderFactory(languageHttpService: LanguageHttpService) {
|
||||||
|
@ -78,12 +79,7 @@ const cookieConfig: NgcCookieConsentConfig = {
|
||||||
type: 'info'
|
type: 'info'
|
||||||
};
|
};
|
||||||
|
|
||||||
const appearance: MatFormFieldDefaultOptions = {
|
export function InstallationConfigurationFactory(appConfig: ConfigurationService, keycloak: KeycloakService, authService: AuthService, languageService: LanguageService, tenantHandlingService: TenantHandlingService) {
|
||||||
appearance: 'outline'
|
|
||||||
// appearance: 'standard'
|
|
||||||
};
|
|
||||||
|
|
||||||
export function InstallationConfigurationFactory(appConfig: ConfigurationService, keycloak: KeycloakService, authService: AuthService, languageService: LanguageService, tenantHandlingService:TenantHandlingService) {
|
|
||||||
return () => appConfig.loadConfiguration().then(() => {
|
return () => appConfig.loadConfiguration().then(() => {
|
||||||
return languageService.loadAvailableLanguages().toPromise();
|
return languageService.loadAvailableLanguages().toPromise();
|
||||||
}).then(x => keycloak.init({
|
}).then(x => keycloak.init({
|
||||||
|
@ -145,7 +141,6 @@ export function InstallationConfigurationFactory(appConfig: ConfigurationService
|
||||||
LoginModule,
|
LoginModule,
|
||||||
//Ui
|
//Ui
|
||||||
NotificationModule,
|
NotificationModule,
|
||||||
// BreadcrumbModule,
|
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
NavbarModule,
|
NavbarModule,
|
||||||
|
@ -156,35 +151,39 @@ export function InstallationConfigurationFactory(appConfig: ConfigurationService
|
||||||
DragulaModule.forRoot(),
|
DragulaModule.forRoot(),
|
||||||
NgxMatomoModule.forRoot({
|
NgxMatomoModule.forRoot({
|
||||||
mode: MatomoInitializationMode.AUTO_DEFERRED,
|
mode: MatomoInitializationMode.AUTO_DEFERRED,
|
||||||
})], providers: [
|
})],
|
||||||
ConfigurationService,
|
providers: [
|
||||||
{
|
ConfigurationService,
|
||||||
provide: APP_INITIALIZER,
|
{
|
||||||
useFactory: InstallationConfigurationFactory,
|
provide: APP_INITIALIZER,
|
||||||
deps: [ConfigurationService, KeycloakService, AuthService, LanguageService, TenantHandlingService],
|
useFactory: InstallationConfigurationFactory,
|
||||||
multi: true
|
deps: [ConfigurationService, KeycloakService, AuthService, LanguageService, TenantHandlingService],
|
||||||
},
|
multi: true
|
||||||
{
|
},
|
||||||
provide: MAT_DATE_LOCALE,
|
{
|
||||||
deps: [CultureService],
|
provide: MAT_DATE_LOCALE,
|
||||||
useFactory: (cultureService) => cultureService.getCurrentCulture().name
|
deps: [CultureService],
|
||||||
},
|
useFactory: (cultureService) => cultureService.getCurrentCulture().name
|
||||||
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
|
},
|
||||||
{ provide: DateAdapter, useClass: MomentUtcDateAdapter },
|
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
|
||||||
{
|
{ provide: DateAdapter, useClass: MomentUtcDateAdapter },
|
||||||
provide: LOCALE_ID,
|
{ provide: DatetimeAdapter, useClass: MomentUtcDateTimeAdapter },
|
||||||
deps: [CultureService],
|
{
|
||||||
useFactory: (cultureService) => cultureService.getCurrentCulture().name
|
provide: LOCALE_ID,
|
||||||
},
|
deps: [CultureService, ConfigurationService],
|
||||||
{
|
useFactory: (cultureService, installationConfigurationService) => cultureService.getCurrentCulture(installationConfigurationService).name
|
||||||
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
},
|
||||||
useValue: appearance
|
{
|
||||||
},
|
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
||||||
Title,
|
useValue: {
|
||||||
CookieService,
|
appearance: 'outline'
|
||||||
MatomoService,
|
}
|
||||||
AnalyticsService,
|
},
|
||||||
provideHttpClient(withInterceptorsFromDi())
|
Title,
|
||||||
]
|
CookieService,
|
||||||
|
MatomoService,
|
||||||
|
AnalyticsService,
|
||||||
|
provideHttpClient(withInterceptorsFromDi())
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { DateFormatPipe } from './pipes/date-format.pipe';
|
import { ColumnClassPipe } from "@app/core/pipes/column-class.pipe";
|
||||||
import { DateTimeFormatPipe } from './pipes/date-time-format.pipe';
|
import { FieldValuePipe } from "@app/core/pipes/field-value.pipe";
|
||||||
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
|
import { AppTitleCaseFormatPipe } from '@common/formatting/pipes/app-title-case-format.pipe';
|
||||||
|
import { CultureInfoDisplayPipe } from './pipes/culture-info-display.pipe';
|
||||||
|
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from './pipes/date-time-format.pipe';
|
||||||
|
import { JsonParserPipe } from './pipes/json-parser.pipe';
|
||||||
import { NgForLimitPipe } from './pipes/ng-for-limit.pipe';
|
import { NgForLimitPipe } from './pipes/ng-for-limit.pipe';
|
||||||
|
import { RemoveHtmlTagsPipe } from './pipes/remove-html-tags.pipe';
|
||||||
import { SumarizeTextPipe } from './pipes/sumarize-text.pipe';
|
import { SumarizeTextPipe } from './pipes/sumarize-text.pipe';
|
||||||
import { TimezoneInfoDisplayPipe } from './pipes/timezone-info-display.pipe';
|
import { TimezoneInfoDisplayPipe } from './pipes/timezone-info-display.pipe';
|
||||||
import { EnumUtils } from './services/utilities/enum-utils.service';
|
import { EnumUtils } from './services/utilities/enum-utils.service';
|
||||||
import { JsonParserPipe } from './pipes/json-parser.pipe';
|
|
||||||
import { DateTimeCultureFormatPipe } from './pipes/date-time-culture-format.pipe';
|
|
||||||
import {FieldValuePipe} from "@app/core/pipes/field-value.pipe";
|
|
||||||
import {ColumnClassPipe} from "@app/core/pipes/column-class.pipe";
|
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
|
||||||
import { AppTitleCaseFormatPipe } from '@common/formatting/pipes/app-title-case-format.pipe';
|
|
||||||
import { RemoveHtmlTagsPipe } from './pipes/remove-html-tags.pipe';
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -27,9 +26,9 @@ import { RemoveHtmlTagsPipe } from './pipes/remove-html-tags.pipe';
|
||||||
SumarizeTextPipe,
|
SumarizeTextPipe,
|
||||||
RemoveHtmlTagsPipe,
|
RemoveHtmlTagsPipe,
|
||||||
TimezoneInfoDisplayPipe,
|
TimezoneInfoDisplayPipe,
|
||||||
DateFormatPipe,
|
CultureInfoDisplayPipe,
|
||||||
DateTimeFormatPipe,
|
DateTimeFormatPipe,
|
||||||
DateTimeCultureFormatPipe,
|
DataTableDateTimeFormatPipe,
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
|
@ -40,9 +39,9 @@ import { RemoveHtmlTagsPipe } from './pipes/remove-html-tags.pipe';
|
||||||
SumarizeTextPipe,
|
SumarizeTextPipe,
|
||||||
RemoveHtmlTagsPipe,
|
RemoveHtmlTagsPipe,
|
||||||
TimezoneInfoDisplayPipe,
|
TimezoneInfoDisplayPipe,
|
||||||
DateFormatPipe,
|
CultureInfoDisplayPipe,
|
||||||
DateTimeFormatPipe,
|
DateTimeFormatPipe,
|
||||||
DateTimeCultureFormatPipe,
|
DataTableDateTimeFormatPipe,
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
|
@ -56,9 +55,9 @@ import { RemoveHtmlTagsPipe } from './pipes/remove-html-tags.pipe';
|
||||||
SumarizeTextPipe,
|
SumarizeTextPipe,
|
||||||
RemoveHtmlTagsPipe,
|
RemoveHtmlTagsPipe,
|
||||||
TimezoneInfoDisplayPipe,
|
TimezoneInfoDisplayPipe,
|
||||||
DateFormatPipe,
|
CultureInfoDisplayPipe,
|
||||||
DateTimeFormatPipe,
|
DateTimeFormatPipe,
|
||||||
DateTimeCultureFormatPipe,
|
DataTableDateTimeFormatPipe,
|
||||||
JsonParserPipe,
|
JsonParserPipe,
|
||||||
FieldValuePipe,
|
FieldValuePipe,
|
||||||
ColumnClassPipe,
|
ColumnClassPipe,
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
export interface CultureInfo {
|
|
||||||
name: string;
|
|
||||||
displayName: string;
|
|
||||||
nativeName: string;
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import { CultureInfo } from '../services/culture/culture-service';
|
||||||
|
|
||||||
|
@Pipe({ name: 'cultureInfoDisplay' })
|
||||||
|
export class CultureInfoDisplayPipe implements PipeTransform {
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
public transform(value: CultureInfo): any {
|
||||||
|
return value.displayName + ' [' + value.name + ']';
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
|
||||||
import moment from 'moment';
|
|
||||||
import 'moment-timezone';
|
|
||||||
|
|
||||||
@Pipe({
|
|
||||||
name: 'dateFormatter'
|
|
||||||
})
|
|
||||||
export class DateFormatPipe implements PipeTransform {
|
|
||||||
|
|
||||||
constructor(private datePipe: DatePipe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any, format?: string, locale?: string): string | null {
|
|
||||||
// using timezone set in timezoneService by default. can be overwritten with pipe arguments
|
|
||||||
const timezoneToUse = moment(value).tz('UTC').format('Z');
|
|
||||||
return this.datePipe.transform(value, format, timezoneToUse, locale);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
import { DatePipe, registerLocaleData } from '@angular/common';
|
|
||||||
import localeEl from '@angular/common/locales/el';
|
|
||||||
import localeDe from '@angular/common/locales/de';
|
|
||||||
import localeEs from '@angular/common/locales/es';
|
|
||||||
import localeSk from '@angular/common/locales/sk';
|
|
||||||
import localeTr from '@angular/common/locales/tr';
|
|
||||||
import localeSr from '@angular/common/locales/sr';
|
|
||||||
import localePt from '@angular/common/locales/pt';
|
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
|
||||||
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
|
|
||||||
import 'moment-timezone';
|
|
||||||
import { CultureInfo } from '../model/culture-info';
|
|
||||||
import { LanguageService } from '../services/language/language.service';
|
|
||||||
|
|
||||||
const availableCultures: CultureInfo[] = require('../../../assets/localization/available-cultures.json');
|
|
||||||
|
|
||||||
@Pipe({
|
|
||||||
name: 'dateTimeCultureFormatter',
|
|
||||||
pure: false
|
|
||||||
})
|
|
||||||
export class DateTimeCultureFormatPipe implements PipeTransform {
|
|
||||||
private cultureValues = new Map<string, CultureInfo>(); // cultures by name
|
|
||||||
private cache;
|
|
||||||
|
|
||||||
constructor(private datePipe: DatePipe,
|
|
||||||
private translate: TranslateService,
|
|
||||||
private languageService: LanguageService) {
|
|
||||||
|
|
||||||
if (availableCultures) {
|
|
||||||
this.cultureValues = new Map<string, CultureInfo>();
|
|
||||||
availableCultures.forEach(culture => {
|
|
||||||
this.cultureValues.set(culture.name, culture);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.translate.onLangChange.subscribe(($event: LangChangeEvent) => {
|
|
||||||
(<any>this).locale = $event.lang;
|
|
||||||
this.cache = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any, format?: string, timezone?: string): string | null {
|
|
||||||
if (!this.cache) {
|
|
||||||
const cultureName = this.languageService.getCurrentLanguage();
|
|
||||||
let locale: string;
|
|
||||||
switch (cultureName) {
|
|
||||||
case 'en': {
|
|
||||||
locale = this.cultureValues.get('en-US').name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'gr': {
|
|
||||||
locale = this.cultureValues.get('el-GR').name;
|
|
||||||
registerLocaleData(localeEl);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'es': {
|
|
||||||
locale = this.cultureValues.get('es-ES').name;
|
|
||||||
registerLocaleData(localeEs);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'de': {
|
|
||||||
locale = this.cultureValues.get('de-DE').name;
|
|
||||||
registerLocaleData(localeDe);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'tr': {
|
|
||||||
locale = this.cultureValues.get('tr-TR').name;
|
|
||||||
registerLocaleData(localeTr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'sk': {
|
|
||||||
locale = this.cultureValues.get('sk-SK').name;
|
|
||||||
registerLocaleData(localeSk);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'sr': {
|
|
||||||
locale = this.cultureValues.get('sr-Latn-RS').name;
|
|
||||||
registerLocaleData(localeSr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'pt': {
|
|
||||||
locale = this.cultureValues.get('pt-PT').name;
|
|
||||||
registerLocaleData(localePt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
locale = this.cultureValues.get('en-US').name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.cache = this.datePipe.transform(value, format, timezone, locale);
|
|
||||||
}
|
|
||||||
return this.cache;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,6 +2,7 @@ import { DatePipe } from '@angular/common';
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import 'moment-timezone';
|
import 'moment-timezone';
|
||||||
|
import { CultureService } from '../services/culture/culture-service';
|
||||||
import { TimezoneService } from '../services/timezone/timezone-service';
|
import { TimezoneService } from '../services/timezone/timezone-service';
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
|
@ -9,13 +10,40 @@ import { TimezoneService } from '../services/timezone/timezone-service';
|
||||||
})
|
})
|
||||||
export class DateTimeFormatPipe implements PipeTransform {
|
export class DateTimeFormatPipe implements PipeTransform {
|
||||||
|
|
||||||
constructor(private datePipe: DatePipe, private timezoneService: TimezoneService) {
|
constructor(private datePipe: DatePipe, private timezoneService: TimezoneService, private cultureService: CultureService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transform(value: any, format?: string, timezone?: string, locale?: string): string | null {
|
transform(value: any, format?: string, timezone?: string, locale?: string): string | null {
|
||||||
|
|
||||||
// using timezone set in timezoneService by default. can be overwritten with pipe arguments
|
// using timezone set in timezoneService by default. can be overwritten with pipe arguments
|
||||||
const timezoneToUse = timezone ? timezone : moment(value).tz(this.timezoneService.getCurrentTimezone()).format('Z');
|
const timezoneToUse = timezone ? timezone : moment(value).tz(this.timezoneService.getCurrentTimezone()).format('Z');
|
||||||
return this.datePipe.transform(value, format, timezoneToUse, locale);
|
let localeToUse = locale ? locale : this.cultureService.getCurrentCulture().name;
|
||||||
|
|
||||||
|
return this.datePipe.transform(value, format, timezoneToUse, localeToUse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'dataTableDateTimeFormatter'
|
||||||
|
})
|
||||||
|
// This is only used for the DataTable Column definition.
|
||||||
|
// It's a hacky way to apply format to the pipe because it only supports passing a pipe instance and calls transform in it without params.
|
||||||
|
export class DataTableDateTimeFormatPipe extends DateTimeFormatPipe implements PipeTransform {
|
||||||
|
|
||||||
|
format: string;
|
||||||
|
|
||||||
|
constructor(private _datePipe: DatePipe, private _timezoneService: TimezoneService, private _cultureService: CultureService) {
|
||||||
|
super(_datePipe, _timezoneService, _cultureService);
|
||||||
|
}
|
||||||
|
|
||||||
|
public withFormat(format: string): DataTableDateTimeFormatPipe {
|
||||||
|
this.format = format;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
transform(value: any): string | null {
|
||||||
|
return super.transform(value, this.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
import { DatePipe } from "@angular/common";
|
|
||||||
import { Pipe, PipeTransform } from "@angular/core";
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
|
import { Guid } from "@common/types/guid";
|
||||||
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
import { Observable, map, of } from "rxjs";
|
||||||
|
import { nameof } from "ts-simple-nameof";
|
||||||
import { DescriptionTemplateFieldType } from "../common/enum/description-template-field-type";
|
import { DescriptionTemplateFieldType } from "../common/enum/description-template-field-type";
|
||||||
import { DescriptionTemplateField, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateRadioBoxData, DescriptionTemplateReferenceTypeData, DescriptionTemplateSelectData } from "../model/description-template/description-template";
|
import { DescriptionTemplateField, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateRadioBoxData, DescriptionTemplateReferenceTypeData, DescriptionTemplateSelectData } from "../model/description-template/description-template";
|
||||||
import { DescriptionFieldPersist } from "../model/description/description";
|
import { DescriptionFieldPersist } from "../model/description/description";
|
||||||
import { Observable, map, of } from "rxjs";
|
|
||||||
import { Guid } from "@common/types/guid";
|
|
||||||
import { DmpService } from "../services/dmp/dmp.service";
|
|
||||||
import { DescriptionService } from "../services/description/description.service";
|
|
||||||
import { StorageFileService } from "../services/storage-file/storage-file.service";
|
|
||||||
import { nameof } from "ts-simple-nameof";
|
|
||||||
import { StorageFile } from "../model/storage-file/storage-file";
|
import { StorageFile } from "../model/storage-file/storage-file";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { DescriptionService } from "../services/description/description.service";
|
||||||
|
import { DmpService } from "../services/dmp/dmp.service";
|
||||||
|
import { StorageFileService } from "../services/storage-file/storage-file.service";
|
||||||
|
import { DateTimeFormatPipe } from "./date-time-format.pipe";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'fieldValue'
|
name: 'fieldValue'
|
||||||
})
|
})
|
||||||
export class FieldValuePipe implements PipeTransform {
|
export class FieldValuePipe implements PipeTransform {
|
||||||
|
|
||||||
constructor(private date: DatePipe,
|
constructor(
|
||||||
|
private dateTimeFormatPipe: DateTimeFormatPipe,
|
||||||
private dmpService: DmpService,
|
private dmpService: DmpService,
|
||||||
private storageFileService: StorageFileService,
|
private storageFileService: StorageFileService,
|
||||||
private descriptionService: DescriptionService,
|
private descriptionService: DescriptionService,
|
||||||
|
@ -39,7 +40,7 @@ export class FieldValuePipe implements PipeTransform {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DescriptionTemplateFieldType.DATE_PICKER:
|
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||||
return of(this.date.transform(controlValue.dateValue, 'dd/MM/yyyy'));
|
return of(this.dateTimeFormatPipe.transform(controlValue.dateValue, 'dd/MM/yyyy'));
|
||||||
case DescriptionTemplateFieldType.FREE_TEXT:
|
case DescriptionTemplateFieldType.FREE_TEXT:
|
||||||
return of(controlValue.textValue);
|
return of(controlValue.textValue);
|
||||||
case DescriptionTemplateFieldType.SELECT: {
|
case DescriptionTemplateFieldType.SELECT: {
|
||||||
|
@ -76,18 +77,18 @@ export class FieldValuePipe implements PipeTransform {
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: {
|
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: {
|
||||||
const data = <DescriptionTemplateLabelAndMultiplicityData>field.data;
|
const data = <DescriptionTemplateLabelAndMultiplicityData>field.data;
|
||||||
if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) {
|
if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) {
|
||||||
return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y=> y.label).join(',')));
|
return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y => y.label).join(',')));
|
||||||
} else if (data?.multipleSelect && controlValue.references && controlValue.textListValue && controlValue.textListValue.length > 0) {
|
} else if (data?.multipleSelect && controlValue.references && controlValue.textListValue && controlValue.textListValue.length > 0) {
|
||||||
return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y=> y.label).join(',')));
|
return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y => y.label).join(',')));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||||
const data = <DescriptionTemplateLabelAndMultiplicityData>field.data;
|
const data = <DescriptionTemplateLabelAndMultiplicityData>field.data;
|
||||||
if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) {
|
if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) {
|
||||||
return this.descriptionService.query(this.descriptionService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y=> y.label).join(',')));
|
return this.descriptionService.query(this.descriptionService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y => y.label).join(',')));
|
||||||
} else if (data?.multipleSelect && controlValue.references && controlValue.textListValue && controlValue.textListValue.length > 0) {
|
} else if (data?.multipleSelect && controlValue.references && controlValue.textListValue && controlValue.textListValue.length > 0) {
|
||||||
return this.descriptionService.query(this.descriptionService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y=> y.label).join(',')));
|
return this.descriptionService.query(this.descriptionService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y => y.label).join(',')));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DescriptionTemplateFieldType.UPLOAD: {
|
case DescriptionTemplateFieldType.UPLOAD: {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Lookup } from "@common/model/lookup";
|
import { Lookup } from "@common/model/lookup";
|
||||||
import { CultureInfo } from "../model/culture-info";
|
|
||||||
|
|
||||||
export class DefaultUserLocaleTimezoneLookup extends Lookup {
|
export class DefaultUserLocaleTimezoneLookup extends Lookup {
|
||||||
like: string;
|
like: string;
|
||||||
|
|
|
@ -36,12 +36,7 @@ export class ConfigurationService extends BaseComponent {
|
||||||
|
|
||||||
private _defaultCulture: string;
|
private _defaultCulture: string;
|
||||||
get defaultCulture(): string {
|
get defaultCulture(): string {
|
||||||
return this._defaultCulture;
|
return this._defaultCulture || 'en';
|
||||||
}
|
|
||||||
|
|
||||||
private _defaultBlueprintId: Guid;
|
|
||||||
get defaultBlueprintId(): Guid {
|
|
||||||
return this._defaultBlueprintId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _defaultTimezone: string;
|
private _defaultTimezone: string;
|
||||||
|
@ -49,6 +44,11 @@ export class ConfigurationService extends BaseComponent {
|
||||||
return this._defaultTimezone || 'UTC';
|
return this._defaultTimezone || 'UTC';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _defaultBlueprintId: Guid;
|
||||||
|
get defaultBlueprintId(): Guid {
|
||||||
|
return this._defaultBlueprintId;
|
||||||
|
}
|
||||||
|
|
||||||
private _logging: Logging;
|
private _logging: Logging;
|
||||||
get logging(): Logging {
|
get logging(): Logging {
|
||||||
return this._logging;
|
return this._logging;
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
import { registerLocaleData } from '@angular/common';
|
import { registerLocaleData } from '@angular/common';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { CultureInfo } from '../../model/culture-info';
|
import { ConfigurationService } from '../configuration/configuration.service';
|
||||||
import { LoggingService } from '../logging/logging-service';
|
import { LoggingService } from '../logging/logging-service';
|
||||||
import { TypeUtils } from '../utilities/type-utils.service';
|
import { TypeUtils } from '../utilities/type-utils.service';
|
||||||
|
|
||||||
const availableCultures: CultureInfo[] = require('../../../../assets/localization/available-cultures.json');
|
const availableCultures: CultureInfo[] = require('../../../../assets/localization/available-cultures.json');
|
||||||
|
|
||||||
|
export interface CultureInfo {
|
||||||
|
name: string;
|
||||||
|
displayName: string;
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CultureService {
|
export class CultureService {
|
||||||
|
|
||||||
|
@ -57,41 +62,263 @@ export class CultureService {
|
||||||
// Set angular locale based on user selection.
|
// Set angular locale based on user selection.
|
||||||
// This is a very hacky way to map cultures with angular cultures, since there is no mapping. We first try to
|
// This is a very hacky way to map cultures with angular cultures, since there is no mapping. We first try to
|
||||||
// use the culture with the specialization (ex en-US), and if not exists we import the base culture (first part).
|
// use the culture with the specialization (ex en-US), and if not exists we import the base culture (first part).
|
||||||
// let locale = newCulture.name;
|
let locale = newCulture.name;
|
||||||
// const base = import(
|
this.loadLocale(locale);
|
||||||
// /* webpackExclude: /\.d\.ts$/ */
|
|
||||||
// /* webpackMode: "lazy-once" */
|
|
||||||
// /* webpackChunkName: "i18n-base" */
|
|
||||||
// `@angular/common/locales/${locale}.mjs`)//.then(m => m[basePkg]);
|
|
||||||
|
|
||||||
// const extra = import(
|
|
||||||
// /* webpackExclude: /\.d\.ts$/ */
|
|
||||||
// /* webpackMode: "lazy-once" */
|
|
||||||
// /* webpackChunkName: "i18n-extra" */
|
|
||||||
// `@angular/common/locales/extra/${locale.split('-')[0]}.mjs`)//.then(m => m[extraPkg]);
|
|
||||||
|
|
||||||
|
|
||||||
// import(`/node_modules/ @angular/common/locales/${locale}.mjs`).catch(reason => {
|
|
||||||
// this.logger.error('Could not load locale: ' + locale);
|
|
||||||
// }).then(selectedLocale => {
|
|
||||||
// if (selectedLocale) {
|
|
||||||
// registerLocaleData(selectedLocale.default);
|
|
||||||
// } else {
|
|
||||||
// locale = newCulture.name.split('-')[0];
|
|
||||||
// import(`/node_modules/@angular/common/locales/${locale}.mjs`).catch(reason => {
|
|
||||||
// this.logger.error('Could not load locale: ' + locale);
|
|
||||||
// }).then(selectedDefaultLocale => {
|
|
||||||
// registerLocaleData(selectedDefaultLocale.default);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCultureChangeObservable(): Observable<CultureInfo> {
|
getCultureChangeObservable(): Observable<CultureInfo> {
|
||||||
return this.cultureChangeSubject.asObservable();
|
return this.cultureChangeSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentCulture(): CultureInfo {
|
getCurrentCulture(installationConfigurationService?: ConfigurationService): CultureInfo {
|
||||||
return this.currentCulture || this.cultureValues.get('en-US'); //TODO: fix this
|
if (this.currentCulture == null && installationConfigurationService != null) {
|
||||||
|
this.cultureSelected(installationConfigurationService.defaultCulture);
|
||||||
|
}
|
||||||
|
return this.currentCulture;
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadLocale(locale: string) {
|
||||||
|
switch (locale) {
|
||||||
|
|
||||||
|
case 'af':
|
||||||
|
import('@angular/common/locales/af').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'am':
|
||||||
|
import('@angular/common/locales/am').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ar-SA':
|
||||||
|
import('@angular/common/locales/ar-SA').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});;
|
||||||
|
break;
|
||||||
|
case 'bg':
|
||||||
|
import('@angular/common/locales/bg').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'cs':
|
||||||
|
import('@angular/common/locales/cs').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'da':
|
||||||
|
import('@angular/common/locales/da').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'de':
|
||||||
|
import('@angular/common/locales/de').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'el':
|
||||||
|
import('@angular/common/locales/el').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'en-GB':
|
||||||
|
import('@angular/common/locales/en-GB').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'es-419':
|
||||||
|
import('@angular/common/locales/es-419').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'es':
|
||||||
|
import('@angular/common/locales/es').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'et':
|
||||||
|
import('@angular/common/locales/et').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'fa':
|
||||||
|
import('@angular/common/locales/fa').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'fi':
|
||||||
|
import('@angular/common/locales/fi').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'fil':
|
||||||
|
import('@angular/common/locales/fil').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'fr-CA':
|
||||||
|
import('@angular/common/locales/fr-CA').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'fr':
|
||||||
|
import('@angular/common/locales/fr').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'he':
|
||||||
|
import('@angular/common/locales/he').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'hi':
|
||||||
|
import('@angular/common/locales/hi').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'hr':
|
||||||
|
import('@angular/common/locales/hr').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'hu':
|
||||||
|
import('@angular/common/locales/hu').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'id':
|
||||||
|
import('@angular/common/locales/id').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'is':
|
||||||
|
import('@angular/common/locales/is').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'it':
|
||||||
|
import('@angular/common/locales/it').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ja':
|
||||||
|
import('@angular/common/locales/ja').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ko':
|
||||||
|
import('@angular/common/locales/ko').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'lt':
|
||||||
|
import('@angular/common/locales/lt').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'lv':
|
||||||
|
import('@angular/common/locales/lv').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ms':
|
||||||
|
import('@angular/common/locales/ms').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ne':
|
||||||
|
import('@angular/common/locales/ne').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'nl':
|
||||||
|
import('@angular/common/locales/nl').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
case 'no':
|
||||||
|
import('@angular/common/locales/no').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'pl':
|
||||||
|
import('@angular/common/locales/pl').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'pt':
|
||||||
|
import('@angular/common/locales/pt').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'pt-PT':
|
||||||
|
import('@angular/common/locales/pt-PT').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ro':
|
||||||
|
import('@angular/common/locales/ro').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ru':
|
||||||
|
import('@angular/common/locales/ru').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'sk':
|
||||||
|
import('@angular/common/locales/sk').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'sl':
|
||||||
|
import('@angular/common/locales/sl').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'sv':
|
||||||
|
import('@angular/common/locales/sv').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'sw-KE':
|
||||||
|
import('@angular/common/locales/sw-KE').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'sw':
|
||||||
|
import('@angular/common/locales/sw').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'th':
|
||||||
|
import('@angular/common/locales/th').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'tr':
|
||||||
|
import('@angular/common/locales/tr').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'uk':
|
||||||
|
import('@angular/common/locales/uk').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'vi':
|
||||||
|
import('@angular/common/locales/vi').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'zh':
|
||||||
|
import('@angular/common/locales/zh').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
import('@angular/common/locales/en').then(data => {
|
||||||
|
registerLocaleData(data.default);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,40 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { TimezoneInfoDisplayPipe } from '@app/core/pipes/timezone-info-display.pipe';
|
||||||
|
import { DefaultUserLocaleCultureLookup, DefaultUserLocaleTimezoneLookup } from '@app/core/query/default-user-locale.lookup';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
|
import moment from 'moment';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import moment from 'moment';
|
import { CultureInfo, CultureService } from '../culture/culture-service';
|
||||||
import { DefaultUserLocaleCultureLookup, DefaultUserLocaleTimezoneLookup } from '@app/core/query/default-user-locale.lookup';
|
|
||||||
import { TimezoneInfoDisplayPipe } from '@app/core/pipes/timezone-info-display.pipe';
|
|
||||||
import { CultureInfo } from '@app/core/model/culture-info';
|
|
||||||
import { CultureService } from '../culture/culture-service';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DefaultUserLocaleService {
|
export class DefaultUserLocaleService {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private timezoneInfoDisplayPipe: TimezoneInfoDisplayPipe,
|
private timezoneInfoDisplayPipe: TimezoneInfoDisplayPipe,
|
||||||
private cultureService: CultureService
|
private cultureService: CultureService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
|
||||||
queryTimezone(q: DefaultUserLocaleTimezoneLookup): Observable<string[]> {
|
queryTimezone(q: DefaultUserLocaleTimezoneLookup): Observable<string[]> {
|
||||||
let timezones = of(moment.tz.names().sort((x, y) => x.localeCompare(y)));
|
let timezones = of(moment.tz.names().sort((x, y) => x.localeCompare(y)));
|
||||||
|
|
||||||
if (q.like) {
|
if (q.like) {
|
||||||
let likeValue = q.like.toLowerCase();
|
let likeValue = q.like.toLowerCase();
|
||||||
timezones = timezones.pipe(map((items: string[]) => {
|
timezones = timezones.pipe(map((items: string[]) => {
|
||||||
let filteredItems: string[] = items.filter(i => this.timezoneInfoDisplayPipe.transform(i).toLowerCase().includes(likeValue));
|
let filteredItems: string[] = items.filter(i => this.timezoneInfoDisplayPipe.transform(i).toLowerCase().includes(likeValue));
|
||||||
if (filteredItems != null && filteredItems?.length > 0) return filteredItems;
|
if (filteredItems != null && filteredItems?.length > 0) return filteredItems;
|
||||||
else return null;
|
else return null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q.selectedItem) {
|
if (q.selectedItem) {
|
||||||
timezones = timezones.pipe(map((items: string[]) => {
|
timezones = timezones.pipe(map((items: string[]) => {
|
||||||
let filteredItem: string = items.find(i => i === q.selectedItem);
|
let filteredItem: string = items.find(i => i === q.selectedItem);
|
||||||
if (filteredItem != null) return [filteredItem];
|
if (filteredItem != null) return [filteredItem];
|
||||||
else return null;
|
else return null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return timezones;
|
return timezones;
|
||||||
}
|
}
|
||||||
|
@ -45,35 +44,35 @@ export class DefaultUserLocaleService {
|
||||||
|
|
||||||
if (q.like) {
|
if (q.like) {
|
||||||
let likeValue = q.like.toLowerCase();
|
let likeValue = q.like.toLowerCase();
|
||||||
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
||||||
let filteredItems = items.filter(i => {
|
let filteredItems = items.filter(i => {
|
||||||
const displayValue = `${i?.displayName} - ${i?.nativeName}`;
|
const displayValue = `${i?.displayName} - ${i?.name}`;
|
||||||
if (displayValue.toLowerCase().includes(likeValue)) {
|
if (displayValue.toLowerCase().includes(likeValue)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (filteredItems != null && filteredItems?.length > 0) return filteredItems;
|
if (filteredItems != null && filteredItems?.length > 0) return filteredItems;
|
||||||
else return null;
|
else return null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q.selectedItem) {
|
if (q.selectedItem) {
|
||||||
let selectedItemValue = q.selectedItem.toLowerCase();
|
let selectedItemValue = q.selectedItem.toLowerCase();
|
||||||
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
||||||
let selected = items.find(i => {
|
let selected = items.find(i => {
|
||||||
if (i.name.toLowerCase().includes(selectedItemValue)) {
|
if (i.name.toLowerCase().includes(selectedItemValue)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
return [selected];
|
return [selected];
|
||||||
}
|
}
|
||||||
else return null;
|
else return null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return cultures;
|
return cultures;
|
||||||
|
@ -85,32 +84,32 @@ export class DefaultUserLocaleService {
|
||||||
//
|
//
|
||||||
singleTimezoneAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
singleTimezoneAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||||
initialItems: (data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null)),
|
initialItems: (data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null)),
|
||||||
filterFn: (searchQuery: string, data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(searchQuery)),
|
filterFn: (searchQuery: string, data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(searchQuery)),
|
||||||
getSelectedItem: (selectedItem: string) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null, selectedItem)),
|
getSelectedItem: (selectedItem: string) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null, selectedItem)),
|
||||||
displayFn: (item: string) => this.getTimezoneDisplayFn(item),
|
displayFn: (item: string) => this.getTimezoneDisplayFn(item),
|
||||||
titleFn: (item: string) => this.timezoneInfoDisplayPipe.transform(item),
|
titleFn: (item: string) => this.timezoneInfoDisplayPipe.transform(item),
|
||||||
valueAssign: (item: string) => item,
|
valueAssign: (item: string) => item,
|
||||||
};
|
};
|
||||||
|
|
||||||
private buildTimezoneAutocompleteLookup(like?: string, selectedItem?: string): DefaultUserLocaleTimezoneLookup {
|
private buildTimezoneAutocompleteLookup(like?: string, selectedItem?: string): DefaultUserLocaleTimezoneLookup {
|
||||||
const lookup: DefaultUserLocaleTimezoneLookup = new DefaultUserLocaleTimezoneLookup();
|
const lookup: DefaultUserLocaleTimezoneLookup = new DefaultUserLocaleTimezoneLookup();
|
||||||
lookup.page = { size: 100, offset: 0 };
|
lookup.page = { size: 100, offset: 0 };
|
||||||
if (like) { lookup.like = like; }
|
if (like) { lookup.like = like; }
|
||||||
if (selectedItem) { lookup.selectedItem = selectedItem }
|
if (selectedItem) { lookup.selectedItem = selectedItem }
|
||||||
return lookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTimezoneDisplayFn(value: any) {
|
getTimezoneDisplayFn(value: any) {
|
||||||
return Array.isArray(value) ? this.timezoneInfoDisplayPipe.transform(value[0]) : this.timezoneInfoDisplayPipe.transform(value);
|
return Array.isArray(value) ? this.timezoneInfoDisplayPipe.transform(value[0]) : this.timezoneInfoDisplayPipe.transform(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
singleCultureAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
singleCultureAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||||
initialItems: (data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(null)),
|
initialItems: (data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(null)),
|
||||||
filterFn: (searchQuery: string, data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(searchQuery)),
|
filterFn: (searchQuery: string, data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(searchQuery)),
|
||||||
getSelectedItem: (selectedItem: string) =>this.queryCulture(this.buildCultureAutocompleteLookup(null, selectedItem)),
|
getSelectedItem: (selectedItem: string) => this.queryCulture(this.buildCultureAutocompleteLookup(null, selectedItem)),
|
||||||
displayFn: (item: any) => this.getCultureDisplayFn(item),
|
displayFn: (item: any) => this.getCultureDisplayFn(item),
|
||||||
titleFn: (item: CultureInfo) => this.getCultureTitleFn(item),
|
titleFn: (item: CultureInfo) => this.getCultureTitleFn(item),
|
||||||
valueAssign: (item: CultureInfo) => item.name,
|
valueAssign: (item: CultureInfo) => item.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -118,12 +117,12 @@ export class DefaultUserLocaleService {
|
||||||
const lookup: DefaultUserLocaleCultureLookup = new DefaultUserLocaleCultureLookup();
|
const lookup: DefaultUserLocaleCultureLookup = new DefaultUserLocaleCultureLookup();
|
||||||
lookup.page = { size: 100, offset: 0 };
|
lookup.page = { size: 100, offset: 0 };
|
||||||
if (like) { lookup.like = like; }
|
if (like) { lookup.like = like; }
|
||||||
if (selectedItem) { lookup.selectedItem = selectedItem }
|
if (selectedItem) { lookup.selectedItem = selectedItem }
|
||||||
return lookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCultureTitleFn(culture: any): string {
|
private getCultureTitleFn(culture: any): string {
|
||||||
return `${culture?.displayName} - ${culture?.nativeName}`;
|
return `${culture?.displayName} - ${culture?.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCultureDisplayFn(culture: any): string {
|
private getCultureDisplayFn(culture: any): string {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class TimezoneService {
|
||||||
|
|
||||||
public buildDateTime(params: {
|
public buildDateTime(params: {
|
||||||
time: string,
|
time: string,
|
||||||
date: moment.Moment
|
date: moment.Moment | string
|
||||||
}): moment.Moment {
|
}): moment.Moment {
|
||||||
|
|
||||||
const { time, date } = params;
|
const { time, date } = params;
|
||||||
|
@ -48,7 +48,7 @@ export class TimezoneService {
|
||||||
}
|
}
|
||||||
|
|
||||||
const momentTime = moment.duration(time);
|
const momentTime = moment.duration(time);
|
||||||
const momentDate = moment(date.toString());
|
const momentDate = moment(date);
|
||||||
|
|
||||||
const toReturn = moment.utc({
|
const toReturn = moment.utc({
|
||||||
year: momentDate.year(),
|
year: momentDate.year(),
|
||||||
|
@ -66,13 +66,16 @@ export class TimezoneService {
|
||||||
dateTime: moment.Moment,
|
dateTime: moment.Moment,
|
||||||
}): { date: moment.Moment, time: string } | null {
|
}): { date: moment.Moment, time: string } | null {
|
||||||
|
|
||||||
|
|
||||||
const { dateTime } = params
|
const { dateTime } = params
|
||||||
|
|
||||||
if (!dateTime) {
|
if (!dateTime) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dateTimeMoment = moment(dateTime.toString()).tz(this.getCurrentTimezone());
|
|
||||||
|
const dateTimeMoment = moment(dateTime).tz(this.getCurrentTimezone());
|
||||||
|
|
||||||
|
|
||||||
const date =
|
const date =
|
||||||
moment.utc({
|
moment.utc({
|
||||||
|
@ -84,9 +87,13 @@ export class TimezoneService {
|
||||||
const hours = dateTimeMoment.hour();
|
const hours = dateTimeMoment.hour();
|
||||||
const minutes = dateTimeMoment.minute();
|
const minutes = dateTimeMoment.minute();
|
||||||
|
|
||||||
|
|
||||||
const hoursString = hours > 10 ? hours.toString() : `0${hours}`
|
const hoursString = hours > 10 ? hours.toString() : `0${hours}`
|
||||||
const minutesString = hours > 10 ? minutes.toString() : `0${minutes}`
|
const minutesString = hours > 10 ? minutes.toString() : `0${minutes}`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
date,
|
date,
|
||||||
time: `${hoursString}:${minutesString}:00`
|
time: `${hoursString}:${minutesString}:00`
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper';
|
import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper';
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit, QueryList, ViewChild } from '@angular/core';
|
import { Component, OnInit, QueryList, ViewChild } from '@angular/core';
|
||||||
import { FormArray, FormControl, FormGroup, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, FormControl, FormGroup, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
@ -124,7 +123,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -148,7 +146,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('DESCRIPTION-TEMPLATE-EDITOR.TITLE-EDIT-DESCRIPTION-TEMPLATE');
|
titleService.setTitle('DESCRIPTION-TEMPLATE-EDITOR.TITLE-EDIT-DESCRIPTION-TEMPLATE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type';
|
import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
import { DescriptionTemplateTypeService } from '@app/core/services/description-template-type/description-template-type.service';
|
import { DescriptionTemplateTypeService } from '@app/core/services/description-template-type/description-template-type.service';
|
||||||
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
import { FormService } from '@common/forms/form-service';
|
import { FormService } from '@common/forms/form-service';
|
||||||
|
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
|
@ -23,11 +27,6 @@ import { map, takeUntil } from 'rxjs/operators';
|
||||||
import { DescriptionTemplateTypeEditorModel } from './description-template-type-editor.model';
|
import { DescriptionTemplateTypeEditorModel } from './description-template-type-editor.model';
|
||||||
import { DescriptionTemplateTypeEditorResolver } from './description-template-type-editor.resolver';
|
import { DescriptionTemplateTypeEditorResolver } from './description-template-type-editor.resolver';
|
||||||
import { DescriptionTemplateTypeEditorService } from './description-template-type-editor.service';
|
import { DescriptionTemplateTypeEditorService } from './description-template-type-editor.service';
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
|
||||||
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
|
||||||
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
|
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './description-template-type-editor.component.html',
|
templateUrl: './description-template-type-editor.component.html',
|
||||||
|
@ -69,7 +68,6 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -82,14 +80,14 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
||||||
private descriptionTemplateTypeEditorService: DescriptionTemplateTypeEditorService,
|
private descriptionTemplateTypeEditorService: DescriptionTemplateTypeEditorService,
|
||||||
public titleService: Title
|
public titleService: Title
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const descriptionLabel:string = route.snapshot.data['entity']?.name;
|
const descriptionLabel: string = route.snapshot.data['entity']?.name;
|
||||||
if (descriptionLabel) {
|
if (descriptionLabel) {
|
||||||
titleService.setTitle(descriptionLabel);
|
titleService.setTitle(descriptionLabel);
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('DESCRIPTION-TEMPLATE-TYPE-EDITOR.TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE');
|
titleService.setTitle('DESCRIPTION-TEMPLATE-TYPE-EDITOR.TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -223,6 +221,7 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
||||||
if (result) {
|
if (result) {
|
||||||
this.formGroup.get('status').setValue(DescriptionTemplateTypeStatus.Finalized);
|
this.formGroup.get('status').setValue(DescriptionTemplateTypeStatus.Finalized);
|
||||||
this.formSubmit();
|
this.formSubmit();
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
|
|
||||||
|
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
||||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
||||||
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-field-type';
|
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-field-type';
|
||||||
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
|
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
|
||||||
|
@ -21,11 +18,15 @@ import { DmpBlueprint, DmpBlueprintPersist, NewVersionDmpBlueprintPersist, Syste
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||||
|
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
|
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
|
||||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||||
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
|
@ -43,8 +44,6 @@ import { DescriptionTemplatePreviewDialogComponent } from '../../description-tem
|
||||||
import { DmpBlueprintEditorModel, FieldInSectionEditorModel } from './dmp-blueprint-editor.model';
|
import { DmpBlueprintEditorModel, FieldInSectionEditorModel } from './dmp-blueprint-editor.model';
|
||||||
import { DmpBlueprintEditorResolver } from './dmp-blueprint-editor.resolver';
|
import { DmpBlueprintEditorResolver } from './dmp-blueprint-editor.resolver';
|
||||||
import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service';
|
import { DmpBlueprintEditorService } from './dmp-blueprint-editor.service';
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -62,8 +61,8 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
formGroup: UntypedFormGroup = null;
|
formGroup: UntypedFormGroup = null;
|
||||||
showInactiveDetails = false;
|
showInactiveDetails = false;
|
||||||
|
|
||||||
hoveredSectionIndex:number = -1;
|
hoveredSectionIndex: number = -1;
|
||||||
hoveredDescriptionTemplateIndex:number = -1;
|
hoveredDescriptionTemplateIndex: number = -1;
|
||||||
|
|
||||||
dmpBlueprintSectionFieldCategory = DmpBlueprintFieldCategory;
|
dmpBlueprintSectionFieldCategory = DmpBlueprintFieldCategory;
|
||||||
dmpBlueprintSystemFieldType = DmpBlueprintSystemFieldType;
|
dmpBlueprintSystemFieldType = DmpBlueprintSystemFieldType;
|
||||||
|
@ -117,7 +116,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -136,13 +134,13 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
public titleService: Title,
|
public titleService: Title,
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
) {
|
) {
|
||||||
const descriptionLabel:string = route.snapshot.data['entity']?.label;
|
const descriptionLabel: string = route.snapshot.data['entity']?.label;
|
||||||
if (descriptionLabel) {
|
if (descriptionLabel) {
|
||||||
titleService.setTitle(descriptionLabel);
|
titleService.setTitle(descriptionLabel);
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('DMP-BLUEPRINT-EDITOR.TITLE-EDIT-BLUEPRINT');
|
titleService.setTitle('DMP-BLUEPRINT-EDITOR.TITLE-EDIT-BLUEPRINT');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -222,7 +220,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
}
|
}
|
||||||
|
|
||||||
persistEntity(onSuccess?: (response) => void): void {
|
persistEntity(onSuccess?: (response) => void): void {
|
||||||
if ( this.isNewVersion == false) {
|
if (this.isNewVersion == false) {
|
||||||
const formData = this.formService.getValue(this.formGroup.value) as DmpBlueprintPersist;
|
const formData = this.formService.getValue(this.formGroup.value) as DmpBlueprintPersist;
|
||||||
|
|
||||||
this.dmpBlueprintService.persist(formData)
|
this.dmpBlueprintService.persist(formData)
|
||||||
|
@ -482,7 +480,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
panelClass: 'custom-modalbox'
|
panelClass: 'custom-modalbox'
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(groupId => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(groupId => {
|
||||||
if (groupId){
|
if (groupId) {
|
||||||
((this.formGroup.get('definition').get('sections') as UntypedFormArray).at(sectionIndex).get('descriptionTemplates') as UntypedFormArray).at(descriptionTemplateIndex).get('descriptionTemplateGroupId').patchValue(groupId);
|
((this.formGroup.get('definition').get('sections') as UntypedFormArray).at(sectionIndex).get('descriptionTemplates') as UntypedFormArray).at(descriptionTemplateIndex).get('descriptionTemplateGroupId').patchValue(groupId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -525,12 +523,12 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
||||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Description));
|
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Description));
|
||||||
}
|
}
|
||||||
|
|
||||||
hasLanguage(): boolean {
|
hasLanguage(): boolean {
|
||||||
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
||||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Language));
|
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Language));
|
||||||
}
|
}
|
||||||
|
|
||||||
hasAccess(): boolean {
|
hasAccess(): boolean {
|
||||||
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value;
|
||||||
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.AccessRights));
|
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.AccessRights));
|
||||||
|
@ -562,7 +560,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
finalize() {
|
finalize() {
|
||||||
if (this.checkValidity() || !this.hasDescriptionTemplates()) {
|
if (this.checkValidity() || !this.hasDescriptionTemplates()) {
|
||||||
this.formGroup.get('status').setValue(DmpBlueprintStatus.Finalized);
|
this.formGroup.get('status').setValue(DmpBlueprintStatus.Finalized);
|
||||||
if(this.isNewVersion) this.isNewVersion = false;
|
if (this.isNewVersion) this.isNewVersion = false;
|
||||||
this.formSubmit();
|
this.formSubmit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,6 +576,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
||||||
|
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
},
|
},
|
||||||
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
import { Language, LanguagePersist } from '@app/core/model/language/language';
|
import { Language, LanguagePersist } from '@app/core/model/language/language';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
|
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
||||||
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
|
@ -21,15 +26,9 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { LanguageEditorModel } from './language-editor.model';
|
||||||
import { LanguageEditorResolver } from './language-editor.resolver';
|
import { LanguageEditorResolver } from './language-editor.resolver';
|
||||||
import { LanguageEditorService } from './language-editor.service';
|
import { LanguageEditorService } from './language-editor.service';
|
||||||
import { LanguageEditorModel } from './language-editor.model';
|
|
||||||
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
|
||||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -73,7 +72,6 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -88,13 +86,13 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
||||||
private titleService: Title,
|
private titleService: Title,
|
||||||
private analyticsService: AnalyticsService
|
private analyticsService: AnalyticsService
|
||||||
) {
|
) {
|
||||||
const descriptionLabel:string = route.snapshot.data['entity']?.code;
|
const descriptionLabel: string = route.snapshot.data['entity']?.code;
|
||||||
if (descriptionLabel) {
|
if (descriptionLabel) {
|
||||||
titleService.setTitle(descriptionLabel);
|
titleService.setTitle(descriptionLabel);
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('LANGUAGE-EDITOR.TITLE-EDIT-LANGUAGE');
|
titleService.setTitle('LANGUAGE-EDITOR.TITLE-EDIT-LANGUAGE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -102,7 +100,7 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.languageHttpService.queryAvailableCodes(this.languageHttpService.buildAutocompleteLookup())
|
this.languageHttpService.queryAvailableCodes(this.languageHttpService.buildAutocompleteLookup())
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => this.availableLanguageCodes = data.items,
|
data => this.availableLanguageCodes = data.items,
|
||||||
error => {
|
error => {
|
||||||
this.router.navigate(['/languages']);
|
this.router.navigate(['/languages']);
|
||||||
|
@ -122,7 +120,7 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
||||||
|
|
||||||
prepareForm(data: Language) {
|
prepareForm(data: Language) {
|
||||||
try {
|
try {
|
||||||
if(data && data.payload){
|
if (data && data.payload) {
|
||||||
this.currentPayload = data.payload;
|
this.currentPayload = data.payload;
|
||||||
}
|
}
|
||||||
this.editorModel = data ? new LanguageEditorModel().fromModel(data) : new LanguageEditorModel();
|
this.editorModel = data ? new LanguageEditorModel().fromModel(data) : new LanguageEditorModel();
|
||||||
|
@ -206,18 +204,18 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
|
||||||
this.formService.validateAllFormFields(this.formGroup);
|
this.formService.validateAllFormFields(this.formGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideFromFile(matCheckBox: MatCheckboxChange, code: string){
|
public overrideFromFile(matCheckBox: MatCheckboxChange, code: string) {
|
||||||
if(matCheckBox.checked == true){
|
if (matCheckBox.checked == true) {
|
||||||
this.languageHttpService.getSingleWithCode(code, LanguageEditorResolver.lookupFields())
|
this.languageHttpService.getSingleWithCode(code, LanguageEditorResolver.lookupFields())
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(language => {
|
.subscribe(language => {
|
||||||
this.formGroup.get('payload').patchValue(language.payload);
|
this.formGroup.get('payload').patchValue(language.payload);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
matCheckBox.source.checked = false;
|
matCheckBox.source.checked = false;
|
||||||
this.httpErrorHandlingService.handleBackedRequestError(error);
|
this.httpErrorHandlingService.handleBackedRequestError(error);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
this.formGroup.get('payload').patchValue(this.currentPayload);
|
this.formGroup.get('payload').patchValue(this.currentPayload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, FormGroup, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, FormGroup, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
||||||
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
|
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
import { PrefillingSource, PrefillingSourcePersist } from '@app/core/model/prefilling-source/prefilling-source';
|
import { PrefillingSource, PrefillingSourcePersist } from '@app/core/model/prefilling-source/prefilling-source';
|
||||||
|
@ -17,6 +13,9 @@ import { ConfigurationService } from '@app/core/services/configuration/configura
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
|
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
|
@ -65,7 +64,6 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -85,7 +83,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('PREFILLING-SOURCE-EDITOR.TITLE-EDIT-PREFILLING-SOURCE');
|
titleService.setTitle('PREFILLING-SOURCE-EDITOR.TITLE-EDIT-PREFILLING-SOURCE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
@ -77,7 +76,6 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -96,7 +94,7 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('REFERENCE-TYPE-EDITOR.TITLE-EDIT-REFERENCE-TYPE');
|
titleService.setTitle('REFERENCE-TYPE-EDITOR.TITLE-EDIT-REFERENCE-TYPE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
@ -75,7 +74,6 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -98,7 +96,7 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('REFERENCE-EDITOR.TITLE-EDIT-REFERENCE');
|
titleService.setTitle('REFERENCE-EDITOR.TITLE-EDIT-REFERENCE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { ReferenceSourceTypePipe } from '@common/formatting/pipes/reference-source-type.pipe';
|
import { ReferenceSourceTypePipe } from '@common/formatting/pipes/reference-source-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
|
|
|
@ -18,12 +18,6 @@
|
||||||
[configuration]="singleCultureAutocompleteConfiguration">
|
[configuration]="singleCultureAutocompleteConfiguration">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
|
|
||||||
<!-- <mat-select [formControl]="this.formGroup.get('defaultUserLocale')?.get('culture')" name="culture">
|
|
||||||
<mat-option *ngFor="let culture of cultures" [value]="culture.name">
|
|
||||||
{{ culture.displayName }} - {{ culture.nativeName }}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select> -->
|
|
||||||
|
|
||||||
<mat-error *ngIf="formGroup.get('defaultUserLocale')?.get('culture').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('defaultUserLocale')?.get('culture').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
<mat-error *ngIf="formGroup.get('defaultUserLocale')?.get('culture')?.hasError('backendError')">{{formGroup.get('defaultUserLocale')?.get('culture')?.getError('backendError').message}}</mat-error>
|
<mat-error *ngIf="formGroup.get('defaultUserLocale')?.get('culture')?.hasError('backendError')">{{formGroup.get('defaultUserLocale')?.get('culture')?.getError('backendError').message}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -5,10 +5,9 @@ import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type';
|
import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type';
|
||||||
import { CultureInfo } from '@app/core/model/culture-info';
|
|
||||||
import { TenantConfiguration, TenantConfigurationPersist } from '@app/core/model/tenant-configuaration/tenant-configuration';
|
import { TenantConfiguration, TenantConfigurationPersist } from '@app/core/model/tenant-configuaration/tenant-configuration';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
import { CultureService } from '@app/core/services/culture/culture-service';
|
import { CultureInfo, CultureService } from '@app/core/services/culture/culture-service';
|
||||||
import { DefaultUserLocaleService } from '@app/core/services/default-user-locale/default-user-locale.service';
|
import { DefaultUserLocaleService } from '@app/core/services/default-user-locale/default-user-locale.service';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
@ -219,14 +218,4 @@ export class DefaultUserLocaleEditorComponent extends BasePendingChangesComponen
|
||||||
this.formService.validateAllFormFields(this.formGroup);
|
this.formService.validateAllFormFields(this.formGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCultureFn(culture?: CultureInfo): string | undefined {
|
|
||||||
|
|
||||||
if (culture == null
|
|
||||||
|| culture.displayName == null
|
|
||||||
|| culture.nativeName == null)
|
|
||||||
return undefined;
|
|
||||||
|
|
||||||
return culture.displayName + '-' + culture.nativeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
@ -71,7 +70,6 @@ export class TenantEditorComponent extends BaseEditor<TenantEditorModel, Tenant>
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -85,7 +83,7 @@ export class TenantEditorComponent extends BaseEditor<TenantEditorModel, Tenant>
|
||||||
private fileUtils: FileUtils,
|
private fileUtils: FileUtils,
|
||||||
private analyticsService: AnalyticsService
|
private analyticsService: AnalyticsService
|
||||||
) {
|
) {
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="col user">{{getParentAnnotation(thread).author.name}}</span>
|
<span class="col user">{{getParentAnnotation(thread).author.name}}</span>
|
||||||
<div class="col-auto annotation-time">{{getParentAnnotation(thread).timeStamp | date: "d MMMM, y 'at' h:mm a"}}</div>
|
<div class="col-auto annotation-time">{{getParentAnnotation(thread).timeStamp | dateTimeFormatter: "d MMMM, y 'at' h:mm a"}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row pt-1">
|
<div class="row pt-1">
|
||||||
<div class="col-12 annotation-full-text">{{getParentAnnotation(thread).payload}}</div>
|
<div class="col-12 annotation-full-text">{{getParentAnnotation(thread).payload}}</div>
|
||||||
|
@ -134,8 +134,7 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="col user">{{annotation.author.name}}</span>
|
<span class="col user">{{annotation.author.name}}</span>
|
||||||
<div class="col-auto annotation-time">{{annotation.timeStamp | date:"d MMMM, y 'at' h:mm a"}}</div>
|
<div class="col-auto annotation-time">{{annotation.timeStamp | dateTimeFormatter:"d MMMM, y 'at' h:mm a"}}</div>
|
||||||
<!-- <div class="col annotation-time">{{annotation.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row pt-1 pb-1">
|
<div class="row pt-1 pb-1">
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
import { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
@ -29,7 +28,6 @@ import {
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
|
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
|
||||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
import { FormService } from '@common/forms/form-service';
|
import { FormService } from '@common/forms/form-service';
|
||||||
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
||||||
|
@ -45,7 +43,6 @@ import { DescriptionEditorResolver } from './description-editor.resolver';
|
||||||
import { DescriptionEditorService } from './description-editor.service';
|
import { DescriptionEditorService } from './description-editor.service';
|
||||||
import { PrefillDescriptionDialogComponent } from './prefill-description/prefill-description.component';
|
import { PrefillDescriptionDialogComponent } from './prefill-description/prefill-description.component';
|
||||||
import { ToCEntry } from './table-of-contents/models/toc-entry';
|
import { ToCEntry } from './table-of-contents/models/toc-entry';
|
||||||
import { ToCEntryType } from './table-of-contents/models/toc-entry-type.enum';
|
|
||||||
import { TableOfContentsService } from './table-of-contents/services/table-of-contents-service';
|
import { TableOfContentsService } from './table-of-contents/services/table-of-contents-service';
|
||||||
import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component';
|
import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component';
|
||||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
||||||
|
@ -91,7 +88,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -116,7 +112,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION');
|
titleService.setTitle('DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -370,7 +366,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
setTimeout(x => {
|
setTimeout(x => {
|
||||||
if (this.isNew) this._resetFields();
|
if (this.isNew) this._resetFields();
|
||||||
else this.refreshOnNavigateToData(this.editorModel?.id);
|
else this.refreshOnNavigateToData(this.editorModel?.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<a [routerLink]="getItemLink()" class="pointer">
|
<a [routerLink]="getItemLink()" class="pointer">
|
||||||
<div class="d-flex flex-direction-row">
|
<div class="d-flex flex-direction-row">
|
||||||
<div class="col-auto description-label">{{'DESCRIPTION-LISTING.DESCRIPTION' | translate}}</div>
|
<div class="col-auto description-label">{{'DESCRIPTION-LISTING.DESCRIPTION' | translate}}</div>
|
||||||
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.EDITED' | translate}}: {{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}</div>
|
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.EDITED' | translate}}: {{description.updatedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||||
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.PUBLISHED' | translate}}: {{description.finalizedAt | dateTimeCultureFormatter: "d MMMM y"}}</div>
|
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.PUBLISHED' | translate}}: {{description.finalizedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div>
|
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div>
|
||||||
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div>
|
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="isLocked" class="col-auto"><span>.</span></div>
|
<div *ngIf="isLocked" class="col-auto"><span>.</span></div>
|
||||||
<div class="col-auto d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
|
<div class="col-auto d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
|
||||||
{{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
|
{{description.updatedAt | dateTimeFormatter: "d MMMM y"}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto d-flex">
|
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto d-flex">
|
||||||
<div class="d-flex flex-row uppercase">
|
<div class="d-flex flex-row uppercase">
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||||
import { Dmp } from '@app/core/model/dmp/dmp';
|
import { Dmp } from '@app/core/model/dmp/dmp';
|
||||||
|
import { DateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { DmpDescriptionTemplateLookup } from '@app/core/query/dmp-description-template.lookup';
|
import { DmpDescriptionTemplateLookup } from '@app/core/query/dmp-description-template.lookup';
|
||||||
import { DmpLookup } from '@app/core/query/dmp.lookup';
|
import { DmpLookup } from '@app/core/query/dmp.lookup';
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||||
|
@ -33,7 +33,7 @@ export class StartNewDescriptionDialogComponent extends BaseComponent {
|
||||||
filterFn: (searchQuery: string, data?: any) => this.dmpService.query(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
filterFn: (searchQuery: string, data?: any) => this.dmpService.query(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
|
||||||
getSelectedItem: (selectedItem: any) => this.dmpService.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
getSelectedItem: (selectedItem: any) => this.dmpService.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||||
displayFn: (item: Dmp) => item.label,
|
displayFn: (item: Dmp) => item.label,
|
||||||
subtitleFn: (item: Dmp) => `${this.language.instant('DASHBOARD.ADD-NEW-DATASET.OPTIONS.CREATED-AT')} ${this.datePipe.transform(item.createdAt ,'dd/MM/yyyy')}`,
|
subtitleFn: (item: Dmp) => `${this.language.instant('DASHBOARD.ADD-NEW-DATASET.OPTIONS.CREATED-AT')} ${this.dateTimeFormatPipe.transform(item.createdAt, 'dd/MM/yyyy')}`,
|
||||||
titleFn: (item: Dmp) => item.label,
|
titleFn: (item: Dmp) => item.label,
|
||||||
valueAssign: (item: Dmp) => item.id,
|
valueAssign: (item: Dmp) => item.id,
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ export class StartNewDescriptionDialogComponent extends BaseComponent {
|
||||||
private language: TranslateService,
|
private language: TranslateService,
|
||||||
private dmpService: DmpService,
|
private dmpService: DmpService,
|
||||||
private filterService: FilterService,
|
private filterService: FilterService,
|
||||||
private datePipe: DatePipe
|
private dateTimeFormatPipe: DateTimeFormatPipe
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.formGroup = data.formGroup;
|
this.formGroup = data.formGroup;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
||||||
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
||||||
|
@ -30,6 +30,7 @@ import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.servic
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { UserService } from '@app/core/services/user/user.service';
|
import { UserService } from '@app/core/services/user/user.service';
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
|
@ -38,6 +39,7 @@ import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/mu
|
||||||
import { MultipleAutoCompleteCanRemoveItem } from '@app/library/auto-complete/multiple/multiple-auto-complete.component';
|
import { MultipleAutoCompleteCanRemoveItem } from '@app/library/auto-complete/multiple/multiple-auto-complete.component';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
import { DescriptionTemplatePreviewDialogComponent } from '@app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component';
|
import { DescriptionTemplatePreviewDialogComponent } from '@app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component';
|
||||||
|
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
import { FormService } from '@common/forms/form-service';
|
import { FormService } from '@common/forms/form-service';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
@ -46,13 +48,10 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { DmpContactPrefillDialogComponent } from '../dmp-contact-prefill-dialog/dmp-contact-prefill-dialog.component';
|
||||||
import { DmpEditorModel, DmpFieldIndicator } from './dmp-editor.model';
|
import { DmpEditorModel, DmpFieldIndicator } from './dmp-editor.model';
|
||||||
import { DmpEditorResolver } from './dmp-editor.resolver';
|
import { DmpEditorResolver } from './dmp-editor.resolver';
|
||||||
import { DmpEditorService } from './dmp-editor.service';
|
import { DmpEditorService } from './dmp-editor.service';
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
|
||||||
import { DmpContactPrefillDialogComponent } from '../dmp-contact-prefill-dialog/dmp-contact-prefill-dialog.component';
|
|
||||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
|
||||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -152,7 +151,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -173,13 +171,13 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
private breadcrumbService: BreadcrumbService
|
private breadcrumbService: BreadcrumbService
|
||||||
) {
|
) {
|
||||||
const descriptionLabel:string = route.snapshot.data['entity']?.label;
|
const descriptionLabel: string = route.snapshot.data['entity']?.label;
|
||||||
if (descriptionLabel) {
|
if (descriptionLabel) {
|
||||||
titleService.setTitle(descriptionLabel);
|
titleService.setTitle(descriptionLabel);
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('DMP-EDITOR.TITLE-EDIT');
|
titleService.setTitle('DMP-EDITOR.TITLE-EDIT');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -202,9 +200,9 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
prepareForm(data: Dmp) {
|
prepareForm(data: Dmp) {
|
||||||
try {
|
try {
|
||||||
if (data?.blueprint?.definition?.sections != null) {
|
if (data?.blueprint?.definition?.sections != null) {
|
||||||
data.blueprint.definition.sections = data.blueprint.definition.sections.sort((s1,s2) => s1.ordinal-s2.ordinal);
|
data.blueprint.definition.sections = data.blueprint.definition.sections.sort((s1, s2) => s1.ordinal - s2.ordinal);
|
||||||
for (let i=0; i<data.blueprint.definition.sections.length; i++){
|
for (let i = 0; i < data.blueprint.definition.sections.length; i++) {
|
||||||
data.blueprint.definition.sections[i].fields = data.blueprint.definition.sections[i]?.fields?.sort((f1,f2) => f1.ordinal-f2.ordinal);
|
data.blueprint.definition.sections[i].fields = data.blueprint.definition.sections[i]?.fields?.sort((f1, f2) => f1.ordinal - f2.ordinal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.editorModel = data ? new DmpEditorModel().fromModel(data) : new DmpEditorModel();
|
this.editorModel = data ? new DmpEditorModel().fromModel(data) : new DmpEditorModel();
|
||||||
|
@ -237,7 +235,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
.pipe(takeUntil(this._destroyed)).subscribe(
|
.pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
this.permissionPerSection = complete,
|
this.permissionPerSection = complete,
|
||||||
this.buildForm();
|
this.buildForm();
|
||||||
},
|
},
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
|
@ -280,7 +278,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
this.getItem(this.editorModel.id, (data: Dmp) => {
|
this.getItem(this.editorModel.id, (data: Dmp) => {
|
||||||
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
|
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
|
||||||
this.prepareForm(data)
|
this.prepareForm(data)
|
||||||
if (this.isNew === false && this.step===0) this.nextStep();
|
if (this.isNew === false && this.step === 0) this.nextStep();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +301,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
//Transform descriptionTemplates
|
//Transform descriptionTemplates
|
||||||
formData.descriptionTemplates = [];
|
formData.descriptionTemplates = [];
|
||||||
for (const sectionId in (this.formGroup.get('descriptionTemplates') as UntypedFormGroup).controls) {
|
for (const sectionId in (this.formGroup.get('descriptionTemplates') as UntypedFormGroup).controls) {
|
||||||
if (this.formGroup.get('descriptionTemplates').get(sectionId).value != undefined){
|
if (this.formGroup.get('descriptionTemplates').get(sectionId).value != undefined) {
|
||||||
formData.descriptionTemplates.push(
|
formData.descriptionTemplates.push(
|
||||||
...(this.formGroup.get('descriptionTemplates').get(sectionId).value as Guid[]).map(x => { return { sectionId: Guid.parse(sectionId), descriptionTemplateGroupId: x } })
|
...(this.formGroup.get('descriptionTemplates').get(sectionId).value as Guid[]).map(x => { return { sectionId: Guid.parse(sectionId), descriptionTemplateGroupId: x } })
|
||||||
);
|
);
|
||||||
|
@ -355,7 +353,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
setTimeout(x => {
|
setTimeout(x => {
|
||||||
if (this.isNew) this.step = 0;
|
if (this.isNew) this.step = 0;
|
||||||
else this.step = this.step > 0 ? this.step - 1 : 0;
|
else this.step = this.step > 0 ? this.step - 1 : 0;
|
||||||
this.ngOnInit();
|
this.ngOnInit();
|
||||||
});
|
});
|
||||||
|
@ -448,27 +446,27 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
//
|
//
|
||||||
selectBlueprint() {
|
selectBlueprint() {
|
||||||
this.dmpBlueprintService.getSingle(this.formGroup.get('blueprint').value, DmpEditorResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed))
|
this.dmpBlueprintService.getSingle(this.formGroup.get('blueprint').value, DmpEditorResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.selectedBlueprint = data;
|
this.selectedBlueprint = data;
|
||||||
this.buildFormAfterBlueprintSelection();
|
this.buildFormAfterBlueprintSelection();
|
||||||
this.nextStep();
|
this.nextStep();
|
||||||
},
|
},
|
||||||
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
selectDefaultBlueprint(): void {
|
selectDefaultBlueprint(): void {
|
||||||
this.dmpBlueprintService.getSingle(this.configurationService.defaultBlueprintId, DmpEditorResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed))
|
this.dmpBlueprintService.getSingle(this.configurationService.defaultBlueprintId, DmpEditorResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.selectedBlueprint = data;
|
this.selectedBlueprint = data;
|
||||||
this.formGroup.get('blueprint').setValue(this.selectedBlueprint.id);
|
this.formGroup.get('blueprint').setValue(this.selectedBlueprint.id);
|
||||||
|
|
||||||
const goToNextStep: boolean = this.formGroup.get('label').valid && this.formGroup.get('description').valid;
|
const goToNextStep: boolean = this.formGroup.get('label').valid && this.formGroup.get('description').valid;
|
||||||
if (goToNextStep) {
|
if (goToNextStep) {
|
||||||
this.buildFormAfterBlueprintSelection();
|
this.buildFormAfterBlueprintSelection();
|
||||||
this.nextStep();
|
this.nextStep();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildFormAfterBlueprintSelection() {
|
private buildFormAfterBlueprintSelection() {
|
||||||
|
@ -534,13 +532,13 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
this.formGroup.get('properties').get('contacts').markAsDirty();
|
this.formGroup.get('properties').get('contacts').markAsDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchContact(contactIndex: number, field: FieldInSection): void{
|
searchContact(contactIndex: number, field: FieldInSection): void {
|
||||||
const dialogRef = this.dialog.open(DmpContactPrefillDialogComponent, {
|
const dialogRef = this.dialog.open(DmpContactPrefillDialogComponent, {
|
||||||
maxWidth: '700px',
|
maxWidth: '700px',
|
||||||
maxHeight: '80vh',
|
maxHeight: '80vh',
|
||||||
data: {
|
data: {
|
||||||
contactFormGroup: (this.formGroup.get('properties').get('contacts') as FormArray).at(contactIndex),
|
contactFormGroup: (this.formGroup.get('properties').get('contacts') as FormArray).at(contactIndex),
|
||||||
label: field.label
|
label: field.label
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<a [routerLink]="isPublic ? this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id]) : this.routerUtils.generateUrl(['/plans/overview/', dmp.id])" class="pointer">
|
<a [routerLink]="isPublic ? this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id]) : this.routerUtils.generateUrl(['/plans/overview/', dmp.id])" class="pointer">
|
||||||
<div class="d-flex flex-direction-row">
|
<div class="d-flex flex-direction-row">
|
||||||
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
|
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
|
||||||
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.updatedAt | dateTimeCultureFormatter: "d MMMM y" }}</div>
|
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.updatedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||||
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ dmp.finalizedAt | dateTimeCultureFormatter: "d MMMM y" }}</div>
|
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ dmp.finalizedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{dmp.label}}</div>
|
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{dmp.label}}</div>
|
||||||
<div class="dmp-subtitle">
|
<div class="dmp-subtitle">
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto d-flex">{{'DMP-OVERVIEW.EDITED' | translate}} :
|
<div class="col-auto d-flex">{{'DMP-OVERVIEW.EDITED' | translate}} :
|
||||||
{{dmp.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
|
{{dmp.updatedAt | dateTimeFormatter: "d MMMM y"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto d-flex">
|
<div class="col-auto d-flex">
|
||||||
<div *ngIf="dmp.status== dmpStatusEnum.Finalized" class="d-flex flex-row uppercase">
|
<div *ngIf="dmp.status== dmpStatusEnum.Finalized" class="d-flex flex-row uppercase">
|
||||||
|
|
|
@ -1,44 +1,40 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
|
||||||
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
|
||||||
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
|
||||||
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
|
||||||
import { SupportiveMaterial, SupportiveMaterialPersist } from '@app/core/model/supportive-material/supportive-material';
|
|
||||||
import { Guid } from '@common/types/guid';
|
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
|
||||||
import { SupportiveMaterialEditorModel } from './supportive-material-editor.model';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { FormService } from '@common/forms/form-service';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
|
||||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
|
||||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
|
||||||
import { SupportiveMaterialEditorService } from './supportive-material-editor.service';
|
|
||||||
import { SupportiveMaterialEditorResolver } from './supportive-material-editor.resolver';
|
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
|
import { SupportiveMaterial, SupportiveMaterialPersist } from '@app/core/model/supportive-material/supportive-material';
|
||||||
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
||||||
import { nameof } from 'ts-simple-nameof';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { Language } from '@app/core/model/language/language';
|
|
||||||
import { LanguageLookup } from '@app/core/query/language.lookup';
|
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
|
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||||
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
|
import { Guid } from '@common/types/guid';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { SupportiveMaterialEditorModel } from './supportive-material-editor.model';
|
||||||
|
import { SupportiveMaterialEditorResolver } from './supportive-material-editor.resolver';
|
||||||
|
import { SupportiveMaterialEditorService } from './supportive-material-editor.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-supportive-material-editor',
|
selector: 'app-supportive-material-editor',
|
||||||
templateUrl: './supportive-material-editor.component.html',
|
templateUrl: './supportive-material-editor.component.html',
|
||||||
styleUrls: ['./supportive-material-editor.component.scss'],
|
styleUrls: ['./supportive-material-editor.component.scss'],
|
||||||
providers: [SupportiveMaterialEditorService]
|
providers: [SupportiveMaterialEditorService]
|
||||||
})
|
})
|
||||||
export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMaterialEditorModel, SupportiveMaterial> implements OnInit {
|
export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMaterialEditorModel, SupportiveMaterial> implements OnInit {
|
||||||
isNew = true;
|
isNew = true;
|
||||||
|
@ -59,7 +55,6 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -74,7 +69,7 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
||||||
private supportiveMaterialEditorService: SupportiveMaterialEditorService,
|
private supportiveMaterialEditorService: SupportiveMaterialEditorService,
|
||||||
private fileUtils: FileUtils,
|
private fileUtils: FileUtils,
|
||||||
) {
|
) {
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -172,25 +167,25 @@ export class SupportiveMaterialEditorComponent extends BaseEditor<SupportiveMate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public selectedMaterialChanged(){
|
public selectedMaterialChanged() {
|
||||||
this.getSupportiveMaterialData();
|
this.getSupportiveMaterialData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public selectedLangChanged(){
|
public selectedLangChanged() {
|
||||||
this.getSupportiveMaterialData();
|
this.getSupportiveMaterialData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSupportiveMaterialData(){
|
private getSupportiveMaterialData() {
|
||||||
|
|
||||||
if(this.formGroup.get('type').value >= 0 && this.formGroup.get('languageCode').value){
|
if (this.formGroup.get('type').value >= 0 && this.formGroup.get('languageCode').value) {
|
||||||
const lookup = SupportiveMaterialService.DefaultSupportiveMaterialLookup();
|
const lookup = SupportiveMaterialService.DefaultSupportiveMaterialLookup();
|
||||||
lookup.types = [this.formGroup.get('type').value];
|
lookup.types = [this.formGroup.get('type').value];
|
||||||
lookup.languageCodes = [this.formGroup.get('languageCode').value];
|
lookup.languageCodes = [this.formGroup.get('languageCode').value];
|
||||||
this.supportiveMaterialService.query(lookup).pipe(takeUntil(this._destroyed)).subscribe(data => { //TODO HANDLE-ERRORS
|
this.supportiveMaterialService.query(lookup).pipe(takeUntil(this._destroyed)).subscribe(data => { //TODO HANDLE-ERRORS
|
||||||
if(data.count == 1){
|
if (data.count == 1) {
|
||||||
this.formGroup.get('id').patchValue(data.items[0].id);
|
this.formGroup.get('id').patchValue(data.items[0].id);
|
||||||
this.formGroup.get('payload').patchValue(data.items[0].payload);
|
this.formGroup.get('payload').patchValue(data.items[0].payload);
|
||||||
}else{
|
} else {
|
||||||
this.formGroup.get('id').patchValue(null);
|
this.formGroup.get('id').patchValue(null);
|
||||||
this.formGroup.get('payload').patchValue('');
|
this.formGroup.get('payload').patchValue('');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { EditorModule } from '@tinymce/tinymce-angular';
|
|
||||||
import { SupportiveMaterialEditorRoutingModule } from './supportive-material-editor.routing';
|
|
||||||
import { SupportiveMaterialEditorComponent } from './supportive-material-editor.component';
|
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
|
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||||
|
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||||
|
import { EditorModule } from '@tinymce/tinymce-angular';
|
||||||
|
import { SupportiveMaterialEditorComponent } from './supportive-material-editor.component';
|
||||||
|
import { SupportiveMaterialEditorRoutingModule } from './supportive-material-editor.routing';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [SupportiveMaterialEditorComponent],
|
declarations: [SupportiveMaterialEditorComponent],
|
||||||
imports: [
|
imports: [
|
||||||
CommonUiModule,
|
CommonUiModule,
|
||||||
CommonFormsModule,
|
CommonFormsModule,
|
||||||
SupportiveMaterialEditorRoutingModule,
|
SupportiveMaterialEditorRoutingModule,
|
||||||
EditorModule
|
EditorModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
DatePipe,
|
EnumUtils
|
||||||
EnumUtils
|
],
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class SupportiveMaterialEditorModule { }
|
export class SupportiveMaterialEditorModule { }
|
||||||
|
|
|
@ -72,11 +72,7 @@
|
||||||
<span [ngClass]="providerIcon"></span>
|
<span [ngClass]="providerIcon"></span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<div *ngIf="i != 0" class="col-auto d-flex align-items-center unlink-mail" (click)="userCredential.data.email !== firstEmail && removeAccount(userCredential)">
|
<div *ngIf="i != 0" class="col-auto d-flex align-items-center unlink-mail" (click)="userCredential.data.email !== firstEmail && removeAccount(userCredential)">
|
||||||
<mat-icon
|
<mat-icon [matTooltip]="(userCredential.data?.email !== firstEmail ) ? ('USER-PROFILE.ACTIONS.UNLINK-ACCOUNT' | translate) : ('USER-PROFILE.ACTIONS.UNLINK-ACCOUNT-DISABLED' | translate)" matTooltipPosition="right" [ngClass]="{'disable-unlink':userCredential.data.email === firstEmail}">link_off</mat-icon>
|
||||||
[matTooltip]="(userCredential.data?.email !== firstEmail ) ? ('USER-PROFILE.ACTIONS.UNLINK-ACCOUNT' | translate) : ('USER-PROFILE.ACTIONS.UNLINK-ACCOUNT-DISABLED' | translate)"
|
|
||||||
matTooltipPosition="right"
|
|
||||||
[ngClass]="{'disable-unlink':userCredential.data.email === firstEmail}"
|
|
||||||
>link_off</mat-icon>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -143,18 +139,17 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col timezone-form">
|
<div class="col timezone-form">
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}" [formControl]="this.formGroup.get('additionalInfo').get('timezone')" matInput [matAutocomplete]="timezone" required>
|
<input matInput autocomplete="off" placeholder="{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}" [matAutocomplete]="timezoneAuto" type="text" name="timezone" [formControl]="formGroup.get('additionalInfo').get('timezone')">
|
||||||
<mat-autocomplete #timezone="matAutocomplete">
|
<mat-error *ngIf="formGroup.get('additionalInfo').get('timezone').hasError('backendError')">{{formGroup.get('additionalInfo').get('timezone').getError('backendError').message}}</mat-error>
|
||||||
<mat-option *ngFor="let timezone of timezones | async" [value]="timezone">
|
<mat-error *ngIf="formGroup.get('additionalInfo').get('timezone').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
{{ timezone | timezoneInfoDisplay }}
|
<mat-autocomplete autoActiveFirstOption #timezoneAuto="matAutocomplete">
|
||||||
</mat-option>
|
<mat-option *ngFor="let timezone of filteredTimezones" [value]="timezone">{{timezone | timezoneInfoDisplay}}</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
<mat-error *ngIf="this.formGroup.get('additionalInfo').get('timezone').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Culture -->
|
<!-- Culture -->
|
||||||
<div class="col-12 col-lg-4">
|
<div class="col-12 col-lg-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-auto mb-1 field-title">{{'USER-PROFILE.SETTINGS.CULTURE' | translate}} *</div>
|
<div class="col-auto mb-1 field-title">{{'USER-PROFILE.SETTINGS.CULTURE' | translate}} *</div>
|
||||||
|
@ -162,18 +157,17 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col culture-form">
|
<div class="col culture-form">
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}" [formControl]="this.formGroup.get('additionalInfo').get('culture')" matInput [matAutocomplete]="culture" required>
|
<input matInput autocomplete="off" placeholder="{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}" [matAutocomplete]="cultureAuto" type="text" name="culture" [formControl]="formGroup.get('additionalInfo').get('culture')">
|
||||||
<mat-autocomplete #culture="matAutocomplete" [displayWith]="displayFn(culture)">
|
<mat-error *ngIf="formGroup.get('additionalInfo').get('culture').hasError('backendError')">{{formGroup.get('additionalInfo').get('culture').getError('backendError').message}}</mat-error>
|
||||||
<mat-option *ngFor="let culture of cultures | async" [value]="displayFn(culture)">
|
<mat-error *ngIf="formGroup.get('additionalInfo').get('culture').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
{{ culture.displayName }} - {{ culture.nativeName }}
|
<mat-autocomplete autoActiveFirstOption #cultureAuto="matAutocomplete" [displayWith]="displayCultureFn.bind(this)">
|
||||||
</mat-option>
|
<mat-option *ngFor="let culture of filteredCultures" [value]="culture.name">{{culture | cultureInfoDisplay}}</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
<mat-error *ngIf="this.formGroup.get('additionalInfo').get('culture').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Language -->
|
<!-- Language -->
|
||||||
<div class="col-12 col-lg-4">
|
<div class="col-12 col-lg-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-auto mb-1 field-title">{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}} *</div>
|
<div class="col-auto mb-1 field-title">{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}} *</div>
|
||||||
|
@ -183,7 +177,7 @@
|
||||||
|
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<!-- <mat-label>{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}</mat-label> -->
|
<!-- <mat-label>{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}</mat-label> -->
|
||||||
<mat-select [formControl]="this.formGroup.get('additionalInfo').get('language')" name="language">
|
<mat-select [formControl]="this.formGroup.get('additionalInfo').get('language')" name="language">
|
||||||
<mat-option *ngFor="let language of languages" [value]="language">
|
<mat-option *ngFor="let language of languages" [value]="language">
|
||||||
{{ "GENERAL.LANGUAGES."+ language | translate }}
|
{{ "GENERAL.LANGUAGES."+ language | translate }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
@ -223,4 +217,4 @@
|
||||||
<ng-template #loading>
|
<ng-template #loading>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -3,14 +3,13 @@ import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } fr
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||||
import { CultureInfo } from '@app/core/model/culture-info';
|
|
||||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||||
import { Reference } from '@app/core/model/reference/reference';
|
import { Reference } from '@app/core/model/reference/reference';
|
||||||
import { Tenant } from '@app/core/model/tenant/tenant';
|
import { Tenant } from '@app/core/model/tenant/tenant';
|
||||||
import { User, UserAdditionalInfo, UserCredential, UserPersist } from '@app/core/model/user/user';
|
import { User, UserAdditionalInfo, UserCredential, UserPersist } from '@app/core/model/user/user';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
import { CultureService } from '@app/core/services/culture/culture-service';
|
import { CultureInfo, CultureService } from '@app/core/services/culture/culture-service';
|
||||||
import { PrincipalService } from '@app/core/services/http/principal.service';
|
import { PrincipalService } from '@app/core/services/http/principal.service';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
|
@ -18,6 +17,7 @@ import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/serv
|
||||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||||
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
||||||
import { TenantHandlingService } from '@app/core/services/tenant/tenant-handling.service';
|
import { TenantHandlingService } from '@app/core/services/tenant/tenant-handling.service';
|
||||||
|
import { TimezoneService } from '@app/core/services/timezone/timezone-service';
|
||||||
import { UserService } from '@app/core/services/user/user.service';
|
import { UserService } from '@app/core/services/user/user.service';
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
|
@ -31,7 +31,6 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import * as moment from 'moment-timezone';
|
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
import { nameof } from 'ts-simple-nameof';
|
import { nameof } from 'ts-simple-nameof';
|
||||||
|
@ -52,7 +51,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
firstEmail: String;
|
firstEmail: String;
|
||||||
userLanguage: String;
|
userLanguage: String;
|
||||||
currentUserId: string;
|
currentUserId: string;
|
||||||
cultures: Observable<CultureInfo[]>;
|
cultureValues = new Array<CultureInfo>();
|
||||||
|
timezoneValues = new Array<string>();
|
||||||
|
filteredCultures = new Array<CultureInfo>();
|
||||||
|
filteredTimezones = new Array<string>();
|
||||||
timezones: Observable<any[]>;
|
timezones: Observable<any[]>;
|
||||||
editMode = false;
|
editMode = false;
|
||||||
languages = [];
|
languages = [];
|
||||||
|
@ -74,6 +76,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private language: TranslateService,
|
private language: TranslateService,
|
||||||
private cultureService: CultureService,
|
private cultureService: CultureService,
|
||||||
|
private timezoneService: TimezoneService,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private configurationService: ConfigurationService,
|
private configurationService: ConfigurationService,
|
||||||
private uiNotificationService: UiNotificationService,
|
private uiNotificationService: UiNotificationService,
|
||||||
|
@ -111,6 +114,9 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.cultureValues = this.cultureService.getCultureValues();
|
||||||
|
this.timezoneValues = this.timezoneService.getTimezoneValues();
|
||||||
|
|
||||||
this.tenantFormGroup = this.formBuilder.group({
|
this.tenantFormGroup = this.formBuilder.group({
|
||||||
tenantCode: [this.authService.selectedTenant(), [Validators.required]]
|
tenantCode: [this.authService.selectedTenant(), [Validators.required]]
|
||||||
});
|
});
|
||||||
|
@ -159,12 +165,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
this.userProfileEditorModel = new UserProfileEditorModel().fromModel(result);
|
this.userProfileEditorModel = new UserProfileEditorModel().fromModel(result);
|
||||||
this.formGroup = this.userProfileEditorModel.buildForm(this.languageService.getAvailableLanguagesCodes());
|
this.formGroup = this.userProfileEditorModel.buildForm(this.languageService.getAvailableLanguagesCodes());
|
||||||
|
|
||||||
this.formGroup.get('additionalInfo').get('timezone').valueChanges
|
this.registerChangeListeners();
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => { if (x) { this.timezones = this._filterTimezone(x); } });
|
|
||||||
this.formGroup.get('additionalInfo').get('culture').valueChanges
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => { if (x) { this.cultures = this._filterCulture(x); } });
|
|
||||||
|
|
||||||
this.tenants = this.loadUserTenants();
|
this.tenants = this.loadUserTenants();
|
||||||
this.unlock();
|
this.unlock();
|
||||||
|
@ -172,42 +173,29 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
registerChangeListeners() {
|
||||||
|
|
||||||
|
this.filteredCultures = this.cultureValues.filter((culture) => culture.name === this.userProfileEditorModel.additionalInfo.culture);
|
||||||
|
this.filteredTimezones = this.timezoneValues.filter((zone) => zone === this.userProfileEditorModel.additionalInfo.timezone);
|
||||||
|
// set change listeners
|
||||||
|
this.formGroup.get('additionalInfo').get('timezone').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe((text) => {
|
||||||
|
const searchText = text.toLowerCase();
|
||||||
|
const result = this.timezoneValues.filter((zone) => zone.toLowerCase().indexOf(searchText) >= 0);
|
||||||
|
this.filteredTimezones = result;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.formGroup.get('additionalInfo').get('culture').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe((text) => {
|
||||||
|
const searchText = text.toLowerCase();
|
||||||
|
const result = this.cultureValues.filter((culture) => culture.name.toLowerCase().indexOf(searchText) >= 0);
|
||||||
|
this.filteredCultures = result;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public hasProvider(userCredential: UserCredential, provider: string): boolean {
|
|
||||||
const result = userCredential.data.externalProviderNames?.find(x => x == provider);
|
|
||||||
|
|
||||||
return result != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _filterTimezone(value: string): Observable<any[]> {
|
|
||||||
if (value && typeof value === 'string') {
|
|
||||||
const filterValue = value.toLowerCase();
|
|
||||||
return of(moment.tz.names().filter(option => option.toLowerCase().includes(filterValue)));
|
|
||||||
} else {
|
|
||||||
return of(moment.tz.names());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private _filterCulture(value: string): Observable<any[]> {
|
|
||||||
if (value && typeof value === 'string') {
|
|
||||||
const filterValue = value.toLowerCase();
|
|
||||||
return of(this.cultureService.getCultureValues().filter(option => option.displayName.toLowerCase().includes(filterValue)));
|
|
||||||
} else {
|
|
||||||
return of(this.cultureService.getCultureValues());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
displayFn(culture?: CultureInfo): string | undefined {
|
|
||||||
|
|
||||||
if (culture == null
|
|
||||||
|| culture.displayName == null
|
|
||||||
|| culture.nativeName == null)
|
|
||||||
return undefined;
|
|
||||||
|
|
||||||
return culture.displayName + '-' + culture.nativeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.formService.removeAllBackEndErrors(this.formGroup);
|
this.formService.removeAllBackEndErrors(this.formGroup);
|
||||||
|
@ -375,4 +363,15 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
expandPreferences(): void {
|
expandPreferences(): void {
|
||||||
this.expandedPreferences = true;
|
this.expandedPreferences = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayCultureFn(cultureName?: string): string | undefined {
|
||||||
|
|
||||||
|
const culture: CultureInfo = this.cultureValues?.find(x => x.name == cultureName);
|
||||||
|
if (culture == null
|
||||||
|
|| culture.displayName == null)
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
return culture.displayName + ' [' + culture.name + ']';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"Enabled": false,
|
"Enabled": false,
|
||||||
"Url": "localhost:5000/"
|
"Url": "localhost:5000/"
|
||||||
},
|
},
|
||||||
"defaultCulture": "en-US",
|
"defaultCulture": "en",
|
||||||
"defaultBlueprintId": "86635178-36a6-484f-9057-a934e4eeecd5",
|
"defaultBlueprintId": "86635178-36a6-484f-9057-a934e4eeecd5",
|
||||||
"keycloak": {
|
"keycloak": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,3 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
|
@ -62,7 +61,6 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
|
||||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||||
import moment from 'moment';
|
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
||||||
import { Moment } from 'moment';
|
import moment, { Moment } from 'moment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MomentUtcDateAdapter extends MomentDateAdapter {
|
export class MomentUtcDateAdapter extends MomentDateAdapter {
|
||||||
|
@ -36,10 +35,19 @@ export class MomentUtcDateAdapter extends MomentDateAdapter {
|
||||||
// manually writing on the textbox
|
// manually writing on the textbox
|
||||||
parse(value: any, parseFormat: string | string[]): Moment | null {
|
parse(value: any, parseFormat: string | string[]): Moment | null {
|
||||||
const initialParse = super.parse(value, parseFormat);
|
const initialParse = super.parse(value, parseFormat);
|
||||||
if (initialParse == null) { return null };
|
if (!initialParse) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
if (!initialParse.isValid()) { return initialParse; }
|
if (!initialParse.isValid()) { return initialParse; }
|
||||||
|
|
||||||
const result = moment.utc({ year: initialParse.year(), month: initialParse.month(), date: initialParse.date() }).locale(this.locale);
|
const result = moment.utc({
|
||||||
|
year: initialParse.year(),
|
||||||
|
month: initialParse.month(),
|
||||||
|
date: initialParse.date(),
|
||||||
|
hour: initialParse.hour(),
|
||||||
|
minute: initialParse.minute()
|
||||||
|
}).locale(this.locale);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
import { Injectable, inject } from "@angular/core";
|
||||||
|
import { TimezoneService } from "@app/core/services/timezone/timezone-service";
|
||||||
|
import { MomentDatetimeAdapter } from "@mat-datetimepicker/moment";
|
||||||
|
import moment, { Moment } from "moment";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class MomentUtcDateTimeAdapter extends MomentDatetimeAdapter {
|
||||||
|
|
||||||
|
private timezoneService = inject(TimezoneService);
|
||||||
|
|
||||||
|
// selected from datepicker
|
||||||
|
createDatetime(year: number, month: number, date: number, hour: number, minute: number): Moment {
|
||||||
|
// Moment.js will create an invalid date if any of the components are out of bounds, but we
|
||||||
|
// explicitly check each case so we can throw more descriptive errors.
|
||||||
|
if (month < 0 || month > 11) {
|
||||||
|
throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (date < 1) {
|
||||||
|
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hour < 0 || hour > 23) {
|
||||||
|
throw Error(`Invalid hours "${hour}". Hours has to be between 0 and 23.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minute < 0 || minute > 59) {
|
||||||
|
throw Error(`Invalid minutes "${minute}". Minutes has to between 0 and 59.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const result = moment.utc({ year, month, date, hour, minute }).locale(this.locale);
|
||||||
|
|
||||||
|
|
||||||
|
if (this.timezoneService) {// !!GOTCHA! super() calls createDate . At that moment it has no timezoneService
|
||||||
|
result.tz(this.timezoneService.getCurrentTimezone(), true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the result isn't valid, the date must have been out of bounds for this month.
|
||||||
|
if (!result.isValid()) {
|
||||||
|
throw Error(`Invalid date "${date}" for month with index "${month}".`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// manually writing on the textbox
|
||||||
|
parse(value: any, parseFormat: string | string[]): Moment | null {
|
||||||
|
const initialParse = super.parse(value, parseFormat);
|
||||||
|
if (!initialParse) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!initialParse.isValid()) { return initialParse; }
|
||||||
|
|
||||||
|
const result = moment.utc({
|
||||||
|
year: initialParse.year(),
|
||||||
|
month: initialParse.month(),
|
||||||
|
date: initialParse.date(),
|
||||||
|
hour: initialParse.hour(),
|
||||||
|
minute: initialParse.minute()
|
||||||
|
}).locale(this.locale)
|
||||||
|
.tz(this.timezoneService.getCurrentTimezone(), true)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
format(date: Moment, displayFormat: string): string {
|
||||||
|
date.tz(this.timezoneService.getCurrentTimezone());
|
||||||
|
return super.format(date, displayFormat);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ArrayToStringPipe } from '@common/formatting/pipes/array-to-string.pipe';
|
import { ArrayToStringPipe } from '@common/formatting/pipes/array-to-string.pipe';
|
||||||
import { DataTableDateFormatPipe, DateFormatPipe } from '@common/formatting/pipes/date-format.pipe';
|
|
||||||
import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pipes/date-only-format.pipe';
|
import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pipes/date-only-format.pipe';
|
||||||
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
|
||||||
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
|
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
|
||||||
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
||||||
import { NotificationContactTypePipe } from './pipes/notification-contact-type.pipe';
|
import { NotificationContactTypePipe } from './pipes/notification-contact-type.pipe';
|
||||||
|
@ -22,10 +20,6 @@ import { LockTargetTypePipe } from './pipes/lock-target-type.pipe';
|
||||||
//
|
//
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
DateFormatPipe,
|
|
||||||
DateTimeFormatPipe,
|
|
||||||
DataTableDateFormatPipe,
|
|
||||||
DataTableDateTimeFormatPipe,
|
|
||||||
LowercaseFirstLetterPipe,
|
LowercaseFirstLetterPipe,
|
||||||
ArrayToStringPipe,
|
ArrayToStringPipe,
|
||||||
DateOnlyPipe,
|
DateOnlyPipe,
|
||||||
|
@ -42,10 +36,6 @@ import { LockTargetTypePipe } from './pipes/lock-target-type.pipe';
|
||||||
LockTargetTypePipe
|
LockTargetTypePipe
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
DateFormatPipe,
|
|
||||||
DateTimeFormatPipe,
|
|
||||||
DataTableDateFormatPipe,
|
|
||||||
DataTableDateTimeFormatPipe,
|
|
||||||
LowercaseFirstLetterPipe,
|
LowercaseFirstLetterPipe,
|
||||||
ArrayToStringPipe,
|
ArrayToStringPipe,
|
||||||
DateOnlyPipe,
|
DateOnlyPipe,
|
||||||
|
@ -62,10 +52,6 @@ import { LockTargetTypePipe } from './pipes/lock-target-type.pipe';
|
||||||
LockTargetTypePipe
|
LockTargetTypePipe
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
DateFormatPipe,
|
|
||||||
DateTimeFormatPipe,
|
|
||||||
DataTableDateFormatPipe,
|
|
||||||
DataTableDateTimeFormatPipe,
|
|
||||||
LowercaseFirstLetterPipe,
|
LowercaseFirstLetterPipe,
|
||||||
ArrayToStringPipe,
|
ArrayToStringPipe,
|
||||||
DateOnlyPipe,
|
DateOnlyPipe,
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
|
||||||
import moment from 'moment';
|
|
||||||
import 'moment-timezone';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
@Pipe({
|
|
||||||
name: 'dateFormatter'
|
|
||||||
})
|
|
||||||
export class DateFormatPipe implements PipeTransform {
|
|
||||||
|
|
||||||
constructor(private datePipe: DatePipe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any, format?: string, locale?: string): string | null {
|
|
||||||
// using timezone set in timezoneService by default. can be overwritten with pipe arguments
|
|
||||||
const timezoneToUse = moment(value).tz('UTC').format('Z');
|
|
||||||
return this.datePipe.transform(value, format, timezoneToUse, locale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
@Pipe({
|
|
||||||
name: 'dataTableDateFormatter'
|
|
||||||
})
|
|
||||||
// This is only used for the DataTable Column definition.
|
|
||||||
// It's a hacky way to apply format to the pipe because it only supports passing a pipe instance and calls transform in it without params.
|
|
||||||
export class DataTableDateFormatPipe extends DateFormatPipe implements PipeTransform {
|
|
||||||
|
|
||||||
format: string;
|
|
||||||
|
|
||||||
constructor(_datePipe: DatePipe) {
|
|
||||||
super(_datePipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
public withFormat(format: string): DataTableDateFormatPipe {
|
|
||||||
this.format = format;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any): string | null {
|
|
||||||
return super.transform(value, this.format);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
|
||||||
import { CultureService } from '@app/core/services/culture/culture-service';
|
|
||||||
import { TimezoneService } from '@app/core/services/timezone/timezone-service';
|
|
||||||
import moment from 'moment';
|
|
||||||
import 'moment-timezone';
|
|
||||||
|
|
||||||
@Pipe({
|
|
||||||
name: 'dateTimeFormatter'
|
|
||||||
})
|
|
||||||
export class DateTimeFormatPipe implements PipeTransform {
|
|
||||||
|
|
||||||
constructor(private datePipe: DatePipe, private timezoneService: TimezoneService, private cultureService: CultureService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any, format?: string, timezone?: string, locale?: string): string | null {
|
|
||||||
// using timezone set in timezoneService by default. can be overwritten with pipe arguments
|
|
||||||
const timezoneToUse = timezone ? timezone : moment(value).tz(this.timezoneService.getCurrentTimezone()).format('Z');
|
|
||||||
const localeToUse = locale ? locale : this.cultureService.getCurrentCulture().name;
|
|
||||||
return this.datePipe.transform(value, format, timezoneToUse, localeToUse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Pipe({
|
|
||||||
name: 'dataTableDateTimeFormatter'
|
|
||||||
})
|
|
||||||
// This is only used for the DataTable Column definition.
|
|
||||||
// It's a hacky way to apply format to the pipe because it only supports passing a pipe instance and calls transform in it without params.
|
|
||||||
export class DataTableDateTimeFormatPipe extends DateTimeFormatPipe implements PipeTransform {
|
|
||||||
|
|
||||||
format: string;
|
|
||||||
|
|
||||||
constructor(private _datePipe: DatePipe, private _timezoneService: TimezoneService, private _cultureService: CultureService) {
|
|
||||||
super(_datePipe, _timezoneService, _cultureService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public withFormat(format: string): DataTableDateTimeFormatPipe {
|
|
||||||
this.format = format;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(value: any): string | null {
|
|
||||||
return super.transform(value, this.format);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +1,40 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormArray, UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||||
|
import { MatChipEditedEvent, MatChipInputEvent } from '@angular/material/chips';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { Title } from '@angular/platform-browser';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||||
|
import { Language } from '@app/core/model/language/language';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
|
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
||||||
|
import { LockService } from '@app/core/services/lock/lock.service';
|
||||||
|
import { LoggingService } from '@app/core/services/logging/logging-service';
|
||||||
|
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
|
import { BaseEditor } from '@common/base/base-editor';
|
||||||
import { FormService } from '@common/forms/form-service';
|
import { FormService } from '@common/forms/form-service';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
|
||||||
import { NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model';
|
|
||||||
import { NotificationTemplateService } from '@notification-service/services/http/notification-template.service';
|
|
||||||
import { NotificationFieldInfoEditorModel, NotificationFieldOptionsEditorModel, NotificationTemplateEditorModel } from './notification-template-editor.model';
|
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
|
||||||
import { BaseEditor } from '@common/base/base-editor';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
|
||||||
import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service';
|
|
||||||
import { NotificationTemplateEditorService } from './notification-template-editor.service';
|
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { NotificationTemplateEditorResolver } from './notification-template-editor.resolver';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { LoggingService } from '@app/core/services/logging/logging-service';
|
import { EmailOverrideMode } from '@notification-service/core/enum/email-override-mode';
|
||||||
import { LanguageHttpService } from '@app/core/services/language/language.http.service';
|
|
||||||
import { Language } from '@app/core/model/language/language';
|
|
||||||
import { nameof } from 'ts-simple-nameof';
|
|
||||||
import { MatChipEditedEvent, MatChipInputEvent } from '@angular/material/chips';
|
|
||||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
|
||||||
import { LockService } from '@app/core/services/lock/lock.service';
|
|
||||||
import { IsActive } from '@notification-service/core/enum/is-active.enum';
|
import { IsActive } from '@notification-service/core/enum/is-active.enum';
|
||||||
|
import { NotificationDataType } from '@notification-service/core/enum/notification-data-type';
|
||||||
import { NotificationTemplateChannel } from '@notification-service/core/enum/notification-template-channel.enum';
|
import { NotificationTemplateChannel } from '@notification-service/core/enum/notification-template-channel.enum';
|
||||||
import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum';
|
import { NotificationTemplateKind } from '@notification-service/core/enum/notification-template-kind.enum';
|
||||||
import { NotificationType } from '@notification-service/core/enum/notification-type.enum';
|
import { NotificationType } from '@notification-service/core/enum/notification-type.enum';
|
||||||
import { EmailOverrideMode } from '@notification-service/core/enum/email-override-mode';
|
import { NotificationServiceEnumUtils } from '@notification-service/core/formatting/enum-utils.service';
|
||||||
import { NotificationDataType } from '@notification-service/core/enum/notification-data-type';
|
import { NotificationTemplate, NotificationTemplatePersist } from '@notification-service/core/model/notification-template.model';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { NotificationTemplateService } from '@notification-service/services/http/notification-template.service';
|
||||||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { NotificationTemplateEditorModel } from './notification-template-editor.model';
|
||||||
|
import { NotificationTemplateEditorResolver } from './notification-template-editor.resolver';
|
||||||
|
import { NotificationTemplateEditorService } from './notification-template-editor.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-notification-template-editor',
|
selector: 'app-notification-template-editor',
|
||||||
|
@ -87,7 +85,6 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
protected uiNotificationService: UiNotificationService,
|
protected uiNotificationService: UiNotificationService,
|
||||||
protected httpErrorHandlingService: HttpErrorHandlingService,
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
protected filterService: FilterService,
|
protected filterService: FilterService,
|
||||||
protected datePipe: DatePipe,
|
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected queryParamsService: QueryParamsService,
|
protected queryParamsService: QueryParamsService,
|
||||||
protected lockService: LockService,
|
protected lockService: LockService,
|
||||||
|
@ -102,13 +99,13 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
private titleService: Title,
|
private titleService: Title,
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
) {
|
) {
|
||||||
const descriptionLabel:string = route.snapshot.data['entity']?.notificationType;
|
const descriptionLabel: string = route.snapshot.data['entity']?.notificationType;
|
||||||
if (descriptionLabel) {
|
if (descriptionLabel) {
|
||||||
titleService.setTitle(descriptionLabel);
|
titleService.setTitle(descriptionLabel);
|
||||||
} else {
|
} else {
|
||||||
titleService.setTitle('NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.TITLE-EDIT-NOTIFICATION-TEMPLATE');
|
titleService.setTitle('NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.TITLE-EDIT-NOTIFICATION-TEMPLATE');
|
||||||
}
|
}
|
||||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -135,19 +132,19 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
try {
|
try {
|
||||||
this.editorModel = data ? new NotificationTemplateEditorModel().fromModel(data) : new NotificationTemplateEditorModel();
|
this.editorModel = data ? new NotificationTemplateEditorModel().fromModel(data) : new NotificationTemplateEditorModel();
|
||||||
|
|
||||||
if(data){
|
if (data) {
|
||||||
if(data.value && data.value.subjectFieldOptions){
|
if (data.value && data.value.subjectFieldOptions) {
|
||||||
this.subjectFieldOptionsEnabled = true;
|
this.subjectFieldOptionsEnabled = true;
|
||||||
this.subjectMandatoryFields = data.value.subjectFieldOptions.mandatory;
|
this.subjectMandatoryFields = data.value.subjectFieldOptions.mandatory;
|
||||||
}
|
}
|
||||||
if(data.value && data.value.bodyFieldOptions){
|
if (data.value && data.value.bodyFieldOptions) {
|
||||||
this.bodyFieldOptionsEnabled = true;
|
this.bodyFieldOptionsEnabled = true;
|
||||||
this.bodyMandatoryFields = data.value.bodyFieldOptions.mandatory;
|
this.bodyMandatoryFields = data.value.bodyFieldOptions.mandatory;
|
||||||
}
|
}
|
||||||
if(data.value && data.value.subjectFieldOptions && data.value.subjectFieldOptions.formatting){
|
if (data.value && data.value.subjectFieldOptions && data.value.subjectFieldOptions.formatting) {
|
||||||
this.subjectFormatting = data.value.subjectFieldOptions.formatting;
|
this.subjectFormatting = data.value.subjectFieldOptions.formatting;
|
||||||
}
|
}
|
||||||
if(data.value && data.value.bodyFieldOptions && data.value.bodyFieldOptions.formatting){
|
if (data.value && data.value.bodyFieldOptions && data.value.bodyFieldOptions.formatting) {
|
||||||
this.bodyFormatting = data.value.bodyFieldOptions.formatting;
|
this.bodyFormatting = data.value.bodyFieldOptions.formatting;
|
||||||
}
|
}
|
||||||
this.ccValues = this.editorModel.value.cc;
|
this.ccValues = this.editorModel.value.cc;
|
||||||
|
@ -166,9 +163,9 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditNotificationTemplate));
|
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditNotificationTemplate));
|
||||||
this.notificationTemplateEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
this.notificationTemplateEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||||
NotificationTemplateEditorModel.reApplyValueValidators({
|
NotificationTemplateEditorModel.reApplyValueValidators({
|
||||||
formGroup: this.formGroup,
|
formGroup: this.formGroup,
|
||||||
validationErrorModel: this.editorModel.validationErrorModel
|
validationErrorModel: this.editorModel.validationErrorModel
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,50 +237,50 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
subjectFieldOptionsSelectionChanged(matCheckBox: MatCheckboxChange){
|
subjectFieldOptionsSelectionChanged(matCheckBox: MatCheckboxChange) {
|
||||||
if(matCheckBox.checked == true){
|
if (matCheckBox.checked == true) {
|
||||||
this.subjectFieldOptionsEnabled = true;
|
this.subjectFieldOptionsEnabled = true;
|
||||||
}else{
|
} else {
|
||||||
this.subjectFieldOptionsEnabled = false;
|
this.subjectFieldOptionsEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyFieldOptionsSelectionChanged(matCheckBox: MatCheckboxChange){
|
bodyFieldOptionsSelectionChanged(matCheckBox: MatCheckboxChange) {
|
||||||
if(matCheckBox.checked == true){
|
if (matCheckBox.checked == true) {
|
||||||
this.bodyFieldOptionsEnabled = true;
|
this.bodyFieldOptionsEnabled = true;
|
||||||
}else{
|
} else {
|
||||||
this.bodyFieldOptionsEnabled = false;
|
this.bodyFieldOptionsEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chip lists
|
// chip lists
|
||||||
|
|
||||||
addChipListValues(type: string, event: MatChipInputEvent){
|
addChipListValues(type: string, event: MatChipInputEvent) {
|
||||||
if(type == "cc"){
|
if (type == "cc") {
|
||||||
this.ccValues = this.add(event, this.ccValues);
|
this.ccValues = this.add(event, this.ccValues);
|
||||||
}else if(type == "bcc"){
|
} else if (type == "bcc") {
|
||||||
this.bccValues = this.add(event, this.bccValues);
|
this.bccValues = this.add(event, this.bccValues);
|
||||||
}else if(type == "extraDataKeys"){
|
} else if (type == "extraDataKeys") {
|
||||||
this.extraDataKeys = this.add(event, this.extraDataKeys);
|
this.extraDataKeys = this.add(event, this.extraDataKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editChipListValues(type: string, event: MatChipEditedEvent, field: string){
|
editChipListValues(type: string, event: MatChipEditedEvent, field: string) {
|
||||||
if(type == "cc"){
|
if (type == "cc") {
|
||||||
this.ccValues = this.edit(field, this.ccValues, event);
|
this.ccValues = this.edit(field, this.ccValues, event);
|
||||||
}else if(type == "bcc"){
|
} else if (type == "bcc") {
|
||||||
this.bccValues = this.edit(field, this.bccValues, event);
|
this.bccValues = this.edit(field, this.bccValues, event);
|
||||||
}else if(type == "extraDataKeys"){
|
} else if (type == "extraDataKeys") {
|
||||||
this.extraDataKeys = this.edit(field, this.extraDataKeys, event);
|
this.extraDataKeys = this.edit(field, this.extraDataKeys, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeChipListValues(type: string, field: string){
|
removeChipListValues(type: string, field: string) {
|
||||||
if(type == "cc"){
|
if (type == "cc") {
|
||||||
this.ccValues = this.remove(field, this.ccValues);
|
this.ccValues = this.remove(field, this.ccValues);
|
||||||
}else if(type == "bcc"){
|
} else if (type == "bcc") {
|
||||||
this.bccValues = this.remove(field, this.bccValues);
|
this.bccValues = this.remove(field, this.bccValues);
|
||||||
}else if(type == "extraDataKeys"){
|
} else if (type == "extraDataKeys") {
|
||||||
this.extraDataKeys = this.remove(field, this.extraDataKeys);
|
this.extraDataKeys = this.remove(field, this.extraDataKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,8 +305,8 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
const value = event.value.trim();
|
const value = event.value.trim();
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
values = this.remove(field, values);
|
values = this.remove(field, values);
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = values.indexOf(field);
|
const index = values.indexOf(field);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { NotificationServiceEnumUtils } from '@notification-service/core/formatt
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
|
||||||
import { QueryResult } from '@common/model/query-result';
|
import { QueryResult } from '@common/model/query-result';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
|
@ -27,6 +26,7 @@ import { NotificationNotifyStatePipe } from '@common/formatting/pipes/notificati
|
||||||
import { NotificationTrackingStatePipe } from '@common/formatting/pipes/notification-tracking-state.pipe';
|
import { NotificationTrackingStatePipe } from '@common/formatting/pipes/notification-tracking-state.pipe';
|
||||||
import { NotificationTrackingProcessPipe } from '@common/formatting/pipes/notification-tracking-process.pipe';
|
import { NotificationTrackingProcessPipe } from '@common/formatting/pipes/notification-tracking-process.pipe';
|
||||||
import { IsActive } from '@notification-service/core/enum/is-active.enum';
|
import { IsActive } from '@notification-service/core/enum/is-active.enum';
|
||||||
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './notification-listing.component.html',
|
templateUrl: './notification-listing.component.html',
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
||||||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||||
import { PipeService } from '@common/formatting/pipe.service';
|
import { PipeService } from '@common/formatting/pipe.service';
|
||||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { ColumnDefinition, ColumnsChangedEvent, HybridListingComponent, PageLoadEvent } from '@common/modules/hybrid-listing/hybrid-listing.component';
|
import { ColumnDefinition, ColumnsChangedEvent, HybridListingComponent, PageLoadEvent } from '@common/modules/hybrid-listing/hybrid-listing.component';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
@ -23,6 +22,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||||
import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe';
|
import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe';
|
||||||
import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum';
|
import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum';
|
||||||
import { InAppNotification } from '@notification-service/core/model/inapp-notification.model';
|
import { InAppNotification } from '@notification-service/core/model/inapp-notification.model';
|
||||||
|
import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-mine-inapp-notification-listing',
|
selector: 'app-mine-inapp-notification-listing',
|
||||||
|
|
Loading…
Reference in New Issue