ServiceRecord-Fremdschlüssel zu NewSchedulerAppointment-Tabelle hinzugefügt. Funktionalität ist noch nicht implementiert. MoK: Ziele/Maßnahmen verbessert; Suche funktioniert jetzt richtig Mehrfachbuchung implementiert Kalender: Termine sind jetzt löschbar, wenn Recht zu bearbeiten vorhanden ist. Unterscheidung zwischen Mitarbeiter-, Klienten-, und Ressourcenauswahl bei Ansicht und Formular
119 lines
4.5 KiB
JavaScript
119 lines
4.5 KiB
JavaScript
// Wird aufgerufen, wenn sich der Wert der CheckBox ändert.
|
|
function changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, checkBoxIdSuffix, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids) {
|
|
try {
|
|
if (url === undefined || url === null) {
|
|
logError("url ist undefined oder null");
|
|
return;
|
|
}
|
|
|
|
var oidStr = "";
|
|
var oids = [];
|
|
var allChecked = true;
|
|
|
|
$("#" + popupId + " input[type=checkbox]").each(function () {
|
|
var id = $(this).attr("id").split("-")[1];
|
|
|
|
if($.isNumeric(id) === false) {
|
|
return;
|
|
}
|
|
|
|
if ($(this).prop("checked")) {
|
|
oids.push(id);
|
|
oidStr += id + ",";
|
|
} else {
|
|
allChecked = false;
|
|
}
|
|
});
|
|
|
|
if(!isCustomer) {
|
|
$("#my-teams-checkbox" + allItemsCheckBoxSuffix).prop("checked", arrayContainsAllItems(oids, teamMemberOids));
|
|
}
|
|
|
|
if (allChecked === true) {
|
|
$("#all-" + (isCustomer ? "customers" : "employees") + "-checkbox" + allItemsCheckBoxSuffix).prop("checked", true);
|
|
} else {
|
|
$("#all-" + (isCustomer ? "customers" : "employees") + "-checkbox" + allItemsCheckBoxSuffix).prop("checked", false);
|
|
}
|
|
|
|
$.get(url, { oidString: oidStr }).done(function (jsonResult) {
|
|
updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids);
|
|
|
|
$("#one-day-scheduler-partial-container").load(filterAppointmentsUrl);
|
|
});
|
|
} catch(error) {
|
|
logError(error.message);
|
|
}
|
|
}
|
|
|
|
// Wird aufgerufen, um die Liste mit den ausgewählten Objekten zu aktualisieren
|
|
function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids) {
|
|
try {
|
|
if (isEmptyOrSpaces(jsonResult)) {
|
|
return;
|
|
}
|
|
|
|
var listItems = $.parseJSON(jsonResult);
|
|
|
|
var list = $("#" + listId);
|
|
list.empty();
|
|
|
|
var colorClass = "text-bewo-employee";
|
|
|
|
if(isCustomer === true) {
|
|
colorClass = "text-bewo-customers";
|
|
}
|
|
|
|
$.each(listItems, function (index, item) {
|
|
var oid;
|
|
|
|
if(isCustomer === true) {
|
|
oid = item.CustomerOid;
|
|
} else {
|
|
oid = item.EmployeeOid;
|
|
}
|
|
|
|
var id = itemIdPrefix + oid;
|
|
|
|
var removeParams = oid + ", '" + checkBoxIdSuffix + "', " + isCustomer + ", '" + url + "', '" + popupId + "', '" + listId + "', '" + itemIdPrefix + "', '" + filterAppointmentsUrl + "', '" + allItemsCheckBoxSuffix + "', " + teamMemberOids;
|
|
|
|
var html =
|
|
"<div class=\"list-group-item my-auto\" id=\"" + id + "\">" +
|
|
"<div class=\"row\">" +
|
|
"<div class=\"input-group\">" +
|
|
"<div class=\"input-group-prepend\">" +
|
|
"<i class='fas fa-user " + colorClass + " h-100'></i>" +
|
|
"</div>" +
|
|
"<p class=\"form-control border-0 bg-transparent text-truncate\">" +
|
|
item.LastName + ", " + item.FirstName +
|
|
"</p>" +
|
|
"<div class=\"input-group-append\">" +
|
|
'<button class="btn btn-primary ficken" type="button" onclick="removeSelectedItem(' + removeParams + ')">' +
|
|
"<span class='fas fa-times-circle'></span>" +
|
|
"</button>" +
|
|
"</div>" +
|
|
"</div>" +
|
|
"</div>" +
|
|
"</div>";
|
|
|
|
list.append(html);
|
|
});
|
|
} catch(error) {
|
|
logError(error.message);
|
|
}
|
|
}
|
|
|
|
function removeSelectedItem(itemOid, itemSuffix, isCustomer, url, popupId, listId, itemIdPrefix, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids) {
|
|
try {
|
|
var prefix = isCustomer ? "customer-" : "employee-";
|
|
|
|
var checkBox = $("#" + prefix + itemOid + itemSuffix);
|
|
|
|
if(checkBox.length) {
|
|
checkBox.prop("checked", false);
|
|
}
|
|
|
|
changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, itemSuffix, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids);
|
|
} catch(error) {
|
|
logError(error);
|
|
}
|
|
} |