loadCoaches(); function loadCoaches() { $("#widget-coaches-table").html(""); var loading = document.createElement("div"); loading.id = "ul-elements-loading"; $("#widget-coaches").append(loading); $("#ul-elements-loading").html("
LOADING DATA...
"); var data = {}; data['sf'] = 'coaches'; data['DomainID'] = "13"; $.ajax({ url: '/data/coaches/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) { alertMsg(data.message); } else { $("#ul-elements-loading").remove(); setWidget(data); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); $("#ul-elements-loading").remove(); } }); } function setWidget(data) { var master_table_body_0 = document.createElement("tbody"); master_table_body_0.id = "master_table_body_0"; $("#widget-coaches-table").append(master_table_body_0); var master_table_header_0 = document.createElement("thead"); master_table_header_0.id = "master_table_header_0"; $("#widget-coaches-table").append(master_table_header_0); $("#master_table_header_0").html( "" + "Posted" + "Name" + "Title" + " " + "" ); for ( var t=0; t < data.coachjobs.length; t++ ) { var master_table_body_row = document.createElement("tr"); master_table_body_row.id = "master_table_body_rowsr"+t; var tName = data.coachjobs[t].TeamName; if ( data.coachjobs[t].JobType == "C" ) tName = data.coachjobs[t].JobName; $("#master_table_body_0").append(master_table_body_row); $("#master_table_body_rowsr"+t).html( "" + unWrapDate(data.coachjobs[t].DatePosted) + ""+ "" + tName + ""+ "" + data.coachjobs[t].JobTitle + ""+ " " ); } } function viewCoachJob(CoachJobID) { alert(CoachJobID); } function viewCoachJob(CoachJobID) { $("#CoachJobID").html(""); if ( CoachJobID == "" ) { return; } var data = {}; data['sf'] = 'job'; data['CoachJobID'] = CoachJobID; $.ajax({ url: '/data/coaches/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) alertMsg(data.message); else { $("#CoachJobID").html(data.coachjob.CoachJobID); $("#JobTitle").html(data.coachjob.JobTitle); if ( data.coachjob.JobType == "C" ) $("#TeamID").html(data.coachjob.JobName); else $("#TeamID").html(data.coachjob.TeamName); $("#PostedBy").html("Posted: " + unWrapDate(data.coachjob.DatePosted)); $("#JobViewer").html(data.coachjob.JobText); $("#ModalJobView").modal(); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); } }); } function printThisJob() { if ( $("#CoachJobID").html() != "" ) { printJob($("#CoachJobID").html()); } } function printJob(CoachJobID) { var data = {}; data['sf'] = 'job'; data['CoachJobID'] = CoachJobID; $.ajax({ url: '/data/coaches/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) alertMsg(data.message); else { window.open( "/app/job/" + CoachJobID, "Print Job", "" ); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); } }); }