Skip to content
Snippets Groups Projects
app.module.ts 7.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • Alex ORLUC's avatar
    Alex ORLUC committed
    import { BrowserModule } from '@angular/platform-browser';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { FormsModule, ReactiveFormsModule } from '@angular/forms';
    
    import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { RouterModule } from '@angular/router';
    import { NgModule } from '@angular/core';
    import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
    
    import { AuthGuard } from './service/auth.guard';
    import { AuthInterceptor } from './service/auth-interceptor.service';
    
    
    // import ngx-translate and the http loader
    import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
    import { TranslateHttpLoader } from '@ngx-translate/http-loader';
    
    export class CustomHammerConfig extends HammerGestureConfig {
    
        'pinch': { enable: false },
        'rotate': { enable: false }
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { ScrollEventModule } from 'ngx-scroll-event';
    import { AngularDraggableModule } from 'angular2-draggable';
    
    import { CookieService } from 'ngx-cookie-service';
    
    import { NgPipesModule } from 'ngx-pipes';
    
    import { LatinisePipe } from 'ngx-pipes';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { AppMaterialModule } from './app-material.module';
    
    // COMPONENTS
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { AppComponent } from './app.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { LoginComponent } from './login/login.component';
    
    import { ForgotPasswordComponent } from './login/forgotPassword/forgotPassword.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { SignaturesComponent } from './signatures/signatures.component';
    import { SignaturePadPageComponent } from './pad/pad.component';
    import { SignaturePadModule } from 'angular2-signaturepad';
    import { DrawerComponent } from './drawer/drawer.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { DocumentComponent } from './document/document.component';
    import { DocumentSignListComponent } from './documentSignList/document-sign-list.component';
    import { DocumentNoteListComponent } from './documentNoteList/document-note-list.component';
    import { DocumentNotePadComponent } from './documentNotePad/document-note-pad.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { SidebarComponent } from './sidebar/sidebar.component';
    
    import { ProfileComponent } from './profile/profile.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { ConfirmModalComponent } from './modal/confirm-modal.component';
    import { WarnModalComponent } from './modal/warn-modal.component';
    import { SuccessInfoValidBottomSheetComponent } from './modal/success-info-valid.component';
    import { RejectInfoBottomSheetComponent } from './modal/reject-info.component';
    
    import { OverlayComponent } from './overlay/overlay.component';
    
    import { VisaWorkflowComponent } from './document/visa-workflow/visa-workflow.component';
    
    import { DocumentListComponent } from './document/document-list/document-list.component';
    
    import { MainDocumentDetailComponent } from './document/main-document-detail/main-document-detail.component';
    
    import { UpdatePasswordComponent } from './login/updatePassword/updatePassword.component';
    
    
    // ADMINISTRATION
    
    import { AdminSidebarComponent } from './sidebar/administration/admin-sidebar.component';
    
    
    import { AdministrationComponent } from './administration/administration.component';
    
    import { UsersListComponent } from './administration/user/users-list.component';
    
    import { UserComponent } from './administration/user/user.component';
    
    import { LdapListComponent } from './administration/ldap/ldap-list.component';
    import { LdapComponent } from './administration/ldap/ldap.component';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    
    // SERVICES
    
    import { NotificationService, CustomSnackbarComponent } from './service/notification.service';
    
    Alex ORLUC's avatar
    Alex ORLUC committed
    import { SignaturesContentService } from './service/signatures.service';
    
    import { FiltersService } from './service/filters.service';
    
    
    // OTHERS
    import { ConfirmComponent } from './plugins/confirm.component';
    
    import { AlertComponent } from './plugins/alert.component';
    
    Florian Azizian's avatar
    Florian Azizian committed
    
    
    
    @NgModule({
    
    Alex ORLUC's avatar
    Alex ORLUC committed
      declarations: [
        AppComponent,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        LoginComponent,
    
        ForgotPasswordComponent,
    
        UpdatePasswordComponent,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        SignaturesComponent,
        SignaturePadPageComponent,
        DrawerComponent,
        DocumentComponent,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        DocumentSignListComponent,
        DocumentNoteListComponent,
        DocumentNotePadComponent,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        SidebarComponent,
        WarnModalComponent,
        ConfirmModalComponent,
        SuccessInfoValidBottomSheetComponent,
        RejectInfoBottomSheetComponent,
    
        ProfileComponent,
    
        OverlayComponent,
    
        MainDocumentDetailComponent,
    
        AdministrationComponent,
        UsersListComponent,
    
        ConfirmComponent,
    
        AdminSidebarComponent,
        LdapListComponent,
        LdapComponent
    
    Alex ORLUC's avatar
    Alex ORLUC committed
      ],
      imports: [
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        FormsModule,
        ReactiveFormsModule,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        BrowserModule,
        BrowserAnimationsModule,
        HttpClientModule,
        RouterModule,
    
        HttpClientModule,
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: HttpLoaderFactory,
            deps: [HttpClient]
          }
        }),
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        SignaturePadModule,
        ScrollEventModule,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        AngularDraggableModule,
        AppMaterialModule,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        RouterModule.forRoot([
    
          { path: 'administration', canActivate: [AuthGuard], component: AdministrationComponent },
          { path: 'administration/users', canActivate: [AuthGuard], component: UsersListComponent },
          { path: 'administration/users/new', canActivate: [AuthGuard], component: UserComponent },
          { path: 'administration/users/:id', canActivate: [AuthGuard], component: UserComponent },
    
          { path: 'administration/ldaps', canActivate: [AuthGuard], component: LdapListComponent },
          { path: 'administration/ldaps/:id', canActivate: [AuthGuard], component: LdapListComponent },
    
          { path: 'documents/:id', canActivate: [AuthGuard], component: DocumentComponent },
    
          { path: 'documents', canActivate: [AuthGuard], component: DocumentComponent },
    
          { path: 'login', component: LoginComponent },
    
    Damien's avatar
    Damien committed
          { path: 'forgot-password', component: ForgotPasswordComponent },
          { path: 'update-password', component: UpdatePasswordComponent },
    
          { path: '**', redirectTo: 'login', pathMatch: 'full' },
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        ], { useHash: true }),
    
    Alex ORLUC's avatar
    Alex ORLUC committed
      ],
      entryComponents: [
    
        CustomSnackbarComponent,
    
    Alex ORLUC's avatar
    Alex ORLUC committed
        WarnModalComponent,
        ConfirmModalComponent,
        SuccessInfoValidBottomSheetComponent,
        RejectInfoBottomSheetComponent,
    
        SignaturesComponent,
    
        ConfirmComponent,
        AlertComponent
    
    Alex ORLUC's avatar
    Alex ORLUC committed
      ],
    
      providers: [
        { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
        SignaturesContentService,
    
        NotificationService,
    
          provide: HAMMER_GESTURE_CONFIG,
          useClass: CustomHammerConfig
    
        CookieService,
        LatinisePipe],
    
    Alex ORLUC's avatar
    Alex ORLUC committed
      bootstrap: [AppComponent]
    
    Florian Azizian's avatar
    Florian Azizian committed
    })
    export class AppModule { }
    
    
    // For traductions
    export function HttpLoaderFactory(http: HttpClient) {
    
      return new TranslateBackendHttpLoader(http);
    }
    
    export class TranslateBackendHttpLoader implements TranslateLoader {
    
      constructor(private http: HttpClient) { }
    
      /**
       * Gets the translations from the server
       * @param lang
       * @returns {any}
       */
      public getTranslation(lang: string): any {
    
    
        return this.http.get(`../rest/languages/` + lang);