bugs solved

This commit is contained in:
Eudes Inácio
2024-02-29 09:58:08 +01:00
parent 71699c3c39
commit d59f772859
5 changed files with 89 additions and 72 deletions
@@ -244,6 +244,9 @@ export class DocumentSetUpMeetingPage implements OnInit {
runValidation() {
this.validateFrom = true
if (new Date(this.postData.StartDate).getTime() > new Date(this.postData.EndDate).getTime()) {
this.toastService._badRequest("A data de fim não pode ser inferior a data de início do evento")
}
}
get dateValid() {
@@ -305,7 +308,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
async saveTask() {
if (this.loggeduser.Profile == 'MDGPR') {
if (this.loggeduser.Profile != 'PR') {
this.injectValidation()
this.runValidation()
if (this.Form.invalid) return false
@@ -45,17 +45,17 @@ export class EditEventPage implements OnInit {
validateFrom = false
postEvent: Event;
isRecurring:string;
isRecurring: string;
isEventEdited: boolean;
loadedEvent: Event;
eventBody: EventBody;
segment:string = "true";
profile:string;
segment: string = "true";
profile: string;
eventAttendees: EventPerson[];
selectedSegment: string;
selectedDate: Date;
initCalendarName: string;
caller:string;
caller: string;
recurringTypes: any;
selectedRecurringType: any;
@@ -68,7 +68,7 @@ export class EditEventPage implements OnInit {
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0,10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0, 10)
public maxDate: any;
public stepHour = 1;
public stepMinute = 15;
@@ -107,18 +107,19 @@ export class EditEventPage implements OnInit {
this.isEventEdited = false;
/* this.postEvent.EventRecurrence = { Type:'-1', LastOccurrence:''}; */
this.postEvent = this.navParams.get('event');
// console.log(this.postEvent);
this.postEvent.StartDate = new Date(this.ajustMinuts(this.postEvent.StartDate))
this.postEvent.EndDate = new Date(this.ajustMinuts(this.postEvent.EndDate))
this.caller = this.navParams.get('caller');
this.initCalendarName = this.postEvent.CalendarName;
for(const index in this.postEvent.Attendees) {
for (const index in this.postEvent.Attendees) {
const user = this.postEvent.Attendees[index]
const userData = this.contactsService.constacts.find(e => user.EmailAddress == e.EmailAddress)
if(userData) {
if (userData) {
this.postEvent.Attendees[index].UserType = userData.UserType
}
@@ -126,20 +127,20 @@ export class EditEventPage implements OnInit {
if(this.postEvent){
if( this.postEvent.Body){
if(typeof(this.postEvent.Body.Text) == 'string'){
if (this.postEvent) {
if (this.postEvent.Body) {
if (typeof (this.postEvent.Body.Text) == 'string') {
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
}
}
}
if(this.postEvent.Attendees == null) {
if (this.postEvent.Attendees == null) {
this.taskParticipants = []
} else {
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired){
this.postEvent.Attendees.forEach(e => {
if (e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
@@ -147,7 +148,7 @@ export class EditEventPage implements OnInit {
})
}
if(this.postEvent.IsRecurring == false) {
if (this.postEvent.IsRecurring == false) {
this.isRecurring = "Não se repete";
}
else {
@@ -165,12 +166,12 @@ export class EditEventPage implements OnInit {
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth >= 1024) {
if (window.innerWidth >= 1024) {
this.modalController.dismiss();
}
}
if(window.innerWidth > 800){
this.showAttendees=true;
if (window.innerWidth > 800) {
this.showAttendees = true;
}
this.getRecurrenceTypes();
@@ -185,8 +186,8 @@ export class EditEventPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
@@ -202,11 +203,11 @@ export class EditEventPage implements OnInit {
goBack() {
this.router.navigate(['/home',this.caller]);
this.router.navigate(['/home', this.caller]);
}
getRecurrenceTypes() {
this.eventsService.getRecurrenceTypes().subscribe(res=>{
this.eventsService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
@@ -217,7 +218,7 @@ export class EditEventPage implements OnInit {
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
@@ -234,40 +235,40 @@ export class EditEventPage implements OnInit {
return date
}
roundTimeQuarterHourPlus15(date:Date) {
roundTimeQuarterHourPlus15(date: Date) {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
const minutes = _date.getMinutes();
_date.setMinutes(minutes + 15)
return _date
}
onSelectedRecurringChanged(ev?:any) {
onSelectedRecurringChanged(ev?: any) {
this.calculetedLastOccurrence(ev);
if(ev.length > 1){
if (ev.length > 1) {
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0){
if (ev.length == 0) {
this.selectedRecurringType = "-1";
}
}
calculetedLastOccurrence(type:number){
calculetedLastOccurrence(type: number) {
// console.log(type);
var valor;
var opcao: boolean;
if (type == 0) {
valor = 7;
opcao = true;
} else if(type == 1){
} else if (type == 1) {
valor = 30;
opcao = true;
} else if(type == 2){
} else if (type == 2) {
valor = 1;
opcao = false;
}else if(type == 3){
} else if (type == 3) {
valor = 5;
opcao = false;
}
@@ -275,7 +276,7 @@ export class EditEventPage implements OnInit {
}
defineLastOccurrence(valor:number, opcao:boolean){
defineLastOccurrence(valor: number, opcao: boolean) {
var time = new Date(this.postEvent.EndDate);
if (opcao == true) {
time.setDate(time.getDate() + valor);
@@ -317,10 +318,10 @@ export class EditEventPage implements OnInit {
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
Validators.required
]),
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime()? 'ok': null,[
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
Validators.required
]),
@@ -333,7 +334,7 @@ export class EditEventPage implements OnInit {
openInicio() {
let input: any = document.querySelector('#new-inicio')
if(input) {
if (input) {
input.click()
}
@@ -341,14 +342,14 @@ export class EditEventPage implements OnInit {
openFim() {
let input: any = document.querySelector('#new-fim')
if(input) {
if (input) {
input.click()
}
}
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if(input) {
if (input) {
input.click()
}
}
@@ -359,8 +360,8 @@ export class EditEventPage implements OnInit {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false;
if(this.selectedRecurringType != '-1') {
if (this.Form.invalid) return false;
if (this.selectedRecurringType != '-1') {
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
}
@@ -371,14 +372,14 @@ export class EditEventPage implements OnInit {
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
if(window['reloadCalendar']) {
if (window['reloadCalendar']) {
window['reloadCalendar']()
}
if(this.initCalendarName != this.postEvent.CalendarName) {
if (this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
@@ -386,7 +387,7 @@ export class EditEventPage implements OnInit {
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
} catch (error) { }
finally {
}
@@ -400,11 +401,11 @@ export class EditEventPage implements OnInit {
} else {
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
if(window['reloadCalendar']) {
if (window['reloadCalendar']) {
window['reloadCalendar']()
}
if(this.initCalendarName != this.postEvent.CalendarName) {
if (this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
@@ -412,7 +413,7 @@ export class EditEventPage implements OnInit {
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
} catch (error) { }
finally {
}
@@ -440,11 +441,11 @@ export class EditEventPage implements OnInit {
try {
for( let e of this.loadedEventAttachments) {
for (let e of this.loadedEventAttachments) {
const id: any = e.Id
const remove = e['remove']
if ( id == 'add') {
if (id == 'add') {
//data.selected
const DocumentToSave = {
SourceTitle: e.SourceName,
@@ -459,7 +460,7 @@ export class EditEventPage implements OnInit {
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
} else if(remove) {
} else if (remove) {
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
}
}
@@ -477,8 +478,8 @@ export class EditEventPage implements OnInit {
}
async openAttendees() {
if(window.innerWidth > 801) {
this.showAttendees=true;
if (window.innerWidth > 801) {
this.showAttendees = true;
}
else {
const modal = await this.modalController.create({
@@ -496,18 +497,18 @@ export class EditEventPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data){
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
if(newAttendees.length) {
if (newAttendees.length) {
this.setIntervenient(newAttendees);
} else {
this.setIntervenient([]);
}
if(newAttendeesCC) {
if (newAttendeesCC) {
this.setIntervenientCC(newAttendeesCC);
} else {
this.setIntervenientCC([]);
@@ -539,7 +540,7 @@ export class EditEventPage implements OnInit {
this.openAttendees();
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
}
@@ -547,11 +548,11 @@ export class EditEventPage implements OnInit {
getAttachments(eventId: string) {
if(this.postEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
if (this.postEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(eventId).subscribe(res => {
this.loadedEventAttachments = res;
},((erro) => {
}, ((erro) => {
console.error('editgetAttchament', erro)
}));
}
@@ -563,8 +564,8 @@ export class EditEventPage implements OnInit {
const id: any = this.loadedEventAttachments[index].Id
if(id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e,i)=> i!=index)
if (id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else {
this.loadedEventAttachments[index]['remove'] = true
}
@@ -583,8 +584,8 @@ export class EditEventPage implements OnInit {
}
});
modal.onDidDismiss().then( async (res)=> {
if(res) {
modal.onDidDismiss().then(async (res) => {
if (res) {
const data = res.data;
const ApplicationIdDocumentToSave: any = {
@@ -617,7 +618,7 @@ export class EditEventPage implements OnInit {
setTimeout(() => {
if(this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Oficial'] && this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Pessoal']) {
if (this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Oficial'] && this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
@@ -635,4 +636,16 @@ export class EditEventPage implements OnInit {
}, 50)
}
ajustMinuts(string) {
var data = new Date(string);
if (data.getMinutes() === 59) {
data.setMinutes(0);
var novaString = data.toISOString().slice(0, 16).replace("T", " ");
return novaString;
} else {
return string;
}
}
}
@@ -126,9 +126,6 @@ export class NewEventPage implements OnInit {
this.selectedDate = this.navParams.get('eventSelectedDate');
this.taskParticipants = this.navParams.get('attendees');
this.CalendarDate = this.navParams.get('CalendarDate')
this.postEvent.StartDate = this.navParams.get('DefaultStartDate')
this.postEvent.EndDate = this.navParams.get('DefaultEndDate')
console.log('end date', this.postEvent.EndDate)
}
ngOnInit() {
@@ -219,6 +219,7 @@ export class ViewEventPage implements OnInit {
div.innerHTML = res.Body.Text
res.Body.Text = div.innerText */
this.loadedEvent = res;
console.log('pass,',res)
this.setTimeZone()
// this.addEventToDb(res);
@@ -258,6 +258,9 @@ export class BookMeetingModalPage implements OnInit {
runValidation() {
this.validateFrom = true
if (new Date(this.dateStart).getTime() > new Date(this.dateEnd).getTime()) {
this.toastService._badRequest("A data de fim não pode ser inferior a data de início do evento")
}
}
get dateValid() {