Gabinete Digital on work.

This commit is contained in:
Paulo Pinto
2020-08-27 13:02:06 +01:00
parent 0773b074f6
commit 104bb42b1b
10 changed files with 81 additions and 120 deletions
-4
View File
@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core';
import { StorageService } from './storage.service';
import { HttpService } from './http.service';
import { Router } from '@angular/router';
import { AuthConnstants } from '../config/auth-constants';
import { HttpClient } from '@angular/common/http';
import { User } from '../models/user.model';
import { environment } from 'src/environments/environment';
@@ -15,8 +13,6 @@ export class AuthService {
constructor(
private storageService: StorageService,
private router: Router,
private http: HttpClient
) { }
-16
View File
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { HttpService } from './http.service';
describe('HttpService', () => {
let service: HttpService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HttpService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
-45
View File
@@ -1,45 +0,0 @@
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { reject } from 'q';
@Injectable({
providedIn: 'root'
})
export class HttpService {
constructor(private http: HttpClient) {}
/* post(serviceName: string, data: any) {
const headers = new HttpHeaders();
const options = { headers: headers, withCredintials: false };
const url = environment.apiURL + serviceName;
return this.http.post(url, JSON.stringify(data), options);
} */
private API_URL = 'https://gpr-dev-08.gabinetedigital.local/api/v2.0/me/calendarview';
/* loginRequest(username:string, password: string, domain: string){
return new Promise((resolve, reject) => {
var data = {
emusernameail: username,
password: password,
domain: domain
};
this.http.post(this.API_URL, data)
.subscribe(result: any)=> {
resolve(result.json());
},
(error)=>{
reject(error.json());
}
})
} */
/* request(API_URL, { json: true },{username:"tiago.kayaya"}, {password:"tabteste@006"}, {domain:"gabinetedigital.local"} ,(err, res, body) => {
if (err) { return console.log(err); }
console.log(body.url);
console.log(body.explanation);
}); */
}
+37 -30
View File
@@ -1,48 +1,55 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { DailyWorkTask } from '../models/dailyworktask.model';
import { AuthService } from '../services/auth.service';
import { User } from '../models/user.model';
import { environment } from 'src/environments/environment';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ProcessesService {
constructor() { }
authheader = {};
loggeduser: User;
headers: HttpHeaders;
GetDailyWorkCount()
{
return 100;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
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()
GetTasksList(processname:string, onlycount:boolean): Observable<any>
{
return this.tasks;
const geturl = environment.apiURL + 'processes/GetTasksList';
let params = new HttpParams();
params = params.set("ProcessName", processname);
params = params.set("OnlyCount", onlycount.toString());
let options = {
headers: this.headers,
params: params
};
return this.http.get<any>(`${geturl}`, options);
}
GetTaskDetail(serialnumber:string)
GetTask(serialnumber:string): Observable<any>
{
console.log(serialnumber);
return this.tasks.find(t => t.SerialNumber = serialnumber);
const geturl = environment.apiURL + 'processes/GetTask';
let params = new HttpParams();
params = params.set("TaskSerialNumber", serialnumber);
let options = {
headers: this.headers,
params: params
};
return this.http.get<any>(`${geturl}`, options);
}
}