Q | Description | Coop | Cpi | ")
.html("" + value.text + "")
.addClass("table-bordered")
.css("text-align", "center")
.appendTo($("#weekhistoryfortimesheettablehead"));
var li2 = $(" | ")
.html("" + value.value.toFixed(2) + "")
.addClass("table-bordered")
.css("text-align", "center")
.appendTo($("#weekhistoryfortimesheettablebody"));
if (value.color) {
li2.css("color", value.color);
}
});
}
if (data.history) {
$.each(data.history, function(key, value) {
var d = new Date(value.tima*1000);
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem");
li.html(buildstringfortimesheethistory(value,0,"history", passhash2, date, empid, name, timezonedifference));
li.appendTo($("#timesheethistory"));
});
}
if (data.deleted) {
$.each(data.deleted, function(key, value) {
var d = new Date(value.tima*1000);
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem");
li.html(buildstringfortimesheethistory(value,0,"deleted", passhash2, date, empid, name, timezonedifference));
li.appendTo($("#timesheethistorydeleted"));
});
}
if (mylevel < 8) {
$("#addnewtimesheetentry").css("display", "none");
} else {
if (getCookie("nameforcc") == "nancy" || getCookie("nameforcc") == "nkhodayari" || getCookie("nameforcc") == "charity" || getCookie("nameforcc") == "alex" || getCookie("nameforcc") == "staci" || getCookie("nameforcc") == "karthic") {
$("#addnewtimesheetentry").css("display", "block");
} else {
$("#addnewtimesheetentry").css("display", "none");
}
}
$("#employeetimesheetprompt").modal();
}
function buildstringfortimesheethistory(data, valx, type, passhash2, date, empid, name, timezonedifference) {
var mystring = "";
valx++;
if (type == "history") {
if (valx==1) {
if (mylevel == 8) {
if (getCookie("nameforcc") == "nancy" || getCookie("nameforcc") == "nkhodayari" || getCookie("nameforcc") == "charity" || getCookie("nameforcc") == "alex" || getCookie("nameforcc") == "staci" || getCookie("nameforcc") == "karthic") {
mystring += "delete ";
mystring += "modify ";
}
}
}
} else if (type == "deleted") {
if (valx==1) {
if (mylevel == 8) {
if (getCookie("nameforcc") == "nancy" || getCookie("nameforcc") == "nkhodayari" || getCookie("nameforcc") == "nancy" || getCookie("nameforcc") == "karthic") {
mystring += "restore ";
}
}
}
}
timezonedifference = parseInt(timezonedifference);
mystring += "" + data.method + " - " + timeStamp(parseInt(urldecode(data.servertima))) + " - " + data.action;
if (typeof data.override === 'object') {
mystring += " - " + buildstringfortimesheethistory(data.override, valx, type, passhash2, date, empid, name, timezonedifference);
}
return mystring;
}
function getcameralist(number) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getcamerainfo.php?temptime=" + mytime + "&number=" + number, function( data ) {
$.each(data, function(key, value) {
var tr = $(" ")
.appendTo($("#bodyofcameralisttable"));
var td1 = $(" | ")
.html("" + value.url + "")
.appendTo(tr);
var td2 = $(" | ")
.html(value.status)
.appendTo(tr);
if (value.status == "offline") {
td2.css("color","red");
} else if (value.status == "online") {
td2.css("color","green");
}
});
$("#getcameralistlink").css("display", "none");
});
}
function approveemployee(number, officenumber) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/inputs/approveemployee.php?temptime=" + mytime + "&number=" + officenumber + "&num=" + number, function( data ) {
});
}
function editempinfo(name, number, officenumber) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getemployeeinfo.php?temptime=" + mytime + "&number=" + officenumber + "&num=" + number, function( data ) {
$("#employeenamespan").html(urldecode(name));
$("#editemployeeempnum").val(number);
$("#editemployeeofficenumber").val(officenumber);
$("#editemployeephone").val(urldecode(data.phone));
$("#editemployeename").val(urldecode(data.name));
$("#editemployeepay").val(urldecode(data.payrate));
$("#editemployeemanager").val(urldecode(data.manager));
$("#editemployeecanuseid").val(urldecode(data.usesidtoclock));
$("#editemployeessn").val(urldecode(data.ssn));
$("#editemployeeaddress").val(urldecode(data.address));
$("#editemployeecity").val(urldecode(data.city2));
$("#editemployeebirthdate").val(urldecode(data.birthdate));
$("#editemployeehiredate").val(urldecode(data.hiredate));
$("#editemployeefilings").val(urldecode(data.filings));
$("#editemployeeallowences").val(urldecode(data.allowences));
$("#editemployeepayrollid").val(urldecode(data.payrollid));
$("#editemployeeroutingnumber").val(urldecode(data.routingnumber));
$("#editemployeeaccountnumber").val(urldecode(data.accountnumber));
if (data.globalusersql.level < 8) {
$("#showmanagerfieldeditemployeesbutton").css("display","block");
//$("#addempbutton").css("display","none");
} else {
$("#showmanagerfieldeditemployeesbutton").css("display","none");
}
console.log(data);
$("#editemployeeprompt").modal();
$("#editemployeebirthdate").datetimepicker({defaultDate: urldecode(data.birthdate)});
$("#editemployeehiredate").datetimepicker({defaultDate: urldecode(data.hiredate)});
});
}
function addofficetofieldwips(theccnum, thesubccnum, number) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getfieldwipinfo.php?temptime=" + mytime + "&num=" + theccnum + "&subnum=" + thesubccnum + "&number=" + number, function( data ) {
console.log(data);
$("#addofficetofieldwipnum").val(urldecode(data.ccnum));
$("#addofficetofieldwipsjobnumber").val(urldecode(data.jobnumber));
$("#addofficetofieldwipsjobname").val(urldecode(data.jobname));
$("#addofficetofieldwipsjobcode").val(urldecode(data.cocode));
$("#addofficetofieldwipspmname").val(urldecode(data.pmname));
$("#addofficetofieldwipname").val(urldecode(data.desc));
$("#addofficetofieldwipsquota").val(urldecode(data.totq));
$("#addofficetofieldwipsstartdate").val(urldecode(data.startdate));
$("#addofficetofieldwipsenddate").val(urldecode(data.enddate));
$("#addofficetofieldwipscpi").val(urldecode(data.cpi));
$("#addofficetofieldwipscoop").val(urldecode(data.coop));
$("#addofficetofieldwipsformat").val(urldecode(data.format));
$( '#addofficetofieldwipsstartdate' ).datetimepicker({ defaultDate: urldecode(data.startdate) });
$( '#addofficetofieldwipsenddate' ).datetimepicker({ defaultDate: urldecode(data.enddate) });
$("#addofficetofieldwips").modal();
});
}
function getuserinfo(theusernum) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getuserinfo.php?temptime=" + mytime + "&num=" + theusernum, function( data ) {
console.log(data);
$("#edituserprevurl").val(window.location.href);
$("#editusernum").val(urldecode(data.number));
$("#editusername").val(urldecode(data.name));
$("#edituseremail").val(urldecode(data.email));
$("#editusercellphone").val(urldecode(data.cellphone));
$("#editusermainphone").val(urldecode(data.mainnumber));
$("#edituserprimaryfunction").val(urldecode(data.primaryfunction));
$("#edituserofficesortorder").val(urldecode(data.officesortorder));
$("#edituseremail").attr("disabled", "disabled");
$("#editusermainphone").attr("disabled", "disabled");
$("#edituserprompt").modal();
});
}
function getuseraccountinfo(theusernum) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getuseraccountinfo.php?temptime=" + mytime + "&num=" + theusernum, function( data ) {
console.log(data);
$("#edituseraccountprevurl").val(window.location.href);
$("#edituseraccountnum").val(urldecode(data.number));
$("#edituseraccountusername").val(urldecode(data.username));
$("#edituseraccountactive").val(urldecode(data.active));
$("#edituseraccountprompt").modal();
});
}
function logintoacomputerloadfuncs(number, comphash) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/logintoacomputerloadfuncs.php?temptime=" + mytime + "&number=" + number + "&comphash=" + comphash, function( data ) {
console.log(data);
$("#logintocomputernamefield").html(data.name + " " + data.mallinfo + "");
$("#logintocomputerlastcheckinfield").html(data.phone + " - Last checkin " + data.timestring + "");
$("#logmeinnumber").val(number);
$("#logmeincomphash").val(comphash);
$("#loginto-iframe").removeAttr("src");
$("#loginto-iframe").html("");
$("#logmeinloginprompt").find("button").each(function() {
$(this).removeAttr("disabled");
$(this).css("background-color", "white");
});
$("#recentloginsul").html("");
$.each(data.recent, function(key, value) {
var d = new Date(value.tima*1000);
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem")
.html(urldecode(value.loginuser) + " - " + timeStamp(value.tima) + "")
.appendTo($("#recentloginsul"));
});
$("#logmeinloginprompt").modal();
});
}
function logintothiscompas(name) {
mytime = parseInt(Date.now()/1000);
var tempstring = "http://firewall.ccmar.com/logmeinwindow.php?number=" + $("#logmeinnumber").val() + "&time=" + mytime + "&comphash=" + $("#logmeincomphash").val() + "&loginto=" + name;
console.log(tempstring);
$("#loginto-iframe").attr("src", tempstring);
}
function infologintothiscompas(name) {
mytime = parseInt(Date.now()/1000);
var tempstring = "http://firewall.ccmar.com/logmeinwindow.php?number=" + $("#logmeininfonumber").val() + "&time=" + mytime + "&comphash=" + $("#logmeininfocomphash").val() + "&loginto=" + name;
console.log(tempstring);
$("#info-loginto-iframe").attr("src", tempstring);
}
function getcompinfo(number, comphash) {
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/getcompinfo.php?temptime=" + mytime + "&number=" + number + "&comphash=" + comphash, function( data ) {
console.log(data);
$("#infologintocomputernamefield").html(data.name + " " + data.mallinfo + "");
$("#infologintocomputerlastcheckinfield").html(data.phone + " - Last checkin " + data.timestring + "");
$("#logmeininfonumber").val(number);
$("#logmeininfocomphash").val(comphash);
$("#info-loginto-iframe").removeAttr("src");
$("#info-loginto-iframe").html("");
$("#logmeininfoprompt").find("button").each(function() {
$(this).removeAttr("disabled");
$(this).css("background-color", "white");
});
$("#inforecentloginsul").html("");
$("#infoprocessul").html("");
$("#infoprocessul2").html("");
$("#logininfoprompttablebody").html("");
if ("process" in data.checkindata) {
var processstring = urldecode(data.checkindata.process).split("|");
processstring = arrayUnique(processstring);
var myx = 0;
$.each(processstring, function(key, value) {
if (value.indexOf(".") && value.length > 5) {
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem")
.css("padding", "0")
.css("margin", "0")
.css("line-height", "14px")
.css("word-wrap", "break-word")
.html("" + value + "");
if (myx==0) {li.appendTo($("#infoprocessul"));}
if (myx==1) {li.appendTo($("#infoprocessul2"));}
myx++;
if (myx==2) {myx=0;}
}
});
}
// $("#infoprocessul").html(urldecode(data.checkindata.process));
$.each(data.recent, function(key, value) {
var d = new Date(value.tima*1000);
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem")
.html(urldecode(value.loginuser) + " - " + timeStamp(value.tima) + "")
.appendTo($("#inforecentloginsul"));
});
$.each(data.websites, function(key, value) {
var d = new Date(value.tima*1000);
var li = $("")
.addClass("ui-menu-item")
.attr("role", "menuitem")
.html("" + urldecode(value.domain) + " - " + value.status + "")
.appendTo($("#inforecentwebsitesul"));
});
var myarraylist = [{"name":"eyeversion"},{"name":"osinfo"},{"name":"pcname"},{"name":"username"},{"name":"mytime"},{"name":"ram"},{"name":"cpuusage"},{"name":"localip"},{"name":"remoteip"},{"name":"display"},{"name":"uptime"},{"name":"timestring"},{"name":"disk"}];
if (data.checkindata) {
$.each(myarraylist, function(key, value) {
var tr = $(" ");
var td = $(" | ");
td.css("padding","2px");
if (value.name == "timestring") {td.html("Last checkin");} else {td.html(value.name);}
td.appendTo(tr);
var td2 = $(" | ");
td2.css("padding","2px");
if (value.name == "ram") {
if ("availram" in data.checkindata && "totalram" in data.checkindata) {
td2.html(urldecode(data.checkindata['availram'] + " / " + data.checkindata['totalram']));
}
} else if (value.name == "timestring") {
td2.html(urldecode(data.timestring));
} else if (value.name == "display") {
if ("screenheight" in data.checkindata && "screenwidth" in data.checkindata && "colordepth" in data.checkindata) {
td2.html(urldecode(data.checkindata['screenheight'] + "x" + data.checkindata['screenwidth'] + " @ " + data.checkindata['colordepth'] + " bits"));
}
} else {
if (value.name in data.checkindata) {
if (value.name == "cpuusage") {
td2.html(urldecode(data.checkindata[value.name]) + "%");
} else if (value.name == "disk") {
var tempdis = urldecode(data.checkindata[value.name]).split("|");
$.each(tempdis, function(key2, value2) {
if (value2.trim().length > 0) {
var temptemp = value2.split("=");
if (temptemp[2]>0 || temptemp[3]>0) {
var tempst = temptemp[0] + " " + temptemp[1] + " " + (temptemp[2]/(1024*1024*1024)).toPrecision(5) + " gig / " + (temptemp[3]/(1024*1024*1024)).toPrecision(5) + " gig";
td2.html(td2.html() + tempst + " ");
}
}
});
} else {
td2.html(urldecode(data.checkindata[value.name]));
}
}
}
td2.appendTo(tr);
tr.appendTo($("#logininfoprompttablebody"));
});
}
$("#logmeininfoprompt").modal();
});
}
function showfieldseditemp() {
var manpass = prompt("Please enter the managers password");
mytime = parseInt(Date.now()/1000);
$.getJSON( "/json/validatemanagerspassword.php?empnum=" + $("#editemployeeempnum").val() + "&temptime=" + mytime + "&managerspass=" + manpass, function( data ) {
if (data.status == "true") {
// $("#addempbutton").css("display","inline-block");
$("#editemployeepay").attr("type", "number");
$("#editemployeessn").attr("type", "text");
$("#editemployeeroutingnumber").attr("type", "text");
$("#editemployeeaccountnumber").attr("type", "text");
$("#editemployeepay").val(data['editemployeepay']);
$("#editemployeessn").val(data['editemployeessn']);
$("#editemployeeroutingnumber").val(data['ditemployeeroutingnumber']);
$("#editemployeeaccountnumber").val(data['editemployeeaccountnumber']);
} else {
$("#editemployeepay").attr("type", "password");
$("#editemployeessn").attr("type", "password");
$("#editemployeeroutingnumber").attr("type", "password");
$("#editemployeeaccountnumber").attr("type", "password");
$("#editemployeepay").val("");
$("#editemployeessn").val("");
$("#editemployeeroutingnumber").val("");
$("#editemployeeaccountnumber").val("");
}
});
}
function changerespondent() {
console.log("a");
var theid = document.getElementById('theidforresp').value;
if (document.getElementById('firstnamechange').value.length <= 0) {console.log("b");$('#addrespondentinfomessagechange').html('Please input a First Name');
} else if (document.getElementById('lastnamechange').value.length <= 0) {console.log("c");$('#addrespondentinfomessagechange').html('Please input a last name');
// } else if (document.getElementById('recruiterchange').value.length <= 0) {console.log("d");$('#addrespondentinfomessagechange').html('Please input a recruiter');
// } else if (document.getElementById('interviewerchange').value.length <= 0) {$('#addrespondentinfomessage').html('Please input an interviewer');
// } else if (document.getElementById('jobidchange').value.length <= 0) {$('#addrespondentinfomessage').html('Please input a job');
} else {
var urltoaddmovieto = '/inputs/respondentinput.php?get=changerespondent&id=' + theid + '&firstname=' + encodeURIComponent(document.getElementById('firstnamechange').value) + '&lastname=' +
encodeURIComponent(document.getElementById('lastnamechange').value) + '&phone=' + encodeURIComponent(document.getElementById('phonechange').value) + '&address=' +
encodeURIComponent(document.getElementById('addresschange').value) + '&city=' + encodeURIComponent(document.getElementById('citychange').value) + '&state=' +
encodeURIComponent(document.getElementById('statechange').value) + '&zip=' + encodeURIComponent(document.getElementById('zipcodechange').value) + '&desc=' +
encodeURIComponent(document.getElementById('descchange').value) + '&email=' +
encodeURIComponent(document.getElementById('emailchange').value) + '&jobid=' + encodeURIComponent(document.getElementById('jobidchange').value) + '&submit=change';
// alert(urltoaddmovieto);
console.log(urltoaddmovieto);
window.location = urltoaddmovieto;
}
}
function addrespondent() {
if (document.getElementById('firstname').value.length <= 0) {$('#addrespondentinfomessage').html('Please input a First Name');
} else if (document.getElementById('lastname').value.length <= 0) {$('#addrespondentinfomessage').html('Please input a last name');
// } else if (document.getElementById('recruiter').value.length <= 0) {$('#addrespondentinfomessage').html('Please input a recruiter');
// } else if (document.getElementById('interviewer').value.length <= 0) {$('#addrespondentinfomessage').html('Please input an interviewer');
// } else if (document.getElementById('jobid').value.length <= 0) {$('#addrespondentinfomessage').html('Please input a job');
} else {
var urltoaddmovieto = '/inputs/respondentinput.php?get=addrespondent&firstname=' + encodeURIComponent(document.getElementById('firstname').value) + '&lastname=' +
encodeURIComponent(document.getElementById('lastname').value) + '&phone=' + encodeURIComponent(document.getElementById('phone').value) + '&address=' +
encodeURIComponent(document.getElementById('address').value) + '&city=' + encodeURIComponent(document.getElementById('city').value) + '&state=' +
encodeURIComponent(document.getElementById('state').value) + '&zip=' + encodeURIComponent(document.getElementById('zipcode').value) + '&email=' +
encodeURIComponent(document.getElementById('email').value) + '&age=' + encodeURIComponent(document.getElementById('age').value) +
'&desc=' + encodeURIComponent(document.getElementById('description').value) + '&gender=' +
encodeURIComponent(document.getElementById('gender').value) + '&jobid=' + encodeURIComponent(document.getElementById('jobid').value) + '&submit=new';
window.location = urltoaddmovieto;
}
}
function searchrespondent() {
var urltoaddmovieto = '/index.php?get=respondentinput&do=search&firstname=' + encodeURIComponent(document.getElementById('firstname').value) + '&lastname=' +
encodeURIComponent(document.getElementById('lastname').value) + '&phone=' + encodeURIComponent(document.getElementById('phone').value) + '&address=' +
encodeURIComponent(document.getElementById('address').value) + '&city=' + encodeURIComponent(document.getElementById('city').value) + '&state=' +
encodeURIComponent(document.getElementById('state').value) + '&zip=' + encodeURIComponent(document.getElementById('zipcode').value) + '&email=' +
encodeURIComponent(document.getElementById('email').value)
+ '&desc=' + encodeURIComponent(document.getElementById('description').value)
+ '&minage=' + encodeURIComponent(document.getElementById('minage').value)
+ '&maxage=' + encodeURIComponent(document.getElementById('maxage').value)
+ '&jobid=' + encodeURIComponent(document.getElementById('jobid').value);
window.location = urltoaddmovieto;
}
function searchrespondentb_oldsystem(fname, lname) {
$("#blank_respondentinputpromptb_body").empty();
$.getJSON("/json/getarcsrespinfo_oldsystem.php?fname=" + urlencode(fname) + "&lname=" + urlencode(lname), function(val) {
if (val.length > 0) {
var myresp = val[0];
$('#blank_respondentinputpromptb').modal('show')
var userstring = "";
userstring+="Name" + myresp.firstname + " " + myresp.lastname + "";
userstring+="email" + myresp.email + "";
if (myresp.phone) {userstring+="phone" + myresp.phone + "";}
if (myresp.gender) {userstring+="gender3" + (myresp.gender=="1"?"Male":(myresp.gender=="2"?"Female":myresp.gender)) + "";}
if (myresp.age && myresp.age > 0 && myresp.age < 110) {userstring+="age" + myresp.age + "";}
if (myresp.address) {userstring+="Address" + myresp.address + "";}
if (myresp.city) {userstring+="City" + myresp.city + "";}
if (myresp.state) {userstring+="State" + myresp.state + "";}
if (myresp.zipcode) {userstring+="Zip" + myresp.zipcode + "";}
userstring+="jobs";
$.each(val, function(key2, val2) {
userstring+=val2.coname + ": " + timeStamp(val2.tima) + " " + urldecode(val2.studysubject) + " : " + urldecode(val2.jobname) + " " + urldecode(val2.desc) + " ";
});
userstring+="";
$("#blank_respondentinputpromptb_body").append($("").addClass("dl-horizontal respondent_noedit").html(userstring)).append(" ");;
} else {
$("#blank_respondentinputpromptb_body").append("respondent not found");
}
});
}
function searchrespondentb(forceemail="") {
console.log("a1");
console.log(forceemail);
var urltoaddmovieto = 'https://sync.gui.cc/arcsapi/search';
///includes/proxy/searchresp.php?';
// var urltoaddmovietoquery = '';
var email = "";
var fname = "";
var lname = "";
var phone = "";
var postobject = {};
if (forceemail.trim().length > 0) {
forceemail = urldecode(forceemail);
$('#respondentinputpromptb').modal('show')
console.log("try");
if (validateEmail(forceemail.trim())) {
postobject['email'] = forceemail.trim();
email = forceemail.trim();
// urltoaddmovietoquery = 'email=' + encodeURIComponent(urldecode(forceemail));
} else {
$("#addrespondentinfomessageb").html("Invalid email format");
}
} else if ($("#emailb").val().trim().length > 0) {
if (validateEmail($("#emailb").val().trim())) {
postobject['email'] = document.getElementById('emailb').value.trim();
email = document.getElementById('emailb').value.trim();
// urltoaddmovietoquery = 'email=' + encodeURIComponent(document.getElementById('emailb').value.trim());
} else {
$("#addrespondentinfomessageb").html("Invalid email format");
}
}
if ($("#fnameb").val().trim().length > 1) {
postobject['fname'] = document.getElementById('fnameb').value.trim();
fname = document.getElementById('fnameb').value.trim();
}
if ($("#lnameb").val().trim().length > 1) {
postobject['lname'] = document.getElementById('lnameb').value.trim();
lname = document.getElementById('lnameb').value.trim();
}
if ($("#phoneb").val().trim().length > 0) {
$("#phoneb").val(parseInt($("#phoneb").val().replace(/-/g, "").trim()));
if ($("#phoneb").val().trim().length != 10) {
$("#addrespondentinfomessageb").html("Phone must be 10 digits no dashes or periods");
} else {
postobject['phone'] = document.getElementById('phoneb').value.trim();
phone = document.getElementById('phoneb').value.trim();
// urltoaddmovietoquery = 'phone=' + encodeURIComponent(document.getElementById('phoneb').value.trim());
}
}
if (Object.keys(postobject).length > 0 && $("#searchrespondentbuttonb").val() == "Search Respondent") {
$("#searchrespondentbuttonb").val("Searching...").attr("disabled","disabled");
$("#arcssearchresults").empty();
searchrespondent_lookupccmar(email, phone, fname, lname);
// $.get(urltoaddmovieto + urltoaddmovietoquery, function(data) {
// console.log(urltoaddmovieto);
// console.log(postobject);
// $.post(urltoaddmovieto, postobject, function(data) {
// $("#searchrespondentbuttonb").val("Search Respondent").removeAttr("disabled").css({"display":"none"});
// var dude = data;
// if (Object.keys(dude).length > 0) {
// $("#searchinarcs").html("found");
// } else {
// $("#searchinarcs").html("not found");
// }
// });
} else {
console.log("no query");
}
}
function searchrespondent_lookupccmar_fromid(id) {
// alert("please wait a few minutes and try again");
$.getJSON("/json/lookuprespondentinoldccmar_fromid.php?id=" + id, function(data) {
$("#respondentinputpromptb").modal("show");
console.log(data);
searchrespondent_lookupccmar(urldecode(data.email), urldecode(data.phone), urldecode(data.firstname), urldecode(data.lastname))
});
}
function searchrespondent_lookupccmar(email, phone, fname, lname, number) {
$('.nav-tabs a[href="#arcssearchresults"]').tab('show');
// $("#arcssearchresults").append("Search for " + stringresult + " in ARCS : ");
$("#arcssearchresults").empty().append("Searching for respondent... ");
$.getJSON("/json/lookuprespondentinoldccmar.php?email=" + urlencode(email) + "&fname=" + urlencode(fname) + "&lname=" + urlencode(lname) + "&phone=" + urlencode(phone), function(data) {
$("#searchrespondentbuttonb").val("Search Respondent").removeAttr("disabled").css({"display":"none"});
$("#searcholddbtempspan").empty();
if (data.length > 0) {
$.each(data, function(key, val) {
var userstring = "";
userstring+="- Name
- " + urldecode(val.firstname) + " " + urldecode(val.lastname) + "
";
if (val.email) {userstring+="- email
- " + urldecode(val.email) + "
";}
if (val.phone) {userstring+="- phone
- " + val.phone.substr(0,3) + "-" + val.phone.substr(3,3) + "-" + val.phone.substr(6,4) + "
";}
if (val.gender) {userstring+="- gender2
- " + (val.gender=="1"?"Male":(val.gender=="2"?"Female":val.gender)) + "
";}
if (val.race) {userstring+="- ethnicity
- " + (val.race=="1"?"Caucasian":(val.race=="2"?"AA":(val.race=="3"?"Hispanic":(val.race=="4"?"Asian":(val.race=="5"?"Other":val.race))))) + "
";}
if (val.age && val.age > 0) {userstring+="- age
- " + val.age + "
";}
if (val.birthdate && val.birthdate != "1900-01-01") {userstring+="- Birthdate
- " + val.birthdate + "
";}
if (val.address) {userstring+="- Address
- " + urldecode(val.address) + "
";}
if (val.city) {userstring+="- City
- " + urldecode(val.city) + "
";}
if (val.state) {userstring+="- State
- " + val.state + "
";}
if (val.zipcode) {userstring+="- Zip
- " + val.zipcode + "
";}
userstring+="- jobs
- ";
$.each(val.jobs, function(key2, val2) {
userstring+=(typeof val2.coname !== 'undefined' && val2.coname?"" + val2.coname + ": ":(typeof val2.cocode !== 'undefined' && val2.cocode?val2.cocode + ": ":"")) + timeStamp(val2.tima) + "
" + (val2.studysubject?urldecode(val2.studysubject) + " : ":"") + (val2.jobname?urldecode(val2.jobname):"") + (val2.desc?" " + urldecode(val2.desc) + "":"") + (val2.other?" " + urldecode(val2.other) + "":"") + "
";
});
userstring+=" ";
$("#arcssearchresults").append($("").addClass("dl-horizontal respondent_noedit").html(userstring).on("click", function() {
var myjobsforccmardude = [];
myjobsforccmardude.push(JSON.parse('{"0":"unk_16945018945824","ccnum":"unk_16945018945824","1":"4000","cocode":"4000","2":"542566","id":"542566","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17033064722979","ccnum":"unk_17033064722979","1":"4000","cocode":"4000","2":"546769","id":"546769","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17090495177252","ccnum":"unk_17090495177252","1":"4000","cocode":"4000","2":"549054","id":"549054","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17092057282820","ccnum":"unk_17092057282820","1":"4000","cocode":"4000","2":"549113","id":"549113","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17092834525492","ccnum":"unk_17092834525492","1":"4000","cocode":"4000","2":"549218","id":"549218","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17093426746267","ccnum":"unk_17093426746267","1":"4000","cocode":"4000","2":"549237","id":"549237","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
myjobsforccmardude.push(JSON.parse('{"0":"unk_17121217884292","ccnum":"unk_17121217884292","1":"4000","cocode":"4000","2":"550385","id":"550385","3":"normal","format":"normal","4":"ccmovies","jobname":"ccmovies","5":"","jobnumber":"","6":"","desc":""}'));
starteditrespondent(val, val.jobs, myjobsforccmardude);
console.log("clicked");
console.log(myjobsforccmardude);
})).append(" ");
});
} else {
$("#searcholddbtempspan").html("No results in database
").append($("").html("Click here to add this respondent to the database
").on("click", function() {
searchrespondent_notfound(email, phone, fname, lname);
}));
}
});
}
function searchrespondent_notfound(email, phone, fname, lname) {
// $("#arcssearchresults").append("Search for " + stringresult + " : ").append($("").attr({"color":"red"}).html("Not found")).append($(" ")).append($(" "));
$("#arcssearchresults").empty();
$("#arcssearchresults")
.append($("").addClass("form-group")
.append($(" |