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
73 lines
2.7 KiB
JavaScript
73 lines
2.7 KiB
JavaScript
function changeResourceSelection(popupId, url, listId, listItemIdPrefix, checkBoxIdPrefix, filterAppointmentsUrl) {
|
|
var selectedOids = [];
|
|
var oidString = "";
|
|
|
|
$("#" + popupId + " input:checked").each(function () {
|
|
var id = $(this).attr("id");
|
|
|
|
selectedOids.push(id.split("-")[1]);
|
|
});
|
|
|
|
for (var i = 0; i < selectedOids.length; i++) {
|
|
oidString += selectedOids[i] + ",";
|
|
}
|
|
|
|
$.get(url, { resourceOids: oidString }).done(function (jsonResult) {
|
|
updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url, filterAppointmentsUrl);
|
|
|
|
if(popupId === "resources-popup2") {
|
|
var selectedResources = $.parseJSON(jsonResult);
|
|
|
|
$("#resource-count2").text(selectedResources.length);
|
|
}
|
|
|
|
$("#one-day-scheduler-partial-container").load(filterAppointmentsUrl);
|
|
});
|
|
}
|
|
|
|
function updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url, filterAppointmentsUrl) {
|
|
var list = $("#" + listId);
|
|
|
|
list.empty();
|
|
|
|
if (isEmptyOrSpaces(jsonResult)) {
|
|
return;
|
|
}
|
|
|
|
var resourceList = $.parseJSON(jsonResult);
|
|
|
|
$.each(resourceList, function (index, customListItem) {
|
|
var listItemId = listItemIdPrefix + customListItem.ResourceOid;
|
|
var checkBoxId = "resource-" + customListItem.ResourceOid + checkBoxIdPrefix + "";
|
|
|
|
var html =
|
|
"<div class=\"list-group-item my-auto\" id=\"" + listItemId + "\">" +
|
|
"<div class=\"row\">" +
|
|
"<div class=\"input-group\">" +
|
|
"<div class=\"input-group-prepend\">" +
|
|
"<i class=\"fas fa-cubes text-bewo-resource h-100\"></i>" +
|
|
"</div>" +
|
|
"<p class=\"form-control border-0 bg-transparent text-truncate\">" + customListItem.Name + "<p>" +
|
|
"<div class=\"input-group-append\">" +
|
|
"<button class=\"btn btn-primary\" type=\"button\" onclick=\"removeSelectedResource('" + listItemId + "', '" + checkBoxId + "', '" + popupId + "', '" + url + "', '" + listId + "', '" + filterAppointmentsUrl + "')\"><span class=\"fas fa-times-circle\"></span></button>" +
|
|
"</div>" +
|
|
"</div>" +
|
|
"</div>" +
|
|
"</div>";
|
|
|
|
list.append(html);
|
|
});
|
|
}
|
|
|
|
function removeSelectedResource(listItemId, checkBoxId, popupId, url, listId, fetchAppointmentsUrl) {
|
|
$("#" + listItemId).remove();
|
|
|
|
var checkbox = $("#" + checkBoxId);
|
|
|
|
if (checkbox.length) {
|
|
checkbox.prop("checked", false);
|
|
}
|
|
|
|
changeResourceSelection(popupId, url, listId, null, null, fetchAppointmentsUrl);
|
|
}
|