mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
fix view event in some component
This commit is contained in:
@@ -19,6 +19,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service'
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { DateService } from 'src/app/services/date.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-event',
|
||||
@@ -71,7 +72,8 @@ export class ViewEventPage implements OnInit {
|
||||
private RouteService: RouteService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private dateService: DateService
|
||||
private dateService: DateService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
|
||||
|
||||
@@ -187,65 +189,25 @@ export class ViewEventPage implements OnInit {
|
||||
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
||||
}
|
||||
|
||||
loadEvent() {
|
||||
async loadEvent() {
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
let res = await this.agendaDataRepository.getEventById(this.eventId)
|
||||
|
||||
console.log('Loaded Event', res)
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
this.setTimeZone()
|
||||
// this.addEventToDb(res);
|
||||
|
||||
loader.remove()
|
||||
}, (error) => {
|
||||
|
||||
|
||||
if (error.status === 0) {
|
||||
this.getFromDb();
|
||||
} else {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
loader.remove()
|
||||
this.modalController.dismiss('Eevent not Foud');
|
||||
this.RouteService.goBack();
|
||||
}
|
||||
loader.remove()
|
||||
});
|
||||
if(res.isOk()) {
|
||||
console.log('Loaded Event', res.value)
|
||||
loader.remove()
|
||||
let changeDate = this.dateService.fixDate(res.value as any) as any
|
||||
this.loadedEvent = changeDate as any;
|
||||
this.setTimeZone()
|
||||
} else {
|
||||
|
||||
|
||||
if(this.CalendarId) {
|
||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||
console.log('Loaded Event', res)
|
||||
/* const div = document.createElement("div")
|
||||
div.innerHTML = res.Body.Text
|
||||
res.Body.Text = div.innerText */
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
console.log('pass,',res)
|
||||
this.setTimeZone()
|
||||
|
||||
// this.addEventToDb(res);
|
||||
|
||||
loader.remove()
|
||||
}, (error) => {
|
||||
|
||||
if (error.status === 0) {
|
||||
this.getFromDb();
|
||||
} else {
|
||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
||||
loader.remove()
|
||||
this.modalController.dismiss('Eevent not Foud');
|
||||
this.RouteService.goBack();
|
||||
}
|
||||
loader.remove()
|
||||
});
|
||||
}
|
||||
|
||||
this.httpErrorHandle.httpStatusHandle(res.error)
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
||||
this.RouteService.goBack();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
loadEvent1() {
|
||||
|
||||
Reference in New Issue
Block a user