
|
<div class="control-section">
<div class="content-wrapper">
@Html.EJS().Schedule("schedule").Width("100%").Height("650px").QuickInfoTemplates(new ScheduleQuickInfoTemplates { Header = "#header-template", Content = "#content-template", Footer = "#footer-template" }).PopupOpen("OnPopupOpen").EventRendered("onEventRendered").EventSettings(e => e.DataSource(ViewBag.datasource)).SelectedDate(new DateTime(2018, 2, 15)).Render()
</div>
</div>
<script id="footer-template" type="text/x-template">
<div class="quick-info-footer">
${if (elementType == "cell")}
<div class="cell-footer">
<button id="more-details">More Details</button>
<button id="add">Add</button>
</div>
${else}
<div class="event-footer">
<button id="color">Change color</button>
<button id="set-color">Set color</button>
</div>
${/if}
</div>
</script>
function OnPopupOpen(args) {
if (["QuickInfo", "EditEventInfo"].indexOf(args.type) > -1) {
var colorBtn = args.element.querySelector("#color");
if (colorBtn) {
new ej.buttons.Button(
{ content: "color", cssClass: "e-flat" },
colorBtn
);
colorBtn.onclick = function (e) {
var header = document.querySelector(".quick-info-header-content");
header.style.backgroundColor = colors[colorIndex];
colorIndex = colorIndex === 5 ? 0 : colorIndex + 1;
};
}
var setColorBtn = args.element.querySelector("#set-color");
if (setColorBtn) {
new ej.buttons.Button(
{ content: "Set color", cssClass: "e-flat" },
setColorBtn
);
setColorBtn.onclick = function (e) {
var data = scheduleObj.activeEventData.event;
// Setting up the color to the appointment
data.CategoryColor = colors[colorIndex - 1];
// Updating the value of the event object
data.CustomData = "Edited data";
// Adding the changes in the event data using saveEvent method
scheduleObj.saveEvent(data);
};
}
}
} |
|
setColorBtn.onclick = function (e) {
var data = scheduleObj.activeEventData.event;
var isRecurrence = data.RecurrenceRule ? true : false;
data = isRecurrence ? scheduleObj.eventBase.getParentEvent(data) : data;
// Setting up the color to the appointment
data.CategoryColor = colors[colorIndex - 1];
// Updating the value of the event object
data.CustomData = "Edited data";
// Adding the changes in the event data using saveEvent method
if (isRecurrence) {
scheduleObj.saveEvent(data, "EditSeries");
} else {
scheduleObj.saveEvent(data);
}
}; |
|
setColorBtn.onclick = function (e) {
var data = scheduleObj.activeEventData.event;
var events = scheduleObj.eventsData;
var cusData;
if (data.CustomData == "Default data") {
cusData = events.filter(i => i.CustomData == "Default data");
} else {
cusData = events.filter(i => i.CustomData == "Custom data");
}
for (var i = 0; i < cusData.length; i++) {
cusData[i].CategoryColor = colors[colorIndex - 1];
var colorEvent = cusData[i];
var isRecurrence = cusData[i].RecurrenceRule ? true : false;
if (isRecurrence) {
scheduleObj.saveEvent(colorEvent, "EditSeries");
} else {
scheduleObj.saveEvent(colorEvent);
}
}
}; |
