1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep(e,t,n,i,c,r,_){try{var a=e[r](_),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(i,c)}function _asyncToGenerator(a){return function(){var e=this,_=arguments;return new Promise(function(t,n){var i=a.apply(e,_);function c(e){asyncGeneratorStep(i,t,n,c,r,"next",e)}function r(e){asyncGeneratorStep(i,t,n,c,r,"throw",e)}c(void 0)})}}function includesString(e,t){return e.toLowerCase().includes(t.toLowerCase())}function ADisSettings(e){return _ADisSettings.apply(this,arguments)}function _ADisSettings(){return(_ADisSettings=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ADisDB.ADisSettings.each(function(e){e.name==t&&(n=e.value)});case 2:return e.abrupt("return",n);case 3:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}ADisDB.on("ready",function(){if("/"===window.location.pathname||"/#"===window.location.pathname){$.getJSON("https://raw.josef-froehle.de/Dexus/automatic-dispose/master/all_missions.json",function(e){for(var t in e)n=e[t],ADisDB.ADisAvailabelMissions.put({missionID:n.id,type:n.type,name:n.name,jsondata:n}).catch(function(e){console.error(e)});var n})}if(-1!==window.location.pathname.indexOf("/missions/")){var n,i,c,r,_=function(e){return ADisDB.transaction("rw",[ADisDB.ADisMissionsOwn,ADisDB.ADisSettings,ADisDB.ADisAvailabelMissions],function(){return ADisDB.ADisAvailabelMissions.get({type:e.toString()}).then(function(e){console.log(e),null!=e&&e.jsondata&&(c=e.jsondata,t())})})},t=function(){console.log(" Automatic Dispose: Starte Alarmierungsprozess"),setTimeout(function(){Promise.resolve().then(_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}))).then(_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}))).then(_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}))).then(_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([l(),o(),h(),u(),f()]).then(function(e){-1!=["adis-ownmissions","adis-krankentransporte","adis-verbandmission"].indexOf(window.name)&&setTimeout(function(){$("#mission_alarm_btn").click()},250)});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)})))},250)},a=function(){return $("#mission_vehicle_driving tbody").find("tr").each(function(){var e=$(this).find("a").first().attr("href").substr($(this).find("a").first().attr("href").lastIndexOf("/")+1),t=$(this).find("a").first().text(),n=$(this).find("a").first().attr("vehicle_type_id");v[e]={id:e,name:t,type:n}}),$("#mission_vehicle_at_mission tbody").find("tr").each(function(){var e=$(this).find("a").first().attr("href").substr($(this).find("a").first().attr("href").lastIndexOf("/")+1),t=$(this).find("a").first().text(),n=$(this).find("a").first().attr("vehicle_type_id");v[e]={id:e,name:t,type:n}}),console.log(" Automatic Dispose: Bereits beteiligte Fahrzeuge:"),console.log(v),v},s=function(){var s=0;return $(".mission_patient").each(function(){var e=$(this).text(),t=!1,n=!1,i=!1,c=!1,r=!1,_=!1,a=!1;0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen einen RTW oder KTW Typ B")&&(_=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen ein RTW")&&(t=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen ein NEF")&&(n=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen ein RTH")&&(i=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen einen LNA")&&(c=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen einen OrgL")&&(r=!0),0<$(this).find(".alert-danger").length&&-1!=$(this).find(".alert-danger").text().indexOf("Wir benötigen eine Tragehilfe")&&(a=!0),x[s]={name:e,need_RTW:t,need_NEF:n,need_RTH:i,need_LNA:c,need_OrgL:r,need_SEG_KTWB:_,need_Tragehilfe:a},s++}),console.log(" Automatic Dispose: Patientenliste:"),console.log(x),x},l=function(){if("object"!=_typeof(c.emergency_medical_service))return!1;for(var e in 5<=Object.keys(x).length&&k[55]++,10<=Object.keys(x).length&&k[56]++,x){var t=x[e];1==c.emergency_medical_service.use_KTW&&(t.need_RTW||t.need_NEF||t.need_RTH||k[38]++),t.need_LNA&&k[55]<1&&k[55]++,t.need_OrgL&&k[56]<1&&k[56]++,1==t.need_Tragehilfe&&k[0]++,1==c.emergency_medical_service.use_RTW&&k[28]++,1==c.emergency_medical_service.use_NEF&&k[29]++,1==c.emergency_medical_service.use_RTH&&k[31]++}return"true"==c.emergency_medical_service.use_SEG_ELW1_Only?k[59]++:("true"==c.emergency_medical_service.use_SEG_FULL||3<=Object.keys(x).length)&&(k[58]++,k[58]++,k[58]++,k[59]++,k[60]++),(0<$("#vehicle_show_table_body_all").length?$("#vehicle_show_table_body_all"):$("#vehicle_show_table_body_rett")).find(".vehicle_select_table_tr").each(function(){try{var e=$(this).attr("id").replace("vehicle_element_content_",""),t=$(this).attr("vehicle_type")}catch(e){console.error("MOP ",e)}"KTW"==t&&0<k[38]?($("#vehicle_checkbox_"+e).click(),k[38]--):("LF 20"==t||"LF 10"==t||"LF 8/6"==t||"LF 20/16"==t||"LF 10/6"==t||"LF 16-TS"==t||"HLF 20"==t||"TSF-W"==t||"TLF 2000"==t||"TLF 3000"==t||"TLF 8/8"==t||"TLF 8/18"==t||"TLF 16/24-Tr"==t||"TLF 16/25"==t||"TLF 16/45"==t||"TLF 20/40"==t||"TLF 20/40-SL"==t||"TLF 16"==t)&&0<k[0]+k[1]+k[6]+k[7]+k[8]+k[9]+k[30]+k[37]+k[17]+k[18]+k[19]+k[20]+k[21]+k[22]+k[23]+k[24]+k[25]+k[26]?($("#vehicle_checkbox_"+e).click(),k[0]--):"NAW"==t&&0<k[28]&&0<k[29]?($("#vehicle_checkbox_"+e).click(),k[74]--,k[28]--,k[29]--):"GRTW"==t&&0<k[73]?($("#vehicle_checkbox_"+e).click(),k[73]--):"RTW"==t&&0<k[28]?($("#vehicle_checkbox_"+e).click(),k[28]--):"NEF"==t&&0<k[29]?($("#vehicle_checkbox_"+e).click(),k[29]--):"RTH"==t&&0<k[31]?($("#vehicle_checkbox_"+e).click(),k[31]--):"KdoW-LNA"==t&&0<k[55]?($("#vehicle_checkbox_"+e).click(),k[55]--):"KdoW-OrgL"==t&&0<k[56]?($("#vehicle_checkbox_"+e).click(),k[56]--):"KTW Typ B"==t&&0<k[58]?($("#vehicle_checkbox_"+e).click(),k[58]--,k[28]--):"ELW 1 (SEG)"==t&&0<k[59]?($("#vehicle_checkbox_"+e).click(),k[59]--):"GW-San"==t&&0<k[60]&&($("#vehicle_checkbox_"+e).click(),k[60]--,k[29]--,k[29]--)}),!0},o=function(){return"object"==_typeof(c.fire_department)&&(console.log(k),k[0]+=parseInt(c.fire_department.num_LF),k[3]+=parseInt(c.fire_department.num_ELW_1),k[34]+=parseInt(c.fire_department.num_ELW_2),k[2]+=parseInt(c.fire_department.num_DLK),k[4]+=parseInt(c.fire_department.num_RW),k[57]+=parseInt(c.fire_department.num_FwK),k[5]+=parseInt(c.fire_department.num_GW_A),k[27]+=parseInt(c.fire_department.num_GW_G),k[10]+=parseInt(c.fire_department.num_GW_Oel),k[12]+=parseInt(c.fire_department.num_GW_Mess),k[11]+=parseInt(c.fire_department.num_SW),k[33]+=parseInt(c.fire_department.num_GW_Hoeh),k[53]+=parseInt(c.fire_department.num_Dekon_P),k[75]+=parseInt(c.fire_department.num_FLF),k[76]+=parseInt(c.fire_department.num_Rettungstreppe),k[83]+=parseInt(c.fire_department.num_GW_Werkfeuerwehr),k[84]+=parseInt(c.fire_department.num_ULF_mit_Loescharm),k[86]+=parseInt(c.fire_department.num_Turboloescher),$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function(){var e=$(this).attr("id").replace("vehicle_element_content_",""),t=$(this).attr("vehicle_type");$("#vehicle_sort_"+e).attr("sortvalue");("LF 20"==t||"LF 10"==t||"LF 8/6"==t||"LF 20/16"==t||"LF 10/6"==t||"LF 16-TS"==t||"HLF 20"==t||"TSF-W"==t||"TLF 2000"==t||"TLF 3000"==t||"TLF 8/8"==t||"TLF 8/18"==t||"TLF 16/24-Tr"==t||"TLF 16/25"==t||"TLF 16/45"==t||"TLF 20/40"==t||"TLF 20/40-SL"==t||"TLF 16"==t)&&0<k[0]+k[1]+k[6]+k[7]+k[8]+k[9]+k[30]+k[37]+k[17]+k[18]+k[19]+k[20]+k[21]+k[22]+k[23]+k[24]+k[25]+k[26]?($("#vehicle_checkbox_"+e).click(),k[0]--,"HLF 20"==t&&0<k[4]&&k[4]--):"HLF 20"==t&&0<k[4]?($("#vehicle_checkbox_"+e).click(),k[0]--,k[4]--):("DLK 23"==t||"TM 50"==t)&&0<k[2]?($("#vehicle_checkbox_"+e).click(),k[2]--):"AB-Einsatzleitung"==t&&0<k[3]+k[34]+k[78]?($("#vehicle_checkbox_"+e).click(),k[3]--,k[34]--):"ELW 2"==t&&0<k[3]+k[34]?($("#vehicle_checkbox_"+e).click(),k[3]--,k[34]--):"ELW 1"==t&&0<k[3]?($("#vehicle_checkbox_"+e).click(),k[3]--):"MTW"==t&&0<k[36]?($("#vehicle_checkbox_"+e).click(),k[36]--):"FwK"==t&&0<k[57]?($("#vehicle_checkbox_"+e).click(),k[57]--):"GWK"==t&&0<k[4]?($("#vehicle_checkbox_"+e).click(),k[4]--,k[39]--):("RW"==t||"AB-Rüst"==t)&&0<k[4]?($("#vehicle_checkbox_"+e).click(),k[4]--):("GW-A"==t||"AB-Atemschutz"==t)&&0<k[5]?($("#vehicle_checkbox_"+e).click(),k[5]--):("GW-Öl"==t||"AB-Öl"==t)&&0<k[10]?($("#vehicle_checkbox_"+e).click(),k[10]--):"GW-Messtechnik"==t&&0<k[12]?($("#vehicle_checkbox_"+e).click(),k[12]--):("GW-L2-Wasser"==t||"SW 1000"==t||"SW 2000"==t||"SW 2000-Tr"==t||"SW Kats"==t||"AB-Schlauch"==t)&&0<k[11]?($("#vehicle_checkbox_"+e).click(),k[11]--):("GW-Gefahrgut"==t||"AB-Gefahrgut"==t)&&0<k[27]?($("#vehicle_checkbox_"+e).click(),k[27]--):"GW-Höhenrettung"==t&&0<k[33]?($("#vehicle_checkbox_"+e).click(),k[33]--):("Dekon-P"==t||"AB-Dekon-P"==t)&&0<k[53]?($("#vehicle_checkbox_"+e).click(),k[53]--):"GW-Werkfeuerwehr"==t&&0<k[83]?($("#vehicle_checkbox_"+e).click(),k[83]--):"ULF mit Löscharm"==t&&0<k[84]?($("#vehicle_checkbox_"+e).click(),k[84]--):"Turbolöscher"==t&&0<k[86]?($("#vehicle_checkbox_"+e).click(),k[86]--):"FLF"==t&&0<k[75]?($("#vehicle_checkbox_"+e).click(),k[75]--):"Rettungstreppe"==t&&0<k[76]&&($("#vehicle_checkbox_"+e).click(),k[76]--)}),!0)},h=function(){return"object"==_typeof(c.police_department)&&(k[32]+=parseInt(c.police_department.num_FuStW),k[35]+=parseInt(c.police_department.num_leBefKw),k[50]+=parseInt(c.police_department.num_GruKw),k[51]+=parseInt(c.police_department.num_FueKw),k[52]+=parseInt(c.police_department.num_GefKw),k[72]+=parseInt(c.police_department.num_WaWe),k[61]+=parseInt(c.police_department.num_PHu),k[79]+=parseInt(c.police_department.num_SEK_ZF),k[80]+=parseInt(c.police_department.num_SEK_MTF),k[81]+=parseInt(c.police_department.num_MEK_ZF),k[82]+=parseInt(c.police_department.num_MEK_MTF),$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function(){var e=$(this).attr("id").replace("vehicle_element_content_",""),t=$(this).attr("vehicle_type");$("#vehicle_sort_"+e).attr("sortvalue");"FuStW"==t&&0<k[32]?($("#vehicle_checkbox_"+e).click(),k[32]--):"leBefKw"==t&&0<k[35]?($("#vehicle_checkbox_"+e).click(),k[35]--):"GruKw"==t&&0<k[50]?($("#vehicle_checkbox_"+e).click(),k[50]--):"FüKw"==t&&0<k[51]?($("#vehicle_checkbox_"+e).click(),k[51]--):"GefKw"==t&&0<k[52]?($("#vehicle_checkbox_"+e).click(),k[52]--):"WaWe 10"==t&&0<k[72]?($("#vehicle_checkbox_"+e).click(),k[72]--):"Polizeihubschrauber"==t&&0<k[61]?($("#vehicle_checkbox_"+e).click(),k[61]--):"SEK - ZF"==t&&0<k[79]?($("#vehicle_checkbox_"+e).click(),k[79]--):"SEK - MTF"==t&&0<k[80]?($("#vehicle_checkbox_"+e).click(),k[80]--):"MEK - ZF"==t&&0<k[81]?($("#vehicle_checkbox_"+e).click(),k[81]--):"MEK - MTF"==t&&0<k[82]&&($("#vehicle_checkbox_"+e).click(),k[82]--)}),!0)},f=function(){return"object"==_typeof(c.water_rescue)&&(k[63]+=parseInt(c.water_rescue.num_GW_T),k[64]+=parseInt(c.water_rescue.num_GW_W),k[70]+=parseInt(c.water_rescue.num_MzB),$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function(){var e=$(this).attr("id").replace("vehicle_element_content_","");$("#vehicle_sort_"+e).attr("sortvalue");("GW-Taucher"==$(this).attr("vehicle_type")||"Tauchkraftwagen"==$(this).attr("vehicle_type"))&&0<k[63]?($("#vehicle_checkbox_"+e).click(),k[63]--):"GW-Wasserrettung"==$(this).attr("vehicle_type")&&0<k[64]?($("#vehicle_checkbox_"+e).click(),k[64]--):("MZB"==$(this).attr("vehicle_type")||"Anh MzB"==$(this).attr("vehicle_type")||"Anh MzAB"==$(this).attr("vehicle_type")||"Anh SchlB"==$(this).attr("vehicle_type")||"AB-MZB"==$(this).attr("vehicle_type"))&&0<k[66]+k[67]+k[68]+k[70]+k[71]&&($("#vehicle_checkbox_"+e).click(),k[70]--)}),!0)},u=function(){return"object"==_typeof(c.technical_emergency_service)&&(k[39]+=parseInt(c.technical_emergency_service.num_GKW),k[40]+=parseInt(c.technical_emergency_service.num_MTW_TZ),k[41]+=parseInt(c.technical_emergency_service.num_MzKW),k[42]+=parseInt(c.technical_emergency_service.num_LKW_K9),k[43]+=parseInt(c.technical_emergency_service.num_BRmG_R),k[44]+=parseInt(c.technical_emergency_service.num_Anh_DLE),k[45]+=parseInt(c.technical_emergency_service.num_MLW_5),k[65]+=parseInt(c.technical_emergency_service.num_LKW_7Lkr),$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function(){var e=$(this).attr("id").replace("vehicle_element_content_","");$("#vehicle_sort_"+e).attr("sortvalue");"GKW"==$(this).attr("vehicle_type")&&0<k[39]?($("#vehicle_checkbox_"+e).click(),k[39]--):"MTW-TZ"==$(this).attr("vehicle_type")&&0<k[40]?($("#vehicle_checkbox_"+e).click(),k[40]--):"MzKW"==$(this).attr("vehicle_type")&&0<k[41]?($("#vehicle_checkbox_"+e).click(),k[41]--):"LKW K 9"==$(this).attr("vehicle_type")&&0<k[42]?($("#vehicle_checkbox_"+e).click(),k[42]--):"BRmG R"==$(this).attr("vehicle_type")&&0<k[43]?($("#vehicle_checkbox_"+e).click(),k[43]--):"Anh DLE"==$(this).attr("vehicle_type")&&0<k[44]?($("#vehicle_checkbox_"+e).click(),k[44]--):"MLW 5"==$(this).attr("vehicle_type")&&0<k[45]?($("#vehicle_checkbox_"+e).click(),k[45]--):"LKW 7 Lkr 19 tm"==$(this).attr("vehicle_type")&&0<k[65]&&($("#vehicle_checkbox_"+e).click(),k[65]--)}),!0)},d=function(){for(VehicleTypeID=0;VehicleTypeID<=m;VehicleTypeID++)k[VehicleTypeID]=0;for(VehicleTypeID=0;VehicleTypeID<=m;VehicleTypeID++)e(VehicleTypeID);return console.log("ADis_PrepareVehicleNeedList: ok"),!0},e=function(e){for(var t in v){v[t].type==e&&p(e)}$("#mission_vehicle_driving tbody, #mission_vehicle_at_mission tbody").find("tr").each(function(){$(this).find("a").first().attr("vehicle_type_id")==e&&p(e)})},p=function(e){e=Number(e);-1!=[38].indexOf(e)?k[e]--:-1!=[0,1,6,7,8,9,30,37,17,18,19,20,21,22,23,24,25,26].indexOf(e)?(-1!=[30].indexOf(e)&&k[4]--,k[0]--):-1!=[74].indexOf(e)?(k[74]--,k[28]--,k[29]--):-1!=[73].indexOf(e)?k[73]--:-1!=[28].indexOf(e)?k[28]--:-1!=[29].indexOf(e)?k[29]--:-1!=[31].indexOf(e)?k[31]--:-1!=[55].indexOf(e)?k[55]--:-1!=[56].indexOf(e)?k[56]--:-1!=[58].indexOf(e)?k[58]--:-1!=[59].indexOf(e)?k[59]--:-1!=[60].indexOf(e)?k[60]--:-1!=[2].indexOf(e)?k[2]--:-1!=[34,78].indexOf(e)?(k[3]--,k[34]--):-1!=[3].indexOf(e)?k[3]--:-1!=[36].indexOf(e)?k[36]--:-1!=[57].indexOf(e)?k[57]--:-1!=[4].indexOf(e)?(k[4]--,k[39]--):-1!=[4,47].indexOf(e)?k[4]--:-1!=[5,48].indexOf(e)?k[5]--:-1!=[10,49].indexOf(e)?k[10]--:-1!=[12].indexOf(e)?k[12]--:-1!=[11,13,14,15,16].indexOf(e)?k[11]--:-1!=[27,77].indexOf(e)?k[27]--:-1!=[33].indexOf(e)?k[33]--:-1!=[53,54].indexOf(e)?k[53]--:-1!=[83].indexOf(e)?k[83]--:-1!=[84].indexOf(e)?k[84]--:-1!=[85].indexOf(e)?(k[85]--,k[2]--):-1!=[86].indexOf(e)?k[86]--:-1!=[75].indexOf(e)?k[75]--:-1!=[76].indexOf(e)?k[76]--:-1!=[32].indexOf(e)?k[32]--:-1!=[35].indexOf(e)?k[35]--:-1!=[50].indexOf(e)?k[50]--:-1!=[51].indexOf(e)?k[51]--:-1!=[52].indexOf(e)?k[52]--:-1!=[72].indexOf(e)?k[72]--:-1!=[61].indexOf(e)?k[61]--:-1!=[79].indexOf(e)?k[79]--:-1!=[80].indexOf(e)?k[80]--:-1!=[81].indexOf(e)?k[81]--:-1!=[82].indexOf(e)?k[82]--:-1!=[63,69].indexOf(e)?k[63]--:-1!=[64].indexOf(e)?k[64]--:-1!=[66,67,68,70,71].indexOf(e)?k[70]--:-1!=[39].indexOf(e)?(k[39]--,k[4]--):-1!=[40].indexOf(e)?k[40]--:-1!=[41].indexOf(e)?k[41]--:-1!=[42].indexOf(e)?k[42]--:-1!=[43].indexOf(e)?k[43]--:-1!=[44].indexOf(e)?k[44]--:-1!=[45].indexOf(e)?k[45]--:-1!=[65].indexOf(e)&&k[65]--},m=86;$(document).ready(function(){setTimeout(function(){n=document.location.pathname.substr(document.location.pathname.lastIndexOf("/")+1);var e=$("a#mission_help");if(0<e.length){var t=(i=e[0].href.split("?")[0]).match(/\d+$/i);i=Number(t[0])}r=Math.floor((new Date).getTime()/1e3),console.log("MissionID",n),console.log("MissionType",i),console.log("CurrentTime",r),null!==i&&null!=i&&_(i)},150)});var v={},x={},k={}}}); |