mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
teste mobile done!
This commit is contained in:
@@ -19,6 +19,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -89,6 +90,8 @@ export class EditEventPage implements OnInit {
|
||||
sesseionStora = SessionStore
|
||||
environment = environment
|
||||
allDayCheck: boolean = false;
|
||||
deletedAttachmentsList = [];
|
||||
addedAttachmentsList = [];
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -101,7 +104,8 @@ export class EditEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private contactsService: ContactsService,
|
||||
private domSanitazerService: DomSanitizerService
|
||||
private domSanitazerService: DomSanitizerService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
|
||||
/* this.postEvent = new Event(); */
|
||||
@@ -123,6 +127,8 @@ export class EditEventPage implements OnInit {
|
||||
this.postEvent.Attendees[index].UserType = userData.UserType
|
||||
}
|
||||
|
||||
console.log('jhv',this.postEvent.Category)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -155,15 +161,15 @@ export class EditEventPage implements OnInit {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
|
||||
this.loadedEventAttachments = this.postEvent?.Attachments
|
||||
|
||||
this.CalendarNameOwnerName = this.eventsService.detectCalendarNameByCalendarId(this.postEvent.CalendarId)
|
||||
this.changeAgenda()
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log(this.postEvent?.Attachments)
|
||||
console.log(this.loadedEventAttachments)
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if (window.innerWidth >= 1024) {
|
||||
@@ -202,7 +208,7 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.modalController.dismiss({action:'cancel'});
|
||||
this.modalController.dismiss({ action: 'cancel' });
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -358,6 +364,59 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async save_v2() {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
return false
|
||||
}
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
try {
|
||||
|
||||
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('edit event error: ', error)
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.postEvent.EventId, this.postEvent.Attendees).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
|
||||
await this.saveDocument()
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.postEvent.EventId, this.loadedEventAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.postEvent.EventId, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
this.isEventEdited = true;
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
|
||||
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
console.log('edit: ', error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async save() {
|
||||
|
||||
@@ -403,7 +462,7 @@ export class EditEventPage implements OnInit {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
} else {
|
||||
console.log('edid calendar id',this.postEvent.CalendarId);
|
||||
console.log('edid calendar id', this.postEvent.CalendarId);
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
|
||||
|
||||
if (window['reloadCalendar']) {
|
||||
@@ -568,12 +627,13 @@ export class EditEventPage implements OnInit {
|
||||
deleteAttachment(attachmentID: string, index) {
|
||||
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
this.deletedAttachmentsList.push(id)
|
||||
|
||||
if (id == 'add') {
|
||||
/* if (id == 'add') {
|
||||
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
|
||||
} else {
|
||||
this.loadedEventAttachments[index]['remove'] = true
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
@@ -585,6 +645,7 @@ export class EditEventPage implements OnInit {
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
eventAgenda: true,
|
||||
select: true,
|
||||
}
|
||||
});
|
||||
@@ -593,7 +654,7 @@ export class EditEventPage implements OnInit {
|
||||
if (res) {
|
||||
const data = res.data;
|
||||
|
||||
const ApplicationIdDocumentToSave: any = {
|
||||
/* const ApplicationIdDocumentToSave: any = {
|
||||
SourceName: data.selected.Assunto,
|
||||
ParentId: this.postEvent.EventId,
|
||||
SourceId: data.selected.Id,
|
||||
@@ -606,11 +667,11 @@ export class EditEventPage implements OnInit {
|
||||
Source: '1',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
|
||||
this.postEvent.Attachments = this.loadedEventAttachments;
|
||||
this.loadedEventAttachments.push(data.selected)
|
||||
this.addedAttachmentsList.push(data.selected)
|
||||
|
||||
}
|
||||
})
|
||||
@@ -642,52 +703,52 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
onCheckboxChange(event: any) {
|
||||
console.log(this.postEvent.CalendarId)
|
||||
if (this.allDayCheck) {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
|
||||
onCheckboxChange(event: any) {
|
||||
console.log(this.postEvent.CalendarId)
|
||||
if (this.allDayCheck) {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user