This commit is contained in:
Peter Maquiran
2021-07-26 15:19:03 +01:00
parent 3f007be25e
commit 85f6df2f0e
16 changed files with 852 additions and 197 deletions
+172 -168
View File
@@ -1,170 +1,174 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { ChatPage } from './pages/chat/chat.page';
import { MessagesPage } from './pages/chat/messages/messages.page';
const routes = [
{
path: '',
loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule)
},
{
path: '',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'empty-chat',
loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule)
},
{
path: 'empty-container',
loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule)
},
{
path: 'events-to-approve',
loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule)
},
{
path: 'expedients',
loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule)
},
{
path: 'document-detail',
loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule)
},
{
path: 'edit-group',
loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule)
},
{
path: 'pedidos',
loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule)
},
{
path: 'despachos',
loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule)
},
{
path: 'create-process',
loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule)
},
{
path: 'pendentes',
loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule)
},
{
path: 'delegar',
loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule)
},
{
path: 'add-note',
loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule)
},
{
path: 'dar-parecer',
loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule)
},
{
path: 'opts-expediente',
loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule)
},
{
path: 'despachos-pr',
loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule)
},
{
path: 'diplomas',
loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule)
},
{
path: 'expedientes-pr',
loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule)
},
{
path: 'diplomas-assinar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule)
},
{
path: 'opts-expediente-pr',
loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule)
},
{
path: 'despachos-options',
loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule)
},
{
path: 'despachos-pr-options',
loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule)
},
{
path: 'deploma-options',
loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule)
},
{
path: 'pin',
loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule)
},
{
path: 'fingerprint',
loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule)
},
{
path: 'new-event',
loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule)
},
{
path: 'approve-event',
loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule)
},
{
path: 'bad-request',
loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule)
},
{
path: 'success-message',
loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule)
},
{
path: 'forward',
loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule)
},
{
path: 'edit-event-to-approve',
loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule)
},
{
path: 'actions-options',
loadChildren: () => import('./shared/popover/actions-options/actions-options.module').then( m => m.ActionsOptionsPageModule)
},
{
path: 'edit-action',
loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule)
},
{
path: 'eliminate-event',
loadChildren: () => import('./modals/eliminate-event/eliminate-event.module').then( m => m.EliminateEventPageModule)
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { ChatPage } from './pages/chat/chat.page';
import { MessagesPage } from './pages/chat/messages/messages.page';
const routes = [
{
path: '',
loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule)
},
{
path: '',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'empty-chat',
loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule)
},
{
path: 'empty-container',
loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule)
},
{
path: 'events-to-approve',
loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule)
},
{
path: 'expedients',
loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule)
},
{
path: 'document-detail',
loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule)
},
{
path: 'edit-group',
loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule)
},
{
path: 'pedidos',
loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule)
},
{
path: 'despachos',
loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule)
},
{
path: 'create-process',
loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule)
},
{
path: 'pendentes',
loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule)
},
{
path: 'delegar',
loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule)
},
{
path: 'add-note',
loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule)
},
{
path: 'dar-parecer',
loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule)
},
{
path: 'opts-expediente',
loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule)
},
{
path: 'despachos-pr',
loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule)
},
{
path: 'diplomas',
loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule)
},
{
path: 'expedientes-pr',
loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule)
},
{
path: 'diplomas-assinar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule)
},
{
path: 'opts-expediente-pr',
loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule)
},
{
path: 'despachos-options',
loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule)
},
{
path: 'despachos-pr-options',
loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule)
},
{
path: 'deploma-options',
loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule)
},
{
path: 'pin',
loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule)
},
{
path: 'fingerprint',
loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule)
},
{
path: 'new-event',
loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule)
},
{
path: 'approve-event',
loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule)
},
{
path: 'bad-request',
loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule)
},
{
path: 'success-message',
loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule)
},
{
path: 'forward',
loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule)
},
{
path: 'edit-event-to-approve',
loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule)
},
{
path: 'actions-options',
loadChildren: () => import('./shared/popover/actions-options/actions-options.module').then( m => m.ActionsOptionsPageModule)
},
{
path: 'edit-action',
loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule)
},
{
path: 'eliminate-event',
loadChildren: () => import('./modals/eliminate-event/eliminate-event.module').then( m => m.EliminateEventPageModule)
},
{
path: 'inactivity',
loadChildren: () => import('./pages/inactivity/inactivity.module').then( m => m.InactivityPageModule)
},
/*
path: 'chat',
component: ChatPage
} */
];
@NgModule({
imports: [
RouterModule.forRoot(routes,
{ preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
/*
path: 'chat',
component: ChatPage
} */
];
@NgModule({
imports: [
RouterModule.forRoot(routes,
{ preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
+10
View File
@@ -356,6 +356,16 @@ const routes: Routes = [
],
},
{
path: 'inactivity',
children: [
{
path:'',
loadChildren: ()=> import('../pages/inactivity/inactivity.module').then(m => m.InactivityPageModule)
},
],
},
],
canActivate: [AuthGuard]
+6 -3
View File
@@ -376,15 +376,18 @@
<app-event-list
[style.display]="mobileComponent.showEventList ? 'flex' : 'none'"
[profile]="profile"
[showComponent] = "mobileComponent.showEventList"
(approveEventDismiss) = "approveEventDismiss($event)"
(cloneAllmobileComponent)="viewEventDetailDismiss($event)"
>
</app-event-list>
<!-- Edit event to approve -->
<!-- Event to approve details -->
<app-approve-event class="d-flex flex-column"
*ngIf="mobileComponent.showEventToApprove"
[class.transparent]="mobileComponent.transparentEventToApprove"
[style.display]="mobileComponent.transparentEventToApprove ? 'flex' : 'none'"
[showComponent] = "mobileComponent.showEventToApprove"
[componentTransparent] = "mobileComponent.transparentEventToApprove"
[serialNumber] = "eventToaprove.serialNumber"
[InstanceId] = "eventToaprove.InstanceId"
[saveData] = "eventToaprove.saveData"
@@ -396,6 +399,7 @@
>
</app-approve-event>
<!-- Edit event to approve -->
<app-edit-event-to-approve
class="d-flex flex-column height-100"
*ngIf="mobileComponent.showEditEventToApprove"
@@ -403,7 +407,6 @@
[taskParticipantsCc]="taskParticipantsCc"
[saveData] = "eventToaprove.saveData"
[serialNumber] = "eventToaprove.serialNumber"
[saveData] = "eventToaprove.saveData"
(setContact)="setContact($event)"
(clearContact)="clearContact()"
(openAttendeesComponent)="openAttendeesComponent($event)"
+8 -2
View File
@@ -1076,9 +1076,12 @@ export class AgendaPage implements OnInit {
approveEventDismissGoBack() {
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
// this.mobileComponent.showEventList = false;
this.mobileComponent.transparentEventList = true;
this.cloneAllmobileComponent()
alert('show')
this.mobileComponent.showEventToApprove = true;
this.mobileComponent.showEditEventToApprove = false
}
@@ -1206,6 +1209,9 @@ export class AgendaPage implements OnInit {
} else if (this.IsEvent = 'add') {
this.cloneAllmobileComponent();
}
}
async EventToApproveGoBack() {
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { InactivityPage } from './inactivity.page';
const routes: Routes = [
{
path: '',
component: InactivityPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class InactivityPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { InactivityPageRoutingModule } from './inactivity-routing.module';
import { InactivityPage } from './inactivity.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
InactivityPageRoutingModule
],
declarations: [InactivityPage]
})
export class InactivityPageModule {}
@@ -0,0 +1,88 @@
<ion-content class="text-white">
<div class="main-wrapper">
<div class="wrapper" *ngIf="!hasSession && !setPin || loginPreference == 'none' && !setPin ">
<div class="bg-1 d-flex justify-center align-center">
<div class="bg-2 d-flex justify-center align-center">
<div class="bg-3 d-flex justify-center align-center">
<div class="bg-4 d-flex justify-center align-center">
<div class="div-logo">
<img src='assets/images/fullLogo.png' alt='logo'>
</div>
</div>
</div>
</div>
</div>
<h3 class="center text-white">Inicie a sessão</h3>
<form class="form">
<p class="form-label text-white">Email</p>
<ion-item class="form-input">
<ion-input type="text" [(ngModel)]="username" name="input-username"></ion-input>
</ion-item>
<p class="form-label text-white">Palavra-passe</p>
<ion-item class="form-input">
<ion-input (keyup.enter)="Login()" type="password" [(ngModel)]="password" name="input-password" ></ion-input>
</ion-item>
<div class="d-flex pt-25">
<button class="btn-ok btn-login" fill="clear" expand="block" shape="round" (click)="Login()">Iniciar</button>
</div>
</form>
<div class="msg-bottom d-flex">
<p class="msg-bottom-p">Uma iniciativa do Gabinete do Presidente da República</p>
</div>
</div>
<div class="main-content height-100" *ngIf="setPin || hasSession && loginPreference == 'pin' ">
<div class=" align-center justify-center">
<div class="div-top-header">
<div class="div-logo">
<img src='assets/images/logo-bg.png' alt='logo'>
</div>
</div>
<ion-title *ngIf="hasPin" class="title">Digite o PIN</ion-title>
<ion-title *ngIf="!hasPin" class="title">Digite o novo PIN</ion-title>
<div class="d-flex pt-25 align-center justify-center">
<div class="dot" [class.dot-active]="code.length >= 1"></div>
<div class="dot" [class.dot-active]="code.length >= 2"></div>
<div class="dot" [class.dot-active]="code.length >= 3"></div>
<div class="dot"[class.dot-active]="code.length >= 4"></div>
</div>
<div class="terminal">
<div class="d-flex">
<div class="circle" (click)="setCode('1')">1</div> <div class="circle" (click)="setCode('2')">2</div> <div class="circle" (click)="setCode('3')">3</div>
</div>
<div class="d-flex">
<div class="circle" (click)="setCode('4')">4</div> <div class="circle" (click)="setCode('5')">5</div> <div class="circle" (click)="setCode('6')">6</div>
</div>
<div class="d-flex">
<div class="circle" (click)="setCode('7')">7</div> <div class="circle" (click)="setCode('8')">8</div> <div class="circle" (click)="setCode('9')">9</div>
</div>
<div class="d-flex align-center justify-center">
<div class="circle" (click)="setCode('0')">0</div>
</div>
</div>
<div *ngIf="hasPin" class="voltar d-flex align-center justify-center pt-25 clear" (click)="loginPreference = 'none'">
Entrar com senha
</div>
<div id="clear" class="cy-clear voltar d-flex align-center justify-center pt-25 clear" (click)="clearCode()">
Limpar
</div>
</div>
</div>
</div>
</ion-content>
@@ -0,0 +1,219 @@
@import '~src/function.scss';
:host, app-login {
ion-content {
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
}
}
ion-content{
background-color: white !important;
}
.main-wrapper{
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
display: flex;
width: 100vw;
height: 100vh;
overflow: auto;
}
.wrapper{
width: 400px;
height: auto;
padding: 0 !important;
margin: auto !important;
overflow: auto;
}
.logo{
width: 400px;
height: 400px;
background-image: url("/assets/background/auth.svg");
background-position: center;
background-repeat: no-repeat;
}
.bg-1{
width: 250px;
height: 250px;
overflow: auto;
border-radius: 50%;
background: #4cb9f825;
margin: auto;
.bg-2{
width: 225px;
height: 225px;
overflow: auto;
border-radius: 50%;
background: #61bdf2b4;
margin: auto;
.bg-3{
width: 200px;
height: 200px;
overflow: auto;
border-radius: 50%;
background: #96d3f8be;
margin: auto;
.bg-4{
width: 175px;
height: 175px;
overflow: auto;
border-radius: 50%;
background: rgba(255, 255, 255, 0.918);
padding: 15px;
margin: auto;
.bg-4 img{
width: 100%;
}
}
}
}
}
.div-logo{
width: 200px !important;
margin: 0 auto;
padding-bottom: 15px;
}
.div-logo img{
width: 100%;
}
.wrapper ion-input{
font-size: 16px;
}
.wrapper ion-button{
font-size: medium;
margin-top: 16px;
}
ion-item{
--background: transparent;
}
.form{
width: 300px;
margin: auto;
overflow: auto;
}
.form-label{
margin: 15px 0 5px 0;
font-size: 15px;
}
.form-input{
--background: #fff;
--color:#000;
border-radius: 22.5px;
margin: 10px 0 10px 0;
}
.btn-login{
font-size: 16px;
}
.div-top-header{
margin: 0 em(20px);
padding-top: em(15px);
border: 0!important;
}
.div-logo {
background: transparent;
width: em(140px);
justify-content: center;
display: flex;
}
.div-logo img{
width: 100%;
margin: 0px auto;
}
.circle{
color: white;
width: 70px;
height: 70px;
display: flex;
align-items: center;
justify-content: center;
font-size: 19pt;
background: #44b5ea;
border-radius: 56px;
margin-left: 30px;
margin-bottom: 15px;
user-select: none;
}
.title{
padding-top: 32px;
}
.terminal {
padding-top: 112px;
margin-left: -30px;
justify-content: center;
display: flex;
flex-direction: column;
align-items: center;
}
.clear{
color: #44b5ea;
font-size: 12pt;
}
.dot-active{
background: #44b5ea;
}
.dot{
width: 25px;
height: 25px;
margin: 0 10px 0 0;
border: 3px solid #44b5ea;
box-sizing: border-box;
border-radius: 50px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
-ms-border-radius: 50px;
-o-border-radius: 50px;
}
.main-content {
width: 100vw;
height: 100vh;
background-color: white;
text-align: center;
align-items: center;
justify-content: center;
background-image: url("/assets/background/auth.svg");
background-size: 686px 674px;
background-position: center;
background-position-y: 110px;
background-repeat: no-repeat;
margin: auto;
}
.voltar{
user-select: none;
}
.msg-bottom{
width: 100%;
color: #fff;
align-items: center;
justify-content: center;
.msg-bottom-p{
width: 220px;
position: absolute;
bottom: 0 !important;
text-align: center;
}
}
@media only screen and (max-height: 746px){
.msg-bottom-p {
padding-top: 20px;
position: unset !important;
}
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { InactivityPage } from './inactivity.page';
describe('InactivityPage', () => {
let component: InactivityPage;
let fixture: ComponentFixture<InactivityPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ InactivityPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(InactivityPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+194
View File
@@ -0,0 +1,194 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from 'src/app/services/auth.service';
import { UserForm } from 'src/app/models/user.model';
import { ToastService } from 'src/app/services/toast.service';
import { environment } from 'src/environments/environment';
import { AlertController } from '@ionic/angular';
import { NotificationsService } from 'src/app/services/notifications.service';
import crypto from 'crypto-js'
import { LocalstoreService } from 'src/app/store/localstore.service';
@Component({
selector: 'app-inactivity',
templateUrl: './inactivity.page.html',
styleUrls: ['./inactivity.page.scss'],
})
export class InactivityPage implements OnInit {
logstatus: boolean;
username: string = environment.defaultuser;
password: string = environment.defaultuserpwd;
userattempt: UserForm;
code = []
hasPin: boolean
loginPreference: string
hasSession = false
setPin = false
constructor(
private notificatinsservice: NotificationsService,
private router: Router,
private authService: AuthService,
private toastService: ToastService,
public alertController: AlertController,
private localstoreService: LocalstoreService
) {
}
ngOnInit() {
// clear local storage
window.localStorage.clear();
let userData = this.localstoreService.get('UserData', {})
const loginPreference = userData?.loginPreference
const pin = userData?.PIN
}
//Function to validade the login inputs
validateUsername() {
return (
this.username.trim().length > 0
);
}
validatePassword() {
return (
this.password.trim().length > 0
);
}
async presentAlert(message: string) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Mensagem do sistema',
message: message,
buttons: ['OK']
});
await alert.present();
}
/* loginRocketChat() {
let postData = {
"user": this.username,
"password": this.password,
}
this.authService.loginChat(postData).subscribe((res: any) => {
console.log(res.data);
this.storageService.store(AuthConnstants.AUTH, res.data);
console.log('Login to Rocket chat OK');
}, (error: any) => {
console.log('Network error');
this.presentAlert('Network error ' + error);
});
} */
getToken() {
this.notificatinsservice.getAndpostToken(this.username);
}
async Login() {
if (this.validateUsername()) {
if(this.validatePassword()){
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
let attempt = await this.authService.login(this.userattempt)
if (attempt) {
this.authService.loginChat(this.userattempt);
this.getToken();
this.hasSession = true
this.hasPin = false
this.setPin = true
if(!this.hasPin || this.hasPin) {
} else {
this.router.navigate(['/home/events']);
}
}
}
else {
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
}
}
else {
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
}
}
setCode(code: string) {
if(this.code.length < 4) {
this.code.push(code)
}
if(this.code.length == 4) {
const code = this.code.join('')
const encrypted = crypto.SHA1(code)
if(!this.hasPin) {
// alert('storePin')
this.storePin()
} else {
// alert('pinLogin')
this.pinLogin()
}
}
}
clearCode() {
this.code =[]
}
pinLogin() {
const code = this.code.join('')
const encrypted = crypto.SHA1(code)
let userData = this.localstoreService.get('UserData', {})
const pin = userData?.PIN
//if( encrypted == pin) {
if( encrypted == this.localstoreService.get('UserData', false)) {
//this.toastService.successMessage()
this.router.navigate(['/home/events']);
} else {
this.toastService.badRequest('Pin incorreto')
this.code = []
}
}
storePin() {
const code = this.code.join('')
const encrypted = crypto.SHA1(code).toString()
let userData: Object = this.localstoreService.get('UserData', {})
userData['PIN'] = encrypted
userData['loginPreference'] = 'none'
this.localstoreService.set('UserData', userData)
this.localstoreService.set('PIN', encrypted)
this.router.navigate(['/home/events']);
}
}
@@ -130,7 +130,7 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
Validators.required,
//Validators.required,
// Validators.minLength(4)
]),
capturedImage: new FormControl(this.capturedImage, [
@@ -215,6 +215,34 @@ export class NewPublicationPage implements OnInit {
loader.remove()
}
} else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle,
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
console.log('Edit change image');
console.log(this.publication);
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
}
else {
@@ -102,6 +102,6 @@
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Adicionar Nota</button>
<button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
<button hidden class="btn-delete" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Rejeitar</button>
<button class="btn-delete" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Rejeitar</button>
</div>
</ion-footer>
@@ -18,7 +18,7 @@ import { ToastService } from 'src/app/services/toast.service';
export class ApproveEventPage implements OnInit {
event: Event;
loadedEvent:any;
@Input() loadedEvent:any;
loadedAttachments:any;
customDate:any;
today:any;
@@ -28,6 +28,8 @@ export class ApproveEventPage implements OnInit {
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() serialNumber:string;
@Input() showComponent:string;
@Input() componentTransparent: any
@Input() InstanceId:string;
@Input() showAside:boolean;
@@ -58,7 +60,11 @@ export class ApproveEventPage implements OnInit {
ngOnInit() {
this.getTask();
this.getAttachments();
}
ngOnChanges() {
this.getTask();
this.getAttachments();
}
notImplemented() {
@@ -94,6 +100,7 @@ export class ApproveEventPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
} finally {
this.close()
loader.remove()
}
@@ -121,8 +128,9 @@ export class ApproveEventPage implements OnInit {
this.toastService.successMessage('Evento rejeitado')
} catch (error) {
this.toastService.badRequest('Processo não efectuado')
} finally {
} finally {
loader.remove()
this.close()
}
}
@@ -247,14 +247,14 @@ export class EditEventToApprovePage implements OnInit {
// Validators.required
// ]),
participantes: new FormControl(this.taskParticipants, [
Validators.required
// Validators.required
]),
})
}
save() {
async save() {
this.injectValidation()
this.runValidation()
@@ -263,6 +263,8 @@ export class EditEventToApprovePage implements OnInit {
// set dates to eventProcess object
this.getDatepickerData()
this.taskParticipantsCc.forEach( e => {
e.IsRequired = false
})
@@ -300,24 +302,28 @@ export class EditEventToApprovePage implements OnInit {
console.log(event);
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
try {
await this.eventsService.postEventToApproveEdit(event).toPromise()
this.close()
this.toastService.successMessage('Evento editado');
}, error =>{
this.toastService.badRequest('Evento não editado');
})
} catch(e) {
this.toastService.badRequest('Evento não editado');
}
this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add') {
delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
this.toastService.successMessage();
// this.toastService.successMessage();
}, error =>{
this.toastService.badRequest();
});
} else if(document['action'] == 'delete') {
delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
this.toastService.successMessage()
// this.toastService.successMessage()
}, error =>{
this.toastService.badRequest()
})
@@ -325,8 +331,6 @@ export class EditEventToApprovePage implements OnInit {
})
this.modalController.dismiss();
}
// setIntervenient(data){
@@ -27,6 +27,7 @@ export class EventListPage implements OnInit {
segment:string;
@Input() profile:string;
@Input() showComponent:string;
@Output() cloneAllmobileComponent = new EventEmitter<any>();
@Output() approveEventDismiss = new EventEmitter<any>();
@@ -55,6 +56,10 @@ export class EventListPage implements OnInit {
});
}
ngOnChanges() {
this.LoadToApproveEvents();
}
segmentChanged(ev: any) {
this.LoadToApproveEvents();
}
@@ -140,7 +140,7 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
Validators.required,
// Validators.required,
// Validators.minLength(4)
]),
Message: new FormControl(this.pub.Message, [
@@ -158,11 +158,10 @@ export class NewPublicationPage implements OnInit {
if(this.Form.invalid) return false
if(this.publicationType == '3') {
alert('3')
if(this.capturedImage != '') {
alert('2')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -180,7 +179,6 @@ export class NewPublicationPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
@@ -193,7 +191,7 @@ export class NewPublicationPage implements OnInit {
}
else if (!this.publication.OriginalFileName) {
alert('1')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -219,15 +217,42 @@ export class NewPublicationPage implements OnInit {
loader.remove()
}
} else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle,
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
console.log('Edit change image');
console.log(this.publication);
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
}
else {
let time = new Date()
this.publication = {
DateIndex: time,
DocumentId:null,
DocumentId: null,
ProcessId:this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,