848 lines
33 KiB
JavaScript
848 lines
33 KiB
JavaScript
var timeOut = 10000;
|
|
|
|
zeitRegEx = /^(2[0-3]|[01]?[0-9])(:|,|\.|#|;)?([0-5][0-9])$/;
|
|
|
|
function loadServiceDescriptionsOnSuccess(json) {
|
|
if (json === "SessionTimeout") {
|
|
window.location.href = window.redirectLink;
|
|
return;
|
|
}
|
|
|
|
var liste = $.parseJSON(json);
|
|
var leistungenSelect = $("#leistungen_select");
|
|
|
|
leistungenSelect.empty();
|
|
leistungenSelect.val("");
|
|
|
|
$.each(liste, function (index, leistung) {
|
|
leistungenSelect.append('<option value="' + leistung.ServiceDescriptionOid + '">' + leistung.Name + "</option>");
|
|
});
|
|
|
|
if(liste[0] !== undefined) {
|
|
leistungenSelect.val(liste[0].ServiceDescriptionOid);
|
|
|
|
makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: liste[0].ServiceDescriptionOid }, null);
|
|
}
|
|
}
|
|
|
|
function showAjaxError(jqXHR, textStatus, errorThrown) {
|
|
hideSanduhr();
|
|
//if (jqXHR.status == 0) {
|
|
//toggleErrorPopup("Es besteht zurzeit keine Internetverbindung." +
|
|
// " Die Daten werden zwischengespeichert und beim nächsten Login an den Server gesendet. " + errorThrown,2);
|
|
//setTimeout(function () {
|
|
//showServiceRecords();
|
|
//}, timeOut);
|
|
//}
|
|
//else
|
|
|
|
if(jqXHR.status === 0) {
|
|
console.log("status is 0; ajax call aborted.\nError thrown: " + errorThrown + ";\nText status: " + textStatus);
|
|
return;
|
|
}
|
|
|
|
toggleErrorPopup(jqXHR.status + " " + errorThrown);
|
|
}
|
|
|
|
function showErrorMsg(message) {
|
|
toggleErrorPopup(message);
|
|
}
|
|
|
|
function resizeLabelColumns() {
|
|
$("#tabLbl").css("width", $("#zieleLbl").css("width"));
|
|
}
|
|
|
|
function toggleMenu() {
|
|
var menuDiv = $("#menu-div");
|
|
$(menuDiv).fadeToggle("fast");
|
|
}
|
|
|
|
function loadServiceDescriptions() {
|
|
var selectedCategory = $("#kategorien_select").find(":selected").val();
|
|
|
|
if (selectedCategory === null || selectedCategory === undefined) {
|
|
return;
|
|
}
|
|
|
|
makeAjaxCall("GET", window.loadServiceCategoriesUrl, loadServiceDescriptionsOnSuccess, { pServiceCategoryOid: selectedCategory }, null);
|
|
|
|
loadTextbausteineForServiceCategory(selectedCategory);
|
|
}
|
|
|
|
function setServiceDescription() {
|
|
var sdOid = $($("#leistungen_select")).find(":selected").val();
|
|
|
|
makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: sdOid }, null);
|
|
}
|
|
|
|
function selectServiceRecord(oid) {
|
|
$("#versteckt").val("Speichern");
|
|
$("html, body").animate({ scrollTop: 0 }, "fast");
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: window.setSelectedServiceRecordUrl,
|
|
data: { recordOid: oid },
|
|
success: function () {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: window.getSelectedRecordInformationUrl,
|
|
success: function (jsonServiceRecord) {
|
|
try {
|
|
if(jsonServiceRecord === "SessionTimeout") {
|
|
window.location.href = window.redirectLink;
|
|
return;
|
|
}
|
|
|
|
var record = $.parseJSON(jsonServiceRecord);
|
|
|
|
var goals = record.Goals;
|
|
|
|
var idArray = new Array();
|
|
var meinGoalsArray = new Array();
|
|
|
|
var j = 0;
|
|
for(var i = 0; i < goals.length; i++) {
|
|
if(goals[i].ValueListEntryOid !== undefined) {
|
|
idArray[j] = goals[i].ValueListEntryOid;
|
|
j++;
|
|
}
|
|
}
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: window.loadGoalsUrl,
|
|
data: { pCostbearer2SupportConceptOid: $($("#scDropDown")).find(":selected").val() },
|
|
success: function (goalsJson) {
|
|
if (goalsJson === "SessionTimeout") {
|
|
window.location.href = window.redirectLink;
|
|
return;
|
|
}
|
|
|
|
try {
|
|
meinGoalsArray = goalsJson !== "" ? $.parseJSON(goalsJson) : "";
|
|
} catch (exception) {
|
|
console.log("Fehler beim JSON Parsing von selectServiceRecord(" + oid + "): " + exception.message);
|
|
}
|
|
|
|
var rawStartDateStr = record.Start[18] === "1" ? "" : record.Start.slice(11, 16);
|
|
var rawEndDateStr = record.End[18] === "1" ? "" : record.End.slice(11, 16);
|
|
var startDateYearStr = record.Start.slice(0, 4);
|
|
var startDateMonthStr = record.Start.slice(5, 7);
|
|
var startDateDayStr = record.Start.slice(8, 10);
|
|
var dateStr = startDateDayStr + "." + startDateMonthStr + "." + startDateYearStr;
|
|
|
|
var endDateYearStr = record.End.slice(0, 4);
|
|
var endDateMonthStr = record.End.slice(5, 7);
|
|
var endDateDayStr = record.End.slice(8, 10);
|
|
var endDateDateStr = endDateDayStr + "." + endDateMonthStr + "." + endDateYearStr;
|
|
|
|
$("#start_textbox").val(rawStartDateStr);
|
|
$("#ende_textbox").val(rawEndDateStr);
|
|
$("#datum_textbox").val(dateStr);
|
|
$("#notiz_textbox").val(record.Notice);
|
|
|
|
$("#enddatum_textbox").val(endDateDateStr);
|
|
$("#notiz_textbox1").val(record.Notice);
|
|
$("#notiz_textbox2").val(record.Notice2);
|
|
$("#notiz_textbox3").val(record.Notice3);
|
|
$("#notiz_textbox4").val(record.Notice4);
|
|
$("#notiz_textbox5").val(record.Notice5);
|
|
|
|
$("#duration_textbox").val(record.RoundedDuration);
|
|
|
|
$("#distance_textbox").val(record.DistanceInMeter);
|
|
|
|
$("#employeesDropDown").val(record.Employee.EmployeeOid);
|
|
|
|
window.serviceRecordEmployeeOid = record.Employee.EmployeeOid;
|
|
|
|
actuallyBuildCollapsibleSet(meinGoalsArray, idArray);
|
|
|
|
$("#anlegenEditierenBtn").val("Speichern");
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: window.loadServiceCategoriesUrl,
|
|
success: function (result) {
|
|
if (isEmptyOrSpaces(result)) {
|
|
window.location.href = window.redirectLink;
|
|
return;
|
|
}
|
|
|
|
if (result === "SessionTimeout") {
|
|
window.location.href = redirectLink;
|
|
return;
|
|
}
|
|
|
|
$("#kategorien_select").val(record.ServiceDescription.Category.ServiceCategoryOid);
|
|
|
|
var liste = $.parseJSON(result);
|
|
$("#leistungen_select").empty();
|
|
$("#leistungen_select").val("");
|
|
|
|
$.each(liste, function (index, leistung) {
|
|
$("#leistungen_select").append('<option value="' + leistung.ServiceDescriptionOid + '">' + leistung.Name + '</option>');
|
|
});
|
|
|
|
$("#leistungen_select").val(record.ServiceDescription.ServiceDescriptionOid);
|
|
|
|
makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: record.ServiceDescription.ServiceDescriptionOid }, null);
|
|
|
|
toggleLabel("distance_textbox");
|
|
toggleLabel("duration_textbox");
|
|
toggleLabel("start_textbox");
|
|
toggleLabel("ende_textbox");
|
|
|
|
$("input").prop("disabled", false);
|
|
$("#abbrechenBtn").prop("disabled", true);
|
|
$("select").prop("disabled", false);
|
|
|
|
toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container");
|
|
toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container");
|
|
toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container");
|
|
toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container");
|
|
|
|
$("#abbrechenBtn").prop("disabled", false);
|
|
|
|
if (isInGroupBookingMode()) {
|
|
$("#changeBookingModeCheckBox").prop("checked", false);
|
|
|
|
console.log("Gruppenbuchungsmodus abgewählt");
|
|
|
|
makeAjaxCall("GET", window.resetGroupBookingModeViaGETUrl, function (result) {
|
|
$("#changeBookingModeCheckBox").prop("checked", false);
|
|
$("#leftContent input[type=checkbox]").prop("checked", false);
|
|
$("#rightContent input[type=checkbox]").prop("checked", false);
|
|
$("#employeeCollapsible input[type=checkbox]").prop("checked", false);
|
|
|
|
$("#selectSCForm").show();
|
|
|
|
if (result.toLowerCase() === "true") {
|
|
$("#singleSCEmployeeSelectionContainer").show();
|
|
}
|
|
|
|
$("#groupBookingOpenPopupBtn").hide();
|
|
$("#groupBookingOpenEmployeeSelectionPopupBtn").hide();
|
|
}, null, null);
|
|
}
|
|
|
|
hideSanduhr();
|
|
},
|
|
error: showErrorMsg,
|
|
data: { pServiceCategoryOid: record.ServiceDescription.Category.ServiceCategoryOid }
|
|
});
|
|
},
|
|
error: showAjaxError,
|
|
complete: hideSanduhr
|
|
});
|
|
|
|
} catch (exception1) {
|
|
console.log('Fehler beim JSON Parsing von selectServiceRecord(' + oid + '): ' + exception1.message);
|
|
}
|
|
},
|
|
error: showAjaxError
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function activateForm(actionPath, shouldLoadServiceDescriptions) {
|
|
$("input").prop("disabled", false);
|
|
$("textarea").prop("disabled", false);
|
|
$(".doku-tab-link").prop("disabled", false);
|
|
$("#kategorien_select, #leistungen_select, #recordLoader_select, #textbausteine_select, #employeesDropDown").prop("disabled", false);
|
|
|
|
//toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container");
|
|
//toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container");
|
|
// toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container");
|
|
// toggleSelectClassesForElement("#employeesDropDown", "#employee-select-container");
|
|
|
|
loadGoals(actionPath);
|
|
|
|
$("#kategorien_select").val($("#kategorien_select option").eq(0).val());
|
|
|
|
if(shouldLoadServiceDescriptions) {
|
|
loadServiceDescriptions();
|
|
}
|
|
}
|
|
|
|
function resetRecordForm() {
|
|
showSanduhr();
|
|
|
|
$("#versteckt").val("Anlegen");
|
|
$("#anlegenEditierenBtn").val("Anlegen");
|
|
|
|
clearZED();
|
|
|
|
if (isInGroupBookingMode()) {
|
|
$("#changeBookingModeCheckBox").prop("checked", false);
|
|
showSanduhr();
|
|
$("#groupBookingForm").submit();
|
|
}
|
|
|
|
$("#start_textbox").val("").trigger("change");
|
|
$("#ende_textbox").val("").trigger("change");
|
|
$("#notiz_textbox").val("").trigger("change");
|
|
$("#duration_textbox").val("").trigger("change");
|
|
$("#distance_textbox").val("").trigger("change");
|
|
|
|
$("#datum_textbox").val(getDateStringWithLeadingZeros(new Date()));
|
|
$("#enddatum_textbox").val(getDateStringWithLeadingZeros(new Date()));
|
|
|
|
$("#kategorien_select").val($("#kategorien_select option").eq(0).val());
|
|
|
|
for(var i = 0; i < numberOfDocumentationTypes; i++) {
|
|
$("#notiz_textbox" + (i + 1)).val("");
|
|
}
|
|
|
|
var selectedCategory = $("#kategorien_select").find(":selected").val();
|
|
|
|
if(isInEditingMode()) {
|
|
makeAjaxCall("POST", window.resetEditingModeUrl, function(response) { window.location.reload(); }, { pFormCollection: null }, null);
|
|
}
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: loadServiceCategoriesUrl,
|
|
data: { pServiceCategoryOid: selectedCategory },
|
|
success: function (json) {
|
|
loadServiceDescriptionsOnSuccess(json);
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: setSelectedServiceRecordUrl,
|
|
data: { recordOid: null },
|
|
success: function () {
|
|
loadGoals(loadGoalsUrl);
|
|
|
|
hideSanduhr();
|
|
},
|
|
error: showAjaxError
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function toggleOnclick(element) {
|
|
var collapsedDiv = $(element).next("div");
|
|
var isHidden = "none" === $(collapsedDiv).css("display");
|
|
var newIcon = "url('";
|
|
newIcon += isHidden ? toggleIconUContentUrl : toggleIconDContentUrl;
|
|
newIcon += "')";
|
|
|
|
$(element).css("background-image", newIcon);
|
|
$(collapsedDiv).fadeToggle("fast");
|
|
}
|
|
|
|
$(document).mouseup(function(e) {
|
|
var menu = $("#menu-div");
|
|
var menuBtn = $("#menu-btn");
|
|
|
|
if(!menu.is(e.target) && !menuBtn.is(e.target) && menu.has(e.target).length === 0) {
|
|
menu.fadeOut("fast");
|
|
}
|
|
});
|
|
|
|
function saveCreateServicerecod() {
|
|
showSanduhr();
|
|
|
|
validateServiceRecordBeforeSubmit();
|
|
}
|
|
|
|
function validateTimeField(id) {
|
|
var timeStr = $(id).val();
|
|
var zeitStr = id === "#start_textbox" ? "Start" : "End";
|
|
|
|
if (timeStr !== "" && !zeitRegEx.test(timeStr)) {
|
|
showZeiterfassungsError("Bitte geben Sie eine " + zeitStr + "-Zeit in einem gültigen Format (HH:MM oder HHMM) an.");
|
|
return false;
|
|
} else {
|
|
clearZED();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function togglePopup(serviceRecordOid) {
|
|
$("#oidHolder").val(serviceRecordOid);
|
|
var popupDiv = $("#popupDiv");
|
|
|
|
var isShowing = $(".modalWrapper").css("display") === "none";
|
|
var displayValue = $(".modalWrapper").css("display") === "block" ? "none" : "block";
|
|
|
|
toggleModalWrapper();
|
|
popupDiv.css("display", displayValue);
|
|
|
|
if (isShowing) {
|
|
var titleOuterHeight = $("#popupTitle").outerHeight();
|
|
var textOuterHeight = $("#popupText").outerHeight();
|
|
var buttonDivOuterHeight = $("#popupBtnDiv").outerHeight();
|
|
var btnOuterHeight = $(".popupBtn").outerHeight();
|
|
|
|
var newHeight = titleOuterHeight + textOuterHeight + buttonDivOuterHeight + btnOuterHeight + btnOuterHeight;
|
|
|
|
popupDiv.css("height", newHeight + "px");
|
|
|
|
popupDiv.css("top", window.pageYOffset + window.innerHeight / 2 - newHeight / 2);
|
|
popupDiv.css("margin-top", "0");
|
|
} else {
|
|
popupDiv.css("margin-top", "auto");
|
|
}
|
|
}
|
|
|
|
function toggleModalWrapper() {
|
|
var displayValue = $(".modalWrapper").css("display") === "block" ? "none" : "block";
|
|
|
|
$(".modalWrapper").css("display", displayValue);
|
|
$(".modalWrapper").css("height", $(document).height());
|
|
}
|
|
|
|
function ErfolgteSpx() {
|
|
if (document.getElementById("SaveSignature").value === "True") {
|
|
|
|
toggleSuccessPopup("Eintrag wurde gespeichert." + "\n" + "Möchte Sie diesen unterschreiben lassen?", 4);
|
|
document.getElementById("SaveSignature").value = "False";
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: SetSaveSignatureUrl,
|
|
data: { save: false }
|
|
});
|
|
}
|
|
}
|
|
|
|
function initSignatureInfo(serviceRecordOid){
|
|
$.ajax({
|
|
type: "GET",
|
|
url: getSelectedRecordInformationUrlWithOid,
|
|
data: {oid: serviceRecordOid},
|
|
success: function(jsonServiceRecord) {
|
|
try {
|
|
if(jsonServiceRecord === "SessionTimeout") {
|
|
window.location.href = redirectLink;
|
|
return;
|
|
}
|
|
|
|
var record = $.parseJSON(jsonServiceRecord);
|
|
|
|
var startDate = record.Start[18] === "1" ? "" : record.Start.slice(11, 16);
|
|
var endDate = record.End[18] === "1" ? "" : record.End.slice(11, 16);
|
|
var jahr = record.Start.slice(0, 4);
|
|
var monat = record.Start.slice(5, 7);
|
|
var tag = record.Start.slice(8, 10);
|
|
var datum = tag + "." + monat + "." + jahr;
|
|
var serviceDescriptionName = record.ServiceDescription.Name;
|
|
var serviceCategoryName = record.ServiceDescription.Category.Name;
|
|
|
|
var zahl2 = $("#scDropDown").val();
|
|
|
|
$("#UnterschriftHilfeplan").val('HilfePlan: ' + $("#scDropDown option[value='" + zahl2 + "']").text());
|
|
$("#UnterschriftEmployee").val('Mitarbeiter: ' + record.Employee.FirstName + ' ' + record.Employee.LastName);
|
|
$("#UnterschriftKategorie").val('Kategorie: ' + serviceCategoryName);
|
|
$("#UnterschriftLeistung").val('Leistungen: ' + serviceDescriptionName);
|
|
$("#UnterschriftDatum").val('Datum / Uhrzeit: ' + datum + ' / ' + startDate + ' - ' + endDate);
|
|
|
|
$("#SaveRecordOID").val(serviceRecordOid);
|
|
|
|
console.log('Loading data for service record: ' + $("#SaveRecordOID").value);
|
|
} catch(exception) {
|
|
console.log('Error: ' + + '');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// Man kann nur eine fatale Fehlermeldung auf einmal anzeigen. Ein Aufruf dieser Methode bei einem bereits angezeigten Fehler führt dazu, dass das Popup wieder unsichtbar geschaltet wird.
|
|
function writeFatalErrorMessage(msg, i) {
|
|
toggleErrorPopup(msg, i);
|
|
}
|
|
|
|
function showZeiterfassungsError(msg) {
|
|
$("#zeiterfassungsErrorTableRow").css("display", "table-row");
|
|
$("#zeiterfassungsErrorTableCell").css("display", "table-cell");
|
|
$("#zeiterfassungsErrorDisplay").html(msg + "<br />");
|
|
}
|
|
|
|
function clearZED() {
|
|
$("#zeiterfassungsErrorTableRow").hide();//.css("display", "none");
|
|
$("#zeiterfassungsErrorDisplay").empty();
|
|
}
|
|
|
|
function showServiceRecords() {
|
|
location.reload();
|
|
|
|
$("#customersDropDown").val($("#customersDropDown option").eq(0).val());
|
|
$("#klientenTabelle").hide();
|
|
$("#zeiterfassung").show();
|
|
$("#KalenderNavigation").hide();
|
|
$("#klienten").hide();
|
|
$("#Kalender").hide();
|
|
$("#colorRibbon").css("background-color", "#c80000");
|
|
$("#UnterschriftBereich").hide();
|
|
|
|
$("#Statistics").show();
|
|
$("#SupportStatistik").hide();
|
|
|
|
toggleMenu();
|
|
}
|
|
|
|
function showSanduhr() {
|
|
$(".modalWrapper").show();
|
|
$(".modalWrapper").css("height", $(document).height());
|
|
$(".warte-animation").css("display", "inline-block");
|
|
|
|
}
|
|
|
|
function hideSanduhr() {
|
|
if($("#errorPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") {
|
|
$(".modalWrapper").hide();
|
|
$(".modalWrapper").css("height", "0");
|
|
}
|
|
|
|
if($("#SuccessPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") {
|
|
$(".modalWrapper").hide();
|
|
$(".modalWrapper").css("height", "0");
|
|
}
|
|
|
|
if($("#AendernPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") {
|
|
$(".modalWrapper").hide();
|
|
$(".modalWrapper").css("height", "0");
|
|
}
|
|
|
|
$(".warte-animation").hide();
|
|
}
|
|
|
|
function submitDeletionForm() {
|
|
showSanduhr();
|
|
$("#deletionForm").submit();
|
|
}
|
|
|
|
function toggleErrorPopup(errorMessage, i) {
|
|
var isDisplayNone = $("#errorPopupDiv").css("display") === "none";
|
|
var displayValue = isDisplayNone ? "block" : "none";
|
|
|
|
$("#errorPopupDiv").css("display", displayValue);
|
|
$(".modalWrapper").css("display", displayValue);
|
|
$(".modalWrapper").css("height", $(document).height());
|
|
|
|
if(isDisplayNone ) {
|
|
$("#errorPopupText").text(errorMessage);
|
|
|
|
if(i === 1) {
|
|
$("#errorPopupTitle").text("Info");
|
|
$("#errorPopupOkBtn").onclick = "toggleErrorPopup('')";
|
|
} else if(i === 2) {
|
|
$("#errorPopupTitle").text("Fehler");
|
|
$("#errorPopupOkBtn").onclick = "toggleErrorPopup('')";
|
|
|
|
clearLocalStorage(1);
|
|
//SaveOnly(); // Speichere Daten bei absturz
|
|
}
|
|
else {
|
|
$("#errorPopupTitle").text("Fehler");
|
|
$("#errorPopupOkBtn").onclick = "toggleErrorPopup('')";
|
|
}
|
|
|
|
var errorPopupTitleOuterHeight = $("#errorPopupTitle").outerHeight();
|
|
var errorPopupTextOuterHeight = $("#errorPopupText").outerHeight();
|
|
var errorPopupButtonOuterHeight = $("#errorPopupBtnDiv").outerHeight();
|
|
var errorPopupOkButtonOuterHeight = $("#errorPopupOkBtn").outerHeight();
|
|
|
|
var height = errorPopupTitleOuterHeight + errorPopupTextOuterHeight + errorPopupButtonOuterHeight + errorPopupOkButtonOuterHeight + errorPopupOkButtonOuterHeight;
|
|
|
|
$("#errorPopupDiv").css("height", height + "px");
|
|
|
|
$("#errorPopupDiv").css("top", window.pageYOffset + window.innerHeight / 2 - height / 2);
|
|
$("#errorPopupDiv").css("margin-top", "0");
|
|
} else {
|
|
$("#errorPopupDiv").css("margin-top", "auto");
|
|
}
|
|
}
|
|
|
|
function toggleSuccessPopup(message, i) {
|
|
var isDisplayNone = $("#SuccessPopupDiv").css("display") === "none";
|
|
var displayValue = isDisplayNone ? "block" : "none";
|
|
|
|
$("#SuccessPopupDiv").css("display", displayValue);
|
|
$(".modalWrapper").css("display", displayValue);
|
|
$(".modalWrapper").css("height", $(document).height());
|
|
|
|
$("#SuccessPopupOkBtn").val("OK");
|
|
|
|
if(i === 2) {
|
|
$(".SuccessPopupUSchrift").css("display", "none");
|
|
}
|
|
else if(i === 3) {
|
|
$(".SuccessPopupUSchrift").css("display", "none");
|
|
$("#SuccessPopupTitle").text("Es ist leider ein Fehler aufgetreten!");
|
|
}
|
|
else if(i === 4) {
|
|
$(".SuccessPopupUSchrift").css("display", "inline");
|
|
$("#SuccessPopupOkBtn").val("Nein");
|
|
}
|
|
else {
|
|
$(".SuccessPopupUSchrift").css("display", "inline");
|
|
}
|
|
|
|
if(isDisplayNone) {
|
|
$("#SuccessPopupText").text(message);
|
|
|
|
var successPopupTitleOuterHeight = $("#SuccessPopupTitle").outerHeight();
|
|
var successPopupTextOuterHeight = $("#SuccessPopupText").outerHeight();
|
|
var successPopupButtonOuterHeight = $("#SuccessPopupBtnDiv").outerHeight();
|
|
var successPopupOkButtonOuterHeight = $(".SuccessPopupOkBtn").outerHeight();
|
|
var successPopupSignatureButtonOuterHeight = $(".SuccessPopupUSchrift").outerHeight();
|
|
|
|
var height = successPopupTitleOuterHeight + successPopupTextOuterHeight + successPopupButtonOuterHeight + successPopupOkButtonOuterHeight + successPopupSignatureButtonOuterHeight;
|
|
|
|
$("#SuccessPopupDiv").css("height", height + "px");
|
|
|
|
$("#SuccessPopupDiv").css("top", window.pageYOffset + window.innerHeight / 2 - height / 2);
|
|
$("#SuccessPopupDiv").css("margin-top", "0");
|
|
} else {
|
|
$("#SuccessPopupDiv").css("margin-top", "auto");
|
|
}
|
|
}
|
|
|
|
function toggleUpdateAppointmentPopup(message) {
|
|
var isDisplayNone = $("#AendernPopupDiv").css("display") === "none";
|
|
var displayValue = isDisplayNone ? "block" : "none";
|
|
|
|
$("#AendernPopupDiv").css("display", displayValue);
|
|
$(".modalWrapper").css("display", displayValue);
|
|
$(".modalWrapper").css("height", $(document).height());
|
|
|
|
if(isDisplayNone) {
|
|
$("#AendernPopupText").text(message);
|
|
|
|
var aendernPopupTitleOuterHeight = $("#AendernPopupTitle").outerHeight();
|
|
var aenderPopupTextOuterHeight = $("#AendernPopupText").outerHeight();
|
|
var aendernPopupButtonDivOuterHeight = $("#AendernPopupBtnDiv").outerHeight();
|
|
var aendernPopupOkButtonOuterHeight = $(".AendernPopupOkBtn").outerHeight();
|
|
var aendernPopupSignatureOuterHeight = $(".AendernPopupUSchrift").outerHeight();
|
|
|
|
var height = aendernPopupTitleOuterHeight + aenderPopupTextOuterHeight + aendernPopupButtonDivOuterHeight + aendernPopupOkButtonOuterHeight + aendernPopupSignatureOuterHeight;
|
|
|
|
$("#AendernPopupDiv").css("height", height + "px");
|
|
|
|
$("#AendernPopupDiv").css("top", window.pageYOffset + window.innerHeight / 2 - height / 2);
|
|
$("#AendernPopupDiv").css("margin-top", "0");
|
|
} else {
|
|
$("#AendernPopupDiv").css("margin-top", "auto");
|
|
}
|
|
}
|
|
|
|
function confirmErrorPopup() {
|
|
toggleErrorPopup("");
|
|
}
|
|
|
|
function clearRecords() {
|
|
$("#serviceRecords").empty();
|
|
}
|
|
|
|
function setSelectedEmployee() {
|
|
var oid = parseInt($("#employeesDropDown").find(":selected").val());
|
|
|
|
if(isNaN(oid)) {
|
|
return;
|
|
}
|
|
|
|
window.serviceRecordEmployeeOid = oid;
|
|
|
|
makeAjaxCall("GET", setServiceRecordEmployeeUrl, null, { employeeOid: window.serviceRecordEmployeeOid }, null);
|
|
}
|
|
|
|
function SaveOnly() {
|
|
if(typeof Storage !== "undefined") {
|
|
clearLocalStorage(1);
|
|
|
|
var costBearer2SupportConceptOid = $("#scDropDown").val();
|
|
var hilfeplan = $("#scDropDown option[value='" + zahl + "']").text();
|
|
var mitarbeiter = $("#employeesDropDown option:selected").text();
|
|
var kategorie = $("#kategorien_select option:selected").text();
|
|
var leistung = $("#leistungen_select option:selected").val();
|
|
var duration = $("#duration_textbox").val();
|
|
var notiz = $("#notiz_textbox").val();
|
|
|
|
var notiz2, notiz3, notiz4, notiz5;
|
|
|
|
if($("#notiz_textbox1").val() !== "") {
|
|
notiz = $("#notiz_textbox1").val();
|
|
}
|
|
|
|
if($("#notiz_textbox2").val() !== "") {
|
|
notiz2 = $("#notiz_textbox2").val();
|
|
}
|
|
|
|
if($("#notiz_textbox3").val() !== "") {
|
|
notiz3 = $("#notiz_textbox3").val();
|
|
}
|
|
|
|
if($("#notiz_textbox4").val() !== "") {
|
|
notiz4 = $("#notiz_textbox4").val();
|
|
}
|
|
|
|
if($("#notiz_textbox5").val() !== "") {
|
|
notiz5 = $("#notiz_textbox5").val();
|
|
}
|
|
|
|
localStorage.setItem("Zeitdaten", new LocalServiceRecord(costBearer2SupportConceptOid, hilfeplan, mitarbeiter, kategorie, leistung, $("#datum_textbox").val(), $("#start_textbox").val(), $("#ende_textbox").val(), duration, notiz, notiz2, notiz3, notiz4, notiz5, $("#enddatum_textbox").val()));
|
|
}
|
|
}
|
|
|
|
function clearLocalStorage(i) {
|
|
if(i === 1) {
|
|
localStorage.removeItem("Zeitdaten");
|
|
}
|
|
|
|
if(i === 2) {
|
|
localStorage.removeItem("Kalenderdaten");
|
|
}
|
|
}
|
|
|
|
function saveZeiterfassungAfterCrash(datum, startd, endd, dauer, doku, leistung, costBearer2SupportConceptOid, doku2, doku3, doku4, doku5, enddatum) {
|
|
var x = getDateObj(true);
|
|
var y = getDateObj(false);
|
|
|
|
var vonDatum = getDateTimeStringWithLeadingZeros(x);
|
|
var bisDatum = getDateTimeStringWithLeadingZeros(y);
|
|
|
|
if (costBearer2SupportConceptOid === -2) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: saveZeiterfassungAfterCrashUrl,
|
|
data: {
|
|
pDatum: datum,
|
|
pStartDate: startd,
|
|
pEndDate: endd,
|
|
pDuration: dauer,
|
|
pNotice: doku,
|
|
pServiceDescription: leistung,
|
|
pNotice2: doku2,
|
|
pNotice3: doku3,
|
|
pNotice4: doku4,
|
|
pNotice5: doku5,
|
|
pEndDate2: enddatum
|
|
}, success: null, error: null
|
|
});
|
|
} else {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: CheckRightsAfterCrashUrl,
|
|
data: { von: vonDatum, bis: bisDatum, inEditMode: false, dateString: datum, startString: startd, endString: endd, costbearerOId: costBearer2SupportConceptOid, leistung:leistung},
|
|
success: function (json) {
|
|
|
|
var hasSufficientRights = json;
|
|
|
|
if (hasSufficientRights === "True") {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: saveZeiterfassungAfterCrashUrl,
|
|
data: { Datum: datum, StartD: startd, EndeD: endd, Dauer: dauer, Doku: doku, Leistungen: leistung, Doku2: doku2, Doku3: doku3, Doku4: doku4, Doku5: doku5, EndDatum: enddatum }, success: function () { }, error: function () { writeFatalErrorMessage("Es konnte keine verbindung zum Server aufgebaut werden. Bitte überprüfen sie ihre Internet Verbindung."); /*$("#scDropDown option[value='" + oid + "']").attr('selected', true).trigger("change");*/ }
|
|
});
|
|
|
|
} else {
|
|
clearLocalStorage(1);
|
|
|
|
setTimeout(function () {
|
|
$("#scDropDown option[value='" + costBearer2SupportConceptOid + "']").attr("selected", true).trigger("change");
|
|
}, 4500);
|
|
|
|
}
|
|
}, error: function () {
|
|
clearLocalStorage(1);
|
|
writeFatalErrorMessage("Es konnte keine Verbindung zum Server aufgebaut werden. Bitte überprüfen Sie Ihre Internetverbindung.");
|
|
// $("#scDropDown option[value='" + costBearer2SupportConceptOid + "']").attr('selected', true).trigger("change");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function showErrorAfterCrash() {
|
|
var errorAfterCrashSwitch = $("#ErrorZeiterfassungAfterCrashSchalter");
|
|
var switchValue = errorAfterCrashSwitch.val();
|
|
var errorMessage = "";
|
|
|
|
if(switchValue === 2 || switchValue === 3) {
|
|
errorMessage = "Es konnte keine Verbindung zum Server aufgebaut werden. Bitte überprüfen sie ihre Internet Verbindung.";
|
|
} else if(switchValue === 4) {
|
|
errorMessage = "Das Datum liegt außerhalb des Zeitraumes des gewählten Hilfeplans. Der Eintrag kann nicht gespeichert werden.";
|
|
} else if(switchValue === 5) {
|
|
errorMessage = "Die eingegebene Uhrzeit ist ungültig. Der Eintrag kann nicht gespeichert werden.";
|
|
}
|
|
|
|
if(errorAfterCrashSwitch.val() > 1) {
|
|
writeFatalErrorMessage(errorMessage);
|
|
|
|
errorAfterCrashSwitch.val(1);
|
|
clearLocalStorage(1);
|
|
setTimeout(function() {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: ErrorZeiterfassungAnzeigenUrl,
|
|
data: { errorwert: 1 }
|
|
});
|
|
}, timeOut);
|
|
}
|
|
}
|
|
|
|
function focusOnTab(tabIdentifier) {
|
|
focusOnDoku(tabIdentifier);
|
|
}
|
|
|
|
function focusOnDoku(number) {
|
|
setTimeout(function() {
|
|
var displayValue;
|
|
|
|
for (var i = 0; i < window.numberOfDocumentationTypes; i++) {
|
|
var idNumber = i + 1;
|
|
displayValue = idNumber === number ? "block" : "none";
|
|
|
|
if (idNumber === number) {
|
|
$("#doku-name-" + idNumber).addClass("active");
|
|
} else {
|
|
$("#doku-name-" + idNumber).removeClass("active");
|
|
}
|
|
|
|
$("#doku-tab-content-" + idNumber).css("display", displayValue);
|
|
$("#notiz_textbox" + idNumber).css("display", displayValue);
|
|
}
|
|
|
|
$("#notiz_textbox" + number).get(0).focus();
|
|
window.focusedDokuTextarea = $("#notiz_textbox" + number);
|
|
}, 100);
|
|
}
|
|
|
|
function updateDokuTabLinks() {
|
|
if (numberOfDocumentationTypes !== undefined && numberOfDocumentationTypes > 1) {
|
|
var height = 0;
|
|
|
|
$(".doku-tab-link").css("height", "auto");
|
|
|
|
for (var i = 0; i < numberOfDocumentationTypes; i++) {
|
|
var idNumber = i + 1;
|
|
|
|
var dokuTab = $("#doku-name-" + idNumber);
|
|
|
|
var outerHeight = dokuTab.outerHeight();
|
|
|
|
if (outerHeight > height) {
|
|
height = outerHeight;
|
|
}
|
|
}
|
|
|
|
$(".doku-tab-link").css("height", height + "px");
|
|
}
|
|
}
|
|
|
|
$(window).resize(function () {
|
|
updateDokuTabLinks();
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
$("#colorRibbon").css("background-color", "#c80000");
|
|
});
|
|
|
|
function goBackToZeiterfassung() {
|
|
window.location.href = redirectLink;
|
|
} |