list events

This commit is contained in:
Peter Maquiran
2024-05-29 15:45:34 +01:00
parent caa11d6be7
commit 38d36a6e49
22 changed files with 629 additions and 198 deletions
@@ -9,7 +9,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { EventsService } from 'src/app/services/events.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { environment } from 'src/environments/environment';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({
selector: 'app-event-list',
templateUrl: './event-list.page.html',
@@ -43,6 +43,7 @@ export class EventListPage implements OnInit {
private router: Router,
private sortService: SortService,
public eventService: EventsService,
public AgendaDataRepositoryService: AgendaDataRepositoryService
) {
this.loggeduser = SessionStore.user;
}
@@ -55,7 +56,7 @@ export class EventListPage implements OnInit {
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
// select pr by default
const pr = this.eventService.calendarNamesAry.find( e => e.Role == 'Presidente da República')
if(pr) {
@@ -99,7 +100,7 @@ export class EventListPage implements OnInit {
/* if(SessionStore.user.Profile == 'PR') {
return false
} */
this.showLoader = true;
const segment: any = this.segment
@@ -121,8 +122,12 @@ export class EventListPage implements OnInit {
this.showLoader = false;
}
alert('my agenda')
this.eventoaprovacaostore.save(segment, this.eventsList)
let a = await this.AgendaDataRepositoryService.eventToApprove({userId: this.SessionStore.user.UserId}).toPromise()
} else if(segment) {
// console.log('segment', segment)
@@ -134,7 +139,7 @@ export class EventListPage implements OnInit {
this.eventsList = []
this.showLoader = false;
}
this.eventsList = this.eventsList
this.eventsList = this.eventsList
this.eventoaprovacaostore.save(segment, this.eventsList)
@@ -145,7 +150,7 @@ export class EventListPage implements OnInit {
}
async LoadToApproveEventsNoLoader() {
this.LoadToApproveEvents()
}
@@ -165,7 +170,7 @@ export class EventListPage implements OnInit {
doRefresh(event) {
this.LoadToApproveEvents();
setTimeout(() => {
try {
event?.target?.complete();
@@ -174,7 +179,7 @@ export class EventListPage implements OnInit {
}
close() {
this.cloneAllmobileComponent.emit();
}
@@ -19,6 +19,8 @@ import { NavigationExtras, Router } from '@angular/router';
import { EventController } from 'src/app/controller/event'
import { DateService } from 'src/app/services/date.service';
import { EventList } from 'src/app/models/agenda/AgendaEventList';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({
selector: 'app-view-event',
templateUrl: './view-event.page.html',
@@ -65,7 +67,8 @@ export class ViewEventPage implements OnInit {
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private router: Router,
private dateService: DateService
private dateService: DateService,
public AgendaDataRepositoryService: AgendaDataRepositoryService
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -123,52 +126,24 @@ export class ViewEventPage implements OnInit {
setTimeZone() {
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
}
loadEvent() {
async loadEvent() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
try {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
let res = await this.AgendaDataRepositoryService.getEventById(this.eventId).toPromise()
console.log('Loaded Event', res)
res = this.dateService.fixDate(res as any)
this.loadedEvent = res as any;
this.setTimeZone()
// this.addEventToDb(res);
this.setTimeZone()
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
} catch (error) {
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.httpErrorHandle.httpStatusHandle(error)
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
/* const div = document.createElement("div")
div.innerHTML = res.Body.Text
res.Body.Text = div.innerText */
this.loadedEvent = res;
// console.log('Event details',res)
this.setTimeZone()
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.httpErrorHandle.httpStatusHandle(error)
});
}
// this.httpErrorHandle.httpStatusHandle(error)
}
}
@@ -197,7 +197,7 @@
{{last ? scrollToBottom() : ''}}
</div>
<div *ngIf="msg.t == 'ul'" class="info-text-leave">
<div *ngFor="let user of allUsers">
<div *ngFor="let user of ChatSystemService.users">
<div *ngIf="msg.msg == user.username">
<ion-label>{{user.name}} saiu do grupo</ion-label><br />
</div>
@@ -205,7 +205,7 @@
{{last ? scrollToBottom() : ''}}
</div>
<div *ngIf="msg.t == 'ru'" class="info-text-leave">
<div *ngFor="let user of allUsers">
<div *ngFor="let user of ChatSystemService.users">
<div *ngIf="msg.msg == user.username">
<ion-label>{{user.name}} foi removido do grupo</ion-label><br />
</div>
@@ -145,8 +145,10 @@ export class OptsExpedientePage implements OnInit {
window['attachments-expediente-update']();
this.toastService._successMessage()
this.popoverController.dismiss()
loader.remove()
}, (error) => {
this.httpErrorHanlde.httpStatusHandle(error)
loader.remove()
},()=> {
loader.remove()
});