142 lines
4.8 KiB
JavaScript
142 lines
4.8 KiB
JavaScript
var verlist = new Array(1);
|
|
var mobnos="";
|
|
var dispname="";
|
|
function VerifierList()
|
|
{
|
|
QryStr="bid="+$("#bid").val();
|
|
RunAjax("GET","verlist",QryStr,1);
|
|
}
|
|
function AfterResponse(AjaxResponse,OprID)
|
|
{
|
|
if(OprID==1)
|
|
{
|
|
if(AjaxResponse.trim().search("failed:")>-1)
|
|
{
|
|
AjaxResponse=AjaxResponse.replace("failed:","");
|
|
CallMessage(AjaxResponse,3000,200,300);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
var rows=AjaxResponse.split(RowDelim);
|
|
var optDiv=document.createElement("div");
|
|
optDiv.setAttribute("id","TablePanel");
|
|
optDiv.setAttribute("class","tableContainer");
|
|
optDiv.setAttribute("style","font-family:Tahoma;overflow:visible;padding-right:3px;height:400px;overflow:auto;width:400px");
|
|
var ListPanel="<table border='0' cellspacing='0' style='width:382px' id='verlist'>";
|
|
ListPanel=ListPanel+"<thead class='thead'><tr>";
|
|
ListPanel=ListPanel+"<td>Code</td><td>Name</td><td>Mobile No</td>";
|
|
ListPanel=ListPanel+"<td><input width='20' type='checkbox' id='chkparent' onclick='ToggleChecks(\"chkcol\",this.checked)' ></td></thead><tbody>";
|
|
for(indx=0;indx<rows.length-1;indx++)
|
|
{
|
|
var cols=rows[indx].split(ColDelim);
|
|
var bgclr="";
|
|
var chldchk="<input width='20' type='checkbox' id='chkcol' onclick='checkList(\"chkcol\",\"chkparent\")' >";
|
|
if(cols[2].length < 10 || cols[2].length > 10)
|
|
{
|
|
bgclr="style='background-color:#fda78d' title='Invalid mobile no'";
|
|
}
|
|
ListPanel=ListPanel+"<tr "+bgclr+">";
|
|
ListPanel=ListPanel+"<td id='code'>"+cols[1].split('|')[0]+"</td>";
|
|
ListPanel=ListPanel+"<td>"+cols[1].split('|')[1]+"</td>";
|
|
ListPanel=ListPanel+"<td>"+cols[2]+"</td>";
|
|
ListPanel=ListPanel+"<td id='mobno'>"+chldchk+"</td>";
|
|
ListPanel=ListPanel+"</tr>";
|
|
}
|
|
ListPanel=ListPanel+"<tr><td colspan='4'><input type='button' class='button' name='btnok' style='margin-top:5px;float:right' value='OK' id='btnok' accesskey='K' onclick=\"updateReceipents(document.getElementById('inptDialog'),'verlist')\" />";
|
|
ListPanel=ListPanel+"<input type='button' class='button' name='btncancel' style='margin-top:5px;float:right' value='Close' id='btncancel' accesskey='C' onclick=\"hideDialog(document.getElementById('inptDialog'))\" /></td></tr></tbody></table>";
|
|
optDiv.innerHTML=ListPanel;
|
|
ShowInputDialog(optDiv,"Verifier List","commondet","inptDialog");
|
|
}
|
|
}
|
|
}
|
|
function updateReceipents(ElemToRemove,verlst)
|
|
{
|
|
$('#'+verlst+' tr').each(function(){
|
|
if($("input:checkbox",this).length > 0)
|
|
{
|
|
var isChecked = $("input:checkbox",this)[0].checked;
|
|
if(isChecked)
|
|
{
|
|
var name=$(this).find('td').eq(0).html();
|
|
var mob=$(this).find('td').eq(2).html();
|
|
if(mob.length==10)
|
|
{
|
|
CheckAddedReceipents(name.trim(),mob.trim());
|
|
}
|
|
}
|
|
}
|
|
});
|
|
ElemToRemove.parentNode.removeChild(ElemToRemove);
|
|
}
|
|
function CheckAddedReceipents(name,mob)
|
|
{
|
|
if(mobnos.search(mob+ColDelim)==-1)
|
|
{
|
|
mobnos=mobnos+(mob)+""+ColDelim;
|
|
dispname=dispname+(name)+""+ColDelim;
|
|
AddReceipent(name,mob);
|
|
}
|
|
}
|
|
function hideDialog(ElemToRemove)
|
|
{
|
|
RemoveDialog(ElemToRemove);
|
|
}
|
|
function CountChars()
|
|
{
|
|
var charlength=($("#message").val().length+$("#greetings").val().length+$("#regards").val().length);
|
|
var messages=(charlength/136);
|
|
$("#leftchars").html(" <font color='blue'><strong>"+(Math.ceil(messages))+"</strong></font> ("+charlength+" chars)");
|
|
}
|
|
function AddReceipent(name,mob)
|
|
{
|
|
var widgWid="cursor:pointer";
|
|
var icnWidget=document.createElement('div');
|
|
icnWidget.setAttribute('class', 'lblcontainer icnwidget');
|
|
icnWidget.setAttribute('style', widgWid);
|
|
icnWidget.setAttribute('id', 'wid'+mob);
|
|
icnWidget.setAttribute('title', 'click to remove this receipent');
|
|
icnWidget.setAttribute("onclick", "RemoveReceipent(this)");
|
|
var text=document.createTextNode(name);
|
|
icnWidget.appendChild(text);
|
|
document.getElementById('recepdiv').appendChild(icnWidget);
|
|
}
|
|
function RemoveReceipent(el)
|
|
{
|
|
mobnos=mobnos.replace(el.id.replace('wid','')+ColDelim,'');
|
|
dispname=dispname.replace((el.innerHTML)+ColDelim,'');
|
|
$(el).remove();
|
|
}
|
|
function keyListen(el,e) {
|
|
var keycode = e.keyCode;
|
|
if(keycode==13)
|
|
{
|
|
validate(document.getElementById('receipents'),'f','Mobilenos');
|
|
if(checkForm())
|
|
{
|
|
var elval=el.value.replace(/,|;/g,ColDelim);
|
|
var mob=elval.split(ColDelim);
|
|
for(indx=0;indx<mob.length;indx++)
|
|
{
|
|
CheckAddedReceipents(mob[indx],mob[indx]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function ValidateGenerateSMS()
|
|
{
|
|
validate(document.getElementById('message'),'t','SMS');
|
|
if(checkForm())
|
|
{
|
|
if(mobnos.length==0)
|
|
{
|
|
CallMessage('1018GSMS:error:Please select any receipent.',3000,200,300);
|
|
}
|
|
else
|
|
{
|
|
$("#val1").val(dispname);
|
|
$("#val2").val(mobnos);
|
|
SubmitForm('gengroupsms', '_parent', 'gsms');
|
|
}
|
|
}
|
|
} |