2020-11-19 23:02:12 +01:00
|
|
|
var allgroups=[];var customers=[];var decpoint=".";var currency="";var payments=[];function getGeneralConfigItemsCus(){$("#customersearch").val("");$("#groupsearch").val("");clearNewCustomerFields();clearNewGroupFields();doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertConfigDoRest,"Fehler Konfigurationsdaten");doAjax("GET","php/contenthandler.php?module=customers&command=getPaymentsForGuest",null,insertPayments,"Fehler Zahlungswege",true);customizeDatePicker("#newcustomercheckin",null);customizeDatePicker("#newcustomercheckout",null);customizeDatePicker("#customerdate","")}function insertConfigDoRest(b){if(b.status==="OK"){var a=b.msg;$("#customersearch").val("");setLanguage(a.userlanguage);decpoint=a.decpoint;currency=a.currency;bindGroupsOrCustomerBtns();showCustomersArea();startSearch()}else{setTimeout(function(){document.location.href="index.html"},250)}}function insertPayments(d){if(d.status=="OK"){var c=d.msg;payments=[];for(var b=0;b<c.length;b++){var a=c[b];payments[payments.length]={id:a.id,name:a.name}}}}function createPaymentsArea(b,e,f){var a=createCollapsibleStartGeneral("paymentsarea_"+b,f,"f","paymentsarea",true);for(var c=0;c<payments.length;c++){var d=payments[c];a+=createApplyButton("payment_"+b+"_"+d.id+"_"+e,d.name,"e","paymentpay")}a+="</div>";return a}function showCustomersArea(){$("#customersarea").show();$("#groupsarea").hide();$("#customersbtn").buttonMarkup({theme:"f"});$("#customersbtn").buttonMarkup({icon:"arrow-d"});$("#groupsbtn").buttonMarkup({theme:"c"});$("#groupsbtn").buttonMarkup({icon:"arrow-r"})}function showGroupsArea(){$("#customersarea").hide();$("#groupsarea").show();$("#customersbtn").buttonMarkup({theme:"c"});$("#customersbtn").buttonMarkup({icon:"arrow-r"});$("#groupsbtn").buttonMarkup({theme:"f"});$("#groupsbtn").buttonMarkup({icon:"arrow-d"})}function bindGroupsOrCustomerBtns(){$("#customersbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showCustomersArea()});$("#groupsbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showGroupsArea()});$("#newcustomerbtn").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var b=$("#newcustomername").val().trim();var k=$("#newcustomeremail").val().trim();var m=$("#newcustomeraddress").val().trim();var g=$("#newcustomerremark").val().trim();var i=$("#newcustomerphone").val().trim();var j=$("#newcustomermobil").val().trim();var c=$("#newcustomerwww").val().trim();var a=$("#newcustomerroom").val().trim();if(b===""){alert(CUS_EMPTY_NAME[l])}else{var f=getCheckinouts("#newcustomercheckin","#newcustomercheckout");if(!f.valid){alert(CUS_CHECKIN_AFTER_OUT[l]);return}var d={name:b,email:k,addr:m,remark:g,phone:i,mobil:j,www:c,checkin:f.checkin,checkout:f.checkout,room:a};if(!cusCheckTextLengths(d)){return}doAjax("POST","php/contenthandler.php?module=customers&command=createNewCustomer",d,handleCreateCustomerResult,"Gast anlegen unmöglich",true)}});$("#customersearch").off("keyup").on("keyup",function(a){startSearch()});$("#groupsearch").off("keyup").on("keyup",function(a){startSearch()});$("#newgroupbtn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var a=$("#newgroupname").val().trim();var d=$("#newgroupremark").val().trim();if(a===""){alert(GROUP_EMPTY_NAME[l])}else{var b={name:a,remark:d};doAjax("POST","php/contenthandler.php?module=customers&command=createNewGroup",b,handleCreateGroupResult,"Gruppe anlegen unmöglich",true)}});$("#customerlog").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();window.open("php/contenthandler.php?module=customers&command=exportLog","_blank")})}function bindOnDynamicCustomersBtn(){$(".applycustomer").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var j=this.id.split("_")[1];var a=[];for(var b=0;b<allgroups.length;b++){var f=allgroups[b];var c="#grplistitem_"+j+"_"+f.id;if($(c).hasClass("ingroup")){a[a.length]=f.id}}var h=getCheckinouts("#cusfield_ch
|