/*
 Copyright 2020-2025 Mpowered Ventures Ltd.
 All rights reserved. info@mpowered.biz
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};
$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f<e.length-1;f++){var k=e[f];if(!(k in d))return;d=d[k]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&($jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+e,e=
$jscomp.propertyToPolyfillSymbol[e],$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(b,a){return $jscomp.findInternal(this,b,a).v}},"es6","es3");
function getblade_init_form(){window.fb_gb_debug=!0;if(0<$("#callseditpage").length){window.addSelectFilter();window.wfpicstablesimgcol=1;window.wfpicstablesfncol=2;window.atmtpicstablesimgcol=1;window.atmtpicstablesfncol=2;var a=window.getMobileOperatingSystem();window.fb_gb_debug&&console.log("mobileOS: "+a);"Re-Issue Call"==$("#submitBtn").val()&&(Date.parse($("#CALL_WO_GEN_DATE").val())<Date.parse($("#CALL_DATE").val())&&(window.callsEditPageSetCallDateToToday(),$("#CALL_WO_GEN_DATE").val($("#CALL_DATE").val()),
$("#CALL_WO_GEN_DATE").trigger("change")),window.callsEditPageMainFormCalcNewBfdate());$("#CALL_PRIORITY option").each(function(b){window.fb_gb_debug&&console.log("CALL_PRIORITY: "+$(this).val()+": "+$(this).text())});window.callsEditPageMainFormSaveDefaultValues();window.callsEditPageMainDynamicChecks();window.callsEditPageAddWidgets();window.fb_gb_debug&&console.log("starting CALL_DATE: "+$("#CALL_DATE").val());window.fb_gb_debug&&console.log("starting CALL_DATETIME: "+$("#CALL_DATETIME").val());
window.fb_gb_debug&&console.log("starting CALL_WO_GEN_DATE: "+$("#CALL_WO_GEN_DATE").val());window.fb_gb_debug&&console.log("starting CALL_BRING_FORWARD_DATE: "+$("#CALL_BRING_FORWARD_DATE").val());$("#CALL_REQUESTOR_ADDRESS_OG").val($("#CALL_REQUESTOR_ADDRESS").val());window.callsEditPageMainFormReset();$("#nameAddressDrop").change(function(){var b=$.parseXML($("#nameAddressDrop").val()),a=$(b).find("n")[0].innerHTML;a=a.replace(/;;mylt;;/g,"<");a=a.replace(/;;mygt;;/g,">");a=a.replace(/;;myamp;;/g,
"&");a=a.replace(/;;myquot;;/g,'"');a=a.replace(/;;myapos;;/g,"'");b=$(b).find("a")[0].innerHTML;b=b.replace(/;;mylt;;/g,"<");b=b.replace(/;;mygt;;/g,">");b=b.replace(/;;myamp;;/g,"&");b=b.replace(/;;myquot;;/g,'"');b=b.replace(/;;myapos;;/g,"'");b=b.replace(/;;mycrlf;;/g,"\n");$("#CALL_REQUESTOR_NAME").val(a.toUpperCase());$("#CALL_REQUESTOR_ADDRESS").val(b.toUpperCase())});$("#addwf-reissue-button").prop("href",$("#addwf-reissue-button").prop("href")+"&reissuecall=1");$("#addtaggedcall-button").prop("href",
$("#addtaggedcall-button").prop("href")+"&taggedcallid="+$("#CALL_ID").val());$("#wrndivCALL_BRING_FORWARD_DATE").hide();$("#wrndivCALLWF_ASSIGN_TO").hide();$("#assignToDrop").change(function(){-1!=$("#assignToDrop").val()?$("#CALLWF_ASSIGN_TO").val($("#assignToDrop").val()):$("#CALLWF_ASSIGN_TO").val("");$("#CALLWF_ASSIGN_TO").trigger("change");$("#wrndivCALLWF_ASSIGN_TO").hide();"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1);window.callsEditPageMainFormBizRulesChck();
$("#resetBtn").prop("disabled",!1)});$("#CALL_BRING_FORWARD_DATE").on("blur",function(){"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1);window.callsEditPageMainFormBizRulesChck();$("#wrndivCALL_BRING_FORWARD_DATE").hide();$("#resetBtn").prop("disabled",!1)});$("body").on("input propertychange change","#CALL_DETAIL",function(b){"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1);$("#resetBtn").prop("disabled",!1)});$("body").on("input propertychange change",
"#CALL_REQUESTOR_ADDRESS",function(b){"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1);$("#resetBtn").prop("disabled",!1)});$("body").on("input propertychange change","#CALLWF_COMMENTS",function(b){"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1);$("#resetBtn").prop("disabled",!1)});$("textarea").on("input",function(){window.fb_gb_debug&&console.log("in generic input[type=text] handler");0<$("#wfaddpanel").length&&!$("#wfaddpanel").is(":hidden")?
($("#submitBtnWF").prop("disabled",!1),window.callsEditPageOvlyBizRulesChck(),$("#resetBtnWF").prop("disabled",!1)):("Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1),window.callsEditPageMainFormBizRulesChck(),window.callsEditPageMainDynamicChecks(),$("#PRESET_NAME").val(""),$("#resetBtn").prop("disabled",!1))});$('input[type="text"]').on("change keyup paste",function(){window.fb_gb_debug&&console.log("in generic input[type=text] handler");0<$("#wfaddpanel").length&&!$("#wfaddpanel").is(":hidden")?
($("#submitBtnWF").prop("disabled",!1),window.callsEditPageOvlyBizRulesChck(),$("#resetBtnWF").prop("disabled",!1)):("Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1),window.callsEditPageMainFormBizRulesChck(),window.callsEditPageMainDynamicChecks(),$("#PRESET_NAME").val(""),$("#resetBtn").prop("disabled",!1))});$('input[type="checkbox"]').change(function(){window.fb_gb_debug&&console.log("in generic input[type=checkbox] handler");0<$("#wfaddpanel").length&&!$("#wfaddpanel").is(":hidden")?
($("#submitBtnWF").prop("disabled",!1),window.callsEditPageOvlyBizRulesChck(),$("#resetBtnWF").prop("disabled",!1)):("Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1),window.callsEditPageMainFormBizRulesChck(),$("#PRESET_NAME").val(""),$("#resetBtn").prop("disabled",!1))});$("select").change(function(){window.fb_gb_debug&&console.log("in generic select.change handler");0<$("#wfaddpanel").length&&!$("#wfaddpanel").is(":hidden")?($("#submitBtnWF").prop("disabled",!1),window.callsEditPageOvlyBizRulesChck(),
$("#resetBtnWF").prop("disabled",!1)):("Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!1),window.callsEditPageMainFormBizRulesChck(),$("#PRESET_NAME").val(""),$("#resetBtn").prop("disabled",!1))});$("#form-help-open-btn").click(function(b){b.preventDefault();$("#form-help-open-btn").hide();$("#form-help-open").show();return!1});$("#form-myoscalls-btn").click(function(b){b.preventDefault();$("#resetBtn").click();$("#CALL_STATUS").val("ACTIVE");$("#CALL_STATUS").trigger("change");
$("#CALL_WO_GEN_DATE_END").val((new Date(Date.now())).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}));$("#CALL_WO_GEN_DATE_END").trigger("change");$("#CALLWF_ASSIGN_TO").val($("#USER_NAME").val());$("#CALLWF_ASSIGN_TO").trigger("change");$("#form-help-open").hide();$("#form-help-open-btn").show();$("#PRESET_NAME").val($(this).html().trim());return!1});$("#form-myoscalls-go-btn").click(function(b){b.preventDefault();$("#form-myoscalls-btn").click();$("#submitBtn").click();
return!1});$("#form-crtdlst2wks-btn").click(function(b){b.preventDefault();$("#resetBtn").click();$("#CALL_DATE_START").val((new Date(Date.now()-12096E5)).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}));$("#CALL_DATE_START").trigger("change");$("#form-help-open").hide();$("#form-help-open-btn").show();$("#PRESET_NAME").val($(this).html().trim());return!1});$("#form-crtdlst2wks-go-btn").click(function(b){b.preventDefault();$("#form-crtdlst2wks-btn").click();$("#submitBtn").click();
return!1});$("#form-activenass-btn").click(function(b){b.preventDefault();$("#resetBtn").click();$("#CALL_STATUS").val("ACTIVE");$("#CALL_STATUS").trigger("change");$("#CALLWF_ASSIGN_TO").val("{UNASSIGNED}");$("#CALLWF_ASSIGN_TO").trigger("change");$("#form-help-open").hide();$("#form-help-open-btn").show();$("#PRESET_NAME").val($(this).html().trim());return!1});$("#form-activenass-go-btn").click(function(b){b.preventDefault();$("#form-activenass-btn").click();$("#submitBtn").click();return!1});$("#form-activebf-btn").click(function(b){b.preventDefault();
$("#resetBtn").click();$("#CALL_STATUS").val("ACTIVE");$("#CALL_STATUS").trigger("change");$("#CALL_BRING_FORWARD_DATE_START").val((new Date(Date.now()-31536E6)).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}));$("#CALL_BRING_FORWARD_DATE_START").trigger("change");$("#CALL_BRING_FORWARD_DATE_END").val((new Date(Date.now()+864E5)).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}));$("#CALL_BRING_FORWARD_DATE_END").trigger("change");$("#form-help-open").hide();
$("#form-help-open-btn").show();$("#PRESET_NAME").val($(this).html().trim());return!1});$("#form-activebf-go-btn").click(function(b){b.preventDefault();$("#form-activebf-btn").click();$("#submitBtn").click();return!1});$("#form-help-close-btn").click(function(b){b.preventDefault();$("#form-help-open").hide();$("#form-help-open-btn").show();return!1});$("#CALL_REQUESTOR_PHONE1").keyup(function(){window.callsEditPageMainDynamicChecks()});$("#CALL_REQUESTOR_PHONE2").keyup(function(){window.callsEditPageMainDynamicChecks()});
$("#CALL_REQUESTOR_EMAIL").keyup(function(){window.callsEditPageMainDynamicChecks()});$("#rqstr-email-button").click(function(b){b.preventDefault();$("#wrndivCALL_REQUESTOR_EMAIL").is(":hidden")?($("#wrndivCALL_REQUESTOR_EMAIL").html('<a href="mailto://'+$("#CALL_REQUESTOR_EMAIL").val()+'" class="btn btn-info btn-default btn-xs" role="button">Email Requestor Directly</a><br><br>NOTE: A Tempest Calls email template set up on CALL NOTIFY REQUESTOR workflow could send an automated email and be viewed in workflow when you Notify Requestor.'),
$("#wrndivCALL_REQUESTOR_EMAIL").show(),$("#rqstr-email-button").html("Hide Email Note")):($("#wrndivCALL_REQUESTOR_EMAIL").hide(),$("#rqstr-email-button").html("Email"));return!1});0<$("#add-pic-main-wf-input").length&&($("#add-pic-main-wf-btn").click(function(b){b.preventDefault();$("#add-pic-main-wf-input").click();return!1}),document.getElementById("add-pic-main-wf-input").addEventListener("change",function(b){window.callsEditPageHandlePicsGeneric("add-pic-main-wf",b)}),$("#wfpicsmaintable tbody").on("click",
"a.icon-delete",function(b){b.preventDefault();$("#wfpicsmaintable").DataTable().row($(this).parents("tr")).remove().draw();window.callsEditPageMainDynamicChecks();return!1}));0<$("#add-pic-ovly-wf-input").length&&($("#add-pic-ovly-wf-btn").click(function(b){b.preventDefault();$("#add-pic-ovly-wf-input").click();return!1}),document.getElementById("add-pic-ovly-wf-input").addEventListener("change",function(b){window.callsEditPageHandlePicsGeneric("add-pic-ovly-wf",b)}),$("#wfpicsovlytable tbody").on("click",
"a.icon-delete",function(b){b.preventDefault();$("#wfpicsovlytable").DataTable().row($(this).parents("tr")).remove().draw();window.callsEditPageOvlyDynamicChecks();return!1}));0<$("#add-pic-ovly-atmt-input").length&&($("#add-pic-ovly-atmt-btn").click(function(b){b.preventDefault();$("#add-pic-ovly-atmt-input").click();return!1}),document.getElementById("add-pic-ovly-atmt-input").addEventListener("change",function(b){window.callsEditPageHandlePicsGeneric("add-pic-ovly-atmt",b)}),$("#atmtpicsovlytable tbody").on("click",
"a.icon-delete",function(b){b.preventDefault();$("#atmtpicsovlytable").DataTable().row($(this).parents("tr")).remove().draw();window.callsEditPageOvlyDynamicChecks();return!1}));window.callsPropTablePostProcessing();$("#CALL_DEPARTMENT").on("change",function(){window.fb_gb_debug&&console.log("CALL_DEPARTMENT has been changed to: "+$("#CALL_DEPARTMENT").val()+", resetting CLASS, PROBLEM and assignToDrop");$("#CALL_PROBLEM").val("-1");$("#CALL_PROBLEM").trigger("change");$("#CALL_CLASS").val("-1");
$("#CALL_CLASS").trigger("change");$("#assignToDrop").val("-1");$("#CALLWF_ASSIGN_TO").val()&&($("#wrndivCALLWF_ASSIGN_TO").html("The Workgroup was changed since the Assign To was set. Is this still correct?"),$("#wrndivCALLWF_ASSIGN_TO").show());window.callsEditPageMainFormBizRulesChck()});$("#CALL_CLASS").on("change",function(){window.fb_gb_debug&&console.log("CALL_CLASS has been changed to: "+$("#CALL_CLASS").val()+", resetting PROBLEM");$("#CALL_PROBLEM").val("-1");$("#CALL_PROBLEM").trigger("change");
window.callsEditPageMainFormBizRulesChck()});"Create Call"!=$("#submitBtn").val()&&($("#CALL_CLASS").val(document.getElementById("CALL_CLASS").defaultValue),$("#CALL_CLASS").trigger("change"),$("#CALL_PROBLEM").val(document.getElementById("CALL_PROBLEM").defaultValue),$("#CALL_PROBLEM").trigger("change"));$("#CALL_PROBLEM").on("change",function(){window.callsEditPageMainFormCalcNewBfdate()});$("#CALL_WO_GEN_DATE").on("change",function(){window.callsEditPageMainFormCalcNewBfdate()});$("#resetBtn").click(function(){window.callsEditPageMainFormReset();
window.callsEditPageMainFormBizRulesChck()});$("#callseditform").submit(function(b){"Create Call"!=$("#submitBtn").val()&&"Call Created"!=$("#submitBtn").val()&&"Search Calls"!=$("#submitBtn").val()&&"Calls Search"!=$("#submitBtn").val()&&"Re-Issue Call"!=$("#submitBtn").val()&&"Save Changes"!=$("#submitBtn").val()&&($("#errdivSUBMIT").html("Invalid form Submit type '"+$("#submitBtn").val()+"'."),$("#errdivSUBMIT").show());if("Calls Search"!=$("#submitBtn").val()&&"Call Created"!=$("#submitBtn").val()){window.fb_gb_debug&&
console.log("callseditform .submit() handler called.");if("Create Call"==$("#submitBtn").val()||"Re-Issue Call"==$("#submitBtn").val()){var a={year:"numeric",month:"short",day:"numeric"},d=new Date;window.fb_gb_debug&&console.log("today: "+window.dateToYYYYMMDDHHMISS(new Date(Date.now())).substr(0,8)+" Call date: "+window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATE").val()))).substr(0,8));window.dateToYYYYMMDDHHMISS(new Date(Date.now())).substr(0,8)!=window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATE").val()))).substr(0,
8)&&($("#errdivCALL_DATE").html("It looks like this Call was started on '"+$("#CALL_DATE").val()+"' and today is '"+d.toLocaleDateString("en-US",a)+"'. You will need to go Back and try the operation again."),$("#errdivCALL_DATE").show())}$(".err-divmf:visible").length?(b.preventDefault(),window.fb_gb_debug&&console.log("Found err-divmf(s) on the page, so bailing out of the submit")):(window.fb_gb_debug&&console.log("Submitting a '"+$("#submitBtn").val()+"' request."),b.preventDefault(),window.callsEditPageMainFormRemoveErrors(),
b=decodeURIComponent($("#POSTEDGETX").val()),b=$.parseXML(b),$(b).find("v06")[0].innerHTML=decodeURIComponent($(b).find("v06")[0].innerHTML),"Search Calls"==$("#submitBtn").val()||"Create Call"==$("#submitBtn").val()||"Re-Issue Call"==$("#submitBtn").val()?$(b).find("v06")[0].innerHTML+="&amp;stage2=1":$(b).find("v06")[0].innerHTML+="&amp;updatecall=1",window.fb_gb_debug&&console.log("v06: "+$(b).find("v06")[0].innerHTML),b=(new window.XMLSerializer).serializeToString(b),window.fb_gb_debug&&console.log("assembled postedGET: "+
b),a=window.callsEditPageMainFormBuildXML($("#submitBtn").val()),"NOVALUES"==a?($("#errdivSUBMIT").html("You must enter search information into at least one field."),$("#errdivSUBMIT").show()):(window.fb_gb_debug&&console.log("assembled postedXML: "+(250>=a.length?a:a.substr(0,250)+"... +"+(a.length-250)+"bytes")),"Search Calls"==$("#submitBtn").val()?(b="&PRESET_NAME="+$("#PRESET_NAME").val()+window.callsCreateQueryURIFromXML(a),window.fb_gb_debug&&console.log("queryURI: "+b),window.fb_gb_debug&&
console.log("intended URL: GetBlade.aspx?blade=Calls%20for%20Service&querycalls=1&stage2=1"+b),$("#callseditform").html('<b>Searching Calls...</b><br><br><input type="submit" id="submitBtn" class="btn btn-success btn-sm" value="Calls Search"/><div id="loading"><img id="loading-image" src="lib/spinner.gif" alt="Loading..." /></div>'),$("#callseditform").attr("action","GetBlade.aspx?blade=Calls%20for%20Service&querycalls=1&stage2=1"+b),$("#submitBtn").prop("disabled",!0),$("#submitBtn").hide(),window.scrollTo(0,
0),$("#callseditform").submit()):(window.fb_gb_debug&&console.log("About to AJAX web service: WebProxy.asmx/webproxy"),$("#loading").show(),b=$.post("WebProxy.asmx/webproxy",{wsmethod:"getblade",postedGET:encodeURIComponent(b),postedXML:encodeURIComponent(a)}),b.always(function(){window.enableParentButtons();$("#loading").hide()}),b.fail(function(){$("#errdivSUBMIT").html("ERROR: Oh snap, it looks like we hit a glitch. Please try again, and it may magically fix itself. If not, please report the error: ajax comm failure URL: WebProxy.asmx/webproxy");
$("#errdivSUBMIT").show()}),b.done(function(a){window.fb_gb_debug&&console.log("Raw data returned from web service: "+(250>=a.length?a:a.substr(0,250)+"... +"+(a.length-250)+"bytes"));if("<?xml"!=a.substr(0,5))$("#errdivSUBMIT").html("ERROR: xml doc not returned from web service."),$("#errdivSUBMIT").show();else if(a=$.parseXML(a),"OK"!=$(a).find("head").find("r01")[0].innerHTML)$("#errdivSUBMIT").html($(a).find("head").find("r01")[0].innerHTML),$("#errdivSUBMIT").show();else{try{window.fb_gb_debug&&
console.log("dbginfo: "+decodeURIComponent($(a).find("dbginfo")[0].innerHTML))}catch(f){}"Create Call"==$("#submitBtn").val()||"Re-Issue Call"==$("#submitBtn").val()?(window.fb_gb_debug&&console.log("We're back OK from the Create/Re-Issue Call call, new query string (decoded) with new CALL_ID: "+decodeURIComponent($(a).find("new_qs")[0].innerHTML)),$("#callseditform").html("<b>Call "+$(a).find("CALL_NUMBER")[0].innerHTML+' created, loading it now...</b><br><br><input type="submit" id="submitBtn" class="btn btn-success btn-sm" value="Call Created"/><div id="loading"><img id="loading-image" src="lib/spinner.gif" alt="Loading..." /></div>'),
$("#submitBtn").prop("disabled",!0),$("#submitBtn").hide(),window.fb_gb_debug&&console.log("mini call created form submit target: GetBlade.aspx?"+decodeURIComponent($(a).find("new_qs")[0].innerHTML)),$("#callseditform").attr("action","GetBlade.aspx?"+decodeURIComponent($(a).find("new_qs")[0].innerHTML)),window.scrollTo(0,0),$("#loading").show(),$("#callseditform").submit()):"Save Changes"==$("#submitBtn").val()&&(window.fb_gb_debug&&console.log("We're back OK from Save Changes. CALL_WO_GENERATE_DATE_REISSUE: "+
decodeURIComponent($(a).find("CALL_WO_GENERATE_DATE_REISSUE")[0].innerHTML)),$("#CALL_WO_GENERATE_DATE_REISSUE").val(decodeURIComponent($(a).find("CALL_WO_GENERATE_DATE_REISSUE")[0].innerHTML)),window.callsEditPageMainFormSaveDefaultValues(),window.callsEditPageMainDynamicChecks(),$("#wrndivCALL_BRING_FORWARD_DATE").hide(),$("#okdivSUBMIT").html("Changes were saved."),$("#okdivSUBMIT").show(),$("#submitBtn").prop("disabled",!0),$("#resetBtn").prop("disabled",!0))}}))))}});window.addEventListener("beforeunload",
function(a){if(!$("#submitBtn").prop("disabled")||0<$("#wfaddpanel").length&&!$("#submitBtnWF").prop("disabled")||0<$("#atmtaddpanel").length&&!$("#submitBtnATMT").prop("disabled"))return(a||window.event).returnValue="You have some unsaved changes.",window.fb_gb_debug&&console.log("in window.addEventListener('beforeunload'...: returning 'You have some unsaved changes.' which does the built-in ask"),"You have some unsaved changes.";window.fb_gb_debug&&console.log("in window.addEventListener('beforeunload'...: returning undefined - which does NOT ask")});
window.imageThumbnailsPostProcessing();$("#wftable").on("draw.dt",function(){window.imageThumbnailsPostProcessing()});window.attachmentFilesPostProcessing();$("#atmtstable").on("draw.dt",function(){window.attachmentFilesPostProcessing()});"Create Call"==$("#submitBtn").val()&&window.callsEditPageMainFormCreateInit();window.callsEditPageMainFormBizRulesChck();"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!0);$("#resetBtn").prop("disabled",!0);window.fb_gb_debug&&console.log("after-js-init CALL_DATE: "+
$("#CALL_DATE").val());window.fb_gb_debug&&console.log("after-js-init CALL_DATETIME: "+$("#CALL_DATETIME").val());window.fb_gb_debug&&console.log("after-js-init CALL_WO_GEN_DATE: "+$("#CALL_WO_GEN_DATE").val());window.fb_gb_debug&&console.log("after-js-init CALL_BRING_FORWARD_DATE: "+$("#CALL_BRING_FORWARD_DATE").val());$("#submitBtnWF").prop("disabled",!0);$("#resetBtnWF").prop("disabled",!0);$("#wkflw-reader-button").on("click",function(a){a.preventDefault();window.callsEditPageOvlyShow($("#wkflw-reader-button").html(),
null);return!1});$("#addtaggedprop-button").on("click",function(a){a.preventDefault();window.callsEditPageOvlyShow($("#addtaggedprop-button").html(),null);return!1});$("#addwf-assign-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;window.callsEditPageOvlyShow($("#addwf-assign-button").html(),null);return!1});$("#addwf-note-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;window.callsEditPageOvlyShow($("#addwf-note-button").html(),
null);return!1});$("#addwf-noti-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;window.callsEditPageOvlyShow($("#addwf-noti-button").html(),null);return!1});$("#addwf-corr-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;window.callsEditPageOvlyShow($("#addwf-corr-button").html(),null);return!1});$("#addwf-complete-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;
window.callsEditPageOvlyShow($("#addwf-complete-button").html(),null);return!1});$("#addwf-cancel-button").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddWorkflow())return!1;window.callsEditPageOvlyShow($("#addwf-cancel-button").html(),null);return!1});$("#addwf-transfer-button").on("click",function(a){a.preventDefault();window.callsEditPageOvlyShow($("#addwf-transfer-button").html(),null);return!1});$("#WFNameDrop").change(function(){-1!=$("#WFNameDrop").val()?$("#CALLWFADD_NAME").val($("#WFNameDrop").val().toUpperCase()):
$("#CALLWFADD_NAME").val("");$("#submitBtnWF").prop("disabled",!1);window.callsEditPageOvlyBizRulesChck();$("#resetBtnWF").prop("disabled",!1)});$("#WFName2Drop").change(function(){-1!=$("#WFName2Drop").val()?$("#CALLWFADD_NAME2").val($("#WFName2Drop").val().toUpperCase()):$("#CALLWFADD_NAME2").val("");$("#submitBtnWF").prop("disabled",!1);window.callsEditPageOvlyBizRulesChck();$("#resetBtnWF").prop("disabled",!1)});$("body").on("input propertychange change","#CALLWFADD_COMMENTS",function(a){$("#submitBtnWF").prop("disabled",
!1);$("#resetBtnWF").prop("disabled",!1)});$("#resetBtnWF").click(function(){window.callsEditPageOvlyReset();window.callsEditPageOvlyBizRulesChck()});$("#cancelBtnWF").on("click",function(a){window.fb_gb_debug&&console.log("TODO: clicked cancelBtnWF");$("#resetBtnWF").prop("disabled")?($("#submitBtnWF").prop("disabled",!0),$("#resetBtnWF").prop("disabled",!0),$("#wfaddpanel").hide(),$("#mask").hide(),$.fn.dataTable.isDataTable("#wfpicsovlytable")&&$("#wfpicsovlytable").DataTable().table().clear(),
$("body,html").css("overflow","auto")):($("#errdivSUBMITWF").html("To Cancel, first tap Reset Form, and then Cancel."),$("#errdivSUBMITWF").show());return!1});$("#callsaddwf").submit(function(a){window.fb_gb_debug&&console.log("callsaddwf .submit() handler called.");var b=!1;$(".err-divwf").each(function(){window.fb_gb_debug&&console.log($(this).is(":hidden"));$(this).is(":hidden")||(b=!0)});if(b)a.preventDefault(),$("#loading").hide(),window.fb_gb_debug&&console.log("Did event.preventDefault()");
else{window.fb_gb_debug&&console.log("Submitting a '"+$("#submitBtnWF").val()+"' request.");window.fb_gb_debug&&console.log("Not going to use the built-in browser submit functionality");a.preventDefault();window.fb_gb_debug&&console.log("Did event.preventDefault()");window.callsEditPageOvlyRemoveErrors();a=decodeURIComponent($("#POSTEDGETX").val());a=$.parseXML(a);$(a).find("v06")[0].innerHTML=decodeURIComponent($(a).find("v06")[0].innerHTML);"Add Tagged Property"!=$("#submitBtnWF").val()&&"Remove Property"!=
$("#submitBtnWF").val()?$(a).find("v06")[0].innerHTML+="&amp;addcallwf=1":"Add Tagged Property"==$("#submitBtnWF").val()?$(a).find("v06")[0].innerHTML+="&amp;addtaggedprop=1":"Remove Property"==$("#submitBtnWF").val()&&($(a).find("v06")[0].innerHTML+="&amp;removeprop=1");window.fb_gb_debug&&console.log("v06: "+$(a).find("v06")[0].innerHTML);a=(new window.XMLSerializer).serializeToString(a);window.fb_gb_debug&&console.log("assembled postedGET: "+a);var d="";if("Transfer Call"!=$("#submitBtnWF").val()&&
"Add Tagged Property"!=$("#submitBtnWF").val()&&"Remove Property"!=$("#submitBtnWF").val()){d='<root buildtype="AddWorkflow">';d+="<USER_NAME>"+encodeURIComponent($("#USER_NAME").val())+"</USER_NAME>";d+="<CALLWFADD_BUTTON>"+encodeURIComponent($("#submitBtnWF").val())+"</CALLWFADD_BUTTON>";d+="<CALLWFADD_NAME>"+encodeURIComponent($("#CALLWFADD_NAME").val().toUpperCase())+"</CALLWFADD_NAME>";d+="<CALLWFADD_NAME2>"+encodeURIComponent($("#CALLWFADD_NAME2").val().toUpperCase())+"</CALLWFADD_NAME2>";d+=
"<CALLWFADD_FILENO>"+encodeURIComponent($("#CALLWFADD_FILENO").val())+"</CALLWFADD_FILENO>";d+="<CALLWFADD_COMMENTS>"+encodeURIComponent($("#CALLWFADD_COMMENTS").val())+"</CALLWFADD_COMMENTS>";d+="<CALLWFADD_TODEPARTMENT>"+encodeURIComponent($("#CALLWFADD_TODEPARTMENT").val())+"</CALLWFADD_TODEPARTMENT>";var e=/<a href="#" class="thumb-image" data-status="inline"><img src="data:image\/.*?;base64,(.*?)" width=".*?" height=".*?"><\/a>/i;d+="<CALLWF_PICS>";$("#wfpicsovlytable").DataTable().table().rows().every(function(a,
b,c){window.fb_gb_debug&&console.log("CALLWF_PICS: adding image index: "+a);a=this.data();e.test(a[window.wfpicstablesimgcol])&&(d+="<x><image>"+a[window.wfpicstablesimgcol].replace(e,"$1")+"</image><filename>"+encodeURIComponent(a[window.wfpicstablesfncol])+"</filename></x>")});d+="</CALLWF_PICS>";d+="</root>"}else if("Transfer Call"==$("#submitBtnWF").val()){if(d=window.callsEditPageMainFormBuildXML($("#submitBtnWF").val()),"ERROR"==d){$("#errdivSUBMITWF").html("ERROR: Internal: The old form XML build does not match the new. See the console log for details.");
$("#errdivSUBMITWF").show();return}}else if("Add Tagged Property"==$("#submitBtnWF").val())d='<root buildtype="AddTaggedProp">',d+="<TAGGED_PROPNO>"+encodeURIComponent($("#TAGGED_PROPNO").val())+"</TAGGED_PROPNO>",d+="</root>";else if("Remove Property"==$("#submitBtnWF").val()){var f=$.parseXML($("#CALLWFADD_EXTRA").val());d='<root buildtype="RemoveTaggedProp">';d+="<REMOVE_PROPNO>"+encodeURIComponent($(f).find("PROPNO")[0].innerHTML)+"</REMOVE_PROPNO>";d+="</root>"}window.fb_gb_debug&&console.log("assembled postedXML: "+
(250>=d.length?d:d.substr(0,250)+"... +"+(d.length-250)+"bytes"));window.fb_gb_debug&&console.log("About to AJAX web service: WebProxy.asmx/webproxy");$("#loading").show();a=$.post("WebProxy.asmx/webproxy",{wsmethod:"getblade",postedGET:encodeURIComponent(a),postedXML:encodeURIComponent(d)});a.always(function(){window.enableParentButtons();$("#loading").hide()});a.fail(function(){$("#errdivSUBMITWF").html("ERROR: Oh snap, it looks like we hit a glitch. Please try again, and it may magically fix itself. If not, please report the error: ajax comm failure URL: WebProxy.asmx/webproxy");
$("#errdivSUBMITWF").show()});a.done(function(a){window.fb_gb_debug&&console.log("Raw data returned from web service: "+(250>=a.length?a:a.substr(0,250)+"... +"+(a.length-250)+"bytes"));if("<?xml"!=a.substr(0,5))$("#errdivSUBMITWF").html("ERROR: xml doc not returned from web service."),$("#errdivSUBMITWF").show();else if(a=$.parseXML(a),"OK"!=$(a).find("head").find("r01")[0].innerHTML)$("#errdivSUBMITWF").html($(a).find("head").find("r01")[0].innerHTML),$("#errdivSUBMITWF").show();else{try{window.fb_gb_debug&&
console.log("dbginfo: "+decodeURIComponent($(a).find("dbginfo")[0].innerHTML))}catch(n){}window.fb_gb_debug&&console.log("We're back OK from addcallwf");var b;if("Add Tagged Property"!=$("#submitBtnWF").val()&&"Remove Property"!=$("#submitBtnWF").val()){$("#CALL_STATUS").val(decodeURIComponent($(a).find("CALL_STATUS")[0].innerHTML));$("#CALL_STATUS_DATETIME").val(decodeURIComponent($(a).find("CALL_STATUS_DATETIME")[0].innerHTML));$("#CALL_WO_GENERATE_DATE_REISSUE").val(decodeURIComponent($(a).find("CALL_WO_GENERATE_DATE_REISSUE")[0].innerHTML));
$("#CALL_ASSIGNED_TO").val(decodeURIComponent($(a).find("CALL_ASSIGNED_TO")[0].innerHTML));a=$(a).find("workflow").find("x");$("#wftable").DataTable().table().clear();for(b=0;b<a.length;++b){var c=decodeURIComponent(a.find("WF_COLOR")[b].innerHTML);$("#wftable").DataTable().table().row.add(['<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_TYPE")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_NAME1")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+
decodeURIComponent(a.find("WF_DESCRIPTION")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_ATTACHMENTS")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_DATETIME")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_LAST_MODIFIED_ON_DATETIME")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_LAST_MODIFIED_BY")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+
decodeURIComponent(a.find("WF_NAME2")[b].innerHTML)+"</span>",'<span style="color:'+c+';">'+decodeURIComponent(a.find("WF_FILE_NUMBER")[b].innerHTML)+"</span>"])}$("#wftable").DataTable().table().draw()}else{a=$(a).find("props").find("x");$("#propstable").DataTable().table().clear();for(b=0;b<a.length;++b)$("#propstable").DataTable().table().row.add(['<a href="#" class="remove-prop gremlins-ovly" data-propno="'+decodeURIComponent(a.find("PROPNO")[b].innerHTML)+'" data-extra="'+decodeURIComponent(a.find("CIVIC_ADDRESS")[b].innerHTML)+
'"><i class="fa fa-trash"></i></a> <span style="color:'+decodeURIComponent(a.find("COLOR")[b].innerHTML)+';">'+decodeURIComponent(a.find("CIVIC_ADDRESS")[b].innerHTML)+"</span>",'<span style=color:"'+decodeURIComponent(a.find("COLOR")[b].innerHTML)+';">'+decodeURIComponent(a.find("CALLS_COUNT")[b].innerHTML)+"</span>",'<span style=color:RED;">'+decodeURIComponent(a.find("TPC_TEXT")[b].innerHTML)+"</span>"]);$("#propstable").DataTable().table().draw();window.callsPropTablePostProcessing()}$("#wfaddpanel").hide();
$("#mask").hide();$.fn.dataTable.isDataTable("#wfpicsovlytable")&&$("#wfpicsovlytable").DataTable().table().clear();$("body,html").css("overflow","auto");$("#submitBtnWF").prop("disabled",!0);$("#resetBtnWF").prop("disabled",!0);window.callsEditPageMainFormBizRulesChck();window.callsEditPageMainDynamicChecks();$("#okdivWFADD").html($("#submitBtnWF").val()+" successfully completed.");$("#okdivWFADD").show();window.setTimeout(function(){$("#okdivWFADD").hide()},3300)}})}});0<$("#add-pic-ovly-atmt-input").length&&
($("#submitBtnATMT").prop("disabled",!0),$("#resetBtnATMT").prop("disabled",!0),$("#add-pic-atmts-btn").on("click",function(a){a.preventDefault();if(!window.callsEditPageMainFormCanAddAttachment())return!1;$("body,html").css("overflow","hidden");$("#mask").show();$("#atmtaddpanel").width($("#getblade-panel").width()+10);$("#atmtaddpanel").show();window.deviceScreenManagement();window.callsEditPageOvlyBizRulesChck();return!1}));$("body").on("input propertychange change","#ATMTADD_DESCRIPTION",function(a){$("#submitBtn").prop("disabled",
!0);$("#resetBtn").prop("disabled",!0);window.callsEditPageOvlyBizRulesChck()});$("#resetBtnATMT").click(function(){window.callsEditPageOvlyReset();window.callsEditPageOvlyBizRulesChck()});$("#cancelBtnATMT").on("click",function(a){window.fb_gb_debug&&console.log("TODO: clicked cancelBtnATMT");$("#resetBtnATMT").prop("disabled")?(window.callsEditPageOvlyReset(),$("#atmtaddpanel").hide(),$("#mask").hide(),$("body,html").css("overflow","auto")):($("#errdivSUBMITATMT").html("To Cancel, first tap Reset Form, and then Cancel."),
$("#errdivSUBMITATMT").show());return!1});$("#callsaddatmt").submit(function(a){window.fb_gb_debug&&console.log("callsaddatmt .submit() handler called.");$("#mask").hide();var b=!1;$(".err-divwf").each(function(){window.fb_gb_debug&&console.log($(this).is(":hidden"));$(this).is(":hidden")||(b=!0)});if(b)a.preventDefault(),window.fb_gb_debug&&console.log("Did event.preventDefault()"),$("#loading").hide();else{window.fb_gb_debug&&console.log("Submitting a '"+$("#submitBtnATMT").val()+"' request.");
window.fb_gb_debug&&console.log("Not going to use the built-in browser submit functionality");a.preventDefault();window.fb_gb_debug&&console.log("Did event.preventDefault()");window.callsEditPageOvlyRemoveErrors();a=decodeURIComponent($("#POSTEDGETX").val());window.fb_gb_debug&&console.log("OG postedGET: "+a);a=$.parseXML(a);$(a).find("v06")[0].innerHTML=decodeURIComponent($(a).find("v06")[0].innerHTML);$(a).find("v06")[0].innerHTML+="&amp;addcallatmt=1";a=(new window.XMLSerializer).serializeToString(a);
window.fb_gb_debug&&console.log("assembled postedGET: "+a);var d="";d='<root buildtype="AddAttachment"><ATMTADD_DESCRIPTION>'+(encodeURIComponent($("#ATMTADD_DESCRIPTION").val())+"</ATMTADD_DESCRIPTION>");var e=/<a href="#" class="thumb-image" data-status="inline"><img src="data:image\/.*?;base64,(.*?)" width=".*?" height=".*?"><\/a>/i;d+="<ATMT_PIC>";var f=$("#atmtpicsovlytable").DataTable().table().data()[0];e.test(f[window.atmtpicstablesimgcol])&&(d+="<filename>"+encodeURIComponent(f[window.atmtpicstablesfncol])+
"</filename><image>"+f[window.atmtpicstablesimgcol].replace(e,"$1")+"</image>");d+="</ATMT_PIC></root>";window.fb_gb_debug&&console.log("assembled postedXML: "+(250>=d.length?d:d.substr(0,250)+"... +"+(d.length-250)+"bytes"));window.fb_gb_debug&&console.log("About to AJAX web service: WebProxy.asmx/webproxy");$("#loading").show();a=$.post("WebProxy.asmx/webproxy",{wsmethod:"getblade",postedGET:encodeURIComponent(a),postedXML:encodeURIComponent(d)});a.always(function(){window.enableParentButtons();
$("#loading").hide()});a.fail(function(){$("#errdivSUBMITATMT").html("ERROR: Oh snap, it looks like we hit a glitch. Please try again, and it may magically fix itself. If not, please report the error: ajax comm failure URL: WebProxy.asmx/webproxy");$("#errdivSUBMITATMT").show()});a.done(function(a){window.fb_gb_debug&&console.log("Raw data returned from web service: "+(250>=a.length?a:a.substr(0,250)+"... +"+(a.length-250)+"bytes"));if("<?xml"!=a.substr(0,5))$("#errdivSUBMITATMT").html("ERROR: xml doc not returned from web service."),
$("#errdivSUBMITATMT").show();else if(a=$.parseXML(a),"OK"!=$(a).find("head").find("r01")[0].innerHTML)$("#errdivSUBMITATMT").html($(a).find("head").find("r01")[0].innerHTML),$("#errdivSUBMITATMT").show();else{try{window.fb_gb_debug&&console.log("dbginfo: "+decodeURIComponent($(a).find("dbginfo")[0].innerHTML))}catch(m){}window.fb_gb_debug&&console.log("We're back OK from addcallatmt");$("#atmtstablecalls").DataTable().table().row.add([decodeURIComponent($(a).find("atmt").find("AT_FILE_DATA")[0].innerHTML),
decodeURIComponent($(a).find("atmt").find("AT_FILE_NAME")[0].innerHTML),decodeURIComponent($(a).find("atmt").find("AT_DESCRIPTION")[0].innerHTML),decodeURIComponent($(a).find("atmt").find("AT_EFFECTIVE_DATE")[0].innerHTML),decodeURIComponent($(a).find("atmt").find("AT_CREATED_ON_DATETIME")[0].innerHTML),decodeURIComponent($(a).find("atmt").find("AT_CREATED_BY")[0].innerHTML),"",decodeURIComponent($(a).find("atmt").find("AT_CREATED_ON_SORTER")[0].innerHTML),$(a).find("atmt").find("AT_LOAD_ERROR")[0].innerHTML]);
$("#atmtstablecalls").DataTable().table().draw();$("#atmtstablecalls tbody tr:first").css("background-color","bisque");window.imageThumbnailsPostProcessing();$("#atmtaddpanel").hide();$("#mask").hide();$.fn.dataTable.isDataTable("#atmtpicsovlytable")&&$("#atmtpicsovlytable").DataTable().table().clear();$("body,html").css("overflow","auto");$("#callsaddatmt")[0].reset();$("#submitBtnATMT").prop("disabled",!0);$("#resetBtnATMT").prop("disabled",!0);window.callsEditPageMainFormBizRulesChck();window.callsEditPageMainDynamicChecks();
$("#okdivATTACH").html($("#submitBtnATMT").val()+" successfully completed.");$("#okdivATTACH").show();window.setTimeout(function(){$("#okdivATTACH").hide()},3300)}})}});"iOS"==a&&($("#nameAddressDrop").removeAttr("style"),$("#nameAddressDrop").attr("style","width:22px!important;height:20px!important;"),$("#assignToDrop").removeAttr("style"),$("#assignToDrop").attr("style","width:22px!important;height:20px!important;"));$("#jsjqNotCompleted").hide()}}
function callsEditPageAddWidgets(){$("#callwf-byme-date-start .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#callwf-byme-date-end .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#call-date-start .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#call-date-end .input-group.date").datepicker({format:"M d, yyyy",
autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#call-status-date-start .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#call-status-date-end .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#workorder-generate .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#workorder-generate-date-start .input-group.date").datepicker({format:"M d, yyyy",
autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#workorder-generate-date-end .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#bring-forward .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#bring-forward-date-start .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#bring-forward-date-end .input-group.date").datepicker({format:"M d, yyyy",
autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0});$("#propstable").DataTable({scrollX:!0,searching:!1,paging:!1,ordering:!1});$("#wftable").DataTable({scrollX:!0,searching:!1,paging:!0,pageLength:10,lengthChange:!1,ordering:!1});$("#wfpicsmaintable").DataTable({scrollX:!0,searching:!1,paging:!1,ordering:!1});$("#wfpicsovlytable").DataTable({scrollX:!0,searching:!1,paging:!1,ordering:!1});$("#atmtstable").DataTable({scrollX:!0,searching:!1,paging:!0,pageLength:10,lengthChange:!1,ordering:!1});
$("#atmtstablecalls").DataTable({scrollX:!0,searching:!1,paging:!1,ordering:!0,order:[[7,"desc"]],columnDefs:[{targets:"_all",orderable:!1},{targets:7,visible:!1}],bInfo:!1,language:{emptyTable:"No attachments"}});$("#atmtpicsovlytable").DataTable({scrollX:!0,searching:!1,paging:!1,ordering:!1,info:!1,language:{emptyTable:"Tap the Add button above"}});$("#wf-date .input-group.date").datepicker({format:"M d, yyyy",autoclose:!0,maxViewMode:1,todayHighlight:!0,todayBtn:!0})}
function callsEditPageMainFormCreateInit(){window.fb_gb_debug&&console.log("in callsEditPageMainFormCreateInit()");"Create Call"==$("#submitBtn").val()&&(2<$("#CALL_DEPARTMENT").children.length&&(document.getElementById("CALL_DEPARTMENT").defaultValue="-1",$("#CALL_DEPARTMENT").val(document.getElementById("CALL_DEPARTMENT").defaultValue),$("#CALL_DEPARTMENT").trigger("change")),document.getElementById("CALL_CLASS").defaultValue="-1",$("#CALL_CLASS").val(document.getElementById("CALL_CLASS").defaultValue),
$("#CALL_CLASS").trigger("change"),document.getElementById("CALL_PROBLEM").defaultValue="-1",$("#CALL_PROBLEM").val(document.getElementById("CALL_PROBLEM").defaultValue),$("#CALL_PROBLEM").trigger("change"))}
function callsEditPageSetCallDateToToday(){window.fb_gb_debug&&console.log("In function callsEditPageSetCallDateToToday()");var a=new Date;$("#CALL_DATE").val(a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}));$("#CALL_DATETIME").val(a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}))}
function callsEditPageMainFormReset(){window.fb_gb_debug&&console.log("In function callsEditPageMainFormReset()");"Save Changes"!=$("#submitBtn").val()&&window.callsEditPageSetCallDateToToday();$("#callseditform")[0].reset();$("#CALL_REQUESTOR_ADDRESS").text($("#CALL_REQUESTOR_ADDRESS_OG").val());"Save Changes"!=$("#submitBtn").val()&&($("#CALL_DEPARTMENT").val(document.getElementById("CALL_DEPARTMENT").defaultValue),$("#CALL_DEPARTMENT").trigger("change"));$("#CALL_CLASS").val(document.getElementById("CALL_CLASS").defaultValue);
$("#CALL_CLASS").trigger("change");$("#CALL_PROBLEM").val(document.getElementById("CALL_PROBLEM").defaultValue);$("#CALL_PROBLEM").trigger("change");"Re-Issue Call"!=$("#submitBtn").val()&&$("#submitBtn").prop("disabled",!0);$("#resetBtn").prop("disabled",!0);window.callsEditPageMainFormRemoveErrors();$("#wrndivCALL_BRING_FORWARD_DATE").hide();$("#wrndivCALLWF_ASSIGN_TO").hide();window.callsEditPageMainDynamicChecks()}
function callsEditPageMainFormRemoveErrors(){$("#errdivCALL_WO_GEN_DATE").hide();$("#workorder-generate").removeClass("has-error");$("#errdivCALL_BRING_FORWARD_DATE").hide();$("#bring-forward").removeClass("has-error");$("#errdivCALL_DATE").hide();$("#errdivCALL_DEPARTMENT").hide();$("#errdivCALL_CLASS").hide();$("#errdivCALL_PROBLEM").hide();$("#errdivCALL_PRIORITY").hide();$("#errdivSUBMIT").hide();$("#okdivSUBMIT").hide();$("#addwf-assign-button-div").hide();$("#addwf-note-button-div").show();
$("#addwf-corr-button-div").show();$("#addwf-noti-button-div").show();$("#addwf-complete-button-div").hide();$("#addwf-cancel-button-div").hide();$("#addwf-transfer-button-div").hide();$("#addwf-reissue-button-div").hide();switch($("#CALL_STATUS").val()){case "ENTERED":case "TRANSFER IN":case "RE-INITIATED":$("#addwf-assign-button-div").show();$("#addwf-cancel-button-div").show();$("#addwf-transfer-button-div").show();break;case "ASSIGNED":$("#addwf-assign-button-div").show();$("#addwf-complete-button-div").show();
$("#addwf-cancel-button-div").show();$("#addwf-transfer-button-div").show();break;case "COMPLETED":128==($("#SECTOKEN").val()&128)&&1024==($("#SECTOKEN").val()&1024)&&$("#addwf-reissue-button-div").show()}$("#addwf-complete-button-div").is(":hidden")&&$("#addwf-cancel-button-div").is(":hidden")&&$("#addwf-reissue-button-div").is(":hidden")&&$("#addwf-comp-canc-reiss-div").hide();$("#callwf-byme-date-start").removeClass("has-error");$("#callwf-byme-date-end").removeClass("has-error");$("#errdivCALLWF_BYME").hide();
$("#call-date-start").removeClass("has-error");$("#call-date-end").removeClass("has-error");$("#errdivCALL_DATE").hide();$("#call-status-date-start").removeClass("has-error");$("#call-status-date-end").removeClass("has-error");$("#errdivCALL_STATUS_DATE").hide();$("#workorder-generate-date-start").removeClass("has-error");$("#workorder-generate-date-end").removeClass("has-error");$("#errdivCALL_WO_GEN_DATE").hide();$("#bring-forward-date-start").removeClass("has-error");$("#bring-forward-date-end").removeClass("has-error");
$("#errdivCALL_BRING_FORWARD_DATE").hide()}
function callsEditPageMainFormBizRulesChck(){window.fb_gb_debug&&console.log("in callsEditPageMainFormBizRulesChck()");window.callsEditPageMainFormRemoveErrors();var a=!1;if("Search Calls"!=$("#submitBtn").val()){var b=Date.parse($("#CALL_DATE").val()),c=Date.parse($("#CALL_WO_GEN_DATE").val()),d=Date.parse($("#CALL_BRING_FORWARD_DATE").val());c>=b||($("#workorder-generate").addClass("has-error"),$("#errdivCALL_WO_GEN_DATE").html("Workorder Generate date must be greater than or equal to the Call date "+$("#CALL_DATE").val()),
$("#errdivCALL_WO_GEN_DATE").show(),a=!0);!$("#CALL_BRING_FORWARD_DATE").val()||d>=c||($("#bring-forward").addClass("has-error"),$("#errdivCALL_BRING_FORWARD_DATE").html("Bring Forward date must be empty OR greater than or equal to the Workorder Generate date "+$("#CALL_WO_GEN_DATE").val()),$("#errdivCALL_BRING_FORWARD_DATE").show(),a=!0,$("#wrndivCALL_BRING_FORWARD_DATE").hide());-1==$("#CALL_DEPARTMENT").val()&&($("#errdivCALL_DEPARTMENT").html("You must select a Workgroup."),$("#errdivCALL_DEPARTMENT").show(),
a=!0);-1==$("#CALL_CLASS").val()&&($("#errdivCALL_CLASS").html("You must select a Class"+(-1==$("#CALL_DEPARTMENT").val()?". Select a Workgroup BEFORE selecting a Class.":"")),$("#errdivCALL_CLASS").show(),a=!0);-1==$("#CALL_PROBLEM").val()&&($("#errdivCALL_PROBLEM").html("You must select a Problem"+(-1==$("#CALL_CLASS").val()?". Select a Class BEFORE selecting a Problem.":"")),$("#errdivCALL_PROBLEM").show(),a=!0)}else{window.fb_gb_debug&&console.log("CALLWF_BYME_DATE_START: "+$("#CALLWF_BYME_DATE_START").val());
window.fb_gb_debug&&console.log("CALLWF_BYME_DATE_END: "+$("#CALLWF_BYME_DATE_END").val());window.fb_gb_debug&&console.log("CALL_DATE_START: "+$("#CALL_DATE_START").val());window.fb_gb_debug&&console.log("CALL_DATE_END: "+$("#CALL_DATE_END").val());window.fb_gb_debug&&console.log("CALL_STATUS_DATE_START: "+$("#CALL_STATUS_DATE_START").val());window.fb_gb_debug&&console.log("CALL_STATUS_DATE_END: "+$("#CALL_STATUS_DATE_END").val());window.fb_gb_debug&&console.log("CALL_WO_GEN_DATE_START: "+$("#CALL_WO_GEN_DATE_START").val());
window.fb_gb_debug&&console.log("CALL_WO_GEN_DATE_END: "+$("#CALL_WO_GEN_DATE_END").val());window.fb_gb_debug&&console.log("CALL_BRING_FORWARD_DATE_START: "+$("#CALL_BRING_FORWARD_DATE_START").val());window.fb_gb_debug&&console.log("CALL_BRING_FORWARD_DATE_END: "+$("#CALL_BRING_FORWARD_DATE_END").val());b=Date.parse($("#CALLWF_BYME_DATE_START").val());c=Date.parse($("#CALLWF_BYME_DATE_END").val());d=Date.parse($("#CALL_DATE_START").val());var e=Date.parse($("#CALL_DATE_END").val()),f=Date.parse($("#CALL_STATUS_DATE_START").val()),
k=Date.parse($("#CALL_STATUS_DATE_END").val()),m=Date.parse($("#CALL_WO_GEN_DATE_START").val()),h=Date.parse($("#CALL_WO_GEN_DATE_END").val()),n=Date.parse($("#CALL_BRING_FORWARD_DATE_START").val()),p=Date.parse($("#CALL_BRING_FORWARD_DATE_END").val()),l=Date.parse((new Date).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})),g;(g=!0,!$("#CALLWF_BYME_DATE_START").val())||!$("#CALLWF_BYME_DATE_END").val()||b<=c||($("#callwf-byme-date-start").addClass("has-error"),$("#callwf-byme-date-end").addClass("has-error"),
$("#errdivCALLWF_BYME").html("The first date cannot be later than the second date."),$("#errdivCALLWF_BYME").show(),a=!0,g=!1);g&&b>l&&($("#callwf-byme-date-start").addClass("has-error"),$("#errdivCALLWF_BYME").html("The date must be today or before."),$("#errdivCALLWF_BYME").show(),a=!0,g=!1);g&&c>l&&($("#callwf-byme-date-end").addClass("has-error"),$("#errdivCALLWF_BYME").html("The date must be today or before."),$("#errdivCALLWF_BYME").show(),a=!0);(g=!0,!$("#CALL_DATE_START").val())||!$("#CALL_DATE_END").val()||
d<=e||($("#call-date-start").addClass("has-error"),$("#call-date-end").addClass("has-error"),$("#errdivCALL_DATE").html("The first date cannot be later than the second date."),$("#errdivCALL_DATE").show(),a=!0,g=!1);g&&d>l&&($("#call-date-start").addClass("has-error"),$("#errdivCALL_DATE").html("The date must be today or before."),$("#errdivCALL_DATE").show(),a=!0,g=!1);g&&e>l&&($("#call-date-end").addClass("has-error"),$("#errdivCALL_DATE").html("The date must be today or before."),$("#errdivCALL_DATE").show(),
a=!0);(g=!0,!$("#CALL_STATUS_DATE_START").val())||!$("#CALL_STATUS_DATE_END").val()||f<=k||($("#call-status-date-start").addClass("has-error"),$("#call-status-date-end").addClass("has-error"),$("#errdivCALL_STATUS_DATE").html("The first date cannot be later than the second date."),$("#errdivCALL_STATUS_DATE").show(),a=!0,g=!1);g&&f>l&&($("#call-status-date-start").addClass("has-error"),$("#errdivCALL_STATUS_DATE").html("The date must be today or before."),$("#errdivCALL_STATUS_DATE").show(),a=!0,
g=!1);g&&k>l&&($("#call-status-date-end").addClass("has-error"),$("#errdivCALL_STATUS_DATE").html("The date must be today or before."),$("#errdivCALL_STATUS_DATE").show(),a=!0);!$("#CALL_WO_GEN_DATE_START").val()||!$("#CALL_WO_GEN_DATE_END").val()||m<=h||($("#workorder-generate-date-start").addClass("has-error"),$("#workorder-generate-date-end").addClass("has-error"),$("#errdivCALL_WO_GEN_DATE").html("The first date cannot be later than the second date."),$("#errdivCALL_WO_GEN_DATE").show(),a=!0);
!$("#CALL_BRING_FORWARD_DATE_START").val()||!$("#CALL_BRING_FORWARD_DATE_END").val()||n<=p||($("#bring-forward-date-start").addClass("has-error"),$("#bring-forward-date-end").addClass("has-error"),$("#errdivCALL_BRING_FORWARD_DATE").html("The first date cannot be later than the second date."),$("#errdivCALL_BRING_FORWARD_DATE").show(),a=!0)}$(".err-divmf:visible").length&&(a=!0);a&&($("#errdivSUBMIT").html("The "+$("#submitBtn").val()+" button will not work until the issues (in red) above are corrected."),
$("#errdivSUBMIT").show())}
function callsEditPageMainFormCalcNewBfdate(){var a=$("#CALL_BRING_FORWARD_DATE").val();if("undefined"===typeof $("#CALL_PROBLEM").children("option:selected").data("bfdays"))$("#CALL_BRING_FORWARD_DATE").val("");else{var b=new Date(Date.parse($("#CALL_WO_GEN_DATE").val()));b.setDate(b.getDate()+window.parseInt($("#CALL_PROBLEM").children("option:selected").data("bfdays"),10));$("#CALL_BRING_FORWARD_DATE").val(b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}))}window.callsEditPageMainFormBizRulesChck();"Create Call"!=
$("#submitBtn").val()&&$("#CALL_BRING_FORWARD_DATE").val()!=a&&($("#wrndivCALL_BRING_FORWARD_DATE").html("The Bring Forward date was changed from '"+a+"' to "+($("#CALL_BRING_FORWARD_DATE").val()?"the newly recalculated date shown.":"empty (because the Problem has no bfdays set).")),$("#wrndivCALL_BRING_FORWARD_DATE").show())}
function callsEditPageMainFormSaveDefaultValues(){try{document.getElementById("CALL_DEPARTMENT").defaultValue=$("#CALL_DEPARTMENT").val()}catch(a){}try{document.getElementById("CALL_CLASS").defaultValue=$("#CALL_CLASS").val()}catch(a){}try{document.getElementById("CALL_PROBLEM").defaultValue=$("#CALL_PROBLEM").val()}catch(a){}try{document.getElementById("CALL_PRIORITY").defaultValue=$("#CALL_PRIORITY").val()}catch(a){}try{document.getElementById("CALL_REFERENCE").defaultValue=$("#CALL_REFERENCE").val()}catch(a){}try{document.getElementById("CALL_WO_GEN_DATE").defaultValue=
$("#CALL_WO_GEN_DATE").val()}catch(a){}try{document.getElementById("CALL_BRING_FORWARD_DATE").defaultValue=$("#CALL_BRING_FORWARD_DATE").val()}catch(a){}try{document.getElementById("CALL_REPEAT").defaultValue=$("#CALL_REPEAT").val()}catch(a){}try{$("#CALL_FOLLOW_UP").prop("defaultChecked",$("#CALL_FOLLOW_UP").is(":checked")?!0:!1)}catch(a){}try{$("#CALL_INTERNAL").prop("defaultChecked",$("#CALL_INTERNAL").is(":checked")?!0:!1)}catch(a){}try{document.getElementById("CALL_SUBJECT_IDENTITY").defaultValue=
$("#CALL_SUBJECT_IDENTITY").val()}catch(a){}try{document.getElementById("CALL_FREE_FORM_LOCATION").defaultValue=$("#CALL_FREE_FORM_LOCATION").val()}catch(a){}try{document.getElementById("CALL_DETAIL").defaultValue=$("#CALL_DETAIL").val()}catch(a){}try{document.getElementById("CALL_REQUESTOR_NAME").defaultValue=$("#CALL_REQUESTOR_NAME").val()}catch(a){}try{document.getElementById("CALL_REQUESTOR_ADDRESS").defaultValue=$("#CALL_REQUESTOR_ADDRESS").val()}catch(a){}try{document.getElementById("CALL_REQUESTOR_PHONE1").defaultValue=
$("#CALL_REQUESTOR_PHONE1").val()}catch(a){}try{document.getElementById("CALL_REQUESTOR_PHONE2").defaultValue=$("#CALL_REQUESTOR_PHONE2").val()}catch(a){}try{document.getElementById("CALL_REQUESTOR_EMAIL").defaultValue=$("#CALL_REQUESTOR_EMAIL").val()}catch(a){}try{document.getElementById("CALLWF_ASSIGN_TO").defaultValue=$("#CALLWF_ASSIGN_TO").val()}catch(a){}try{document.getElementById("CALLWF_COMMENTS").defaultValue=$("#CALLWF_COMMENTS").val()}catch(a){}}
function callsEditPageHandlePicsGeneric(a,b){window.fb_gb_debug&&console.log("callsEditPageHandlePicsGeneric() received pictype: "+a);var c=b.target.files[0],d=new window.FileReader;d.onerror=function(){alert("ERROR: File read encountered an unknown error")};d.onabort=function(){alert("ERROR: File read was aborted")};d.onload=function(){var b=d.result;window.fb_gb_debug&&console.log("Image original size: "+Math.round(b.length/1048576*100)/100+"Mb");var f=new window.Image;f.src=b;f.onload=function(){var d=
f.width,e=f.height;if(800<d||800<e){window.fb_gb_debug&&console.log("Processing image down to 800xory");if(d>e){var h=800/d*e;d=800}else d*=800/e,h=800;e=document.createElement("canvas");e.width=d;e.height=h;e.getContext("2d").drawImage(this,0,0,d,h);b=e.toDataURL(c.type);e=h}d>e?(h=50/d*d,d=50/d*e):(h=50/e*d,d=50/e*e);e=c.type.substring(c.type.indexOf("/")+1);"jpeg"==e&&(e="jpg");"add-pic-ovly-atmt"==a?($("#atmtpicsovlytable").DataTable().table().row.add(['<a href="#" class="icon-delete"><i class="fa fa-trash"></i></a>',
'<a href="#" class="thumb-image" data-status="inline"><img src="'+b+'" width="'+h.toString()+'" height="'+d.toString()+'"></a>',(new Date).getTime()+"Z."+e,Math.round(b.length/1048576*100)/100+"Mb"]),$("#atmtpicsovlytable").DataTable().table().draw(),window.callsEditPageOvlyDynamicChecks()):"add-pic-main-wf"==a?($("#wfpicsmaintable").DataTable().table().row.add(['<a href="#" class="icon-delete"><i class="fa fa-trash"></i></a>','<a href="#" class="thumb-image" data-status="inline"><img src="'+b+'" width="'+
h.toString()+'" height="'+d.toString()+'"></a>',(new Date).getTime()+"Z."+e,Math.round(b.length/1048576*100)/100+"Mb"]),$("#wfpicsmaintable").DataTable().table().draw(),window.callsEditPageMainDynamicChecks()):"add-pic-ovly-wf"==a&&($("#wfpicsovlytable").DataTable().table().row.add(['<a href="#" class="icon-delete"><i class="fa fa-trash"></i></a>','<a href="#" class="thumb-image" data-status="inline"><img src="'+b+'" width="'+h.toString()+'" height="'+d.toString()+'"></a>',(new Date).getTime()+"Z."+
e,Math.round(b.length/1048576*100)/100+"Mb"]),$("#wfpicsovlytable").DataTable().table().draw(),window.callsEditPageOvlyDynamicChecks());window.imageThumbnailsPostProcessing()};f.onerror=function(){alert("ERROR: Encountered an unknown error processing the image for max size 800x800")}};try{d.readAsDataURL(c)}catch(e){}}
function callsEditPageMainDynamicChecks(){"Re-Issue Call"!=$("#submitBtn").val()&&128==($("#SECTOKEN").val()&128)&&1024==($("#SECTOKEN").val()&1024)&&"COMPLETED"===$("#CALL_STATUS").val()&&""!==$("#CALL_REPEAT").val()?($("#wrndivREISSUE").html("This Call is COMPLETED and repeats "+$("#CALL_REPEAT").val()+'<br><a href="" style="margin-top:5px;" id="addwf-reissue-button2" class="btn btn-success btn-default btn-xs" role="button">Re-Issue Call</a>'),$("#addwf-reissue-button2").prop("href",$("#addwf-reissue-button2").prop("href")+
"&reissuecall=1"),$("#wrndivREISSUE").show()):($("#wrndivREISSUE").html(""),$("#wrndivREISSUE").hide());var a=/([0-9]{1,2}[\-. ]?)?\(?([0-9]{3}[\-. ]?)\)?([0-9]{3}[\-. ]?)([0-9]{4})/gi,b=/([a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)/gi;$("#CALL_REQUESTOR_PHONE1").val()&&a.test($("#CALL_REQUESTOR_PHONE1").val())?($("#rqstr-phone1-button").prop("href",$("#CALL_REQUESTOR_PHONE1").val().replace(a,"tel://$1$2$3$4")),
$("#rqstr-phone1-button").show()):$("#rqstr-phone1-button").hide();$("#CALL_REQUESTOR_PHONE2").val()&&a.test($("#CALL_REQUESTOR_PHONE2").val())?($("#rqstr-phone2-button").prop("href",$("#CALL_REQUESTOR_PHONE2").val().replace(a,"tel://$1$2$3$4")),$("#rqstr-phone2-button").show()):$("#rqstr-phone2-button").hide();$("#CALL_REQUESTOR_EMAIL").val()&&b.test($("#CALL_REQUESTOR_EMAIL").val())?$("#rqstr-email-button").show():($("#rqstr-email-button").html("Email"),$("#rqstr-email-button").hide(),$("#wrndivCALL_REQUESTOR_EMAIL").hide());
$("#CALLWF_ASSIGN_TO").val()?($("#add-pic-main-wf-div").show(),$("#wfpicsmaintable").DataTable().table().draw(),$("#add-pic-main-wf-btn").show()):($("#add-pic-main-wf-div").hide(),$.fn.dataTable.isDataTable("#wfpicsmaintable")&&($("#wfpicsmaintable").DataTable().table().clear(),$("#wfpicsmaintable").DataTable().table().draw()))}
function callsEditPageMainFormBuildXML(a){var b=new Date,c='<root buildtype="'+a+'" generatedby="GetBlade.js">';c+="<USER_NAME>"+encodeURIComponent($("#USER_NAME").val())+"</USER_NAME>";"Transfer Call"==a&&(c+="<CALLWFADD_BUTTON>"+encodeURIComponent($("#submitBtnWF").val())+"</CALLWFADD_BUTTON>");if("Transfer Call"==a||"Re-Issue Call"==a)c+='<CALL_ID desc="Originating Call">'+$("#CALL_ID").val()+"</CALL_ID>";if("Search Calls"==a||"Transfer Call"==a||"Re-Issue Call"==a)c+='<CALL_NUMBER desc="Originating Call">'+
encodeURIComponent($("#CALL_NUMBER").val())+"</CALL_NUMBER>";"Search Calls"==a&&(c+="<CALLWF_BYME_DATE_START>"+($("#CALLWF_BYME_DATE_START").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALLWF_BYME_DATE_START").val()))).substr(0,8)):"")+"</CALLWF_BYME_DATE_START>",c+="<CALLWF_BYME_DATE_END>"+($("#CALLWF_BYME_DATE_END").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALLWF_BYME_DATE_END").val()))).substr(0,8)):"")+"</CALLWF_BYME_DATE_END>");
if("Save Changes"==a||"Create Call"==a||"Re-Issue Call"==a)c+="<CALL_DATE>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATE").val()))).substr(0,8))+"</CALL_DATE>",c+="<CALL_DATETIME>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATETIME").val()))))+"</CALL_DATETIME>";"Transfer Call"==a&&(c+="<CALL_DATE>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(b).substr(0,8))+"</CALL_DATE>",c+="<CALL_DATETIME>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(b))+
"</CALL_DATETIME>");"Search Calls"==a&&(c+="<CALL_DATE_START>"+($("#CALL_DATE_START").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATE_START").val()))).substr(0,8)):"")+"</CALL_DATE_START>",c+="<CALL_DATE_END>"+($("#CALL_DATE_END").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_DATE_END").val()))).substr(0,8)):"")+"</CALL_DATE_END>",c+="<CALL_STATUS>"+encodeURIComponent($("#CALL_STATUS").val())+"</CALL_STATUS>",c+="<CALL_STATUS_DATE_START>"+
($("#CALL_STATUS_DATE_START").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_STATUS_DATE_START").val()))).substr(0,8)):"")+"</CALL_STATUS_DATE_START>",c+="<CALL_STATUS_DATE_END>"+($("#CALL_STATUS_DATE_END").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_STATUS_DATE_END").val()))).substr(0,8)):"")+"</CALL_STATUS_DATE_END>");if("Search Calls"==a||"Create Call"==a||"Re-Issue Call"==a)"Search Calls"!=a&&(c+="<CALL_DEPARTMENT>"+encodeURIComponent($("#CALL_DEPARTMENT").val())+
"</CALL_DEPARTMENT>"),c+="<CALL_DEPARTMENT_TEXT>"+encodeURIComponent($("#CALL_DEPARTMENT").children("option:selected").text())+"</CALL_DEPARTMENT_TEXT>";"Transfer Call"==a&&(c+="<CALL_DEPARTMENT>"+encodeURIComponent($("#CALLWFADD_TODEPARTMENT").val())+"</CALL_DEPARTMENT>",c+="<CALL_DEPARTMENT_TEXT>"+encodeURIComponent($("#CALLWFADD_TODEPARTMENT").children("option:selected").text())+"</CALL_DEPARTMENT_TEXT>");if("Search Calls"==a||"Save Changes"==a||"Create Call"==a||"Re-Issue Call"==a)"Search Calls"!=
a&&(c+="<CALL_CLASS>"+encodeURIComponent($("#CALL_CLASS").val())+"</CALL_CLASS>"),"Search Calls"==a&&(c+="<CALL_CLASS_TEXT>"+encodeURIComponent($("#CALL_CLASS").children("option:selected").text())+"</CALL_CLASS_TEXT>"),"Search Calls"!=a&&(c+="<CALL_PROBLEM>"+encodeURIComponent($("#CALL_PROBLEM").val())+"</CALL_PROBLEM>"),"Search Calls"==a&&(c+="<CALL_PROBLEM_TEXT>"+encodeURIComponent($("#CALL_PROBLEM").children("option:selected").text())+"</CALL_PROBLEM_TEXT>");"Transfer Call"==a&&(c+="<CALL_CLASS></CALL_CLASS>",
c+="<CALL_PROBLEM></CALL_PROBLEM>");c+="<CALL_DETAIL>"+encodeURIComponent($("#CALL_DETAIL").val())+"</CALL_DETAIL>";c+="<CALL_FREE_FORM_LOCATION>"+encodeURIComponent($("#CALL_FREE_FORM_LOCATION").val().toUpperCase())+"</CALL_FREE_FORM_LOCATION>";c+="<CALL_SUBJECT_IDENTITY>"+encodeURIComponent($("#CALL_SUBJECT_IDENTITY").val().toUpperCase())+"</CALL_SUBJECT_IDENTITY>";"Search Calls"!=a&&(c+="<CALL_PRIORITY>"+encodeURIComponent($("#CALL_PRIORITY").children("option:selected").val())+"</CALL_PRIORITY>");
"Search Calls"==a&&(c+="<CALL_PRIORITY_TEXT>"+encodeURIComponent($("#CALL_PRIORITY").children("option:selected").text())+"</CALL_PRIORITY_TEXT>");c+="<CALL_REFERENCE>"+encodeURIComponent($("#CALL_REFERENCE").val().toUpperCase())+"</CALL_REFERENCE>";if("Save Changes"==a||"Create Call"==a||"Re-Issue Call"==a)c+="<CALL_WO_GEN_DATE>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_WO_GEN_DATE").val()))).substr(0,8))+"</CALL_WO_GEN_DATE>",c+="<CALL_BRING_FORWARD_DATE>"+($("#CALL_BRING_FORWARD_DATE").val()?
encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_BRING_FORWARD_DATE").val()))).substr(0,8)):"")+"</CALL_BRING_FORWARD_DATE>";"Transfer Call"==a&&(c+="<CALL_WO_GEN_DATE>"+encodeURIComponent(window.dateToYYYYMMDDHHMISS(b).substr(0,8))+"</CALL_WO_GEN_DATE>",c+="<CALL_BRING_FORWARD_DATE></CALL_BRING_FORWARD_DATE>");"Search Calls"==a&&(c+="<CALL_WO_GEN_DATE_START>"+($("#CALL_WO_GEN_DATE_START").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_WO_GEN_DATE_START").val()))).substr(0,
8)):"")+"</CALL_WO_GEN_DATE_START>",c+="<CALL_WO_GEN_DATE_END>"+($("#CALL_WO_GEN_DATE_END").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_WO_GEN_DATE_END").val()))).substr(0,8)):"")+"</CALL_WO_GEN_DATE_END>",c+="<CALL_BRING_FORWARD_DATE_START>"+($("#CALL_BRING_FORWARD_DATE_START").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_BRING_FORWARD_DATE_START").val()))).substr(0,8)):"")+"</CALL_BRING_FORWARD_DATE_START>",c+="<CALL_BRING_FORWARD_DATE_END>"+
($("#CALL_BRING_FORWARD_DATE_END").val()?encodeURIComponent(window.dateToYYYYMMDDHHMISS(new Date(Date.parse($("#CALL_BRING_FORWARD_DATE_END").val()))).substr(0,8)):"")+"</CALL_BRING_FORWARD_DATE_END>");c+="<CALL_REPEAT>"+encodeURIComponent($("#CALL_REPEAT").children("option:selected").text())+"</CALL_REPEAT>";if("Save Changes"==a||"Create Call"==a||"Transfer Call"==a||"Re-Issue Call"==a)c+="<CALL_FOLLOW_UP>"+($("#CALL_FOLLOW_UP").is(":checked")?"1":"0")+"</CALL_FOLLOW_UP>",c+="<CALL_INTERNAL>"+($("#CALL_INTERNAL").is(":checked")?
"1":"0")+"</CALL_INTERNAL>";0<$("#CALL_REQUESTOR_NAME").length&&(c+="<CALL_REQUESTOR_NAME>"+encodeURIComponent($("#CALL_REQUESTOR_NAME").val().toUpperCase())+"</CALL_REQUESTOR_NAME>",c+="<CALL_REQUESTOR_ADDRESS>"+encodeURIComponent($("#CALL_REQUESTOR_ADDRESS").val().toUpperCase())+"</CALL_REQUESTOR_ADDRESS>",c+="<CALL_REQUESTOR_PHONE1>"+encodeURIComponent($("#CALL_REQUESTOR_PHONE1").val())+"</CALL_REQUESTOR_PHONE1>",c+="<CALL_REQUESTOR_PHONE2>"+encodeURIComponent($("#CALL_REQUESTOR_PHONE2").val())+
"</CALL_REQUESTOR_PHONE2>",c+="<CALL_REQUESTOR_EMAIL>"+encodeURIComponent($("#CALL_REQUESTOR_EMAIL").val())+"</CALL_REQUESTOR_EMAIL>");if("Search Calls"==a||"Create Call"==a||"Re-Issue Call"==a)if(c+="<CALLWF_ASSIGN_TO>"+encodeURIComponent($("#CALLWF_ASSIGN_TO").val().toUpperCase())+"</CALLWF_ASSIGN_TO>","Create Call"==a||"Re-Issue Call"==a)c+="<CALLWF_COMMENTS>"+encodeURIComponent($("#CALLWF_COMMENTS").val())+"</CALLWF_COMMENTS>";"Transfer Call"==a&&(c+="<CALLWFADD_FRDEPARTMENT>"+encodeURIComponent($("#CALLWFADD_FRDEPARTMENT").val())+
"</CALLWFADD_FRDEPARTMENT>",c+="<CALLWFADD_TODEPARTMENT>"+encodeURIComponent($("#CALLWFADD_TODEPARTMENT").val())+"</CALLWFADD_TODEPARTMENT>");if("Create Call"==a){var d=/<a href="#" class="thumb-image" data-status="inline"><img src="data:image\/.*?;base64,(.*?)" width=".*?" height=".*?"><\/a>/i;c+="<CALLWF_PICS>";$("#wfpicsmaintable").DataTable().table().rows().every(function(a,b,e){a=this.data();d.test(a[window.wfpicstablesimgcol])&&(c+="<x><filename>"+encodeURIComponent(a[window.wfpicstablesfncol])+
"</filename><image>"+a[window.wfpicstablesimgcol].replace(d,"$1")+"</image></x>")});c+="</CALLWF_PICS>"}c+="</root>";try{var e=$.parseXML(c)}catch(k){window.fb_gb_debug&&console.log("callsEditPageMainFormBuildXML(): postedXML:\r\n"+c),window.fb_gb_debug&&console.log("callsEditPageMainFormBuildXML(): postedXML is invalid"),c="ERROR"}if("ERROR"!=c&&"Search Calls"==a){var f=!1;$(e).find("root").children().each(function(a,b){window.fb_gb_debug&&console.log(b.nodeName+": "+b.innerHTML);"USER_NAME"!=b.nodeName&&
b.innerHTML&&"-1"!=b.innerHTML&&(f=!0)});f||"ERROR"==c||(c="NOVALUES")}return c}function callsCreateQueryURIFromXML(a){var b="";a=$.parseXML(a);$(a).find("root").children().each(function(a,d){"USER_NAME"!=d.nodeName&&d.innerHTML&&"-1"!=d.innerHTML&&(b+="&"+d.nodeName+"="+encodeURIComponent(d.innerHTML))});return b}
function callsEditPageMainFormCanAddWorkflow(){return $("#submitBtn").prop("disabled")&&$("#errdivSUBMIT").is(":hidden")?!0:($("#okdivWFADD").html("You must Save Changes (below) before adding workflow."+("-1"==$("#CALL_PROBLEM").val()||"-1"==$("#CALL_CLASS").val()?" You also need to select a Class and Problem for the Call.":"")),$("#okdivWFADD").show(),window.setTimeout(function(){$("#okdivWFADD").hide()},3300),!1)}
function callsEditPageMainFormCanAddAttachment(){return $("#submitBtn").prop("disabled")&&$("#errdivSUBMIT").is(":hidden")?!0:($("#wrndivATTACH").html("You must Save Changes (above) before adding a photo."),$("#wrndivATTACH").show(),window.setTimeout(function(){$("#wrndivATTACH").hide()},3300),!1)}
function callsEditPageOvlyShow(a,b){window.fb_gb_debug&&console.log("in callsEditPageOvlyShow() buttonName: "+a+" extra: "+b);$("body,html").css("overflow","hidden");$("#mask").show();$("#CALLWFADD_NAME_LBL").html("Name:");$("#CALLWFADD_NAME").val("");$("#workflow-flds").hide();$("#workflow-flds-corr").hide();$("#transfer-flds").hide();$("#CALLWFADD_NAME2").prop("required",!1);$("#CALLWFADD_NAME2").val("");$("#CALLWFADD_FILENO").val("");$("#CALLWFADD_COMMENTS_LBL").html("Comments:");$("#CALLWFADD_COMMENTS").val("");
$("#CALLWFADD_COMMENTS").prop("required",!0);$("#CALLWFADD_TODEPARTMENT").val("");$("#CALLWFADD_TODEPARTMENT").prop("required",!1);$("#CALLWFADD_HELP").hide();$("#submitBtnWF").show();$("#resetBtnWF").show();$("#cancelBtnWF").show();switch(a){case "Assign":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Assign To:");$("#CALLWFADD_NAME").val("");break;case "Add Note":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Noted By:");$("#CALLWFADD_NAME").val($("#USER_NAME").val());$("#CALLWFADD_COMMENTS_LBL").html("Note:");
break;case "Notify Req.":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Notification By:");$("#CALLWFADD_NAME").val($("#USER_NAME").val());break;case "Corresp.":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Correspondence By:");$("#CALLWFADD_NAME").val($("#USER_NAME").val());$("#workflow-flds-corr").show();$("#CALLWFADD_NAME2").prop("required",!0);break;case "Complete Call":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Completed By:");$("#CALLWFADD_NAME").val($("#USER_NAME").val());
break;case "Cancel Call":$("#workflow-flds").show();$("#CALLWFADD_NAME_LBL").html("Canceled By:");$("#CALLWFADD_NAME").val($("#USER_NAME").val());break;case "Transfer Call":$("#CALLWFADD_NAME").prop("required",!1);$("#CALLWFADD_COMMENTS").prop("required",!1);$("#transfer-flds").show();$("#CALLWFADD_TODEPARTMENT").prop("required",!0);break;case $("#addtaggedprop-button").html():$("#CALLWFADD_NAME").prop("required",!1);$("#CALLWFADD_COMMENTS").prop("required",!1);break;case "Remove Property from Call?":$("#CALLWFADD_NAME").prop("required",
!1),$("#CALLWFADD_COMMENTS").prop("required",!1)}$("#wfaddpanel-heading").html(a+(a==$("#addtaggedprop-button").html()?"?":"")+("Assign"==a&&$("#CALL_ASSIGNED_TO").val()?" (Currently assigned to "+$("#CALL_ASSIGNED_TO").val()+")":""));if("Remove Property from Call?"!==a&&a!=$("#addtaggedprop-button").html()&&"Workflow Reader View"!=a)window.callsEditPageOvlySaveDefaultValues(),$("#submitBtnWF").val(a),$("#submitBtnWF").prop("disabled",!0),$("#resetBtnWF").prop("disabled",!0);else if("Remove Property from Call?"==
a)$("#CALLWFADD_EXTRA").val(b),a=$.parseXML(b),$("#CALLWFADD_HELP").html("Remove Property at address:<br>"+decodeURIComponent($(a).find("ADDRESS")[0].innerHTML)+"<br>from Call "+$("#CALL_NUMBER").val()+"?"),$("#CALLWFADD_HELP").show(),$("#submitBtnWF").val("Remove Property"),$("#submitBtnWF").prop("disabled",!1),$("#resetBtnWF").hide();else if(a==$("#addtaggedprop-button").html())$("#submitBtnWF").val("Add Tagged Property"),$("#submitBtnWF").prop("disabled",!1),$("#resetBtnWF").hide();else if("Workflow Reader View"==
a){var c="",d=!0;$("#wftable").DataTable().table().rows().every(function(a,b,k){'<a href="#"'!==$(this.cell(a,0).data())[0].innerHTML.substr(0,11)?(d=!0,0!==a&&(c+="<hr>"),c+=$(this.cell(a,4).data())[0].innerHTML+" <strong>"+$(this.cell(a,0).data())[0].innerHTML+"</strong> "+$(this.cell(a,1).data())[0].innerHTML+(""!==$(this.cell(a,7).data())[0].innerHTML?" Corresp. To: "+$(this.cell(a,7).data())[0].innerHTML+(""!==$(this.cell(a,8).data())[0].innerHTML?" File Number: "+$(this.cell(a,8).data())[0].innerHTML:
""):"")+"<br>",c+='<i>"'+$(this.cell(a,2).data())[0].innerHTML.replace(/<br>/g," ")+'"</i>'):(d&&(c+="<br><br>",d=!1),c+=$(this.cell(a,0).data())[0].innerHTML)});$("#CALLWFADD_HELP").html(c);$("#CALLWFADD_HELP").show();$("#submitBtnWF").hide();$("#resetBtnWF").hide();window.imageThumbnailsPostProcessing()}$("#wfaddpanel").width($("#getblade-panel").width()+10);$("#wfaddpanel").show();window.deviceScreenManagement();window.callsEditPageOvlyBizRulesChck()}
function callsEditPageOvlyDynamicChecks(){window.fb_gb_debug&&console.log("in callsEditPageOvlyDynamicChecks()");if($("#CALLWFADD_NAME").val()){$("#add-pic-ovly-wf-div").show();var a=$("#wfpicsovlytable").DataTable().table();a.draw();0===a.rows().count()&&$.fn.dataTable.isDataTable("#wfpicsovlytable")&&(a.clear(),a.draw())}else $("#add-pic-ovly-wf-div").hide(),$.fn.dataTable.isDataTable("#wfpicsovlytable")&&($("#wfpicsovlytable").DataTable().table().clear(),$("#wfpicsovlytable").DataTable().table().draw());
$("#atmtaddpanel").is(":visible")?(a=$("#atmtpicsovlytable").DataTable().table(),a.draw(),0===a.rows().count()&&$.fn.dataTable.isDataTable("#atmtpicsovlytable")&&(a.clear(),a.draw()),$("#submitBtnATMT").prop("disabled",!0),$("#resetBtnATMT").prop("disabled",!0),0===a.rows().count()?($("#add-pic-ovly-atmt-btn").show(),$("#ATMTADD_DESCRIPTION").val()&&$("#resetBtnATMT").prop("disabled",!1)):($("#add-pic-ovly-atmt-btn").hide(),$("#resetBtnATMT").prop("disabled",!1),$("#ATMTADD_DESCRIPTION").val()&&$("#submitBtnATMT").prop("disabled",
!1))):$.fn.dataTable.isDataTable("#atmtpicsovlytable")&&($("#atmtpicsovlytable").DataTable().table().clear(),$("#amtpicsovlytable").DataTable().table().draw())}function callsEditPageOvlyRemoveErrors(){$("#errdivSUBMITWF").html("");$("#errdivSUBMITWF").hide();$("#errdivSUBMITATMT").html("");$("#errdivSUBMITATMT").hide()}
function callsEditPageOvlySaveDefaultValues(){document.getElementById("CALLWFADD_NAME").defaultValue=$("#CALLWFADD_NAME").val();document.getElementById("CALLWFADD_NAME2").defaultValue=$("#CALLWFADD_NAME2").val();document.getElementById("CALLWFADD_FILENO").defaultValue=$("#CALLWFADD_FILENO").val();document.getElementById("CALLWFADD_COMMENTS").defaultValue=$("#CALLWFADD_COMMENTS").val();document.getElementById("CALLWFADD_TODEPARTMENT").defaultValue=$("#CALLWFADD_TODEPARTMENT").val()}
function callsEditPageOvlyBizRulesChck(){window.fb_gb_debug&&console.log("in callsEditPageOvlyBizRulesChck()");window.callsEditPageOvlyDynamicChecks();window.callsEditPageOvlyRemoveErrors()}
function callsEditPageOvlyReset(){window.fb_gb_debug&&console.log("in callsEditPageOvlyReset()");$("#callsaddwf")[0].reset();$("#submitBtnWF").prop("disabled",!0);$("#resetBtnWF").prop("disabled",!0);$("#callsaddatmt")[0].reset();$("#submitBtnATMT").prop("disabled",!0);$("#resetBtnATMT").prop("disabled",!0);$("#atmtpicsovlytable").DataTable().table().clear();window.callsEditPageOvlyRemoveErrors()}
function callsPropTablePostProcessing(){$(".remove-prop").unbind("click");$(".remove-prop").click(function(a){window.fb_gb_debug&&console.log("clicked remove-prop: "+$(this).data("propno")+" extra: "+$(this).data("extra"));window.callsEditPageOvlyShow("Remove Property from Call?","<root><PROPNO>"+encodeURIComponent($(this).data("propno"))+"</PROPNO><ADDRESS>"+encodeURIComponent($(this).data("extra"))+"</ADDRESS></root>");a.preventDefault()});var a=!1;"zzzzzz"!=$("#TAGGED_PROPNO").val()&&(a=!0,$("#propstable").DataTable().table().rows().every(function(b,
c,d){$("#TAGGED_PROPNO").val()==$(this.data()[0]).data("propno")&&(a=!1)}));a?$("#addtaggedprop-span").show():$("#addtaggedprop-span").hide()};
