145 lines
4.5 KiB
Plaintext
145 lines
4.5 KiB
Plaintext
@using BeWoPlanerMobil.Util.Constants
|
|
@using BeWoPlanerMobil.Util.SchedulerUtils
|
|
@using BS.Shared.DataContracts.Compact
|
|
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
|
|
|
|
@{
|
|
ViewBag.Title = "DevExpressScheduler";
|
|
}
|
|
|
|
<script type="text/javascript">
|
|
function UpdateSchedulerHeight() {
|
|
scheduler.SetHeight(1);
|
|
|
|
var containerHeight = ASPxClientUtils.GetDocumentClientHeight();
|
|
|
|
if(document.body.scrollHeight > containerHeight) {
|
|
containerHeight = document.body.scrollHeight;
|
|
}
|
|
|
|
scheduler.SetHeight(containerHeight);
|
|
}
|
|
|
|
function resizeSchedulerEditForm() {
|
|
const editFormPopup = $("#abc-table").parent().parent().parent();
|
|
|
|
const vw = $(window).width();
|
|
|
|
if(editFormPopup.outerWidth() !== undefined && vw < 678) {
|
|
const newWidth = vw * .95;
|
|
|
|
const allChildren = editFormPopup.parent().find("*");
|
|
|
|
allChildren.each((index, element) => {
|
|
const item = $(element);
|
|
|
|
if(item[0].tagName === "SCRIPT") {
|
|
return;
|
|
}
|
|
|
|
if(item.width() > newWidth) {
|
|
item.outerWidth(newWidth);
|
|
item.css("max-width", newWidth);
|
|
}
|
|
});
|
|
|
|
$("#abc-table").siblings().css("max-width", newWidth);
|
|
|
|
editFormPopup.outerWidth(newWidth);
|
|
editFormPopup.css("max-width", newWidth);
|
|
editFormPopup.css("left", "0");
|
|
editFormPopup.css("top", "0");
|
|
editFormPopup.css("position", "relative");
|
|
editFormPopup.css("margin", "0 auto");
|
|
}
|
|
}
|
|
|
|
function OnAppointmentFormSave(s, e) {
|
|
if(IsValidAppointment()) {
|
|
scheduler.AppointmentFormSave();
|
|
}
|
|
}
|
|
|
|
function IsValidAppointment() {
|
|
$.validator.unobtrusive.parse("form");
|
|
|
|
return $("form").valid();
|
|
}
|
|
|
|
function CloseCustomerGridLookup() {
|
|
CustomerGridLookup.ConfirmCurrentSelection();
|
|
CustomerGridLookup.HideDropDown();
|
|
}
|
|
|
|
function CloseEmployeeGridLookup() {
|
|
EmployeeGridLookup.ConfirmCurrentSelection();
|
|
EmployeeGridLookup.HideDropDown();
|
|
}
|
|
|
|
function CloseResourceGridLookup() {
|
|
ResourceGridLookup.ConfirmCurrentSelection();
|
|
ResourceGridLookup.HideDropDown();
|
|
}
|
|
|
|
ASPxClientControl.GetControlCollection().ControlsInitialized.AddHandler(function(s, e) {
|
|
UpdateSchedulerHeight();
|
|
});
|
|
|
|
ASPxClientControl.GetControlCollection().BrowserWindowResized.AddHandler(function(s, e) {
|
|
UpdateSchedulerHeight();
|
|
});
|
|
|
|
function onActiveViewChanged(s, e) {
|
|
$.get("@Url.Action("SelectActiveViewType")", { viewTypeName: e.newView });
|
|
}
|
|
|
|
function onMenuItemClicked(s, e) {
|
|
try {
|
|
if(e.itemName === "ToServiceRecord") {
|
|
e.handled = true;
|
|
scheduler.PerformCallback({ apptID: scheduler.GetSelectedAppointmentIds()[0], actionId: e.itemName });
|
|
}
|
|
|
|
if(e.itemName === "ShowAvailableEmployees") {
|
|
const start = scheduler.selection.interval.start;
|
|
const duration = scheduler.selection.interval.duration;
|
|
const tmpDate = new Date();
|
|
|
|
const end = new Date(tmpDate.setTime(start.getTime() + duration));
|
|
|
|
e.handled = true;
|
|
|
|
const startStr = getTimeStamp(start, false, false);
|
|
const endStr = getTimeStamp(end, false, false);
|
|
|
|
$("#scheduler-container").load("@Url.Action("CheckEmployeeAvailability")", {startString: startStr, endString: endStr});
|
|
}
|
|
} catch(error) {
|
|
console.error(error);
|
|
}
|
|
}
|
|
|
|
function OnAppointmentMenuPopup(s, e) {
|
|
const selectedAppointment = scheduler.GetAppointmentById(scheduler.GetSelectedAppointmentIds()[0]);
|
|
console.log(selectedAppointment);
|
|
for(let i = 0; i < e.item.items.length; i++) {
|
|
const currentItem = e.item.items[i];
|
|
|
|
if(currentItem.name === "ToServiceRecord") {
|
|
const isTask = selectedAppointment.customField("IsTask");
|
|
const isAbsenceTime = selectedAppointment.customField("IsAbsenceTime");
|
|
|
|
if(isTask === true || isAbsenceTime === true) {
|
|
currentItem.SetVisible(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
@using(Html.BeginForm())
|
|
{
|
|
<div id="scheduler-container">
|
|
@Html.Partial("SchedulerPagePartial", Model)
|
|
</div>
|
|
} |