- Rechte "Klient Betreuung ansehen" und "Klient Abwesenheiten ansehen" MoK: - Zeitraumauswahl wird wieder aus den Benutzereinstellungen geladen - NHibernate Lazy-Loading von Contract->EmploymentType auf false gesetzt, um Probleme mit geschlossener Session im MoK-Mitarbeiterstundenkonto-Bericht zu umgehen - Eigene Scripte in Verzeichnis "ownsoft-Scripts" verschoben
99 lines
4.3 KiB
JavaScript
99 lines
4.3 KiB
JavaScript
// Wird aufgerufen, wenn sich der Wert der CheckBox ändert.
|
|
function changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, checkBoxIdSuffix, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids, allItemsCheckBoxId) {
|
|
try {
|
|
if(url === undefined || url === null) {
|
|
logError("url ist undefined oder null");
|
|
return;
|
|
}
|
|
|
|
var selectedItemOids = $("#" + popupId + " .popup-list-item-container input:checked").map(function () { return $(this).attr("id").split("-")[1]; }).get();
|
|
var allItemOids = $("#" + popupId + " .popup-list-item-container input[type=checkbox]").map(function () { return $(this).attr("id").split("-")[1]; }).get();
|
|
|
|
if(!isCustomer) {
|
|
$("#my-teams-checkbox" + allItemsCheckBoxSuffix).prop("checked", arrayContainsAllItems(selectedItemOids, teamMemberOids));
|
|
}
|
|
|
|
$("#" + allItemsCheckBoxId).prop("checked", arrayContainsAllItems(selectedItemOids, allItemOids));
|
|
|
|
$.get(url, { oidString: selectedItemOids.toString() }).done(function (jsonResult) {
|
|
updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids);
|
|
|
|
$("#one-day-scheduler-partial-container").load(filterAppointmentsUrl);
|
|
});
|
|
} catch(error) {
|
|
showErrorPopup(error);
|
|
}
|
|
}
|
|
|
|
// Wird aufgerufen, um die Liste mit den ausgewählten Objekten zu aktualisieren
|
|
function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids, allItemsCheckBoxId) {
|
|
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) {
|
|
showErrorPopup(error);
|
|
}
|
|
}
|
|
|
|
function removeSelectedItem(itemOid, itemSuffix, isCustomer, url, popupId, listId, itemIdPrefix, filterAppointmentsUrl, allItemsCheckBoxSuffix, teamMemberOids, allItemsCheckBoxId) {
|
|
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, allItemsCheckBoxId);
|
|
} catch(error) {
|
|
showErrorPopup(error);
|
|
}
|
|
} |