2016-06-27 01:45:38 +02:00
var ZeiterfassungDatakonstrukt = [ ] ;
var KlientDatakonstrukt = [ ] ;
2018-02-05 14:21:08 +01:00
var klientzwischenspeicher = [ ] ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
var timeOut = 10000 ;
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
function buildCollapsibleSet ( jsonString ) {
2016-06-27 01:45:38 +02:00
try {
2018-12-12 14:27:40 -04:00
if ( jsonString . length < 2 ) {
2016-06-27 01:45:38 +02:00
return ;
}
2018-06-29 16:35:19 +02:00
var kollektion = $ . parseJSON ( jsonString ) ;
2018-06-22 20:25:13 +02:00
2018-05-22 17:19:56 +02:00
actuallyBuildCollapsibleSet ( kollektion , null ) ;
2018-06-22 20:25:13 +02:00
} catch ( exception ) {
2018-11-30 16:47:57 -04:00
console . log ( "Fehler(BuildCollapsibleSet): " + exception . message ) ;
2016-06-27 01:45:38 +02:00
}
}
2018-05-22 17:19:56 +02:00
function actuallyBuildCollapsibleSet ( kollektion , selectedGoalOids ) {
2016-06-27 01:45:38 +02:00
$ ( "#kollabierbar1" ) . empty ( ) ;
collapsibleHtml = "" ;
2018-01-29 12:57:10 +01:00
2016-06-27 01:45:38 +02:00
$ . each ( kollektion , function ( index ) {
2018-05-22 17:19:56 +02:00
buildGoalTreeItem ( kollektion [ index ] , selectedGoalOids ) ;
2016-06-27 01:45:38 +02:00
} ) ;
$ ( "#kollabierbar1" ) . append ( collapsibleHtml ) ;
}
2018-10-08 11:57:16 +02:00
var level = 0 ;
2016-06-27 01:45:38 +02:00
var collapsibleHtml ;
2018-12-13 07:15:24 -04:00
zeitRegEx = /^(2[0-3]|[01]?[0-9])(:|,|\.|#|;)?([0-5][0-9])$/ ;
2018-05-22 17:19:56 +02:00
function buildGoalTreeItem ( goalItem , selectedGoalOids ) {
2018-10-08 11:57:16 +02:00
var goalOid = goalItem . ValueListEntryOid ;
var goalHeader = goalItem . Header ;
2018-12-10 23:40:38 -04:00
var isChecked = selectedGoalOids !== null && isElementInArray ( selectedGoalOids , goalOid ) ? "checked" : "" ;
2018-10-08 11:57:16 +02:00
if ( ! goalItem . IsLeaf ) {
//collapsibleHtml += '<input type="checkbox" style="width: auto;" onclick="updateGoals(' + goalOid + ')" id="' + goalOid + '" value="' + goalHeader + '" ' + isChecked + '/><label class="toggle-btnLabel" for="' + goalHeader + '">' + goalHeader + '</label>';
collapsibleHtml += '<div onclick="toggleOnclick(this);" class="toggle-btn-div" style="margin-right: 0; padding-right: 0;display: block;"><input type="checkbox" style="width: auto;" onclick="updateChildGoals(' + goalOid + ');event.stopPropagation();" id="goal' + goalOid + '" value="' + goalOid + '" ' + isChecked + ' />' + goalHeader + '</div>' ;
//collapsibleHtml += '<input onclick="toggleOnclick(this);" type="button" class="toggle-btn" value="' + goalHeader + '" style="margin-right: 0; padding-right: 0;" />';
2018-06-13 14:38:35 +02:00
collapsibleHtml += '<div style="margin-right: 0; padding-right: 0;display: none;" class="kollabierbar">' ;
try {
$ . each ( goalItem . Children ,
function ( index ) {
buildGoalTreeItem ( goalItem . Children [ index ] , selectedGoalOids ) ;
} ) ;
2018-06-22 20:25:13 +02:00
} catch ( exception ) {
console . log ( 'Fehler bei der Baumkonstruktion: ' + exception . message ) ;
2018-06-13 14:38:35 +02:00
}
2018-10-08 11:57:16 +02:00
collapsibleHtml += "</div>" ;
2018-06-13 14:38:35 +02:00
} else {
2018-10-08 11:57:16 +02:00
2018-06-22 20:25:13 +02:00
collapsibleHtml += '<div style="margin-right: 0; padding-right: 0;display: block;"><input type="checkbox" style="width: auto;" onclick="updateGoals(' + goalOid + ')" id="' + goalOid + '" value="' + goalHeader + '" ' + isChecked + ' />' + goalHeader + '</div>' ;
2016-06-27 01:45:38 +02:00
}
}
function loadGoalsOnSuccess ( json ) {
2018-01-29 12:57:10 +01:00
if ( json === "SessionTimeout" ) {
2016-06-27 01:45:38 +02:00
window . location . href = redirectLink ;
return ;
}
2018-04-18 14:33:21 +02:00
buildCollapsibleSet ( json ) ;
2016-06-27 01:45:38 +02:00
}
2018-04-18 14:33:21 +02:00
function loadServiceDescriptionsOnSuccess ( json ) {
2018-02-07 14:14:08 +01:00
if ( json === "SessionTimeout" ) {
2018-12-13 20:59:05 -04:00
window . location . href = window . redirectLink ;
2016-06-27 01:45:38 +02:00
return ;
}
2018-06-29 16:35:19 +02:00
var liste = $ . parseJSON ( json ) ;
2017-04-26 14:57:32 +02:00
2016-06-27 01:45:38 +02:00
$ ( "#leistungen_select" ) . empty ( ) ;
2017-04-26 14:57:32 +02:00
$ ( "#leistungen_select" ) . val ( "" ) ;
2018-11-22 14:05:45 +01:00
$ . each ( liste , function ( index , leistung ) {
2018-12-13 20:59:05 -04:00
$ ( "#leistungen_select" ) . append ( '<option value="' + leistung . ServiceDescriptionOid + '">' + leistung . Name + "</option>" ) ;
2016-06-27 01:45:38 +02:00
} ) ;
2018-04-27 14:11:21 +02:00
if ( liste [ 0 ] !== undefined ) {
2018-12-13 20:59:05 -04:00
$ ( "#leistungen_select" ) . val ( liste [ 0 ] . ServiceDescriptionOid ) ;
2018-11-22 14:05:45 +01:00
2018-12-13 20:59:05 -04:00
makeAjaxCall ( "GET" , window . setServiceDescriptionUrl , null , { pServiceDescriptionOid : liste [ 0 ] . ServiceDescriptionOid } , null ) ;
2016-06-27 01:45:38 +02:00
}
}
function showAjaxError ( jqXHR , textStatus , errorThrown ) {
hideSanduhr ( ) ;
2017-02-01 13:53:59 +01:00
//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();
2018-02-05 14:21:08 +01:00
//}, timeOut);
2017-02-01 13:53:59 +01:00
//}
//else
2018-04-27 14:11:21 +02:00
if ( jqXHR . status === 0 ) {
2018-11-30 16:47:57 -04:00
console . log ( "status is 0; ajax call aborted.\nError thrown: " + errorThrown + ";\nText status: " + textStatus ) ;
2018-04-27 14:11:21 +02:00
return ;
}
2018-06-22 20:25:13 +02:00
2018-01-29 12:57:10 +01:00
toggleErrorPopup ( jqXHR . status + " " + errorThrown ) ;
2016-06-27 01:45:38 +02:00
}
function showErrorMsg ( message ) {
toggleErrorPopup ( message ) ;
}
function resizeLabelColumns ( ) {
$ ( "#tabLbl" ) . css ( "width" , $ ( "#zieleLbl" ) . css ( "width" ) ) ;
}
function loadGoals ( actionPath ) {
2018-06-29 16:35:19 +02:00
var selectedServiceRecord = $ ( $ ( "#scDropDown" ) ) . find ( ":selected" ) . val ( ) ;
2016-09-21 14:28:04 +02:00
2018-11-24 14:28:46 -04:00
if ( selectedServiceRecord === - 1 ) {
return ;
}
2018-01-31 17:52:28 +01:00
makeAjaxCall ( "GET" , actionPath , loadGoalsOnSuccess , { pCostbearer2SupportConceptOid : selectedServiceRecord } , null ) ;
2016-06-27 01:45:38 +02:00
}
function toggleMenu ( ) {
2018-06-29 16:35:19 +02:00
var menuDiv = $ ( "#menu-div" ) ;
2016-06-27 01:45:38 +02:00
$ ( menuDiv ) . fadeToggle ( "fast" ) ;
}
function loadServiceDescriptions ( ) {
2018-06-29 16:35:19 +02:00
var selectedCategory = $ ( "#kategorien_select" ) . find ( ":selected" ) . val ( ) ;
2018-06-22 20:25:13 +02:00
2018-11-24 14:28:46 -04:00
if ( selectedCategory === null || selectedCategory === undefined ) {
2017-04-26 14:57:32 +02:00
return ;
}
2019-03-29 14:04:12 +01:00
2018-12-13 20:59:05 -04:00
makeAjaxCall ( "GET" , window . loadServiceCategoriesUrl , loadServiceDescriptionsOnSuccess , { pServiceCategoryOid : selectedCategory } , null ) ;
2018-06-27 13:55:20 +02:00
2018-11-24 14:28:46 -04:00
loadTextbausteineForServiceCategory ( selectedCategory ) ;
2016-06-27 01:45:38 +02:00
}
function updateGoals ( cbId ) {
makeAjaxCall ( "GET" , updateGoalsUrl , null , { pGoalOid : cbId } , null ) ;
}
2018-10-08 11:57:16 +02:00
var goalOidArray = new Array ( ) ;
function updateChildGoals ( goalOid ) {
goalOidArray = new Array ( ) ;
var parent = document . getElementById ( "goal" + goalOid ) ;
2019-07-10 14:32:47 +02:00
//alert("start");
2018-10-08 11:57:16 +02:00
CheckChildGoalNodes ( parent ) ;
//makeAjaxCall("GET", updateGoalsUrl, null, { pGoalOid: cbId }, null);
}
function CheckChildGoalNodes ( parent ) {
goalOidArray = new Array ( ) ;
var next = parent . parentNode ;
2019-07-10 14:32:47 +02:00
//alert(next);
//alert(next.nextSibling);
2018-10-08 11:57:16 +02:00
var nodeList = next . childNodes ;
2019-07-10 14:32:47 +02:00
//alert(nodeList.length);
2018-10-08 11:57:16 +02:00
for ( var i = 0 ; i < nodeList . length ; i ++ ) {
var node = nodeList [ i ] ;
2019-07-10 14:32:47 +02:00
//alert(node.nodeName);
2018-10-08 11:57:16 +02:00
CheckChildGoalNodes ( node ) ;
}
//makeAjaxCall("GET", updateGoalsUrl, null, { pGoalOid: cbId }, null);
}
2016-06-27 01:45:38 +02:00
function setServiceDescription ( ) {
2018-12-13 20:59:05 -04:00
var sdOid = $ ( $ ( "#leistungen_select" ) ) . find ( ":selected" ) . val ( ) ;
2018-11-22 14:05:45 +01:00
2018-12-13 20:59:05 -04:00
makeAjaxCall ( "GET" , window . setServiceDescriptionUrl , null , { pServiceDescriptionOid : sdOid } , null ) ;
2016-06-27 01:45:38 +02:00
}
function selectServiceRecord ( oid ) {
$ ( "#versteckt" ) . val ( "Speichern" ) ;
2017-04-26 14:57:32 +02:00
$ ( "html, body" ) . animate ( { scrollTop : 0 } , "fast" ) ;
2016-06-27 01:45:38 +02:00
$ . ajax ( {
type : "GET" ,
2018-12-13 20:59:05 -04:00
url : window . setSelectedServiceRecordUrl ,
2016-06-27 01:45:38 +02:00
data : { recordOid : oid } ,
success : function ( ) {
$ . ajax ( {
type : "GET" ,
2018-12-13 20:59:05 -04:00
url : window . getSelectedRecordInformationUrl ,
2016-06-27 01:45:38 +02:00
success : function ( jsonServiceRecord ) {
try {
2018-02-07 14:14:08 +01:00
if ( jsonServiceRecord === "SessionTimeout" ) {
2018-12-13 20:59:05 -04:00
window . location . href = window . redirectLink ;
2016-06-27 01:45:38 +02:00
return ;
}
var record = $ . parseJSON ( jsonServiceRecord ) ;
2018-06-29 16:35:19 +02:00
var goals = record . Goals ;
2018-01-29 12:57:10 +01:00
2018-05-22 17:19:56 +02:00
var idArray = new Array ( ) ;
2016-06-27 01:45:38 +02:00
var meinGoalsArray = new Array ( ) ;
2018-06-29 16:35:19 +02:00
var j = 0 ;
for ( var i = 0 ; i < goals . length ; i ++ ) {
2018-05-22 17:19:56 +02:00
if ( goals [ i ] . ValueListEntryOid !== undefined ) {
idArray [ j ] = goals [ i ] . ValueListEntryOid ;
j ++ ;
}
2016-06-27 01:45:38 +02:00
}
$ . ajax ( {
type : "GET" ,
2018-12-13 20:59:05 -04:00
url : window . loadGoalsUrl ,
2016-06-27 01:45:38 +02:00
data : { pCostbearer2SupportConceptOid : $ ( $ ( "#scDropDown" ) ) . find ( ":selected" ) . val ( ) } ,
success : function ( goalsJson ) {
2018-01-31 17:52:28 +01:00
if ( goalsJson === "SessionTimeout" ) {
2018-12-13 20:59:05 -04:00
window . location . href = window . redirectLink ;
2016-06-27 01:45:38 +02:00
return ;
}
try {
meinGoalsArray = goalsJson !== "" ? $ . parseJSON ( goalsJson ) : "" ;
} catch ( exception ) {
2018-12-12 19:10:07 -04:00
console . log ( "Fehler beim JSON Parsing von selectServiceRecord(" + oid + "): " + exception . message ) ;
2016-06-27 01:45:38 +02:00
}
2018-01-31 17:52:28 +01:00
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 ) ;
2016-06-27 01:45:38 +02:00
$ ( "#notiz_textbox" ) . val ( record . Notice ) ;
2018-01-31 17:52:28 +01:00
$ ( "#enddatum_textbox" ) . val ( endDateDateStr ) ;
2016-06-27 01:45:38 +02:00
$ ( "#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 ) ;
2018-04-18 14:33:21 +02:00
$ ( "#duration_textbox" ) . val ( record . RoundedDuration ) ;
2018-05-25 15:07:47 +02:00
$ ( "#distance_textbox" ) . val ( record . DistanceInMeter ) ;
2016-06-27 01:45:38 +02:00
$ ( "#employeesDropDown" ) . val ( record . Employee . EmployeeOid ) ;
2018-01-29 12:57:10 +01:00
2018-02-07 14:14:08 +01:00
window . serviceRecordEmployeeOid = record . Employee . EmployeeOid ;
2016-06-27 01:45:38 +02:00
actuallyBuildCollapsibleSet ( meinGoalsArray , idArray ) ;
$ ( "#anlegenEditierenBtn" ) . val ( "Speichern" ) ;
$ . ajax ( {
type : "GET" ,
2018-12-13 20:59:05 -04:00
url : window . loadServiceCategoriesUrl ,
2016-06-27 01:45:38 +02:00
success : function ( result ) {
2018-12-13 20:59:05 -04:00
if ( isEmptyOrSpaces ( result ) ) {
window . location . href = window . redirectLink ;
return ;
}
2018-01-31 17:52:28 +01:00
if ( result === "SessionTimeout" ) {
2016-06-27 01:45:38 +02:00
window . location . href = redirectLink ;
return ;
}
$ ( "#kategorien_select" ) . val ( record . ServiceDescription . Category . ServiceCategoryOid ) ;
2018-06-29 16:35:19 +02:00
var liste = $ . parseJSON ( result ) ;
2016-06-27 01:45:38 +02:00
$ ( "#leistungen_select" ) . empty ( ) ;
2018-01-31 17:52:28 +01:00
$ ( "#leistungen_select" ) . val ( "" ) ;
2016-06-27 01:45:38 +02:00
$ . each ( liste , function ( index , leistung ) {
2018-06-22 20:25:13 +02:00
$ ( "#leistungen_select" ) . append ( '<option value="' + leistung . ServiceDescriptionOid + '">' + leistung . Name + '</option>' ) ;
2016-06-27 01:45:38 +02:00
} ) ;
2018-11-22 14:05:45 +01:00
$ ( "#leistungen_select" ) . val ( record . ServiceDescription . ServiceDescriptionOid ) ;
2018-12-13 20:59:05 -04:00
makeAjaxCall ( "GET" , window . setServiceDescriptionUrl , null , { pServiceDescriptionOid : record . ServiceDescription . ServiceDescriptionOid } , null ) ;
2016-06-27 01:45:38 +02:00
2018-05-25 15:07:47 +02:00
toggleLabel ( "distance_textbox" ) ;
2016-06-27 01:45:38 +02:00
toggleLabel ( "duration_textbox" ) ;
toggleLabel ( "start_textbox" ) ;
toggleLabel ( "ende_textbox" ) ;
$ ( "input" ) . prop ( "disabled" , false ) ;
$ ( "#abbrechenBtn" ) . prop ( "disabled" , true ) ;
$ ( "select" ) . prop ( "disabled" , false ) ;
2018-01-31 17:52:28 +01:00
2016-06-27 01:45:38 +02:00
toggleSelectClassesForElement ( "#kategorien_select" , "#kategorien-select-container" ) ;
toggleSelectClassesForElement ( "#leistungen_select" , "#leistungen-select-container" ) ;
toggleSelectClassesForElement ( "#recordLoader_select" , "#record-loader-select-container" ) ;
2017-04-26 14:57:32 +02:00
toggleSelectClassesForElement ( "#textbausteine_select" , "#textbausteine-select-container" ) ;
2016-06-27 01:45:38 +02:00
$ ( "#abbrechenBtn" ) . prop ( "disabled" , false ) ;
2018-11-30 16:47:57 -04:00
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 ) ;
2018-12-12 14:27:40 -04:00
$ ( "#selectSCForm" ) . show ( ) ;
2018-11-30 16:47:57 -04:00
2018-12-12 14:27:40 -04:00
if ( result . toLowerCase ( ) === "true" ) {
$ ( "#singleSCEmployeeSelectionContainer" ) . show ( ) ;
2018-11-30 16:47:57 -04:00
}
2018-12-10 23:40:38 -04:00
$ ( "#groupBookingOpenPopupBtn" ) . hide ( ) ;
$ ( "#groupBookingOpenEmployeeSelectionPopupBtn" ) . hide ( ) ;
2018-11-30 16:47:57 -04:00
} , null , null ) ;
}
2016-06-27 01:45:38 +02:00
hideSanduhr ( ) ;
} ,
error : showErrorMsg ,
data : { pServiceCategoryOid : record . ServiceDescription . Category . ServiceCategoryOid }
} ) ;
} ,
error : showAjaxError ,
complete : hideSanduhr
} ) ;
} catch ( exception1 ) {
2018-06-22 20:25:13 +02:00
console . log ( 'Fehler beim JSON Parsing von selectServiceRecord(' + oid + '): ' + exception1 . message ) ;
2016-06-27 01:45:38 +02:00
}
} ,
error : showAjaxError
} ) ;
}
} ) ;
}
2019-03-29 14:04:12 +01:00
function activateForm ( actionPath , shouldLoadServiceDescriptions ) {
2016-06-27 01:45:38 +02:00
$ ( "input" ) . prop ( "disabled" , false ) ;
2018-12-10 23:40:38 -04:00
$ ( "textarea" ) . prop ( "disabled" , false ) ;
$ ( ".doku-tab-link" ) . prop ( "disabled" , false ) ;
2018-12-17 18:32:32 -04:00
$ ( "#kategorien_select, #leistungen_select, #recordLoader_select, #textbausteine_select, #employeesDropDown" ) . prop ( "disabled" , false ) ;
2018-11-24 14:28:46 -04:00
2018-12-17 18:32:32 -04:00
//toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container");
//toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container");
// toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container");
// toggleSelectClassesForElement("#employeesDropDown", "#employee-select-container");
2016-06-27 01:45:38 +02:00
loadGoals ( actionPath ) ;
$ ( "#kategorien_select" ) . val ( $ ( "#kategorien_select option" ) . eq ( 0 ) . val ( ) ) ;
2019-03-29 14:04:12 +01:00
if ( shouldLoadServiceDescriptions ) {
loadServiceDescriptions ( ) ;
}
2016-06-27 01:45:38 +02:00
}
function resetRecordForm ( ) {
showSanduhr ( ) ;
$ ( "#versteckt" ) . val ( "Anlegen" ) ;
$ ( "#anlegenEditierenBtn" ) . val ( "Anlegen" ) ;
clearZED ( ) ;
2018-11-30 16:47:57 -04:00
if ( isInGroupBookingMode ( ) ) {
$ ( "#changeBookingModeCheckBox" ) . prop ( "checked" , false ) ;
showSanduhr ( ) ;
$ ( "#groupBookingForm" ) . submit ( ) ;
}
2016-06-27 01:45:38 +02:00
$ ( "#start_textbox" ) . val ( "" ) . trigger ( "change" ) ;
$ ( "#ende_textbox" ) . val ( "" ) . trigger ( "change" ) ;
$ ( "#notiz_textbox" ) . val ( "" ) . trigger ( "change" ) ;
$ ( "#duration_textbox" ) . val ( "" ) . trigger ( "change" ) ;
2018-06-22 20:25:13 +02:00
$ ( "#distance_textbox" ) . val ( "" ) . trigger ( "change" ) ;
2016-06-27 01:45:38 +02:00
$ ( "#datum_textbox" ) . val ( getDateStringWithLeadingZeros ( new Date ( ) ) ) ;
2018-05-22 17:19:56 +02:00
$ ( "#enddatum_textbox" ) . val ( getDateStringWithLeadingZeros ( new Date ( ) ) ) ;
2016-06-27 01:45:38 +02:00
$ ( "#kategorien_select" ) . val ( $ ( "#kategorien_select option" ) . eq ( 0 ) . val ( ) ) ;
2018-06-29 16:35:19 +02:00
for ( var i = 0 ; i < numberOfDocumentationTypes ; i ++ ) {
2018-11-26 13:27:16 -04:00
$ ( "#notiz_textbox" + ( i + 1 ) ) . val ( "" ) ;
2018-02-02 14:43:40 +01:00
}
2018-06-29 16:35:19 +02:00
var selectedCategory = $ ( "#kategorien_select" ) . find ( ":selected" ) . val ( ) ;
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( isInEditingMode ( ) ) {
2018-11-30 16:47:57 -04:00
makeAjaxCall ( "POST" , window . resetEditingModeUrl , function ( response ) { window . location . reload ( ) ; } , { pFormCollection : null } , null ) ;
2018-04-18 14:33:21 +02:00
}
2018-06-22 20:25:13 +02:00
2016-06-27 01:45:38 +02:00
$ . ajax ( {
type : "GET" ,
url : loadServiceCategoriesUrl ,
data : { pServiceCategoryOid : selectedCategory } ,
success : function ( json ) {
2018-04-18 14:33:21 +02:00
loadServiceDescriptionsOnSuccess ( json ) ;
2016-06-27 01:45:38 +02:00
$ . ajax ( {
type : "GET" ,
url : setSelectedServiceRecordUrl ,
data : { recordOid : null } ,
success : function ( ) {
loadGoals ( loadGoalsUrl ) ;
hideSanduhr ( ) ;
} ,
error : showAjaxError
} ) ;
}
} ) ;
}
function toggleOnclick ( element ) {
2018-06-29 16:35:19 +02:00
var collapsedDiv = $ ( element ) . next ( "div" ) ;
var isHidden = "none" === $ ( collapsedDiv ) . css ( "display" ) ;
2016-06-27 01:45:38 +02:00
var newIcon = "url('" ;
newIcon += isHidden ? toggleIconUContentUrl : toggleIconDContentUrl ;
newIcon += "')" ;
$ ( element ) . css ( "background-image" , newIcon ) ;
$ ( collapsedDiv ) . fadeToggle ( "fast" ) ;
}
2018-01-31 17:52:28 +01:00
$ ( document ) . mouseup ( function ( e ) {
2018-06-29 16:35:19 +02:00
var menu = $ ( "#menu-div" ) ;
var menuBtn = $ ( "#menu-btn" ) ;
2016-06-27 01:45:38 +02:00
2018-01-31 17:52:28 +01:00
if ( ! menu . is ( e . target ) && ! menuBtn . is ( e . target ) && menu . has ( e . target ) . length === 0 ) {
2016-06-27 01:45:38 +02:00
menu . fadeOut ( "fast" ) ;
}
} ) ;
function saveCreateServicerecod ( ) {
showSanduhr ( ) ;
2019-03-29 14:04:12 +01:00
validateServiceRecordBeforeSubmit ( ) ;
2016-06-27 01:45:38 +02:00
}
function validateTimeField ( id ) {
2018-06-29 16:35:19 +02:00
var timeStr = $ ( id ) . val ( ) ;
var zeitStr = id === "#start_textbox" ? "Start" : "End" ;
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
if ( timeStr !== "" && ! zeitRegEx . test ( timeStr ) ) {
2018-11-26 13:27:16 -04:00
showZeiterfassungsError ( "Bitte geben Sie eine " + zeitStr + "-Zeit in einem gültigen Format (HH:MM oder HHMM) an." ) ;
2016-06-27 01:45:38 +02:00
return false ;
} else {
clearZED ( ) ;
return true ;
}
}
function togglePopup ( serviceRecordOid ) {
2018-11-30 16:47:57 -04:00
$ ( "#oidHolder" ) . val ( serviceRecordOid ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var isShowing = $ ( ".modalWrapper" ) . css ( "display" ) === "none" ;
var displayValue = $ ( ".modalWrapper" ) . css ( "display" ) === "block" ? "none" : "block" ;
2016-06-27 01:45:38 +02:00
toggleModalWrapper ( ) ;
$ ( "#popupDiv" ) . css ( "display" , displayValue ) ;
if ( isShowing ) {
2018-06-29 16:35:19 +02:00
var titleOuterHeight = $ ( "#popupTitle" ) . outerHeight ( ) ;
var textOuterHeight = $ ( "#popupText" ) . outerHeight ( ) ;
var buttonDivOuterHeight = $ ( "#popupBtnDiv" ) . outerHeight ( ) ;
var btnOuterHeight = $ ( ".popupBtn" ) . outerHeight ( ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var newHeight = titleOuterHeight + textOuterHeight + buttonDivOuterHeight + btnOuterHeight + btnOuterHeight ;
2016-06-27 01:45:38 +02:00
2018-05-22 17:19:56 +02:00
$ ( "#popupDiv" ) . css ( "height" , newHeight + "px" ) ;
2016-06-27 01:45:38 +02:00
2018-05-22 17:19:56 +02:00
$ ( "#popupDiv" ) . css ( "top" , window . pageYOffset + window . innerHeight / 2 - newHeight / 2 ) ;
2016-06-27 01:45:38 +02:00
$ ( "#popupDiv" ) . css ( "margin-top" , "0" ) ;
} else {
$ ( "#popupDiv" ) . css ( "margin-top" , "auto" ) ;
}
}
function toggleModalWrapper ( ) {
2018-06-29 16:35:19 +02:00
var displayValue = $ ( ".modalWrapper" ) . css ( "display" ) === "block" ? "none" : "block" ;
2016-06-27 01:45:38 +02:00
$ ( ".modalWrapper" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "height" , $ ( document ) . height ( ) ) ;
}
2018-01-29 12:57:10 +01:00
2016-06-27 01:45:38 +02:00
function ErfolgteSpx ( ) {
2018-11-26 13:27:16 -04:00
if ( document . getElementById ( "SaveSignature" ) . value === "True" ) {
2018-06-13 14:38:35 +02:00
toggleSuccessPopup ( "Eintrag wurde gespeichert." + "\n" + "Möchte Sie diesen unterschreiben lassen?" , 4 ) ;
document . getElementById ( "SaveSignature" ) . value = "False" ;
2018-01-29 12:57:10 +01:00
2016-06-27 01:45:38 +02:00
$ . ajax ( {
2018-06-13 14:38:35 +02:00
type : "GET" ,
url : SetSaveSignatureUrl ,
data : { save : false }
2016-06-27 01:45:38 +02:00
} ) ;
}
}
2018-06-13 14:38:35 +02:00
function initSignatureInfo ( serviceRecordOid ) {
2016-06-27 01:45:38 +02:00
$ . ajax ( {
type : "GET" ,
url : getSelectedRecordInformationUrlWithOid ,
2018-02-07 14:14:08 +01:00
data : { oid : serviceRecordOid } ,
2018-06-22 20:25:13 +02:00
success : function ( jsonServiceRecord ) {
try {
if ( jsonServiceRecord === "SessionTimeout" ) {
2016-06-27 01:45:38 +02:00
window . location . href = redirectLink ;
return ;
}
2018-06-22 20:25:13 +02:00
2018-06-29 16:35:19 +02:00
var record = $ . parseJSON ( jsonServiceRecord ) ;
2018-02-07 14:14:08 +01:00
2018-06-29 16:35:19 +02:00
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 ;
2018-02-07 14:14:08 +01:00
2018-06-29 16:35:19 +02:00
var zahl2 = $ ( "#scDropDown" ) . val ( ) ;
2018-06-22 20:25:13 +02:00
$ ( "#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 ) ;
2018-02-07 14:14:08 +01:00
$ ( "#SaveRecordOID" ) . val ( serviceRecordOid ) ;
2018-06-22 20:25:13 +02:00
console . log ( 'Loading data for service record: ' + $ ( "#SaveRecordOID" ) . value ) ;
2018-02-07 14:14:08 +01:00
} catch ( exception ) {
2018-06-22 20:25:13 +02:00
console . log ( 'Error: ' + + '' ) ;
2018-02-07 14:14:08 +01:00
}
2016-06-27 01:45:38 +02:00
}
} ) ;
}
2018-12-03 19:14:35 -04:00
// 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.
2018-04-27 14:11:21 +02:00
function writeFatalErrorMessage ( msg , i ) {
toggleErrorPopup ( msg , i ) ;
2016-06-27 01:45:38 +02:00
}
function showZeiterfassungsError ( msg ) {
$ ( "#zeiterfassungsErrorTableRow" ) . css ( "display" , "table-row" ) ;
$ ( "#zeiterfassungsErrorTableCell" ) . css ( "display" , "table-cell" ) ;
$ ( "#zeiterfassungsErrorDisplay" ) . html ( msg + "<br />" ) ;
}
function clearZED ( ) {
$ ( "#zeiterfassungsErrorTableRow" ) . css ( "display" , "none" ) ;
$ ( "#zeiterfassungsErrorDisplay" ) . empty ( ) ;
}
function showCustomers ( ) {
$ ( "#customersDropDown" ) . val ( $ ( "#customersDropDown option" ) . eq ( 0 ) . val ( ) ) ;
preselectCustomer ( ) ;
$ ( "#zeiterfassung" ) . css ( "display" , "none" ) ;
$ ( "#klienten" ) . css ( "display" , "block" ) ;
$ ( "#KalenderNavigation" ) . css ( "display" , "none" ) ;
$ ( "#Kalender" ) . css ( "display" , "none" ) ;
$ ( "#map-canvas" ) . css ( "width" , $ ( "#klientenTabelle" ) . width ( ) ) ;
$ ( "#map-canvas" ) . css ( "height" , "500px" ) ;
$ ( "#UnterschriftBereich" ) . css ( "display" , "none" ) ;
$ ( "#Statistics" ) . css ( "display" , "none" ) ;
$ ( "#SupportStatistik" ) . css ( "display" , "none" ) ;
$ ( "#colorRibbon" ) . css ( "background-color" , "#3b7799" ) ;
toggleMenu ( ) ;
}
function showKalender ( ) {
$ ( "#customersDropDown" ) . val ( $ ( "#customersDropDown option" ) . eq ( 0 ) . val ( ) ) ;
$ ( "#zeiterfassung" ) . css ( "display" , "none" ) ;
$ ( "#KalenderNavigation" ) . css ( "display" , "block" ) ;
$ ( "#Kalender" ) . css ( "display" , "block" ) ;
$ ( "#klienten" ) . css ( "display" , "none" ) ;
$ ( "#colorRibbon" ) . css ( "background-color" , "#04b4d0" ) ;
$ ( "#UnterschriftBereich" ) . css ( "display" , "none" ) ;
$ ( "#Statistics" ) . css ( "display" , "none" ) ;
$ ( "#SupportStatistik" ) . css ( "display" , "none" ) ;
toggleMenu ( ) ;
2018-01-29 12:57:10 +01:00
initCalendar ( ) ;
2016-06-27 01:45:38 +02:00
}
function showUsAendern ( ) {
$ ( "#TerminSpeichern" ) . prop ( 'disabled' , false ) ;
$ ( "#AenderePopupDivSchalter" ) . val ( "true" ) ;
}
function showUsVerwerfen ( ) {
2018-01-29 12:57:10 +01:00
if ( $ ( "#AenderePopupDivSchalter" ) . val ( ) === "true" ) {
2018-02-07 14:14:08 +01:00
toggleUpdateAppointmentPopup ( "Wollen Sie wirklich abbrechen und Ihre Änderungen verwerfen?" ) ;
2018-01-29 12:57:10 +01:00
$ ( "#AenderePopupDivSchalter" ) . val ( "false" ) ;
2016-06-27 01:45:38 +02:00
} else {
2018-01-29 12:57:10 +01:00
hideEditForm ( ) ;
2016-06-27 01:45:38 +02:00
}
}
2018-01-29 12:57:10 +01:00
function initCalendar ( ) {
2016-06-27 01:45:38 +02:00
$ ( "#versteckt" ) . val ( "Speichern" ) ;
2018-01-29 12:57:10 +01:00
$ ( "html, body" ) . animate ( { scrollTop : 0 } , "fast" ) ;
2016-06-27 01:45:38 +02:00
var newtoday ;
2018-06-29 16:35:19 +02:00
var datumStr = $ ( "#KalenderDatum" ) . val ( ) ;
2016-06-27 01:45:38 +02:00
var nextdatum ;
2018-04-18 14:33:21 +02:00
if ( datumStr === "" ) {
2016-06-27 01:45:38 +02:00
nextdatum = new Date ( ) ;
2018-06-29 16:35:19 +02:00
var ddi0 = nextdatum . getDate ( ) ;
var mmi0 = nextdatum . getMonth ( ) + 1 ;
var yyyyi0 = nextdatum . getFullYear ( ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var ddStri0 = ddi0 < 10 ? "0" + ddi0 : ddi0 ;
var mmStri0 = mmi0 < 10 ? "0" + mmi0 : mmi0 ;
2016-06-27 01:45:38 +02:00
2018-01-29 12:57:10 +01:00
$ ( "#KalenderDatum" ) . val ( yyyyi0 + "-" + mmStri0 + "-" + ddStri0 ) ;
2018-02-23 14:42:53 +01:00
2018-01-29 12:57:10 +01:00
newtoday = ddStri0 + '.' + mmStri0 + "." + yyyyi0 ;
2018-02-23 14:42:53 +01:00
2016-06-27 01:45:38 +02:00
$ ( "#KalenderDatumFormat" ) . val ( newtoday ) ;
2018-01-29 12:57:10 +01:00
loadAppointments ( newtoday ) ;
2016-06-27 01:45:38 +02:00
}
2018-01-29 12:57:10 +01:00
}
2016-06-27 01:45:38 +02:00
2018-01-29 12:57:10 +01:00
function initAppointmentEditForm ( ) {
2018-06-29 16:35:19 +02:00
var currTime = new Date ( ) ;
2016-06-27 01:45:38 +02:00
2018-01-29 12:57:10 +01:00
if ( currTime . getMinutes ( ) <= 30 ) {
2018-06-29 16:35:19 +02:00
var k = 30 - currTime . getMinutes ( ) ;
2018-01-29 12:57:10 +01:00
currTime . setMinutes ( currTime . getMinutes ( ) + k ) ;
2016-06-27 01:45:38 +02:00
}
2018-01-29 12:57:10 +01:00
if ( currTime . getMinutes ( ) > 30 ) {
2018-06-29 16:35:19 +02:00
var j = 60 - currTime . getMinutes ( ) ;
2018-01-29 12:57:10 +01:00
currTime . setMinutes ( currTime . getMinutes ( ) + j ) ;
2016-06-27 01:45:38 +02:00
}
2019-03-29 14:04:12 +01:00
$ ( "#AppointmentEditForm" ) . show ( ) ;
$ ( "#KalenderTable" ) . hide ( ) ;
$ ( "#KalenderNavigation" ) . hide ( ) ;
$ ( "#KalenderTableTask" ) . hide ( ) ;
2018-01-29 12:57:10 +01:00
$ ( "#StartDate" ) . val ( $ ( "#KalenderDatumFormat" ) . val ( ) ) ;
$ ( "#EndDate" ) . val ( $ ( "#KalenderDatumFormat" ) . val ( ) ) ;
$ ( "#TerminStartZeit" ) . val ( getHoursAndMinutesWithLeadingZeros ( currTime ) ) ;
$ ( "#TerminEndZeit" ) . val ( "" ) ;
$ ( "#TerminBetreff" ) . val ( "" ) ;
$ ( "#TerminNotiz" ) . val ( "" ) ;
$ ( "#TerminBetreffLabel" ) . val ( "Betreff" ) ;
$ ( "#StartDate" ) . prop ( "readonly" , false ) ;
$ ( "#EndDate" ) . prop ( "readonly" , false ) ;
$ ( "#TerminStartZeit" ) . prop ( "readonly" , false ) ;
$ ( "#TerminEndZeit" ) . prop ( "readonly" , false ) ;
$ ( "#TerminBetreff" ) . prop ( 'readonly' , false ) ;
$ ( "#TerminNotiz" ) . prop ( "readonly" , false ) ;
$ ( "#TerminSpeichern" ) . val ( "Speichern" ) ;
$ ( "#TerminSpeichernAbbrechen" ) . val ( "Abbrechen" ) ;
2019-03-29 14:04:12 +01:00
$ ( "#TerminSpeichern" ) . hide ( ) ;
2018-01-29 12:57:10 +01:00
$ ( "#InsertAppointmentButton" ) . css ( "display" , "inline" ) ;
}
function hideEditForm ( ) {
2018-12-10 23:40:38 -04:00
$ ( "#AppointmentEditForm" ) . hide ( ) ;
$ ( "#KalenderTable" ) . show ( ) ;
$ ( "#KalenderNavigation" ) . show ( ) ;
$ ( "#KalenderTableTask" ) . show ( ) ;
2018-01-29 12:57:10 +01:00
$ ( "#StartDate" ) . val ( "" ) ;
}
2016-06-27 01:45:38 +02:00
function showServiceRecords ( ) {
location . reload ( ) ;
2018-12-12 19:10:07 -04:00
2016-06-27 01:45:38 +02:00
$ ( "#customersDropDown" ) . val ( $ ( "#customersDropDown option" ) . eq ( 0 ) . val ( ) ) ;
2018-12-12 19:10:07 -04:00
$ ( "#klientenTabelle" ) . hide ( ) ;
$ ( "#zeiterfassung" ) . show ( ) ;
$ ( "#KalenderNavigation" ) . hide ( ) ;
$ ( "#klienten" ) . hide ( ) ;
$ ( "#Kalender" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
$ ( "#colorRibbon" ) . css ( "background-color" , "#c80000" ) ;
2018-12-12 19:10:07 -04:00
$ ( "#UnterschriftBereich" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
2018-12-12 19:10:07 -04:00
$ ( "#Statistics" ) . show ( ) ;
$ ( "#SupportStatistik" ) . hide ( ) ;
2018-02-07 14:14:08 +01:00
2016-06-27 01:45:38 +02:00
toggleMenu ( ) ;
}
function goBackToZeiterfassung ( ) {
showSanduhr ( ) ;
$ ( "#customersDropDown" ) . val ( $ ( "#customersDropDown option" ) . eq ( 0 ) . val ( ) ) ;
2018-12-12 19:10:07 -04:00
$ ( "#klientenTabelle" ) . hide ( ) ;
$ ( "#zeiterfassung" ) . show ( ) ;
$ ( "#KalenderNavigation" ) . hide ( ) ;
$ ( "#klienten" ) . hide ( ) ;
$ ( "#Kalender" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
$ ( "#colorRibbon" ) . css ( "background-color" , "#c80000" ) ;
2018-12-12 19:10:07 -04:00
$ ( "#UnterschriftBereich" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
2018-12-12 19:10:07 -04:00
$ ( "#Statistics" ) . show ( ) ;
$ ( "#SupportStatistik" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
}
function klientenLaden ( ) {
$ ( "#map-canvas" ) . fadeOut ( ) ;
2018-02-07 14:14:08 +01:00
2016-06-27 01:45:38 +02:00
showSanduhr ( ) ;
2018-06-29 16:35:19 +02:00
var oid = parseInt ( $ ( "#customersDropDown" ) . find ( ":selected" ) . val ( ) ) ;
2018-02-07 14:14:08 +01:00
2018-04-18 14:33:21 +02:00
if ( oid === - 1 ) {
2018-12-12 19:10:07 -04:00
$ ( "#klientenTabelle" ) . hide ( ) ;
$ ( "#umfeldContainer" ) . hide ( ) ;
$ ( "#kommentarContainer" ) . hide ( ) ;
2018-02-07 14:14:08 +01:00
hideSanduhr ( ) ;
2016-06-27 01:45:38 +02:00
return ;
}
2018-01-29 12:57:10 +01:00
2016-06-27 01:45:38 +02:00
makeAjaxCall ( "GET" , getSelectedCustomerUrl , function ( json ) {
2018-12-12 19:10:07 -04:00
$ ( "#klientenTabelle" ) . show ( ) ;
$ ( "#umfeldContainer" ) . show ( ) ;
$ ( "#kommentarContainer" ) . show ( ) ;
2018-02-07 14:14:08 +01:00
2018-04-18 14:33:21 +02:00
if ( json === "SessionTimeout" ) {
2018-12-12 19:10:07 -04:00
window . location . href = window . redirectLink ;
2016-06-27 01:45:38 +02:00
return ;
2018-02-07 14:14:08 +01:00
}
vm . update ( $ . parseJSON ( json ) ) ;
2016-06-27 01:45:38 +02:00
$ ( ".toggle-btn2" ) . click ( function ( ) {
toggleOnclick ( this ) ;
2018-02-07 14:14:08 +01:00
} ) ;
2016-06-27 01:45:38 +02:00
} ,
2018-10-10 16:43:11 +02:00
{
customerOid : oid
} ,
2016-06-27 01:45:38 +02:00
hideSanduhr ) ;
}
function KlientenVM ( ) {
this . vorname = ko . observable ( "" ) ;
this . nachname = ko . observable ( "" ) ;
this . geburtstag = ko . observable ( "" ) ;
this . geschlecht = ko . observable ( "" ) ;
this . adresszusatz = ko . observable ( "" ) ;
this . strasse = ko . observable ( "" ) ;
this . plz = ko . observable ( "" ) ;
this . ort = ko . observable ( "" ) ;
this . rechnungsadressename = ko . observable ( "" ) ;
this . rechnungsadressestrasse = ko . observable ( "" ) ;
this . rechnungsadressepostleitzahl = ko . observable ( "" ) ;
this . rechnungsadresseort = ko . observable ( "" ) ;
this . email = ko . observable ( "" ) ;
this . pureemail = ko . observable ( "" ) ;
this . fax = ko . observable ( "" ) ;
this . telefon = ko . observable ( "" ) ;
this . handy = ko . observable ( "" ) ;
this . umfeldpersonen = ko . observableArray ( [ ] ) ;
this . Wohnheim = ko . observable ( "" ) ;
2018-02-19 18:34:20 +01:00
this . mobileLink = ko . observable ( "" ) ;
this . landLineLink = ko . observable ( "" ) ;
2018-10-10 16:43:11 +02:00
this . kommentar = ko . observable ( "" ) ;
2016-06-27 01:45:38 +02:00
2019-03-29 16:56:49 +01:00
this . update = function ( data ) {
2016-06-27 01:45:38 +02:00
this . vorname ( data . Vorname ) ;
this . nachname ( data . Nachname ) ;
this . geburtstag ( data . Geburtstag ) ;
this . geschlecht ( data . Geschlecht ) ;
this . adresszusatz ( data . Adresszusatz ) ;
this . strasse ( data . Strasse ) ;
this . plz ( data . Postleitzahl ) ;
this . ort ( data . Ort ) ;
this . rechnungsadressename ( data . RechnungsadresseName ) ;
this . rechnungsadressestrasse ( data . RechnungsadresseStrasse ) ;
this . rechnungsadressepostleitzahl ( data . RechnungsadressePostleitzahl ) ;
this . rechnungsadresseort ( data . RechnungsadresseOrt ) ;
2019-03-29 16:56:49 +01:00
this . email ( 'mailto:' + data . EMail ) ;
2016-06-27 01:45:38 +02:00
this . pureemail ( data . EMail ) ;
this . fax ( data . Fax ) ;
this . telefon ( data . Telefon ) ;
this . handy ( data . Handy ) ;
2018-06-22 20:25:13 +02:00
this . mobileLink ( 'tel:' + data . Handy ) ;
this . landLineLink ( 'tel:' + data . Telefon ) ;
2018-10-10 16:43:11 +02:00
this . kommentar ( data . Kommentar ) ;
2019-03-29 16:56:49 +01:00
console . log ( data ) ;
var mappedUmfeldpersonen = $ . map ( data . Umfeldpersonen , function ( item ) { return new UmfPers ( item ) ; } ) ;
2016-06-27 01:45:38 +02:00
2019-03-29 16:56:49 +01:00
if ( mappedUmfeldpersonen . length === 0 ) {
2016-06-27 01:45:38 +02:00
$ ( "#WohnheimContainer" ) . css ( "display" , "none" ) ;
}
this . umfeldpersonen ( mappedUmfeldpersonen ) ;
calcPropFieldMinSizes ( ) ;
updateEigenschaftsfelder ( ) ;
2019-03-29 16:56:49 +01:00
} ;
2016-06-27 01:45:38 +02:00
}
function UmfPers ( initdata ) {
var self = this ;
2019-03-29 16:56:49 +01:00
2016-06-27 01:45:38 +02:00
self . umfvorname = ko . observable ( initdata . Vorname ) ;
self . umfnachname = ko . observable ( initdata . Nachname ) ;
self . umfstrnr = ko . observable ( initdata . StrNameNr ) ;
self . umfplzort = ko . observable ( initdata . PLZOrt ) ;
self . umftelnr = ko . observable ( "tel:" + initdata . TelNr ) ;
self . nurtelnr = ko . observable ( initdata . TelNr ) ;
self . nurmobil = ko . observable ( initdata . Mobil ) ;
self . umfmobil = ko . observable ( "tel:" + initdata . Mobil ) ;
self . umfemail = ko . observable ( "mailto:" + initdata . EMail ) ;
self . nuremail = ko . observable ( initdata . EMail ) ;
self . umffax = ko . observable ( initdata . Fax ) ;
self . umfrolle = ko . observable ( initdata . Rolle ) ;
self . umftitel = ko . observable ( initdata . Titel ) ;
self . formattedName = ko . computed ( function ( ) {
var titel = self . umftitel ( ) ? self . umftitel ( ) + " " : "" ;
return titel + self . umfvorname ( ) + " " + self . umfnachname ( ) ;
} ) ;
self . update = function ( updatedata ) {
self . umfvorname ( updatedata . Vorname ) ;
self . umfnachname ( updatedata . Nachname ) ;
self . umfstrnr ( updatedata . StrNameNr ) ;
self . umfplzort ( updatedata . PLZOrt ) ;
self . umfmobil ( "tel:" + updatedata . Mobil ) ;
self . nurmobil ( updatedata . Mobil ) ;
self . umfemail ( "mailto:" + updatedata . EMail ) ;
self . nuremail ( ko . observable ( updatedata . EMail ) ) ;
self . umffax ( updatedata . Fax ) ;
self . umfrolle ( updatedata . Rolle ) ;
self . umftitel ( updatedata . Titel ) ;
self . umftelnr ( "tel:" + updatedata . TelNr ) ;
self . nurtelnr ( updatedata . TelNr ) ;
}
}
minSizes = undefined ;
function calcPropFieldMinSizes ( ) {
2018-02-07 14:14:08 +01:00
var width = 0 ;
var height = 0 ;
var elementCount = 0 ;
2016-06-27 01:45:38 +02:00
$ ( ".eigenschaftsdiv" ) . each (
2018-02-07 14:14:08 +01:00
function ( index , element ) {
2018-10-10 16:43:11 +02:00
var x = $ ( element ) . clone ( ) . css ( { "height" : "auto" , "width" : "auto" } ) . appendTo ( "body" ) ;
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
var temporaryWidth = x . outerWidth ( true ) ;
var temporaryHeight = x . outerHeight ( true ) ;
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
x . remove ( ) ;
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
elementCount ++ ;
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
if ( temporaryWidth > width ) {
width = temporaryWidth ;
}
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
if ( temporaryHeight > height ) {
height = temporaryHeight ;
}
2016-06-27 01:45:38 +02:00
}
) ;
2018-02-07 14:14:08 +01:00
window . minSizes = { minWidth : width , minHeight : height , divCount : elementCount } ;
2016-06-27 01:45:38 +02:00
}
function updateEigenschaftsfelder ( ) {
2018-06-29 16:35:19 +02:00
var customerTableWidth = $ ( "#klientenTabelle" ) . width ( ) ;
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
$ ( "#map-canvas" ) . css ( "width" , customerTableWidth - 16 ) ;
$ ( "#map-canvas" ) . css ( "height" , customerTableWidth - 16 ) ;
2016-06-27 01:45:38 +02:00
2018-12-10 23:40:38 -04:00
if ( minSizes === undefined ) {
2016-06-27 01:45:38 +02:00
return ;
2018-02-07 14:14:08 +01:00
}
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var mitPadding = minSizes . minWidth ;
2018-02-07 14:14:08 +01:00
var maxAnzahl = parseInt ( customerTableWidth / mitPadding ) ;
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( maxAnzahl > minSizes . divCount ) {
2016-06-27 01:45:38 +02:00
maxAnzahl = minSizes . divCount ;
2018-02-07 14:14:08 +01:00
}
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
var width = parseInt ( customerTableWidth / maxAnzahl ) - 16 ;
2016-06-27 01:45:38 +02:00
2018-10-10 16:43:11 +02:00
if ( minSizes !== undefined ) {
2016-06-27 01:45:38 +02:00
$ ( ".eigenschaftsdiv" ) . each (
2018-02-07 14:14:08 +01:00
function ( index , element ) {
2018-10-10 16:43:11 +02:00
$ ( element ) . css ( "width" , width + "px" ) ;
$ ( element ) . css ( "height" , ( minSizes . minHeight - 16 ) + "px" ) ;
2016-06-27 01:45:38 +02:00
}
) ;
}
}
$ ( window ) . resize ( function ( ) {
2018-04-18 14:33:21 +02:00
if ( $ ( "#klientenTabelle" ) . css ( "display" ) === "block" ) {
2016-06-27 01:45:38 +02:00
updateEigenschaftsfelder ( ) ;
}
2018-12-10 23:40:38 -04:00
updateDokuTabLinks ( ) ;
2016-06-27 01:45:38 +02:00
} ) ;
function showSanduhr ( ) {
2018-12-12 19:10:07 -04:00
$ ( ".modalWrapper" ) . show ( ) ;
2016-06-27 01:45:38 +02:00
$ ( ".modalWrapper" ) . css ( "height" , $ ( document ) . height ( ) ) ;
$ ( ".warte-animation" ) . css ( "display" , "inline-block" ) ;
}
function hideSanduhr ( ) {
2018-04-18 14:33:21 +02:00
if ( $ ( "#errorPopupDiv" ) . css ( "display" ) === "none" && $ ( "#popupDiv" ) . css ( "display" ) === "none" ) {
2018-12-10 23:40:38 -04:00
$ ( ".modalWrapper" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
$ ( ".modalWrapper" ) . css ( "height" , "0" ) ;
}
2018-04-18 14:33:21 +02:00
if ( $ ( "#SuccessPopupDiv" ) . css ( "display" ) === "none" && $ ( "#popupDiv" ) . css ( "display" ) === "none" ) {
2018-12-10 23:40:38 -04:00
$ ( ".modalWrapper" ) . hide ( ) ;
2018-10-10 16:43:11 +02:00
$ ( ".modalWrapper" ) . css ( "height" , "0" ) ;
2016-06-27 01:45:38 +02:00
}
2018-04-18 14:33:21 +02:00
if ( $ ( "#AendernPopupDiv" ) . css ( "display" ) === "none" && $ ( "#popupDiv" ) . css ( "display" ) === "none" ) {
2018-12-10 23:40:38 -04:00
$ ( ".modalWrapper" ) . hide ( ) ;
2018-10-10 16:43:11 +02:00
$ ( ".modalWrapper" ) . css ( "height" , "0" ) ;
2016-06-27 01:45:38 +02:00
}
2018-01-29 12:57:10 +01:00
2018-12-10 23:40:38 -04:00
$ ( ".warte-animation" ) . hide ( ) ;
2016-06-27 01:45:38 +02:00
}
function submitDeletionForm ( ) {
showSanduhr ( ) ;
$ ( "#deletionForm" ) . submit ( ) ;
}
2018-02-07 14:14:08 +01:00
function toggleErrorPopup ( errorMessage , i ) {
2018-06-29 16:35:19 +02:00
var isDisplayNone = $ ( "#errorPopupDiv" ) . css ( "display" ) === "none" ;
var displayValue = isDisplayNone ? "block" : "none" ;
2016-06-27 01:45:38 +02:00
$ ( "#errorPopupDiv" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "height" , $ ( document ) . height ( ) ) ;
2018-02-05 14:21:08 +01:00
if ( isDisplayNone ) {
2016-06-27 01:45:38 +02:00
$ ( "#errorPopupText" ) . text ( errorMessage ) ;
2018-04-18 14:33:21 +02:00
if ( i === 1 ) {
2016-06-27 01:45:38 +02:00
$ ( "#errorPopupTitle" ) . text ( "Info" ) ;
$ ( "#errorPopupOkBtn" ) . onclick = "toggleErrorPopup('')" ;
2018-04-18 14:33:21 +02:00
} else if ( i === 2 ) {
2016-06-27 01:45:38 +02:00
$ ( "#errorPopupTitle" ) . text ( "Fehler" ) ;
$ ( "#errorPopupOkBtn" ) . onclick = "toggleErrorPopup('')" ;
2018-02-07 14:14:08 +01:00
clearLocalStorage ( 1 ) ;
2017-02-01 13:53:59 +01:00
//SaveOnly(); // Speichere Daten bei absturz
2016-06-27 01:45:38 +02:00
}
else {
$ ( "#errorPopupTitle" ) . text ( "Fehler" ) ;
$ ( "#errorPopupOkBtn" ) . onclick = "toggleErrorPopup('')" ;
}
2018-01-29 12:57:10 +01:00
2018-06-29 16:35:19 +02:00
var errorPopupTitleOuterHeight = $ ( "#errorPopupTitle" ) . outerHeight ( ) ;
var errorPopupTextOuterHeight = $ ( "#errorPopupText" ) . outerHeight ( ) ;
var errorPopupButtonOuterHeight = $ ( "#errorPopupBtnDiv" ) . outerHeight ( ) ;
var errorPopupOkButtonOuterHeight = $ ( "#errorPopupOkBtn" ) . outerHeight ( ) ;
2018-01-29 12:57:10 +01:00
2018-06-29 16:35:19 +02:00
var height = errorPopupTitleOuterHeight + errorPopupTextOuterHeight + errorPopupButtonOuterHeight + errorPopupOkButtonOuterHeight + errorPopupOkButtonOuterHeight ;
2018-01-29 12:57:10 +01:00
2018-02-05 14:21:08 +01:00
$ ( "#errorPopupDiv" ) . css ( "height" , height + "px" ) ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
$ ( "#errorPopupDiv" ) . css ( "top" , window . pageYOffset + window . innerHeight / 2 - height / 2 ) ;
2016-06-27 01:45:38 +02:00
$ ( "#errorPopupDiv" ) . css ( "margin-top" , "0" ) ;
} else {
$ ( "#errorPopupDiv" ) . css ( "margin-top" , "auto" ) ;
}
}
function toggleSuccessPopup ( message , i ) {
2018-06-29 16:35:19 +02:00
var isDisplayNone = $ ( "#SuccessPopupDiv" ) . css ( "display" ) === "none" ;
var displayValue = isDisplayNone ? "block" : "none" ;
2016-06-27 01:45:38 +02:00
$ ( "#SuccessPopupDiv" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "height" , $ ( document ) . height ( ) ) ;
2017-02-01 13:53:59 +01:00
$ ( "#SuccessPopupOkBtn" ) . val ( "OK" ) ;
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( i === 2 ) {
2016-06-27 01:45:38 +02:00
$ ( ".SuccessPopupUSchrift" ) . css ( "display" , "none" ) ;
}
2018-04-18 14:33:21 +02:00
else if ( i === 3 ) {
2017-02-01 13:53:59 +01:00
$ ( ".SuccessPopupUSchrift" ) . css ( "display" , "none" ) ;
$ ( "#SuccessPopupTitle" ) . text ( "Es ist leider ein Fehler aufgetreten!" ) ;
}
2018-04-18 14:33:21 +02:00
else if ( i === 4 ) {
2017-02-01 13:53:59 +01:00
$ ( ".SuccessPopupUSchrift" ) . css ( "display" , "inline" ) ;
$ ( "#SuccessPopupOkBtn" ) . val ( "Nein" ) ;
}
2018-02-05 14:21:08 +01:00
else {
2017-02-01 13:53:59 +01:00
$ ( ".SuccessPopupUSchrift" ) . css ( "display" , "inline" ) ;
2018-02-05 14:21:08 +01:00
}
2018-01-29 12:57:10 +01:00
2018-04-18 14:33:21 +02:00
if ( isDisplayNone ) {
2016-06-27 01:45:38 +02:00
$ ( "#SuccessPopupText" ) . text ( message ) ;
2018-06-29 16:35:19 +02:00
var successPopupTitleOuterHeight = $ ( "#SuccessPopupTitle" ) . outerHeight ( ) ;
var successPopupTextOuterHeight = $ ( "#SuccessPopupText" ) . outerHeight ( ) ;
var successPopupButtonOuterHeight = $ ( "#SuccessPopupBtnDiv" ) . outerHeight ( ) ;
var successPopupOkButtonOuterHeight = $ ( ".SuccessPopupOkBtn" ) . outerHeight ( ) ;
var successPopupSignatureButtonOuterHeight = $ ( ".SuccessPopupUSchrift" ) . outerHeight ( ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var height = successPopupTitleOuterHeight + successPopupTextOuterHeight + successPopupButtonOuterHeight + successPopupOkButtonOuterHeight + successPopupSignatureButtonOuterHeight ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
$ ( "#SuccessPopupDiv" ) . css ( "height" , height + "px" ) ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
$ ( "#SuccessPopupDiv" ) . css ( "top" , window . pageYOffset + window . innerHeight / 2 - height / 2 ) ;
2016-06-27 01:45:38 +02:00
$ ( "#SuccessPopupDiv" ) . css ( "margin-top" , "0" ) ;
} else {
$ ( "#SuccessPopupDiv" ) . css ( "margin-top" , "auto" ) ;
}
}
2018-02-07 14:14:08 +01:00
function toggleUpdateAppointmentPopup ( message ) {
2018-06-29 16:35:19 +02:00
var isDisplayNone = $ ( "#AendernPopupDiv" ) . css ( "display" ) === "none" ;
var displayValue = isDisplayNone ? "block" : "none" ;
2016-06-27 01:45:38 +02:00
$ ( "#AendernPopupDiv" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "display" , displayValue ) ;
$ ( ".modalWrapper" ) . css ( "height" , $ ( document ) . height ( ) ) ;
2018-04-18 14:33:21 +02:00
if ( isDisplayNone ) {
2016-06-27 01:45:38 +02:00
$ ( "#AendernPopupText" ) . text ( message ) ;
2018-06-29 16:35:19 +02:00
var aendernPopupTitleOuterHeight = $ ( "#AendernPopupTitle" ) . outerHeight ( ) ;
var aenderPopupTextOuterHeight = $ ( "#AendernPopupText" ) . outerHeight ( ) ;
var aendernPopupButtonDivOuterHeight = $ ( "#AendernPopupBtnDiv" ) . outerHeight ( ) ;
var aendernPopupOkButtonOuterHeight = $ ( ".AendernPopupOkBtn" ) . outerHeight ( ) ;
var aendernPopupSignatureOuterHeight = $ ( ".AendernPopupUSchrift" ) . outerHeight ( ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var height = aendernPopupTitleOuterHeight + aenderPopupTextOuterHeight + aendernPopupButtonDivOuterHeight + aendernPopupOkButtonOuterHeight + aendernPopupSignatureOuterHeight ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
$ ( "#AendernPopupDiv" ) . css ( "height" , height + "px" ) ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
$ ( "#AendernPopupDiv" ) . css ( "top" , window . pageYOffset + window . innerHeight / 2 - height / 2 ) ;
2016-06-27 01:45:38 +02:00
$ ( "#AendernPopupDiv" ) . css ( "margin-top" , "0" ) ;
} else {
$ ( "#AendernPopupDiv" ) . css ( "margin-top" , "auto" ) ;
}
}
function confirmErrorPopup ( ) {
toggleErrorPopup ( "" ) ;
}
function clearRecords ( ) {
$ ( "#serviceRecords" ) . empty ( ) ;
}
function preselectCustomer ( ) {
$ . ajax ( {
type : "GET" ,
url : getSupportConceptCustomerUrl ,
success : function ( json ) {
2018-04-18 14:33:21 +02:00
if ( json === "NoSupportConceptSelected" ) {
2016-06-27 01:45:38 +02:00
return ;
}
var valueToSelect = $ . parseJSON ( json ) ;
$ ( "#customersDropDown option" ) . each ( function ( ) {
2018-04-18 14:33:21 +02:00
if ( this . value === valueToSelect === true ) {
2016-06-27 01:45:38 +02:00
$ ( "#customersDropDown" ) . val ( valueToSelect ) ;
2018-10-10 16:43:11 +02:00
$ ( "#customersDropDown" ) . trigger ( "change" ) ;
2016-06-27 01:45:38 +02:00
return false ;
} else {
return true ;
}
} ) ;
}
} ) ;
}
2018-02-05 14:21:08 +01:00
function setSelectedEmployee ( ) {
2018-06-29 16:35:19 +02:00
var oid = parseInt ( $ ( "#employeesDropDown" ) . find ( ":selected" ) . val ( ) ) ;
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( isNaN ( oid ) ) {
2016-06-27 01:45:38 +02:00
return ;
}
2018-02-05 14:21:08 +01:00
window . serviceRecordEmployeeOid = oid ;
2016-06-27 01:45:38 +02:00
2018-02-05 14:21:08 +01:00
makeAjaxCall ( "GET" , setServiceRecordEmployeeUrl , null , { employeeOid : window . serviceRecordEmployeeOid } , null ) ;
2016-06-27 01:45:38 +02:00
}
function SaveOnly ( ) {
2018-12-10 23:40:38 -04:00
if ( typeof Storage !== "undefined" ) {
2018-02-07 14:14:08 +01:00
clearLocalStorage ( 1 ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
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 ( ) ;
2016-06-27 01:45:38 +02:00
2018-06-29 16:35:19 +02:00
var notiz2 , notiz3 , notiz4 , notiz5 ;
2018-01-29 12:57:10 +01:00
2018-04-18 14:33:21 +02:00
if ( $ ( "#notiz_textbox1" ) . val ( ) !== "" ) {
2018-02-07 14:14:08 +01:00
notiz = $ ( "#notiz_textbox1" ) . val ( ) ;
2016-06-27 01:45:38 +02:00
}
2018-04-18 14:33:21 +02:00
if ( $ ( "#notiz_textbox2" ) . val ( ) !== "" ) {
2018-02-07 14:14:08 +01:00
notiz2 = $ ( "#notiz_textbox2" ) . val ( ) ;
}
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( $ ( "#notiz_textbox3" ) . val ( ) !== "" ) {
2018-02-07 14:14:08 +01:00
notiz3 = $ ( "#notiz_textbox3" ) . val ( ) ;
}
2016-06-27 01:45:38 +02:00
2018-04-18 14:33:21 +02:00
if ( $ ( "#notiz_textbox4" ) . val ( ) !== "" ) {
2018-02-07 14:14:08 +01:00
notiz4 = $ ( "#notiz_textbox4" ) . val ( ) ;
}
2018-01-29 12:57:10 +01:00
2018-04-18 14:33:21 +02:00
if ( $ ( "#notiz_textbox5" ) . val ( ) !== "" ) {
2018-02-07 14:14:08 +01:00
notiz5 = $ ( "#notiz_textbox5" ) . val ( ) ;
2016-06-27 01:45:38 +02:00
}
2018-02-07 14:14:08 +01:00
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 ( ) ) ) ;
2016-06-27 01:45:38 +02:00
}
}
2018-02-07 14:14:08 +01:00
function clearLocalStorage ( i ) {
2018-01-29 12:57:10 +01:00
if ( i === 1 ) {
2016-06-27 01:45:38 +02:00
localStorage . removeItem ( "Zeitdaten" ) ;
2018-01-29 12:57:10 +01:00
}
if ( i === 2 ) {
2016-06-27 01:45:38 +02:00
localStorage . removeItem ( "Kalenderdaten" ) ;
2018-01-29 12:57:10 +01:00
}
2016-06-27 01:45:38 +02:00
}
2018-02-07 14:14:08 +01:00
function saveZeiterfassungAfterCrash ( datum , startd , endd , dauer , doku , leistung , costBearer2SupportConceptOid , doku2 , doku3 , doku4 , doku5 , enddatum ) {
2018-06-29 16:35:19 +02:00
var x = getDateObj ( true ) ;
var y = getDateObj ( false ) ;
2018-01-29 12:57:10 +01:00
2018-06-29 16:35:19 +02:00
var vonDatum = getDateTimeStringWithLeadingZeros ( x ) ;
var bisDatum = getDateTimeStringWithLeadingZeros ( y ) ;
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
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
2016-06-27 01:45:38 +02:00
} ) ;
2018-02-07 14:14:08 +01:00
} 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 ) {
2018-01-29 12:57:10 +01:00
2018-06-29 16:35:19 +02:00
var hasSufficientRights = json ;
2018-01-29 12:57:10 +01:00
2018-02-07 14:14:08 +01:00
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");*/ }
} ) ;
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
} else {
clearLocalStorage ( 1 ) ;
2016-06-27 01:45:38 +02:00
2018-02-07 14:14:08 +01:00
setTimeout ( function ( ) {
$ ( "#scDropDown option[value='" + costBearer2SupportConceptOid + "']" ) . attr ( "selected" , true ) . trigger ( "change" ) ;
} , 4500 ) ;
2018-01-29 12:57:10 +01:00
2018-02-07 14:14:08 +01:00
}
} , 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");
2016-06-27 01:45:38 +02:00
}
2018-02-07 14:14:08 +01:00
} ) ;
2016-06-27 01:45:38 +02:00
}
}
2018-02-07 14:14:08 +01:00
function showErrorAfterCrash ( ) {
2018-06-29 16:35:19 +02:00
var errorAfterCrashSwitch = $ ( "#ErrorZeiterfassungAfterCrashSchalter" ) ;
var switchValue = errorAfterCrashSwitch . val ( ) ;
2018-02-05 14:21:08 +01:00
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 ) ;
2018-02-07 14:14:08 +01:00
clearLocalStorage ( 1 ) ;
2018-02-05 14:21:08 +01:00
setTimeout ( function ( ) {
2016-06-27 01:45:38 +02:00
$ . ajax ( {
type : "GET" ,
url : ErrorZeiterfassungAnzeigenUrl ,
2018-02-05 14:21:08 +01:00
data : { errorwert : 1 }
2016-06-27 01:45:38 +02:00
} ) ;
2018-02-05 14:21:08 +01:00
} , timeOut ) ;
2016-06-27 01:45:38 +02:00
}
}
2018-12-17 18:32:32 -04:00
2018-02-02 14:43:40 +01:00
function focusOnTab ( tabIdentifier ) {
2018-12-10 23:40:38 -04:00
focusOnDoku ( tabIdentifier ) ;
}
function focusOnDoku ( number ) {
2018-02-02 14:43:40 +01:00
setTimeout ( function ( ) {
var displayValue ;
2018-01-29 12:57:10 +01:00
2018-12-10 23:40:38 -04:00
for ( var i = 0 ; i < window . numberOfDocumentationTypes ; i ++ ) {
2018-06-29 16:35:19 +02:00
var idNumber = i + 1 ;
2018-12-10 23:40:38 -04:00
displayValue = idNumber === number ? "block" : "none" ;
if ( idNumber === number ) {
$ ( "#doku-name-" + idNumber ) . addClass ( "active" ) ;
} else {
$ ( "#doku-name-" + idNumber ) . removeClass ( "active" ) ;
}
2018-01-29 12:57:10 +01:00
2018-12-10 23:40:38 -04:00
$ ( "#doku-tab-content-" + idNumber ) . css ( "display" , displayValue ) ;
$ ( "#notiz_textbox" + idNumber ) . css ( "display" , displayValue ) ;
2018-02-02 14:43:40 +01:00
}
2018-01-29 12:57:10 +01:00
2018-12-17 18:32:32 -04:00
var f = number - 1 ;
var c = window . numberOfDocumentationTypes ;
2018-01-29 12:57:10 +01:00
2018-12-17 18:32:32 -04:00
for ( var e = 0 ; e < window . numberOfDocumentationTypes ; e ++ ) {
2019-03-29 14:04:12 +01:00
if ( ( e > f || e < f - 1 ) && e < c - 1 ) {
2018-12-17 18:32:32 -04:00
$ ( "#doku-name-" + ( e + 1 ) ) . css ( "border-right" , "1px solid #bbbbbb" ) ;
}
2018-02-02 14:43:40 +01:00
}
2018-01-29 12:57:10 +01:00
2018-12-10 23:40:38 -04:00
$ ( "#notiz_textbox" + number ) . get ( 0 ) . focus ( ) ;
window . focusedDokuTextarea = $ ( "#notiz_textbox" + number ) ;
2018-02-02 14:43:40 +01:00
} , 100 ) ;
2018-06-22 20:25:13 +02:00
}
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
function updateDokuTabLinks ( ) {
if ( numberOfDocumentationTypes !== undefined && numberOfDocumentationTypes > 1 ) {
var height = 0 ;
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
$ ( ".doku-tab-link" ) . css ( "height" , "auto" ) ;
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
for ( var i = 0 ; i < numberOfDocumentationTypes ; i ++ ) {
var idNumber = i + 1 ;
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
var dokuTab = $ ( "#doku-name-" + idNumber ) ;
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
var outerHeight = dokuTab . outerHeight ( ) ;
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
if ( outerHeight > height ) {
height = outerHeight ;
}
}
2018-06-27 13:55:20 +02:00
2018-12-10 23:40:38 -04:00
$ ( ".doku-tab-link" ) . css ( "height" , height + "px" ) ;
}
2018-06-27 13:55:20 +02:00
}