-
Notifications
You must be signed in to change notification settings - Fork 888
Expand file tree
/
Copy pathapp.module.ts
More file actions
147 lines (136 loc) · 4.84 KB
/
app.module.ts
File metadata and controls
147 lines (136 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/** Angular Imports */
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { I18nService } from './core/i18n/i18n.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
HttpBackend,
HttpClient,
provideHttpClient,
withInterceptorsFromDi,
HTTP_INTERCEPTORS
} from '@angular/common/http';
/** Environment Configuration */
/** Main Component */
import { WebAppComponent } from './web-app.component';
/** Not Found Component */
import { NotFoundComponent } from './not-found/not-found.component';
/** Custom Modules */
import { CoreModule } from './core/core.module';
import { HomeModule } from './home/home.module';
import { LoginModule } from './login/login.module';
import { SettingsModule } from './settings/settings.module';
import { NavigationModule } from './navigation/navigation.module';
import { ClientsModule } from './clients/clients.module';
import { GroupsModule } from './groups/groups.module';
import { CentersModule } from './centers/centers.module';
import { AccountingModule } from './accounting/accounting.module';
import { SystemModule } from './system/system.module';
import { ProductsModule } from './products/products.module';
import { OrganizationModule } from './organization/organization.module';
import { TemplatesModule } from './templates/templates.module';
import { UsersModule } from './users/users.module';
import { ReportsModule } from './reports/reports.module';
import { SearchModule } from './search/search.module';
import { NotificationsModule } from './notifications/notifications.module';
import { CollectionsModule } from './collections/collections.module';
import { ProfileModule } from './profile/profile.module';
import { TasksModule } from './tasks/tasks.module';
import { ConfigurationWizardModule } from './configuration-wizard/configuration-wizard.module';
import { PortalModule } from '@angular/cdk/portal';
/** Main Routing Module */
import { AppRoutingModule } from './app-routing.module';
import { DatePipe, LocationStrategy } from '@angular/common';
import {
TranslateLoader,
TranslateModule,
MissingTranslationHandler,
MissingTranslationHandlerParams
} from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AuthenticationInterceptor as TokenInterceptor } from './core/authentication/authentication.interceptor';
import { TokenInterceptor as ZitadelTokenInterceptor } from './zitadel/token.interceptor';
import { AuthService } from './zitadel/auth.service';
import { environment } from '../environments/environment';
import { CallbackComponent } from './zitadel/callback/callback.component';
import { OAuthModule } from 'angular-oauth2-oidc';
export class CustomMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams): string {
// Remove the 'labels.catalogs.' prefix and return the fallback value
return params.key.replace('labels.catalogs.', '');
}
}
/**
* App Module
*
* Core module and all feature modules should be imported here in proper order.
*/
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
@NgModule({
declarations: [WebAppComponent],
bootstrap: [WebAppComponent],
imports: [
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (httpBackend: HttpBackend, locationStrategy: LocationStrategy) => {
const http = new HttpClient(httpBackend);
return new TranslateHttpLoader(http, `/assets/translations/`, '.json');
},
deps: [
HttpBackend,
LocationStrategy
]
},
missingTranslationHandler: { provide: MissingTranslationHandler, useClass: CustomMissingTranslationHandler }
}),
BrowserModule,
BrowserAnimationsModule,
PortalModule,
CoreModule,
HomeModule,
LoginModule,
ProfileModule,
SettingsModule,
NavigationModule,
ClientsModule,
ReportsModule,
GroupsModule,
CentersModule,
AccountingModule,
SystemModule,
ProductsModule,
OrganizationModule,
TemplatesModule,
UsersModule,
NotificationsModule,
SearchModule,
CollectionsModule,
TasksModule,
ConfigurationWizardModule,
AppRoutingModule,
NotFoundComponent,
CallbackComponent,
OAuthModule.forRoot()
],
providers: [
DatePipe,
AuthService,
{
provide: HTTP_INTERCEPTORS,
useClass: !environment.OIDC.oidcServerEnabled ? TokenInterceptor : ZitadelTokenInterceptor,
multi: true
},
I18nService
]
})
export class AppModule {}