change publication like instagram and add time zone to agenda

This commit is contained in:
Peter Maquiran
2023-09-26 10:29:29 +01:00
parent c0eee0e2b3
commit f042168e2e
22 changed files with 305 additions and 113 deletions
@@ -53,7 +53,7 @@
<div class="content-details">
<ion-label>
<p>{{customDate}}</p>
<p>{{customDate}}, {{ TimeZoneString }}</p>
<p *ngIf="toDateString(loadedEvent.StartDate) == toDateString(loadedEvent.EndDate)">das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
<p *ngIf="toDateString(loadedEvent.StartDate) != toDateString(loadedEvent.EndDate)">{{loadedEvent.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.EndDate | date: 'dd/M/yy'}} </p>
<p *ngIf="loadedEvent.EventRecurrence">
@@ -53,6 +53,8 @@ export class ViewEventPage implements OnInit {
LoadedDocument: any = null;
sesseionStora = SessionStore
TimeZoneString = ''
constructor(
private modalController: ModalController,
/* private navParams: NavParams, */
@@ -70,7 +72,7 @@ export class ViewEventPage implements OnInit {
private attachmentsService: AttachmentsService,
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
this.eventBody = { BodyType: "1", Text: "" };
@@ -107,7 +109,7 @@ export class ViewEventPage implements OnInit {
JSON.parse(req).forEach(element => {
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
this.storage.remove('eventEdit')
})
});
})
@@ -115,7 +117,7 @@ export class ViewEventPage implements OnInit {
JSON.parse(req).forEach(element => {
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
this.storage.remove('eventDelete')
})
});
})
@@ -141,7 +143,7 @@ export class ViewEventPage implements OnInit {
// } else {
// this.sqliteservice.getAllEvents().then((events: any[] = []) => {
// resolve(events)
// })
// }
// }).catch ((error) => {
@@ -167,7 +169,7 @@ export class ViewEventPage implements OnInit {
else {
// this.router.navigate(['/home', params["params"].caller]);
this.RouteService.goBack();
}
});
}
@@ -179,19 +181,24 @@ export class ViewEventPage implements OnInit {
ev.target.complete();
}
setTimeZone() {
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
}
loadEvent() {
const loader = this.toastService.loading();
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
this.setTimeZone()
// this.addEventToDb(res);
loader.remove()
}, (error) => {
if (error.status === 0) {
this.getFromDb();
} else {
@@ -204,20 +211,21 @@ export class ViewEventPage implements OnInit {
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
const div = document.createElement("div")
div.innerHTML = res.Body.Text
res.Body.Text = div.innerText
this.loadedEvent = res;
this.setTimeZone()
// this.addEventToDb(res);
loader.remove()
}, (error) => {
if (error.status === 0) {
this.getFromDb();
} else {
@@ -261,14 +269,14 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading()
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
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);
@@ -278,29 +286,29 @@ export class ViewEventPage implements OnInit {
() => {
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.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
},
() => {
loader.remove();
});
}
}
@@ -318,7 +326,7 @@ export class ViewEventPage implements OnInit {
});
modal.onDidDismiss().then((res) => {
if (res) {
setTimeout(() => {
@@ -350,7 +358,7 @@ export class ViewEventPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then((res) => {
if (res) {
setTimeout(() => {
@@ -365,7 +373,7 @@ export class ViewEventPage implements OnInit {
}
async editEvent() {
let classs;
if (window.innerWidth <= 800) {
@@ -384,19 +392,19 @@ export class ViewEventPage implements OnInit {
});
modal.onDidDismiss().then((res) => {
if (res) {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent()
}, 250);
this.isEventEdited = true;
if(res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true
this.getAttachments()
this.getAttachments()
}
console.log('res', res)
}
@@ -416,10 +424,10 @@ export class ViewEventPage implements OnInit {
if(this.loadedEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{
this.loadedEvent.Attachments = res;
},((erro) => {
console.error('editgetAttchament', erro)
}));
}));
}
}
@@ -429,7 +437,7 @@ export class ViewEventPage implements OnInit {
const applicationId: any = this.loadedEvent.Attachments[this.dicIndex].ApplicationId
const selectedDoc = this.loadedEvent.Attachments[this.dicIndex]
this.task = {
serialNumber: '',
@@ -515,37 +523,6 @@ export class ViewEventPage implements OnInit {
}
// addEventToDb(data) {
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.ionicStorage.set('eventDetails', data).then(() => {
// })
// } else {
// let event = {
// Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
// Body: JSON.stringify(data.Body) || JSON.stringify(''),
// CalendarId: data.CalendarId,
// CalendarName: data.CalendarName,
// Category: data.Category,
// EndDate: data.EndDate,
// EventId: data.EventId,
// EventRecurrence: JSON.stringify(data.EventRecurrence) || JSON.stringify(''),
// EventType: data.EventType,
// HasAttachments: data.HasAttachments,
// IsAllDayEvent: data.IsAllDayEvent,
// IsMeeting: data.IsMeeting,
// IsRecurring: data.IsRecurring,
// Location: data.Location,
// Organizer: JSON.stringify(data.Organizer) || JSON.stringify(''),
// StartDate: data.StartDate,
// Subject: data.Subject,
// TimeZone: data.TimeZone
// }
// this.sqliteservice.updateEvent(event);
// }
// }
getFromDb() {