mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Allday feature added
This commit is contained in:
@@ -144,7 +144,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div *ngIf="allDayCheck" class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
@@ -164,7 +164,9 @@
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond"
|
||||
[touchUi]="touchUi">
|
||||
[touchUi]="touchUi"
|
||||
[hideTime]="true">
|
||||
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -172,6 +174,66 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="!allDayCheck" class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" floatLabel="never" class="date-hour-picker">
|
||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||
placeholder="Choose a date"
|
||||
[(ngModel)]="postEvent.StartDate"
|
||||
[max]="maxDate"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker1
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond"
|
||||
[touchUi]="touchUi"
|
||||
[hideTime]="false">
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div *ngIf="allDayCheck" class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" floatLabel="never" floatLabel="never" class="date-hour-picker">
|
||||
<input matInput [ngxMatDatetimePicker]="fim"
|
||||
placeholder="Choose a date"
|
||||
[(ngModel)]="postEvent.EndDate"
|
||||
[min]="postEvent.StartDate"
|
||||
[max]="maxDate"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #fim
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond"
|
||||
[hideTime]="true">
|
||||
>
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="!allDayCheck" class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100 d-flex">
|
||||
@@ -193,7 +255,8 @@
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond">
|
||||
[stepSecond]="stepSecond"
|
||||
[hideTime]="false">
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@@ -108,8 +108,6 @@ export class EditEventPage implements OnInit {
|
||||
this.isEventEdited = false;
|
||||
/* this.postEvent.EventRecurrence = { Type:'-1', LastOccurrence:''}; */
|
||||
this.postEvent = this.navParams.get('event');
|
||||
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;
|
||||
@@ -405,6 +403,7 @@ export class EditEventPage implements OnInit {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
} else {
|
||||
console.log('edid calendar id',this.postEvent.CalendarId);
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
|
||||
|
||||
if (window['reloadCalendar']) {
|
||||
@@ -643,26 +642,17 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
ajustMinuts(string) {
|
||||
var partes = string.split(' ');
|
||||
var horaMinuto = partes[1].split(':');
|
||||
if (horaMinuto[1] === '59') {
|
||||
horaMinuto[1] = '00';
|
||||
var novaString = partes[0] + ' ' + horaMinuto.join(':');
|
||||
|
||||
return novaString;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
}
|
||||
@@ -676,6 +666,28 @@ export class EditEventPage implements OnInit {
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user