Hi Nevitha,
Thank you for your
response. Unfortunately, that's not what I'm looking for. I don't need to
programmatically add a reminder. What I need is for an end user to be able to
specify if they want to have a reminder associated with an appointment and how
soon that reminder should pop up for the user.
In ideal scenario, the
New/Edit Event view (that the schedule component has) have a label “Remind me”
and a dropdown box right next to that label and that dropdown box would have
options like “Never”, “5 minutes before”, “15 minutes before”, etc. That way
the user can specify if they want the reminder and how soon. Going through your
documentation here https://ej2.syncfusion.com/angular/documentation/schedule/appointments/,
I could not find how to accomplish that.
Please let me know if my question is still not clear.
|
public eventData: any = [
{
Id: 1,
Subject: "Explosion of Betelgeuse Star",
StartTime: new Date(2021, 3, 20, 8, 0),
EndTime: new Date(2021, 3, 20, 12, 0),
Remainder: 5
},
{
Id: 2,
Subject: "Meeting",
StartTime: new Date(2021, 3, 21, 12, 0),
EndTime: new Date(2021, 3, 21, 16, 0),
Remainder: 15
},
{
Id: 3,
Subject: "Test Meeting",
StartTime: new Date(2021, 3, 23, 6, 0),
EndTime: new Date(2021, 3, 23, 13, 0),
Remainder: 0
}
];
refreshEventReminder(a) {
let scheduleObj: any = (document.querySelector(".e-schedule") as any)
.ej2_instances[0];
let toastObj: any = (document.querySelector(".e-toast") as any)
.ej2_instances[0];
let eventCollection = scheduleObj.getCurrentViewEvents();
eventCollection.forEach((event: { [key: string]: Object }, i: number) => {
let dateFormat: Function = (date: Date): Date =>
new Date(
date.getFullYear(),
date.getMonth(),
date.getDate(),
date.getHours(),
date.getMinutes()
);
let alertBeforeMinutes: any = event.Remainder;
let startTime: Date = dateFormat(event[
scheduleObj.eventFields.startTime
] as Date);
let currentTime: Date = dateFormat(new Date());
if (
alertBeforeMinutes !== 0 &&
currentTime.getTime() ===
startTime.getTime() - 1000 * 60 * alertBeforeMinutes
) {
toastObj.show({
template: compile(
document.getElementById("toastEmail_template").innerHTML.trim()
)(event)
});
}
});
} |
|
onPopupOpen(args): void {
if (args.type === "Editor") {
// Create required custom elements in initial time
if (!args.element.querySelector(".custom-field-row")) {
let row: HTMLElement = createElement("div", { className: "custom-field-row" });
let formElement: HTMLElement = <HTMLElement>(args.element.querySelector(".e-schedule-form"));
formElement.firstChild.insertBefore(row, args.element.querySelector(".e-title-location-row"));
let container: HTMLElement = createElement("div", { className: "custom-field-container" });
let inputEle: HTMLInputElement = createElement("input", { className: "e-field", attrs: { name: "Remainder" } }) as HTMLInputElement;
container.appendChild(inputEle);
row.appendChild(container);
let drowDownList: DropDownList = new DropDownList({
dataSource: [
{ text: "Never", value: 0 },
{ text: "5 minutes before", value: 5 },
{ text: "15 minutes before", value: 15 }
],
fields: { text: "text", value: "value" },
value: args.data.Remainder || 0,
floatLabelType: "Always",
placeholder: "Add Remainder"
});
drowDownList.appendTo(inputEle);
inputEle.setAttribute("name", "Remainder");
}
}
} |