mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
improve
This commit is contained in:
@@ -14,6 +14,8 @@ import { SearchPage } from '../../search/search.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -79,6 +81,8 @@ export class EditEventPage implements OnInit {
|
||||
public stepMinutes = [1, 5, 10, 15, 20, 25];
|
||||
public stepSeconds = [1, 5, 10, 15, 20, 25];
|
||||
|
||||
sesseionStora = SessionStore
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
@@ -249,29 +253,57 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
|
||||
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
||||
|
||||
if(this.initCalendarName != this.postEvent.CalendarName) {
|
||||
|
||||
let body = {
|
||||
"EventId": this.postEvent.EventId,
|
||||
"CalendarDestinationName": this.postEvent.CalendarName,
|
||||
if(this.initCalendarName != this.postEvent.CalendarName) {
|
||||
|
||||
let body = {
|
||||
"EventId": this.postEvent.EventId,
|
||||
"CalendarDestinationName": this.postEvent.CalendarName,
|
||||
}
|
||||
try {
|
||||
await this.eventsService.changeAgenda(body).toPromise();
|
||||
} catch (error) {}
|
||||
finally {
|
||||
this.goBack();
|
||||
}
|
||||
|
||||
}
|
||||
try {
|
||||
await this.eventsService.changeAgenda(body).toPromise();
|
||||
} catch (error) {}
|
||||
finally {
|
||||
this.goBack();
|
||||
|
||||
this.toastService.successMessage();
|
||||
|
||||
}, error => {
|
||||
if(error.status != 0)
|
||||
this.toastService.badRequest()
|
||||
});
|
||||
} else {
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
|
||||
|
||||
if(this.initCalendarName != this.postEvent.CalendarName) {
|
||||
|
||||
let body = {
|
||||
"EventId": this.postEvent.EventId,
|
||||
"CalendarDestinationName": this.postEvent.CalendarName,
|
||||
}
|
||||
try {
|
||||
await this.eventsService.changeAgenda(body).toPromise();
|
||||
} catch (error) {}
|
||||
finally {
|
||||
this.goBack();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.toastService.successMessage();
|
||||
|
||||
}, error => {
|
||||
if(error.status != 0)
|
||||
this.toastService.badRequest()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.toastService.successMessage();
|
||||
|
||||
}, error => {
|
||||
if(error.status != 0)
|
||||
this.toastService.badRequest()
|
||||
});
|
||||
|
||||
|
||||
this.isEventEdited = true;
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
|
||||
|
||||
if(this.CalendarName == 'MDGPR') {
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
console.log(this.loggeduser.Profile);
|
||||
|
||||
console.log(this.postEvent);
|
||||
@@ -309,7 +309,7 @@ export class NewEventPage implements OnInit {
|
||||
console.log(eventId);
|
||||
|
||||
}
|
||||
else if(this.CalendarName == 'PR'){
|
||||
else if(this.loggeduser.Profile == 'PR') {
|
||||
console.log(this.loggeduser.Profile);
|
||||
|
||||
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
|
||||
|
||||
@@ -99,13 +99,6 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
/* this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["eventId"]) {
|
||||
this.eventId = params["eventId"];
|
||||
console.log(params["eventId"]);
|
||||
}
|
||||
}); */
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -248,24 +241,46 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
}, () => { },
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
|
||||
loader.remove();
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
}, () => { },
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
}, () => { },
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user