1function bookingRemoteControlSession(countrySel,fromLocationSel,fromDateInput,fromDateISO,toLocationSel,toDateInput,toDateISO,presetCountry=null,presetLocation=null){let session={getCountry:()=>{let result=countrySel.val();if(result)return result;return'DE'},bookingFormData:()=>{},locationData:{},locationRequestsWaiting:[],countryChangedPartial:(fromLocationSel,fromDateInput,toLocationSel,toDateInput)=>{return function(){fromLocationSel.empty() 2toLocationSel.empty() 3acb.locationsAndOpeningTimes(session,function(data){let emergencyDefaultLocation=null 4let presetLocationFound=!1 5jQuery.each(data.locations,function(idx,loc){if(!emergencyDefaultLocation)emergencyDefaultLocation=loc.code 6if(loc.code===presetLocation)presetLocationFound=!0 7let from_opt=jQuery(`<option value='${loc.code}'>${loc.name}</option>`) 8fromLocationSel.append(from_opt) 9let to_opt=jQuery(`<option value='${loc.code}'>${loc.name}</option>`) 10toLocationSel.append(to_opt)}) 11let defaultLocationCode=(data&&data.country&&data.country.default_location)??emergencyDefaultLocation 12let defaultFromLocation=presetLocationFound?presetLocation:defaultLocationCode 13fromLocationSel.val(defaultFromLocation) 14console.log("From-loc default: External value presetLocation is "+presetLocation+",found "+presetLocationFound+", from data "+defaultLocationCode+" chosen was "+defaultFromLocation+" and readback is "+fromLocationSel.val()) 15let defaultToLocation=presetLocationFound?presetLocation:defaultLocationCode 16toLocationSel.val(defaultToLocation) 17let fd=acb.suggestFromDate(session,fromDateInput.datepicker("getDate"),defaultFromLocation) 18fromDateInput.datepicker("setDate",fd) 19let td=acb.suggestToDate(session,toDateInput.datepicker("getDate"),defaultFromLocation,defaultToLocation) 20toDateInput.datepicker("setDate",td)},{error:function(error){alert('error; '+eval(error))}})}},fromLocationChangedPartial:(fromLocationSel,fromDateInput,toLocationSel,toDateInput)=>{return function(){let fromLocationCode=fromLocationSel.val() 21let fromLocation=acb.locationsAndOpeningTimes(session)['locations'][fromLocationCode]??null 22toLocationSel.empty() 23acb.locationsAndOpeningTimes(session,function(data){jQuery.each(data.locations,function(index,loc){if(fromLocation&&!acb.intersects(loc.suppliers,fromLocation.suppliers).length)return!0 24let to_opt=jQuery(`<option value='${loc.code}'>${loc.name}</option>`) 25toLocationSel.append(to_opt)})}) 26toLocationSel.val(fromLocationCode)}},toLocationChangedPartial:(fromLocationSel,fromDateInput,toLocationSel,toDateInput)=>{return function(){let fromLocationCode=fromLocationSel.val() 27let toLocationCode=toLocationSel.val() 28let td=acb.suggestToDate(session,toDateInput.datepicker("getDate"),fromLocationCode,toLocationCode) 29toDateInput.datepicker("setDate",td)}}} 30let presetCountrySel=presetCountry??session.getCountry() 31console.log("Presetting country to "+presetCountrySel) 32countrySel.val(presetCountrySel) 33fromDateInput.datepicker({altFormat:"yy-mm-dd",dateFormat:"dd/mm-yy",altField:fromDateISO,beforeShowDay:function(date){let status=acb.isDateEnabled(session,date,fromLocationSel.val()) 34return[status]},onSelect:function(){toDateInput.datepicker("option","minDate",fromDateInput.datepicker("getDate"))}});toDateInput.datepicker({altFormat:'yy-mm-dd',dateFormat:"dd/mm-yy",altField:toDateISO,beforeShowDay:function(date){let status=acb.isDateEnabled(session,date,toLocationSel.val()) 35return[status]},});let now=new Date() 36fromDateInput.datepicker("option","minDate",now) 37toDateInput.datepicker("option","minDate",now) 38var fromDate=new Date(now);fromDate.setDate(fromDate.getDate()+90) 39fromDateInput.datepicker("setDate",fromDate);var toDate=new Date(fromDate);toDate.setDate(toDate.getDate()+14) 40toDateInput.datepicker("setDate",toDate) 41fromLocationSel.on('change',session.fromLocationChangedPartial(fromLocationSel,fromDateInput,toLocationSel,toDateInput)) 42toLocationSel.on('change',session.toLocationChangedPartial(fromLocationSel,fromDateInput,toLocationSel,toDateInput)) 43let selectedCountryFunc=session.countryChangedPartial(fromLocationSel,fromDateInput,toLocationSel,toDateInput) 44selectedCountryFunc() 45countrySel.on('change',selectedCountryFunc) 46return session}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.