mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
save
This commit is contained in:
@@ -15,12 +15,59 @@ export class EventsService {
|
||||
authheader = {};
|
||||
loggeduser: User;
|
||||
headers: HttpHeaders;
|
||||
|
||||
headersOwnerOficial: HttpHeaders;
|
||||
headersOwnerPessoal: HttpHeaders;
|
||||
|
||||
headersSharedOficial: HttpHeaders;
|
||||
headersSharedPessoal: HttpHeaders;
|
||||
//lastloadedevent: Event;
|
||||
|
||||
constructor(private http: HttpClient, user: AuthService) {
|
||||
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 = 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[]>{
|
||||
@@ -36,7 +83,9 @@ export class EventsService {
|
||||
};
|
||||
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';
|
||||
let params = new HttpParams();
|
||||
|
||||
@@ -44,12 +93,27 @@ export class EventsService {
|
||||
params = params.set("End", enddate);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
headers: this.headersOwnerOficial,
|
||||
params: params
|
||||
};
|
||||
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';
|
||||
let params = new HttpParams();
|
||||
|
||||
@@ -57,7 +121,51 @@ export class EventsService {
|
||||
params = params.set("End", enddate);
|
||||
|
||||
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
|
||||
};
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
|
||||
@@ -24,94 +24,47 @@ export class ToastService {
|
||||
|
||||
async successMessage(message?: any, callback?) {
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||
var notification = document.createElement('div')
|
||||
notification.id = 'notification'
|
||||
notification.innerHTML = `
|
||||
|
||||
const wrapperAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '1', right: '-100%' },
|
||||
{ offset: 1, opacity: '1', right: '0px' }
|
||||
]);
|
||||
<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>
|
||||
`
|
||||
|
||||
return this.animationController.create()
|
||||
.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(()=>{
|
||||
if (callback) {
|
||||
callback()
|
||||
}
|
||||
modal.dismiss()
|
||||
notification.remove()
|
||||
},7000)
|
||||
|
||||
}
|
||||
|
||||
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()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '1', right: '-100%' },
|
||||
{ offset: 1, opacity: '1', right: '0px' }
|
||||
]);
|
||||
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>
|
||||
`
|
||||
|
||||
return this.animationController.create()
|
||||
.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(()=>{
|
||||
if (callback) {
|
||||
callback()
|
||||
}
|
||||
modal.dismiss()
|
||||
notification.remove()
|
||||
},7000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user