2021-07-03 21:48:27 +00:00
|
|
|
import { NgModule, LOCALE_ID } from '@angular/core';
|
|
|
|
import { registerLocaleData } from '@angular/common';
|
|
|
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
|
|
import locale from '@angular/common/locales/es';
|
|
|
|
import { BrowserModule, Title } from '@angular/platform-browser';
|
|
|
|
import { ServiceWorkerModule } from '@angular/service-worker';
|
|
|
|
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
|
|
|
|
import { TranslateModule, TranslateService, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
|
|
|
|
import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage';
|
|
|
|
import * as dayjs from 'dayjs';
|
|
|
|
import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
|
|
|
|
|
|
|
|
import { SERVER_API_URL } from './app.constants';
|
|
|
|
import { ApplicationConfigService } from 'app/core/config/application-config.service';
|
|
|
|
import './config/dayjs';
|
|
|
|
import { SharedModule } from 'app/shared/shared.module';
|
|
|
|
import { AppRoutingModule } from './app-routing.module';
|
|
|
|
import { HomeModule } from './home/home.module';
|
|
|
|
import { EntityRoutingModule } from './entities/entity-routing.module';
|
2021-07-07 02:19:14 +00:00
|
|
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
|
|
|
|
|
|
import { SocialLoginModule, SocialAuthServiceConfig } from 'angularx-social-login';
|
|
|
|
import { GoogleLoginProvider } from 'angularx-social-login';
|
2021-07-03 21:48:27 +00:00
|
|
|
// jhipster-needle-angular-add-module-import JHipster will add new module here
|
|
|
|
import { NgbDateDayjsAdapter } from './config/datepicker-adapter';
|
|
|
|
import { fontAwesomeIcons } from './config/font-awesome-icons';
|
|
|
|
import { httpInterceptorProviders } from 'app/core/interceptor/index';
|
|
|
|
import { translatePartialLoader, missingTranslationHandler } from './config/translation.config';
|
|
|
|
import { MainComponent } from './layouts/main/main.component';
|
|
|
|
import { NavbarComponent } from './layouts/navbar/navbar.component';
|
|
|
|
import { FooterComponent } from './layouts/footer/footer.component';
|
|
|
|
import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component';
|
|
|
|
import { ErrorComponent } from './layouts/error/error.component';
|
2021-07-04 01:15:33 +00:00
|
|
|
import { SidebarComponent } from './layouts/sidebar/sidebar.component';
|
2021-07-03 21:48:27 +00:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
|
|
|
SharedModule,
|
|
|
|
HomeModule,
|
|
|
|
// jhipster-needle-angular-add-module JHipster will add new module here
|
|
|
|
EntityRoutingModule,
|
|
|
|
AppRoutingModule,
|
2021-07-07 02:19:14 +00:00
|
|
|
SocialLoginModule,
|
2021-07-03 21:48:27 +00:00
|
|
|
// Set this to true to enable service worker (PWA)
|
|
|
|
ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }),
|
|
|
|
HttpClientModule,
|
|
|
|
NgxWebstorageModule.forRoot({ prefix: 'jhi', separator: '-', caseSensitive: true }),
|
|
|
|
TranslateModule.forRoot({
|
|
|
|
loader: {
|
|
|
|
provide: TranslateLoader,
|
|
|
|
useFactory: translatePartialLoader,
|
|
|
|
deps: [HttpClient],
|
|
|
|
},
|
|
|
|
missingTranslationHandler: {
|
|
|
|
provide: MissingTranslationHandler,
|
|
|
|
useFactory: missingTranslationHandler,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
providers: [
|
|
|
|
Title,
|
|
|
|
{ provide: LOCALE_ID, useValue: 'es' },
|
|
|
|
{ provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter },
|
|
|
|
httpInterceptorProviders,
|
2021-07-07 02:19:14 +00:00
|
|
|
{
|
|
|
|
provide: 'SocialAuthServiceConfig',
|
|
|
|
useValue: {
|
|
|
|
autoLogin: false,
|
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
id: GoogleLoginProvider.PROVIDER_ID,
|
|
|
|
provider: new GoogleLoginProvider('178178891217-b517thad8f15d4at2vk2410v7a09dcvt.apps.googleusercontent.com'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
} as SocialAuthServiceConfig,
|
|
|
|
},
|
2021-07-03 21:48:27 +00:00
|
|
|
],
|
2021-07-04 01:33:58 +00:00
|
|
|
declarations: [MainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, FooterComponent, SidebarComponent],
|
2021-07-03 21:48:27 +00:00
|
|
|
bootstrap: [MainComponent],
|
|
|
|
})
|
|
|
|
export class AppModule {
|
|
|
|
constructor(
|
|
|
|
applicationConfigService: ApplicationConfigService,
|
|
|
|
iconLibrary: FaIconLibrary,
|
|
|
|
dpConfig: NgbDatepickerConfig,
|
|
|
|
translateService: TranslateService,
|
|
|
|
sessionStorageService: SessionStorageService
|
|
|
|
) {
|
|
|
|
applicationConfigService.setEndpointPrefix(SERVER_API_URL);
|
|
|
|
registerLocaleData(locale);
|
|
|
|
iconLibrary.addIcons(...fontAwesomeIcons);
|
|
|
|
dpConfig.minDate = { year: dayjs().subtract(100, 'year').year(), month: 1, day: 1 };
|
|
|
|
translateService.setDefaultLang('es');
|
|
|
|
// if user have changed language and navigates away from the application and back to the application then use previously choosed language
|
|
|
|
const langKey = sessionStorageService.retrieve('locale') ?? 'es';
|
|
|
|
translateService.use(langKey);
|
|
|
|
}
|
|
|
|
}
|