// 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(false === checkJson(jsonResult)) { logWarning("updateSelectedList: Der zurückgegebene Wert ist kein gültiges JSON!"); hideSpinner(); return; } var listItems = parseJason(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 = "
" + "
" + "
" + "
" + "" + "
" + "

" + item.LastName + ", " + item.FirstName + "

" + "
" + '" + "
" + "
" + "
" + "
"; 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); } }