add recurence to agenda web

This commit is contained in:
Eudes Inácio
2024-06-07 14:10:17 +01:00
parent 95bb69be99
commit 4be9c6562e
7 changed files with 90 additions and 30 deletions
+3 -1
View File
@@ -4,11 +4,13 @@ import { EventPerson } from './eventperson.model';
export interface EventRecurrence {
Type: number | string;
Type?: number | string;
Day?: number;
DayOfWeek?: number;
Month?: number | string;
LastOccurrence?: Date | string;
frequency?: string,
until?: string
}
export class Event{
@@ -98,8 +98,8 @@ export class AgendaDataRepositoryService {
attendees: this.utils.attendeesAdded(eventData.Attendees),
attachments: this.utils.documentAdded(documents),
recurrence: {
frequency: 0,
occurrences: 0,
frequency: this.utils.eventRecurence(eventData.EventRecurrence.frequency),
until: eventData.EndDate.toISOString(),
},
organizerId: SessionStore.user.UserId,
isAllDayEvent: eventData.IsAllDayEvent,
@@ -80,7 +80,7 @@ export const EventInputDTOSchema = z.object({
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
recurrence: z.object({
frequency: z.number().int(),
occurrences: z.number().int(),
until: z.string(),
}),
organizerId: z.number().int(),
isAllDayEvent: z.boolean(),
+35 -24
View File
@@ -3,16 +3,16 @@ import { AgendaDataService } from './agenda-data.service';
import { EventsService } from '../../events.service';
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class Utils {
constructor(
private agendaDataService: AgendaDataService,
public eventService: EventsService,
) { }
constructor(
private agendaDataService: AgendaDataService,
public eventService: EventsService,
) { }
selectedCalendarUserId(CalendarName,postEvent) {
selectedCalendarUserId(CalendarName, postEvent) {
if (this.eventService.calendarNamesType[CalendarName]?.['Oficial'] && postEvent.CalendarName == 'Oficial') {
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
@@ -60,8 +60,8 @@ export class Utils {
return selectedType[calendarName];
}
documentAdded(documents:any[]) {
console.log('added doc create event',documents)
documentAdded(documents: any[]) {
console.log('added doc create event', documents)
let listupdate = []
documents.forEach(element => {
let object = {
@@ -70,18 +70,18 @@ export class Utils {
description: "",
applicationId: element.applicationId
}
listupdate.push(object)
});
return listupdate
/* return documents.map((e) => {
return {
docId: e.docId,
sourceName: e.subject || e.sourceNames,
description: "",
applicationId: e.applicationId
};
}); */
/* return documents.map((e) => {
return {
docId: e.docId,
sourceName: e.subject || e.sourceNames,
description: "",
applicationId: e.applicationId
};
}); */
}
@@ -102,8 +102,8 @@ export class Utils {
atendeesSeletedType(type) {
var selectedType = {
'true': 0,
'false':1,
'other':2,
'false': 1,
'other': 2,
}
return selectedType[type];
}
@@ -115,7 +115,7 @@ export class Utils {
name: e.Name,
emailAddress: e.EmailAddress,
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
wxUserId: e.Id,
wxUserId: e.Id,
}
});
}
@@ -123,10 +123,10 @@ export class Utils {
statusEventAproval(type) {
var selectedType = {
'Pending': 0,
'Revision':1,
'Approved':2,
"Declined":3,
"Communicated":4
'Revision': 1,
'Approved': 2,
"Declined": 3,
"Communicated": 4
}
return selectedType[type];
}
@@ -141,4 +141,15 @@ export class Utils {
}
});
}
eventRecurence(type) {
var selectedType = {
'never': 0,
'daily': 1,
'weekly': 2,
"monthly": 3,
"yearly": 4
}
return selectedType[type];
}
}
@@ -132,6 +132,38 @@
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-repeat.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs">
<mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
<!-- <input matInput type="text" > -->
<mat-select [(value)]="eventRecurence" >
<mat-option value="never">
Nunca
</mat-option>
<mat-option value="daily">
Diário
</mat-option>
<mat-option value="weekly">
Semanalmente
</mat-option>
<mat-option value="monthly">
Mensal
</mat-option>
<mat-option value="yearly">
Anual
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div *ngIf="allDayCheck" class="container-div">
<div class="ion-item-class-2 d-flex" >
<div class="ion-icon-class">
@@ -82,6 +82,7 @@ export class NewEventPage implements OnInit {
selectedRecurringType: any;
loggedAttendDad: boolean = true;
mostrarModal = false;
eventRecurence = 'never'
@Input() attendees: []
@Input() profile: string;
@@ -232,7 +233,10 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
EventRecurrence: {
frequency: "never", until: this.autoEndTime,
Type: ''
},
};
}
else {
@@ -254,7 +258,8 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
EventRecurrence: { frequency: "never", until: this.autoEndTime,
Type: '' },
}
}
}
@@ -534,6 +539,8 @@ export class NewEventPage implements OnInit {
let loader = this.toastService.loading();
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.EventRecurrence.frequency = this.eventRecurence;
this.agendaDataRepository.createEvent(this.postEvent, this.CalendarName, this.documents).subscribe((value) => {
console.log(value)
+8
View File
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 512 512">
<path fill="none" stroke="#bdbfbe" stroke-linecap="round" stroke-linejoin="round"
stroke-width="32" d="m320 120l48 48l-48 48" />
<path fill="none" stroke="#bdbfbe" stroke-linecap="round" stroke-linejoin="round"
stroke-width="32" d="M352 168H144a80.24 80.24 0 0 0-80 80v16m128 128l-48-48l48-48" />
<path fill="none" stroke="#bdbfbe" stroke-linecap="round" stroke-linejoin="round"
stroke-width="32" d="M160 344h208a80.24 80.24 0 0 0 80-80v-16" />
</svg>

After

Width:  |  Height:  |  Size: 574 B