mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Revisão: Autenticação, Page Events, Page Expediente.
This commit is contained in:
+6
-3
@@ -128,7 +128,9 @@
|
||||
"tsconfig.spec.json",
|
||||
"e2e/tsconfig.json"
|
||||
],
|
||||
"exclude": ["**/node_modules/**"]
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
"e2e": {
|
||||
@@ -174,7 +176,8 @@
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"defaultCollection": "@ionic/angular-toolkit"
|
||||
"defaultCollection": "@ionic/angular-toolkit",
|
||||
"analytics": false
|
||||
},
|
||||
"schematics": {
|
||||
"@ionic/angular-toolkit:component": {
|
||||
@@ -184,4 +187,4 @@
|
||||
"styleext": "scss"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ const routes: Routes = [
|
||||
loadChildren: ()=> import('../pages/gabinete-digital/expediente/expediente.module').then(m => m.ExpedientePageModule)
|
||||
},
|
||||
{
|
||||
path:':expediente-detailId',
|
||||
path:':SerialNumber',
|
||||
loadChildren: ()=> import('../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.module').then(m => m.ExpedienteDetailPageModule)
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface DailyWorkTask{
|
||||
|
||||
SerialNumber: string;
|
||||
Folio: string;
|
||||
Senders: string;
|
||||
CreateDate: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface User {
|
||||
username: string,
|
||||
password: string,
|
||||
domainName: string,
|
||||
BasicAuthKey: string
|
||||
}
|
||||
@@ -7,43 +7,44 @@
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content *ngIf="eventItem | async as event" padding>
|
||||
<ion-content padding>
|
||||
<ion-item-group>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Assunto</ion-label>
|
||||
<ion-input value='{{event.Subject}}'></ion-input>
|
||||
<!-- <ion-input value='{{event.Subject}}'></ion-input> -->
|
||||
<ion-input [(ngModel)]="loadedEvent.Subject"></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Descrição</ion-label>
|
||||
<ion-input value='{{event.Body.Text}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.Body.Text'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Localização</ion-label>
|
||||
<ion-input value='{{event.Location}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.Location'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Intervenientes</ion-label>
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let inter of event.RequiredAttendees">
|
||||
<ion-input value='{{inter.Name}}'></ion-input>
|
||||
<ion-item *ngFor="let inter of loadedEvent.RequiredAttendees">
|
||||
<ion-input [(ngModel)]='inter.Name'></ion-input>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Carácter</ion-label>
|
||||
<ion-input value='{{event.CalendarName}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.CalendarName'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Tipo do evento</ion-label>
|
||||
<ion-input value='{{event.EventType}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.EventType'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Data Início: </ion-label>
|
||||
<ion-input value='{{event.StartDate}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.StartDate'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Data Fim</ion-label>
|
||||
<ion-input value='{{event.EndDate}}'></ion-input>
|
||||
<ion-input [(ngModel)]='loadedEvent.EndDate'></ion-input>
|
||||
</ion-item>
|
||||
<ion-list>
|
||||
<ion-list-header>Anexos</ion-list-header>
|
||||
@@ -54,8 +55,8 @@
|
||||
</ion-list>
|
||||
</ion-item-group>
|
||||
<div class="event-detail-buttons">
|
||||
<ion-button fill="outline" class="ion-button-left">Recusar</ion-button>
|
||||
<ion-button class="ion-button-right">Aprovar</ion-button>
|
||||
<!-- <ion-button fill="outline" class="ion-button-left">Recusar</ion-button> -->
|
||||
<ion-button class="ion-button-right" (click)="Save()">Gravar</ion-button>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
|
||||
@@ -28,7 +28,20 @@ export class EventDetailPage implements OnInit {
|
||||
/* Load my event detail */
|
||||
/* this.loadedEvent = this.eventsService.getEvent(eventId); */
|
||||
this.eventItem = this.eventsService.getEvent(eventId);
|
||||
|
||||
this.eventsService.getEvent(eventId).subscribe(response =>
|
||||
{
|
||||
this.loadedEvent = response;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Save()
|
||||
{
|
||||
this.eventsService.PutEvent(this.loadedEvent).subscribe(response =>
|
||||
{
|
||||
this.loadedEvent = response;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -11,19 +11,19 @@
|
||||
<ion-item-group>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Assunto</ion-label>
|
||||
<ion-input value='Reunião de Conselho de Ministros'></ion-input>
|
||||
<ion-input >{{task.Folio }}</ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Remetentes</ion-label>
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-input value='MINEC'></ion-input>
|
||||
<ion-input>{{ task.Senders }}</ion-input>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Data</ion-label>
|
||||
<ion-input value=''></ion-input>
|
||||
<ion-input value=''>{{ task.CreateDate }}</ion-input>
|
||||
</ion-item>
|
||||
<ion-list>
|
||||
<ion-list-header>Documentos a Anexar</ion-list-header>
|
||||
|
||||
+21
-1
@@ -1,4 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
import { DailyWorkTask } from '../../../../models/dailyworktask.model';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
@@ -7,9 +11,25 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private activateRoute: ActivatedRoute,private processes:ProcessesService) { }
|
||||
|
||||
task:DailyWorkTask;
|
||||
|
||||
serialnumber:string;
|
||||
|
||||
ngOnInit() {
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')){
|
||||
return;
|
||||
}
|
||||
this.serialnumber = paramMap.get('SerialNumber');
|
||||
this.LoadTaskDetail(this.serialnumber);
|
||||
});
|
||||
}
|
||||
|
||||
LoadTaskDetail(serial:string)
|
||||
{
|
||||
this.task = this.processes.GetTaskDetail(serial);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,13 +22,15 @@
|
||||
<ion-list *ngSwitchCase="'expediente'">
|
||||
<ion-item-group>
|
||||
<ion-item-sliding>
|
||||
<ion-item lines="none">
|
||||
<ion-item lines="none"
|
||||
*ngFor = "let task of taskslist">
|
||||
<div class="div-content-expediente">
|
||||
<ion-item lines="none" [routerLink]="['/home/gabinete-digital/1/1']">
|
||||
<ion-icon slot="end" name="document-outline"></ion-icon>
|
||||
<h3>Reunião de Conselho de Ministros</h3>
|
||||
<ion-item lines="none" [routerLink]="['/home/gabinete-digital/1',task.SerialNumber]">
|
||||
<ion-icon slot="end" name="document-outline">
|
||||
</ion-icon>
|
||||
<h3>{{ task.Folio }}</h3>
|
||||
</ion-item>
|
||||
<p><span class="span-left">MINEC, MINFIN</span><span class="span-right">13 JAN</span></p>
|
||||
<p><span class="span-left">{{ task.Senders }}</span><span class="span-right">{{ task.CreateDate }}</span></p>
|
||||
</div>
|
||||
</ion-item>
|
||||
</ion-item-sliding>
|
||||
|
||||
@@ -4,6 +4,9 @@ import { ModalController } from '@ionic/angular';
|
||||
import { ExpedienteModalPage } from '../expediente-modal/expediente-modal.page';
|
||||
import { CalendarComponent } from 'ionic2-calendar';
|
||||
|
||||
import { DailyWorkTask } from '../../../models/dailyworktask.model';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
templateUrl: './expediente.page.html',
|
||||
@@ -15,12 +18,16 @@ export class ExpedientePage implements OnInit {
|
||||
|
||||
@ViewChild(CalendarComponent) myCal: CalendarComponent;
|
||||
|
||||
constructor(private router: Router,private modalCtrl: ModalController ) { }
|
||||
taskslist:DailyWorkTask[];
|
||||
|
||||
constructor(private router: Router,private modalCtrl: ModalController, private processes:ProcessesService ) { }
|
||||
|
||||
ngOnInit() {
|
||||
//Inicializar segment
|
||||
this.segment = "expediente";
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
async openExpedienteModal(){
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: ExpedienteModalPage,
|
||||
@@ -58,5 +65,10 @@ export class ExpedientePage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
LoadList()
|
||||
{
|
||||
this.taskslist = this.processes.GetDailyWorkTasks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,15 +7,16 @@ const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: GabineteDigitalPage
|
||||
},
|
||||
{
|
||||
path: 'expediente',
|
||||
loadChildren: () => import('./expediente/expediente.module').then( m => m.ExpedientePageModule)
|
||||
},
|
||||
{
|
||||
path: 'expediente-modal',
|
||||
loadChildren: () => import('../../Pages/gabinete-digital/expediente-modal/expediente-modal.module').then( m => m.ExpedienteModalPageModule)
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'expediente',
|
||||
loadChildren: () => import('./expediente/expediente.module').then( m => m.ExpedientePageModule)
|
||||
},
|
||||
{
|
||||
path: 'expediente-modal',
|
||||
loadChildren: () => import('../../pages/gabinete-digital/expediente-modal/expediente-modal.module').then( m => m.ExpedienteModalPageModule)
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Gbinete Digital</ion-title>
|
||||
<ion-title>Gabinete Digital</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
<ion-card-content>
|
||||
<ion-item [routerLink]="['/home/gabinete-digital/1']">
|
||||
<ion-label>Correspondência</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{ count_exp_dailywork }}</ion-button>
|
||||
</ion-item>
|
||||
<ion-item [routerLink]="['/home/gabinete-digital/1']" class="ion-activated">
|
||||
<ion-label>Pedidos de parecer</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{count_exp_pp}}</ion-button>
|
||||
</ion-item>
|
||||
<ion-item [routerLink]="['/home/gabinete-digital/1']">
|
||||
<ion-label>Pedidos de deferimento</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{count_exp_pd}}</ion-button>
|
||||
</ion-item>
|
||||
</ion-card-content>
|
||||
</ion-card-header>
|
||||
@@ -30,11 +30,11 @@
|
||||
<ion-card-content>
|
||||
<ion-item (click)="load()" class="ion-item-change-color">
|
||||
<ion-label>Assinados pelo PR</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{count_dip_apr}}</ion-button>
|
||||
</ion-item>
|
||||
<ion-item primary (click)="load()" class="ion-activated">
|
||||
<ion-label>Por validar (MDGPR)</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{count_dip_pv}}</ion-button>
|
||||
</ion-item>
|
||||
</ion-card-content>
|
||||
</ion-card-header>
|
||||
@@ -45,7 +45,7 @@
|
||||
<ion-card-content>
|
||||
<ion-item (click)="load()" class="ion-item-change-color">
|
||||
<ion-label>Presidente da República</ion-label>
|
||||
<ion-button slot="end">1</ion-button>
|
||||
<ion-button slot="end">{{count_de_pr}}</ion-button>
|
||||
</ion-item>
|
||||
</ion-card-content>
|
||||
</ion-card-header>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gabinete-digital',
|
||||
@@ -9,13 +10,30 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
segment:string;
|
||||
|
||||
constructor() { }
|
||||
constructor(private processesbackend:ProcessesService) { }
|
||||
|
||||
count_exp_dailywork : number;
|
||||
count_exp_pp : string;
|
||||
count_exp_pd : string;
|
||||
count_dip_apr : string;
|
||||
count_dip_pv : string;
|
||||
count_de_pr : string;
|
||||
|
||||
ngOnInit() {
|
||||
this.LoadCounts();
|
||||
}
|
||||
|
||||
load(){
|
||||
|
||||
}
|
||||
|
||||
LoadCounts() {
|
||||
this.count_exp_dailywork = this.processesbackend.GetDailyWorkCount();
|
||||
this.count_exp_pp = "-";
|
||||
this.count_exp_pd = "-";
|
||||
this.count_dip_apr = "-";
|
||||
this.count_dip_pv = "-";
|
||||
this.count_de_pr = "-";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,23 +3,18 @@
|
||||
<div class="div-logo">
|
||||
<img src='assets/images/fullLogo.png' alt='logo'>
|
||||
</div>
|
||||
<h2 class="center">Iniciar a sessão</h2>
|
||||
<h2 class="center">Inicie a sessão</h2>
|
||||
<form>
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Username ou email</ion-label>
|
||||
<ion-input type="text" name="username" [(ngModel)]="postData.username"></ion-input>
|
||||
<ion-label position="stacked">Nome de utilizador</ion-label>
|
||||
<ion-input type="text" [(ngModel)]="username" name="input-username"></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Palavra-passe</ion-label>
|
||||
<ion-input type="password" name="password" [(ngModel)]="postData.password"></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Domínio</ion-label>
|
||||
<ion-input type="text" name="domainName" [(ngModel)]="postData.domainName"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-button expand="block" shape="round" color="primary" (click)="simpleLogin()">Entrar</ion-button>
|
||||
<ion-input type="password" [(ngModel)]="password" name="input-password" ></ion-input>
|
||||
</ion-item>
|
||||
<ion-button expand="block" shape="round" color="primary" (click)="Login()">Iniciar</ion-button>
|
||||
</ion-list>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
import { ToastController } from '@ionic/angular';
|
||||
import { User } from 'src/app/models/user.model';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -13,93 +12,43 @@ import { ToastController } from '@ionic/angular';
|
||||
export class LoginPage implements OnInit {
|
||||
|
||||
logstatus: boolean;
|
||||
|
||||
/* Declare variables */
|
||||
public postData = {
|
||||
username: '',
|
||||
password: '',
|
||||
domainName: ''
|
||||
}
|
||||
username: string = "";
|
||||
password: string = "";
|
||||
userattempt: User;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private storageService: StorageService,
|
||||
toastController: ToastController
|
||||
) { }
|
||||
private authService: AuthService) { }
|
||||
|
||||
ngOnInit() {
|
||||
/* console.log(this.authService.validateLogin()); */
|
||||
/* this.authService.login(this.postData); */
|
||||
|
||||
}
|
||||
/* Function to validade the login inputs */
|
||||
validateInput(){
|
||||
let username = this.postData.username.trim();
|
||||
let password = this.postData.password.trim();
|
||||
let domainName = this.postData.domainName.trim();
|
||||
this.userattempt = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
domainName: "",
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
|
||||
return (
|
||||
this.postData.username &&
|
||||
this.postData.password &&
|
||||
username.length > 0
|
||||
&& password.length > 0
|
||||
this.username.trim().length > 0
|
||||
&& this.password.trim().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
loginRequest(){
|
||||
/* axios.get('https://gpr-dev-08.gabinetedigital.local/api/v2.0/me/calendarview?startDateTime=2014-10-01T01:00:00&endDateTime=2020-10-31T23:00:00')
|
||||
.then(response => {
|
||||
console.log(response.data.url);
|
||||
console.log(response.data.explanation);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
}); */
|
||||
|
||||
}
|
||||
|
||||
loginAction(){/*
|
||||
if(this.validateInput()){
|
||||
//Try to login
|
||||
this.authService.login(this.postData).subscribe((res: any)=> {
|
||||
//userData must be in the API results as paratemers otherwise change to the param that is in the API
|
||||
if(res.userData){
|
||||
//Then we store this information at the staorage service
|
||||
this.storageService.store(AuthConnstants.AUTH, res.userData);
|
||||
//Then go to home view
|
||||
this.router.navigate(['home']);
|
||||
}
|
||||
else{
|
||||
console.log("Os dados inseridos são inválidos");
|
||||
}
|
||||
},
|
||||
///Write a connection error
|
||||
(error: any)=>{
|
||||
console.log("Erro de conexão com a API.");
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
//Display an error message
|
||||
console.log("Preencha todos campos");
|
||||
}*/
|
||||
}
|
||||
|
||||
async simpleLogin(){
|
||||
async Login(){
|
||||
//Go to our home in home/feed.
|
||||
|
||||
if(this.validateInput()){
|
||||
this.router.navigate(['/home/events']);
|
||||
|
||||
/* if (await this.authService.login(this.postData))
|
||||
if (await this.authService.login(this.userattempt))
|
||||
{
|
||||
this.router.navigate(['/home/feed']);
|
||||
console.log(this.postData);
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Não foi possível fazer login");
|
||||
} */
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log("Preencha todos campos");
|
||||
|
||||
@@ -2,10 +2,10 @@ import { Injectable } from '@angular/core';
|
||||
import { StorageService } from './storage.service';
|
||||
import { HttpService } from './http.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AuthConnstants } from '../config/auth-constants';
|
||||
import axios from "axios";
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { User } from '../models/user.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -15,70 +15,38 @@ export class AuthService {
|
||||
|
||||
|
||||
constructor(
|
||||
private httpService: HttpService,
|
||||
private storageService: StorageService,
|
||||
private router: Router,
|
||||
private http: HttpClient
|
||||
) { }
|
||||
|
||||
async login(postData: any): Promise<any> {
|
||||
public ValidatedUser:User;
|
||||
|
||||
var session_url = 'https://gpr-dev-08.gabinetedigital.local/api/v2.0/me';
|
||||
var credentials = btoa(postData.domainName + '\\' + postData.username + ':' + postData.password); //conversão em base64 das credenciais inseridas
|
||||
var statusresult = -1;
|
||||
async login(user: User): Promise<boolean> {
|
||||
user.domainName = environment.domain;
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.domainName + '\\' + user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||
|
||||
//configuração dos headers para autênticação básica, passando as credenciais convertidas em base64
|
||||
var config = {
|
||||
headers: {
|
||||
'Authorization': 'Basic ' + credentials,
|
||||
},
|
||||
};
|
||||
|
||||
await axios.get(session_url, config)
|
||||
.then(function (response) {
|
||||
statusresult = response.status;
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error.response) {
|
||||
statusresult = error.response.status;
|
||||
}
|
||||
});
|
||||
|
||||
if (statusresult == 200)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (statusresult == 401)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
||||
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
||||
|
||||
let result: boolean | PromiseLike<boolean>;
|
||||
|
||||
try {
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
this.ValidatedUser = user;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* logout(){
|
||||
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||
this.router.navigate([''])
|
||||
})
|
||||
|
||||
} */
|
||||
validateLogin(){
|
||||
const options = { headers: {'Authorization': 'Basic cGF1bG8ucGludG86dGFidGVzdGVAMDA2'}};
|
||||
const url = 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/api/calendar/ValidateAuth';
|
||||
/* return this.http.get(`${url}`, options); */
|
||||
axios.get(url, options)
|
||||
.then(resp => {
|
||||
if(resp.data)
|
||||
console.log(resp.data);
|
||||
})
|
||||
.catch(err => {
|
||||
// Handle Error Here
|
||||
console.error(err);
|
||||
});
|
||||
logout(){
|
||||
this.ValidatedUser = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import { Event } from '../models/event.model';
|
||||
import axios from 'axios'
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { stringify } from 'querystring';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { User } from '../models/user.model';
|
||||
import { CalModalPageRoutingModule } from '../pages/cal-modal/cal-modal-routing.module';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -56,18 +59,31 @@ export class EventsService {
|
||||
Attachments: null,
|
||||
}
|
||||
];
|
||||
options = {};
|
||||
loggeduser: User;
|
||||
|
||||
url = 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/api/calendar/GetEvents?StartDate=2020-08-14 00:00:00&EndDate=2020-08-19 23:59:00&CalendarName=Pessoal';
|
||||
options = { headers: {'Authorization': 'Basic cGF1bG8ucGludG86dGFidGVzdGVAMDA2'}};
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient, private user: AuthService) {
|
||||
this.loggeduser = user.ValidatedUser;
|
||||
this.options = { headers: {'Authorization': this.loggeduser.BasicAuthKey}};
|
||||
}
|
||||
|
||||
allEvents(): Observable<Event[]>{
|
||||
return this.http.get<Event[]>(`${this.url}`, this.options)
|
||||
console.log(this.loggeduser);
|
||||
const geturl = environment.apiURL + 'calendar/GetEvents?StartDate=2020-08-14 00:00:00&EndDate=2020-08-19 23:59:00&CalendarName=Pessoal';
|
||||
|
||||
return this.http.get<Event[]>(`${geturl}`, this.options)
|
||||
}
|
||||
getEvent(ev: string): Observable<Event>{
|
||||
const url = 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/api/calendar/GetEvent?EventId=';
|
||||
return this.http.get<Event>(`${url + ev}`, this.options)
|
||||
const geturl = environment.apiURL + 'calendar/GetEvent?EventId=';
|
||||
|
||||
return this.http.get<Event>(`${geturl + ev}`, this.options)
|
||||
}
|
||||
|
||||
PutEvent(event: Event): Observable<Event>
|
||||
{
|
||||
const puturl = environment.apiURL +'calendar/PutEvent?conflictResolutionMode=2&sendInvitationsOrCancellationsMode=3';
|
||||
|
||||
return this.http.put<Event>(`${puturl}`, event,this.options)
|
||||
}
|
||||
|
||||
AddEvent(postEvent: any){
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProcessesService } from './processes.service';
|
||||
|
||||
describe('ProcessesService', () => {
|
||||
let service: ProcessesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ProcessesService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { DailyWorkTask } from '../models/dailyworktask.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ProcessesService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
GetDailyWorkCount()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
private tasks: DailyWorkTask[] = [
|
||||
{
|
||||
SerialNumber: "1",
|
||||
Folio: "Teste 1",
|
||||
Senders: "MINEC, MINPLAN, MINFIN",
|
||||
CreateDate: "2020-08-18"
|
||||
},
|
||||
{
|
||||
SerialNumber: "2",
|
||||
Folio: "Teste 2",
|
||||
Senders: "MINFIN",
|
||||
CreateDate: "2020-08-19"
|
||||
},{
|
||||
SerialNumber: "3",
|
||||
Folio: "Teste 3",
|
||||
Senders: "MINEC",
|
||||
CreateDate: "2020-08-20"
|
||||
}
|
||||
];
|
||||
|
||||
GetDailyWorkTasks()
|
||||
{
|
||||
return this.tasks;
|
||||
}
|
||||
|
||||
GetTaskDetail(serialnumber:string)
|
||||
{
|
||||
console.log(serialnumber);
|
||||
return this.tasks.find(t => t.SerialNumber = serialnumber);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiURL: ''
|
||||
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/v1/api/',
|
||||
domain: 'gabinetedigital.local'
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user