mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +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 { ThemeService } from 'src/app/services/theme.service';
|
||||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||||
import { NGX_MAT_DATE_FORMATS } 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 = {
|
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||||
parse: {
|
parse: {
|
||||||
@@ -79,6 +81,8 @@ export class EditEventPage implements OnInit {
|
|||||||
public stepMinutes = [1, 5, 10, 15, 20, 25];
|
public stepMinutes = [1, 5, 10, 15, 20, 25];
|
||||||
public stepSeconds = [1, 5, 10, 15, 20, 25];
|
public stepSeconds = [1, 5, 10, 15, 20, 25];
|
||||||
|
|
||||||
|
sesseionStora = SessionStore
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
private navParams: NavParams,
|
private navParams: NavParams,
|
||||||
@@ -249,6 +253,7 @@ export class EditEventPage implements OnInit {
|
|||||||
|
|
||||||
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
|
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
|
||||||
|
|
||||||
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
||||||
|
|
||||||
if(this.initCalendarName != this.postEvent.CalendarName) {
|
if(this.initCalendarName != this.postEvent.CalendarName) {
|
||||||
@@ -272,6 +277,33 @@ export class EditEventPage implements OnInit {
|
|||||||
if(error.status != 0)
|
if(error.status != 0)
|
||||||
this.toastService.badRequest()
|
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.isEventEdited = true;
|
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.loggeduser.Profile);
|
||||||
|
|
||||||
console.log(this.postEvent);
|
console.log(this.postEvent);
|
||||||
@@ -309,7 +309,7 @@ export class NewEventPage implements OnInit {
|
|||||||
console.log(eventId);
|
console.log(eventId);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(this.CalendarName == 'PR'){
|
else if(this.loggeduser.Profile == 'PR') {
|
||||||
console.log(this.loggeduser.Profile);
|
console.log(this.loggeduser.Profile);
|
||||||
|
|
||||||
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
|
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() {
|
ngOnInit() {
|
||||||
@@ -248,6 +241,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||||
const alert = await this.alertController.create({
|
const alert = await this.alertController.create({
|
||||||
cssClass: 'my-custom-class',
|
cssClass: 'my-custom-class',
|
||||||
@@ -265,7 +259,28 @@ export class ViewEventPage implements OnInit {
|
|||||||
loader.remove();
|
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();
|
loader.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ export class EventsService {
|
|||||||
return this.http.put<Event>(`${puturl}`, event, options)
|
return this.http.put<Event>(`${puturl}`, event, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
editEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number): Observable<Event> {
|
editEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number, CalendarId? ): Observable<Event> {
|
||||||
let arrayReq = [];
|
let arrayReq = [];
|
||||||
arrayReq.push(event);
|
arrayReq.push(event);
|
||||||
const puturl = environment.apiURL + 'calendar/PutEvent';
|
const puturl = environment.apiURL + 'calendar/PutEvent';
|
||||||
@@ -530,11 +530,18 @@ export class EventsService {
|
|||||||
this.headers = this.headersPrOficial;
|
this.headers = this.headersPrOficial;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(this.hasOwnCalendar) {
|
const headers = [
|
||||||
this.headers = this.headerOwnOficial
|
this.headerSharedOficial,
|
||||||
} else {
|
this.headerSharedPessoal,
|
||||||
this.headers = this.headerSharedOficial
|
this.headerOwnPessoal,
|
||||||
}
|
this.headerOwnOficial
|
||||||
|
]
|
||||||
|
|
||||||
|
const header = headers.find((header)=> {
|
||||||
|
return header?.get('CalendarId')?.includes(CalendarId)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.headers = header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -545,11 +552,18 @@ export class EventsService {
|
|||||||
this.headers = this.headersPrPessoal;
|
this.headers = this.headersPrPessoal;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(this.hasSharedCalendar) {
|
const headers = [
|
||||||
this.headers = this.headerSharedPessoal
|
this.headerSharedOficial,
|
||||||
} else {
|
this.headerSharedPessoal,
|
||||||
this.headers = this.headerOwnPessoal
|
this.headerOwnPessoal,
|
||||||
}
|
this.headerOwnOficial
|
||||||
|
]
|
||||||
|
|
||||||
|
const header = headers.find((header)=> {
|
||||||
|
return header?.get('CalendarId')?.includes(CalendarId)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.headers = header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ export class EditEventPage implements OnInit {
|
|||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
this.toastService.successMessage()
|
this.toastService.successMessage()
|
||||||
} else {
|
} else {
|
||||||
await this.eventsService.editEvent(this.postEvent, 2, 3).toPromise()
|
await this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).toPromise()
|
||||||
if(this.initCalendarName != this.postEvent.CalendarName) {
|
if(this.initCalendarName != this.postEvent.CalendarName) {
|
||||||
let body = {
|
let body = {
|
||||||
"EventId": this.postEvent.EventId,
|
"EventId": this.postEvent.EventId,
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ export class NewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(this.CalendarName == 'PR') {
|
else if(this.loggeduser.Profile == 'PR') {
|
||||||
console.log('PR - Aqui');
|
console.log('PR - Aqui');
|
||||||
console.log(this.postEvent);
|
console.log(this.postEvent);
|
||||||
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
|
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
|||||||
})
|
})
|
||||||
export class ViewEventPage implements OnInit {
|
export class ViewEventPage implements OnInit {
|
||||||
|
|
||||||
loadedEvent: any;
|
loadedEvent: Event;
|
||||||
isEventEdited: boolean;
|
isEventEdited: boolean;
|
||||||
eventBody: EventBody;
|
eventBody: EventBody;
|
||||||
loadedAttachments:any;
|
loadedAttachments:any;
|
||||||
@@ -122,11 +122,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
|
|
||||||
|
|
||||||
if(event?.CalendarId) {
|
this.eventsService.genericGetEvent(this.eventId, this.loadedEvent.CalendarId).subscribe(res => {
|
||||||
this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => {
|
|
||||||
console.log(res);
|
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
this.today = new Date(res.StartDate);
|
this.today = new Date(res.StartDate);
|
||||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||||
@@ -143,7 +140,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -193,10 +190,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
|
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
||||||
|
|
||||||
if(event?.CalendarId) {
|
|
||||||
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, event?.CalendarId).subscribe(async () => {
|
|
||||||
this.toastService.successMessage('Evento apagado');
|
this.toastService.successMessage('Evento apagado');
|
||||||
this.close();
|
this.close();
|
||||||
},()=>{},
|
},()=>{},
|
||||||
@@ -204,7 +198,6 @@ export class ViewEventPage implements OnInit {
|
|||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +247,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
workflowInstanceDataFields: {
|
workflowInstanceDataFields: {
|
||||||
FolderID: '',
|
FolderID: '',
|
||||||
Subject: selectedDoc.SourceName,
|
Subject: selectedDoc.SourceName,
|
||||||
SourceSecFsID: selectedDoc.ApplicationId || selectedDoc.ApplicationID,
|
SourceSecFsID: selectedDoc.ApplicationId || selectedDoc['ApplicationID'],
|
||||||
SourceType: 'DOC',
|
SourceType: 'DOC',
|
||||||
SourceID: selectedDoc.SourceId,
|
SourceID: selectedDoc.SourceId,
|
||||||
DispatchNumber: ''
|
DispatchNumber: ''
|
||||||
@@ -320,7 +313,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
taskAction: taskAction,
|
taskAction: taskAction,
|
||||||
task: this.task,
|
task: this.task,
|
||||||
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
|
seachDocuments: this.loadedEvent.Attachments[ this.dicIndex],
|
||||||
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex].ApplicationID
|
aplicationId: this.loadedEvent.Attachments[ this.dicIndex].ApplicationId || this.loadedEvent.Attachments[ this.dicIndex]['ApplicationID']
|
||||||
},
|
},
|
||||||
cssClass: classs,
|
cssClass: classs,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user