This commit is contained in:
tiago.kayaya
2021-06-15 17:42:51 +01:00
parent 1682d63a42
commit b9d4e2dc95
9 changed files with 239 additions and 232 deletions
+1 -1
View File
@@ -135,7 +135,7 @@
</mfp:windows10> </mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum> <mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows> </mfp:windows>
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion> <mfp:platformVersion>8.0.0.00-20210214-154410</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" /> <mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" /> <mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" /> <mfp:serverUri url="" />
+14 -11
View File
@@ -75,10 +75,11 @@ export class HomePage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.count();
//Add a test }
//this.pushCordova();
//Initialize profile as mdgpr async count(){
let date = new Date(); let date = new Date();
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
@@ -87,16 +88,18 @@ export class HomePage implements OnInit {
this.profile = "mdgpr"; this.profile = "mdgpr";
if (this.profile == "mdgpr") { if (this.profile == "mdgpr") {
this.eventService.getAllMdEvents(start, end).subscribe(res => {
this.eventsList = res; let mdOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
this.totalEvent = this.eventsList.length; let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
}); this.eventsList = mdOficialEvents.concat(mdPessoalEvents)
this.totalEvent = this.eventsList.length;
} }
else { else {
this.eventService.getAllPrEvents(start, end).subscribe(res => { let prOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
this.eventsList = res; let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
this.totalEvent = this.eventsList.length; this.eventsList = prOficialEvents.concat(prPessoalEvents)
}); this.totalEvent = this.eventsList.length;
} }
+8 -4
View File
@@ -14,15 +14,19 @@ export class User {
FullName: string FullName: string
OwnerCalendars: { OwnerCalendars: {
CalendarId: string CalendarId: string
CalendarName: "Oficial" | "Pessoal" CalendarName: "Oficial" | "Pessoal";
Id: 1 CalendarRoleId: string;
Id: number;
}[] }[]
RoleDescription: string RoleDescription: string
RoleID: number RoleID: number
SharedCalendars: { SharedCalendars: {
CalendarId: string CalendarId: string
CalendarName: "Oficial" | "Pessoal" CalendarName: "Oficial" | "Pessoal";
Id: 1 CalendarRoleId: string;
Id: number;
OwnerUserId: string;
TypeShare: number;
}[] }[]
UserName: string UserName: string
Profile: any; Profile: any;
+29 -31
View File
@@ -515,7 +515,7 @@ export class AgendaPage implements OnInit {
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0') return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0')
} }
loadRangeEvents(startTime: Date, endTime: Date){ async loadRangeEvents(startTime: Date, endTime: Date){
this.eventSelectedDate = new Date(startTime); this.eventSelectedDate = new Date(startTime);
@@ -531,13 +531,14 @@ export class AgendaPage implements OnInit {
//this.eventSource=[]; //this.eventSource=[];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) { if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) {
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
response => { let mdOficialEvents = await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
// calendar // calendar
this.eventSource=[]; this.eventSource=[];
this.eventsList = response; this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
// loop // loop
this.eventsList.forEach((element, eventIndex) => { this.eventsList.forEach((element, eventIndex) => {
@@ -572,17 +573,17 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500); this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500); this.centralizeTimeline(500);
});
} }
else { else {
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe( let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
response => { let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
// calendar // calendar
this.eventSource=[]; this.eventSource=[];
this.eventsList = response; this.eventsList = prOficialEvents.concat(prPessoalEvents);
// calendar // calendar
this.eventsList.forEach((element, eventIndex) => { this.eventsList.forEach((element, eventIndex) => {
@@ -616,8 +617,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500); this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500); this.centralizeTimeline(500);
});
} }
break; break;
@@ -625,7 +624,7 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource //Inicializa o array eventSource
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => { this.eventService.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
this.eventSource=[]; this.eventSource=[];
this.eventsListPessoal= []; this.eventsListPessoal= [];
@@ -666,10 +665,11 @@ export class AgendaPage implements OnInit {
} }
else{ else{
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => { let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
this.eventSource=[]; this.eventSource=[];
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal"); this.eventsListPessoal = prPessoalEvents.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal.forEach(element => { this.eventsListPessoal.forEach(element => {
this.eventSource.push({ this.eventSource.push({
title: element.Subject, title: element.Subject,
@@ -699,7 +699,7 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500); this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500); this.centralizeTimeline(500);
});
} }
break; break;
@@ -709,7 +709,7 @@ export class AgendaPage implements OnInit {
this.eventsListOficial = []; this.eventsListOficial = [];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => { this.eventService.getAllMdOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
this.eventSource=[]; this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial"); this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
@@ -743,9 +743,9 @@ export class AgendaPage implements OnInit {
this.centralizeTimeline(500); this.centralizeTimeline(500);
}); });
} else { } else {
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => { let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
this.eventSource=[]; this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial"); this.eventsListOficial = prOficialEvents.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => { this.eventsListOficial.forEach(element => {
this.eventSource.push({ this.eventSource.push({
title: element.Subject, title: element.Subject,
@@ -775,7 +775,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500); this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500); this.centralizeTimeline(500);
});
} }
break; break;
@@ -789,15 +788,16 @@ export class AgendaPage implements OnInit {
let counter = 0; let counter = 0;
if(this.loggeduser.Profile == 'MDGPR') { if(this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
response => { let mdOficialEvents = await this.eventService.getAllPrOficialEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
if(this.segment == 'Oficial') { if(this.segment == 'Oficial') {
this.eventsList = response.filter(data => data.CalendarName == "Oficial"); this.eventsList = mdOficialEvents;
} else if (this.segment == 'Pessoal') { } else if (this.segment == 'Pessoal') {
this.eventsList = response.filter(data => data.CalendarName == "Pessoal"); this.eventsList = mdPessoalEvents;
} else { } else {
this.eventsList = response; this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
} }
this.eventSource= this.eventSource.filter(e => e.profile != 'md'); this.eventSource= this.eventSource.filter(e => e.profile != 'md');
@@ -840,18 +840,18 @@ export class AgendaPage implements OnInit {
this.centralizeTimeline(500); this.centralizeTimeline(500);
} }
});
} }
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe( let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
response => { let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
if(this.segment == 'Oficial') { if(this.segment == 'Oficial') {
this.eventsList = response.filter(data => data.CalendarName == "Oficial"); this.eventsList = prOficialEvents;
} else if (this.segment == 'Pessoal') { } else if (this.segment == 'Pessoal') {
this.eventsList = response.filter(data => data.CalendarName == "Pessoal"); this.eventsList = prPessoalEvents;
} else { } else {
this.eventsList = response; this.eventsList = prOficialEvents.concat(prPessoalEvents);
} }
this.eventSource = this.eventSource.filter(e => e.profile != 'pr'); this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
@@ -891,8 +891,6 @@ export class AgendaPage implements OnInit {
this.centralizeTimeline(500); this.centralizeTimeline(500);
} }
});
} }
} }
+33 -26
View File
@@ -114,7 +114,7 @@ export class EventsPage implements OnInit {
this.RefreshEvents(); this.RefreshEvents();
} }
RefreshEvents(){ async RefreshEvents(){
this.currentEvent = ""; this.currentEvent = "";
this.showLoader = true; this.showLoader = true;
@@ -127,43 +127,49 @@ export class EventsPage implements OnInit {
{ {
case "Combinada": case "Combinada":
if(this.loggeduser.Profile == 'MDGPR'){ if(this.loggeduser.Profile == 'MDGPR'){
this.eventService.getAllMdEvents(start, end).subscribe(res => {
this.eventsList = res;
if(res.length > 0){ let mdOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
this.currentEvent = res[0].Subject; let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
this.currentHoursMinutes = res[0].StartDate;
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
if(this.eventsList.length > 0){
this.currentEvent = this.eventsList[0].Subject;
this.currentHoursMinutes = this.eventsList[0].StartDate;
} }
this.totalEvent = this.eventsList.length; this.totalEvent = this.eventsList.length;
this.showLoader = false; this.showLoader = false;
});
}else{
this.eventService.getAllPrEvents(start, end).subscribe(res => {
this.eventsList = res;
console.log(this.eventsList);
console.log(res);
console.log(res[0]);
if(res.length > 0){ }
this.currentEvent = res[0].Subject; else{
this.currentHoursMinutes = res[0].StartDate;
} let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
this.eventsList = prOficialEvents.concat(prPessoalEvents);
console.log(this.eventsList);
console.log(this.eventsList);
if(this.eventsList.length > 0){
this.currentEvent = this.eventsList[0].Subject;
this.currentHoursMinutes = this.eventsList[0].StartDate;
}
this.totalEvent = this.eventsList.length;
this.showLoader = false;
this.totalEvent = this.eventsList.length;
this.showLoader = false;
});
} }
break; break;
case "Pessoal": case "Pessoal":
if(this.loggeduser.Profile == 'MDGPR'){ if(this.loggeduser.Profile == 'MDGPR'){
this.eventService.getAllMdEvents(start, end).subscribe(res => { this.eventService.getAllMdPessoalEvents(start, end).subscribe(res => {
this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal"); this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
this.showLoader = false; this.showLoader = false;
}); });
}else{ }
this.eventService.getAllPrEvents(start, end).subscribe(res => { else{
this.eventService.getAllPrPessoalEvents(start, end).subscribe(res => {
this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal"); this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
this.showLoader = false; this.showLoader = false;
}); });
@@ -172,12 +178,13 @@ export class EventsPage implements OnInit {
break; break;
case "Oficial": case "Oficial":
if(this.loggeduser.Profile == 'MDGPR'){ if(this.loggeduser.Profile == 'MDGPR'){
this.eventService.getAllMdEvents(start, end).subscribe(res => { this.eventService.getAllMdOficialEvents(start, end).subscribe(res => {
this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");; this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
this.showLoader = false; this.showLoader = false;
}); });
}else{ }
this.eventService.getAllPrEvents(start, end).subscribe(res => { else{
this.eventService.getAllPrOficialEvents(start, end).subscribe(res => {
this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");; this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
this.showLoader = false; this.showLoader = false;
}); });
@@ -218,14 +218,8 @@ export class ExpedientTaskModalPage implements OnInit {
console.log(this.postData); console.log(this.postData);
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado', () =>{ await this.toastService.successMessage('Processo efetuado');
console.log('Hoje Teste T'); this.modalController.dismiss();
this.modalController.dismiss(action_despacho);
});
/* setInterval(()=>{
console.log('Hoje Teste T');
this.modalController.dismiss(action_despacho);
}, 7000); */
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
@@ -253,11 +247,9 @@ export class ExpedientTaskModalPage implements OnInit {
"Note": "", "Note": "",
} }
} }
//this.taskResult = await this.processes.postParecer(this.postData).toPromise(); this.taskResult = await this.processes.postParecer(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado'); await this.toastService.successMessage('Processo efetuado');
setInterval(()=>{ this.modalController.dismiss(action_parecer);
this.modalController.dismiss(action_parecer);
}, 7000);
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
@@ -284,9 +276,8 @@ export class ExpedientTaskModalPage implements OnInit {
} }
} }
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise(); this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado', () =>{ await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_deferimento); this.modalController.dismiss(action_deferimento);
});
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} }
@@ -309,7 +300,6 @@ export class ExpedientTaskModalPage implements OnInit {
UsersSelected: attendees, UsersSelected: attendees,
DispatchFolder: this.dispatchFolder, DispatchFolder: this.dispatchFolder,
AttachmentList: docs, AttachmentList: docs,
//SubjectTypes: [],
} }
console.log(this.postData); console.log(this.postData);
try { try {
@@ -323,9 +313,9 @@ export class ExpedientTaskModalPage implements OnInit {
} }
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise(); this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado', () =>{ await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho_pr); this.modalController.dismiss(action_despacho_pr);
});
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} }
@@ -354,9 +344,9 @@ export class ExpedientTaskModalPage implements OnInit {
} }
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise(); this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.badRequest('Processo efetuado', () =>{ await this.toastService.badRequest('Processo efetuado');
this.modalController.dismiss(action_parecer_pr); this.modalController.dismiss(action_parecer_pr);
})
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} }
@@ -407,16 +397,6 @@ export class ExpedientTaskModalPage implements OnInit {
} }
} }
/* setIntervenient(data){
this.taskParticipants = data;
//this.postData.UsersSelected = data;
}
setIntervenientCC(data){
this.taskParticipantsCc = data;
} */
async setIntervenient(data) { async setIntervenient(data) {
this.taskParticipants = data; this.taskParticipants = data;
} }
@@ -530,50 +510,4 @@ export class ExpedientTaskModalPage implements OnInit {
} }
async successMessage(message?: any, callback?) {
var notification = document.createElement('div')
notification.id = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-center">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
document.body.append(notification)
notification.querySelector('.text').innerHTML = message
setTimeout(()=>{
notification.remove()
},7000)
}
async badRequest(message?: string, callback?) {
var notification = document.createElement('div')
notification.id = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-center">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/notification-error.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
document.body.append(notification)
notification.querySelector('.text').innerHTML = message
setTimeout(()=>{
notification.remove()
},7000)
}
} }
@@ -147,7 +147,7 @@ export class ExpedienteDetailPage implements OnInit {
"Note": res.workflowInstanceDataFields.Note, "Note": res.workflowInstanceDataFields.Note,
"FolderId": res.workflowInstanceDataFields.FolderID, "FolderId": res.workflowInstanceDataFields.FolderID,
"FsId": res.workflowInstanceDataFields.FsId, "FsId": res.workflowInstanceDataFields.FsId,
"DocId": res.workflowInstanceDataFields.DocId, "DocId": res.workflowInstanceDataFields.DocID,
"WorkflowName": res.workflowDisplayName, "WorkflowName": res.workflowDisplayName,
} }
+112 -4
View File
@@ -15,12 +15,59 @@ export class EventsService {
authheader = {}; authheader = {};
loggeduser: User; loggeduser: User;
headers: HttpHeaders; headers: HttpHeaders;
headersOwnerOficial: HttpHeaders;
headersOwnerPessoal: HttpHeaders;
headersSharedOficial: HttpHeaders;
headersSharedPessoal: HttpHeaders;
//lastloadedevent: Event; //lastloadedevent: Event;
constructor(private http: HttpClient, user: AuthService) { constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser; this.loggeduser = user.ValidatedUser;
this.headersOwnerOficial = new HttpHeaders();
this.headersOwnerPessoal = new HttpHeaders();
this.headersSharedOficial = new HttpHeaders();
this.headersSharedPessoal = new HttpHeaders();
if(this.loggeduser.Profile == 'MDGPR'){
this.headersOwnerOficial = this.headersOwnerOficial.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersOwnerOficial = this.headersOwnerOficial.set('CalendarId', this.loggeduser.OwnerCalendars[0].CalendarId);
this.headersOwnerOficial = this.headersOwnerOficial.set('CalendarRoleId', this.loggeduser.OwnerCalendars[0].CalendarRoleId);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('CalendarId', this.loggeduser.OwnerCalendars[1].CalendarId);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('CalendarRoleId', this.loggeduser.OwnerCalendars[1].CalendarRoleId);
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', this.loggeduser.SharedCalendars[0].CalendarId);
this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', this.loggeduser.SharedCalendars[0].CalendarRoleId);
this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', this.loggeduser.SharedCalendars[1].CalendarId);
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', this.loggeduser.SharedCalendars[1].CalendarRoleId);
}
else if(this.loggeduser.Profile == 'PR'){
this.headersOwnerOficial = this.headersOwnerOficial.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersOwnerOficial = this.headersOwnerOficial.set('CalendarId', this.loggeduser.OwnerCalendars[0].CalendarId);
this.headersOwnerOficial = this.headersOwnerOficial.set('CalendarRoleId', this.loggeduser.OwnerCalendars[0].CalendarRoleId);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('CalendarId', this.loggeduser.OwnerCalendars[1].CalendarId);
this.headersOwnerPessoal = this.headersOwnerPessoal.set('CalendarRoleId', this.loggeduser.OwnerCalendars[1].CalendarRoleId);
}
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
/* this.headers = this.headers.set('CalendarId', this.loggeduser.OwnerCalendars[0].CalendarId);
this.headers = this.headers.set('CalendarRoleId', this.loggeduser.OwnerCalendars[0].CalendarRoleId); */
} }
getAllEvents(startdate:string, enddate:string): Observable<Event[]>{ getAllEvents(startdate:string, enddate:string): Observable<Event[]>{
@@ -36,7 +83,9 @@ export class EventsService {
}; };
return this.http.get<Event[]>(`${geturl}`, options); return this.http.get<Event[]>(`${geturl}`, options);
} }
getAllPrEvents(startdate:string, enddate:string): Observable<Event[]>{
getAllPrOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr'; const geturl = environment.apiURL + 'calendar/pr';
let params = new HttpParams(); let params = new HttpParams();
@@ -44,12 +93,27 @@ export class EventsService {
params = params.set("End", enddate); params = params.set("End", enddate);
let options = { let options = {
headers: this.headers, headers: this.headersOwnerOficial,
params: params params: params
}; };
return this.http.get<Event[]>(`${geturl}`, options); return this.http.get<Event[]>(`${geturl}`, options);
} }
getAllMdEvents(startdate:string, enddate:string): Observable<Event[]>{
getAllPrPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr';
let params = new HttpParams();
params = params.set("Start", startdate);
params = params.set("End", enddate);
let options = {
headers: this.headersOwnerPessoal,
params: params
};
return this.http.get<Event[]>(`${geturl}`, options);
}
getAllMdOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/md'; const geturl = environment.apiURL + 'calendar/md';
let params = new HttpParams(); let params = new HttpParams();
@@ -57,7 +121,51 @@ export class EventsService {
params = params.set("End", enddate); params = params.set("End", enddate);
let options = { let options = {
headers: this.headers, headers: this.headersOwnerOficial,
params: params
};
return this.http.get<Event[]>(`${geturl}`, options);
}
getAllMdPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/md';
let params = new HttpParams();
params = params.set("Start", startdate);
params = params.set("End", enddate);
let options = {
headers: this.headersOwnerPessoal,
params: params
};
return this.http.get<Event[]>(`${geturl}`, options);
}
getAllSharedOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr';
let params = new HttpParams();
params = params.set("Start", startdate);
params = params.set("End", enddate);
let options = {
headers: this.headersSharedOficial,
params: params
};
return this.http.get<Event[]>(`${geturl}`, options);
}
getAllSharedPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr';
let params = new HttpParams();
params = params.set("Start", startdate);
params = params.set("End", enddate);
let options = {
headers: this.headersSharedPessoal,
params: params params: params
}; };
return this.http.get<Event[]>(`${geturl}`, options); return this.http.get<Event[]>(`${geturl}`, options);
+27 -74
View File
@@ -24,94 +24,47 @@ export class ToastService {
async successMessage(message?: any, callback?) { async successMessage(message?: any, callback?) {
const enterAnimation = (baseEl: any) => { var notification = document.createElement('div')
const backdropAnimation = this.animationController.create() notification.id = 'notification'
.addElement(baseEl.querySelector('ion-backdrop')!) notification.innerHTML = `
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create() <div class="main-content width-100 pa-20">
.addElement(baseEl.querySelector('.modal-wrapper')!) <p class="message d-flex align-center">
.keyframes([ <ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
{ offset: 0, opacity: '1', right: '-100%' }, <p class="text">{{ message }}</p>
{ offset: 1, opacity: '1', right: '0px' } </p>
]);
return this.animationController.create() </div>
.addElement(baseEl) `
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: SuccessMessagePage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
document.body.append(notification)
notification.querySelector('.text').innerHTML = message
setTimeout(()=>{ setTimeout(()=>{
if (callback) { notification.remove()
callback()
}
modal.dismiss()
},7000) },7000)
} }
async badRequest(message?: string, callback?) { async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create() var notification = document.createElement('div')
.addElement(baseEl.querySelector('.modal-wrapper')!) notification.id = 'notification'
.keyframes([ notification.innerHTML = `
{ offset: 0, opacity: '1', right: '-100%' }, <div class="main-content width-100 pa-20">
{ offset: 1, opacity: '1', right: '0px' } <p class="message d-flex align-center">
]); <ion-icon slot="end" class="title-icon pr-10" src="/assets/images/notification-error.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
return this.animationController.create() </div>
.addElement(baseEl) `
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: BadRequestPage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
document.body.append(notification)
notification.querySelector('.text').innerHTML = message
setTimeout(()=>{ setTimeout(()=>{
if (callback) { notification.remove()
callback()
}
modal.dismiss()
},7000) },7000)
} }
} }