diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e1ea848deee0943935cf5040b30a74659eaeff32..1de967bc814ba42dc282d8c41bed7167885f99b0 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router'; import { AboutComponent } from './about/about.component'; import { HomeComponent } from './home/home.component'; +import { RedirectionComponent } from './redirection/redirection.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { TeamComponent } from './team/team.component'; import { PqrComponent } from './simulator/pqr/pqr.component'; @@ -12,7 +13,7 @@ import { ResetPasswordComponent } from './reset-password/reset-password.componen import { ContactComponent } from './contact/contact.component'; const routes: Routes = [ - { path: '', component: HomeComponent, canDeactivate: [HasErrorGuard] }, + { path: '', component: RedirectionComponent, canDeactivate: [HasErrorGuard] }, { path: 'pqr', component: PqrComponent, canDeactivate: [HasErrorGuard] }, { path: 'about', component: AboutComponent }, { path: 'quality', component: QualityComponent }, diff --git a/src/app/app.component.html b/src/app/app.component.html index 17fe042b34a3755c336df6278a5d2a50dc7bc45e..330575847b615acf42c694afc7b9f062914a2f65 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -16,7 +16,7 @@ <img [src]="'assets/images/simcaq_logo_' + (isInverseColor ? 'gray' : 'white') + '.svg'" alt="Logo SimCAQ"> </a> </div> - <div #navbarContent id="mainNavBar" class="collapse navbar-collapse" [collapse]="navBarIsCollapsed"> + <!-- <div #navbarContent id="mainNavBar" class="collapse navbar-collapse" [collapse]="navBarIsCollapsed"> <p class="navbar-text slogan" [class.inverse]="isInverseColor"> <em>Por uma educação pública gratuita e de qualidade para todos/as</em> </p> @@ -61,7 +61,7 @@ <app-profile [isInverseColor]="isInverseColor"></app-profile> </div> </ul> - </div> + </div> --> </div> </nav> <nav class="navbar visible-print-inline"> @@ -77,7 +77,7 @@ <router-outlet></router-outlet> </div> <div *ngIf="showFooter" class="container-fluid hidden-print"> - <div class="sup-footer"> + <!-- <div class="sup-footer"> <div class="row"> <div class="col-md-6 col-lg-3"> <ul class="list-sub-footer"> @@ -131,7 +131,7 @@ </ul> </div> </div> - </div> + </div> --> <div class="footer"> <div class="title">Realização:</div> <a href="http://www.ufpr.br" target="_blank" title="Universidade Federal do Paraná - UFPR"> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 867b37d5bb57a1b7438aa43310ea5c0707ee5865..bd21003653f06cd2e08bead779af1c635786230c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -76,9 +76,9 @@ export class AppComponent extends BaseUnsubscribe implements OnInit { this.showFooter = true; // Close the navbar menu (mobile screen). - if (this.navbarContent.nativeElement.classList.contains('show')) { - this.navbarMenuToggle.nativeElement.click(); - } + // if (this.navbarContent.nativeElement.classList.contains('show')) { + // this.navbarMenuToggle.nativeElement.click(); + // } }); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8dcc64ed96cc08a941318f527f2b079056e9c3e7..708a22e37b43ef4a7e4e9d0c85e27980b0651784 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,6 +13,7 @@ import { AppHttpInterceptor } from './shared/services/http/interceptors/app-http import { AppErrorHandler } from './shared/services/error-handler/app-error-handler.service'; import { AppComponent } from './app.component'; import { HomeComponent } from './home/home.component'; +import { RedirectionComponent } from './redirection/redirection.component'; import { AppRoutingModule } from './app-routing.module'; import { LoginComponent } from './login/login.component'; import { NotFoundComponent } from './not-found/not-found.component'; @@ -22,6 +23,7 @@ import { AboutComponent } from './about/about.component'; import { QualityComponent } from './quality/quality.component'; import { ResetPasswordComponent } from './reset-password/reset-password.component'; import { ContactComponent } from './contact/contact.component'; +import { WarningModalComponent } from './shared/components/modal/warning/warningModal.component'; registerLocaleData(localePt, 'pt'); @@ -39,6 +41,7 @@ registerLocaleData(localePt, 'pt'); declarations: [ AppComponent, HomeComponent, + RedirectionComponent, LoginComponent, NotFoundComponent, TeamComponent, @@ -46,7 +49,8 @@ registerLocaleData(localePt, 'pt'); AboutComponent, QualityComponent, ResetPasswordComponent, - ContactComponent + ContactComponent, + WarningModalComponent ], entryComponents: [ LoginComponent, diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index bee1608f39aec82d5fc4b0f362d89a1fb4fc4d29..c9b36aa639ce1abe9249d83c1baa9fed77933b13 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -10,12 +10,6 @@ $blue-color-hover: #43657a; background: url(assets/images/home_bg_curve.svg) no-repeat top right; background-size: cover; - .warningModal { - background-color: #ffffff; - margin-top: 100px; - - } - .phrases { color: $navbar-color; margin-top: 55px; diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 9e851e09f1954763bbdeb85aae0652000494b52f..25de93bf8d86e5c496832ca8f9be06248b2665c5 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -25,12 +25,12 @@ export class HomeComponent extends BaseUnsubscribe implements OnInit { bsModalRef: BsModalRef; - constructor(private simulatorService: SimulatorService, private authService: AuthService,private bsModalService: BsModalService) { + constructor(private simulatorService: SimulatorService, private authService: AuthService, private bsModalService: BsModalService) { super(); - this.bsModalRef = this.bsModalService.show(WarningModalComponent); - this.bsModalRef.content.title = 'Ops!'; - this.bsModalRef.content.body = 'Página não encontrada!'; + // this.bsModalRef = this.bsModalService.show(WarningModalComponent); + // this.bsModalRef.content.title = 'O SIMCAQ não está mais sendo desenvolvido no C3SL/UFPR!'; + // this.bsModalRef.content.body = 'Ele está no seguinte endereço: <a href="https://simcaq.ufg.br">https://simcaq.ufg.br</a> '; } ngOnInit(): void { diff --git a/src/app/redirection/redirection.component.html b/src/app/redirection/redirection.component.html new file mode 100644 index 0000000000000000000000000000000000000000..24c20545c74a5c0a00a641a4d7dde5259c3199f4 --- /dev/null +++ b/src/app/redirection/redirection.component.html @@ -0,0 +1,26 @@ +<meta http-equiv = "refresh" content = "10; url = https://simcaq.ufg.br" /> + +<div class="container"> + <div class="row"> + <div class="col-lg-12"> + <div class="redirection-container"> + <div class="redirection"> + <div class="redirection-title"> + <h1>O SIMCAQ não está mais sendo desenvolvido no C3SL/UFPR. </h1> + </div> + <div class="redirection-text"> + Ele está no seguinte endereço: <a href="https://simcaq.ufg.br">https://simcaq.ufg.br</a> + </div> + <div class="redirection-text"> + Você será redirecionado em {{this.counter}} segundos... + </div> + <div class="redirection-text"> + <p>Se você não for redirecionado automaticamente, clique no botão abaixo.</p> + </div> + <div class="redirection-button"> + <a href="https://simcaq.ufg.br" class="button">Ir direto para o link</a> + </div> + </div> + </div> + </div> + </div> \ No newline at end of file diff --git a/src/app/redirection/redirection.component.scss b/src/app/redirection/redirection.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..a153cfb9076407395058c940fac5133b3b25a535 --- /dev/null +++ b/src/app/redirection/redirection.component.scss @@ -0,0 +1,25 @@ +.container { + margin-top: 20vh; + margin-bottom: 18%; + padding-left: 0; + padding-right: 0; + display: flex; + + .redirection-text { + font-size: 20px; + padding-top: 20px; + } + + .redirection-button { + padding-top: 20px; + + .button { + border: 1px solid #49697d; + background-color: #49697d; + border-radius: 4px; + color: #fff; + padding: 10px 20px; + font-size: 15px; + } + } +} \ No newline at end of file diff --git a/src/app/redirection/redirection.component.spec.ts b/src/app/redirection/redirection.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..55a6bf6a2cb02805372f906bb435987ecd40fa4e --- /dev/null +++ b/src/app/redirection/redirection.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RedirectionComponent } from './redirection.component'; + +describe('RedirectionComponent', () => { + let component: RedirectionComponent; + let fixture: ComponentFixture<RedirectionComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RedirectionComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RedirectionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/redirection/redirection.component.ts b/src/app/redirection/redirection.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf9bb41608cee65786cbfc2c370067b82e79d8e6 --- /dev/null +++ b/src/app/redirection/redirection.component.ts @@ -0,0 +1,69 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { takeUntil, map } from 'rxjs/operators'; +import { Observable, timer } from 'rxjs'; +import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; + +import { SimulationType } from '../simulator/simulator/entities/enums/simulation-type.enum'; +import { SimulatorService } from '../simulator/simulator/services/simulator.service'; +import { AuthService } from '../shared/services/auth/auth.service'; +import { BaseUnsubscribe } from '../shared/entities/base/base-unsubscribe'; +import { WarningModalComponent } from 'app/shared/components/modal/warning/warningModal.component'; + +@Component({ + selector: 'app-redirection', + templateUrl: './redirection.component.html', + styleUrls: ['./redirection.component.scss'] +}) +export class RedirectionComponent extends BaseUnsubscribe implements OnInit { + + financingSimulationIsEnable: boolean = false; + + readonly caq: SimulationType = SimulationType.caq; + readonly planning: SimulationType = SimulationType.planning; + readonly financing: SimulationType = SimulationType.financing; + + bsModalRef: BsModalRef; + + counter = 10; + + constructor(private simulatorService: SimulatorService, private authService: AuthService, private bsModalService: BsModalService, private router: Router) { + super(); + } + + ngOnInit(): void { + + setInterval( () => this.numDecrement(this.counter), 1000); + + this.verifyFinancingSimulationIsEnable(); + + this.authService.userLoggedObserver.pipe( + takeUntil(this.unsubscribe)) + .subscribe(userIsLoggedIn => { + if (userIsLoggedIn) { + this.verifyFinancingSimulationIsEnable(); + } else { + this.financingSimulationIsEnable = false; + } + }); + + } + + numDecrement(numRecieved : number) { + while(numRecieved > 0) { + this.counter = numRecieved - 1; + return numRecieved; + } + } + + startSimulation(simulationType: SimulationType): void { + this.simulatorService.startSimulation(simulationType); + } + + private verifyFinancingSimulationIsEnable(): void { + this.authService.userIsAdmin().pipe( + takeUntil(this.unsubscribe)) + .subscribe(userIsAdmin => this.financingSimulationIsEnable = userIsAdmin); + } + +} diff --git a/src/app/shared/components/modal/warning/warningModal.component.scss b/src/app/shared/components/modal/warning/warningModal.component.scss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b1b2b3104c7d9a55ab7c8eecab722013fded27fa 100644 --- a/src/app/shared/components/modal/warning/warningModal.component.scss +++ b/src/app/shared/components/modal/warning/warningModal.component.scss @@ -0,0 +1,4 @@ +.modal-content { + width: 100vh; + height: 50vh; +} \ No newline at end of file