Files
matrix/cygnus-onprem-app/build/WebContent/js/appjs/optrcasetool.js

187 lines
4.5 KiB
JavaScript

curindx=0;
maxrow=0;
function InitPage()
{
maxrow=$('#tabbody tr').length-1;
$('#tabbody tr').click(function (event) {
rindx=$(this).index();
if(event.target.id != "chkcol"+rindx)
{
if($("#chkcol"+rindx).attr("checked")=="checked")
{
$(this).removeClass('rowhover');
$("#chkcol"+rindx).attr("checked",false);
}
else
{
$(this).addClass('rowhover');
$("#chkcol"+rindx).attr("checked",true);
}
checkList("chkcol","chkparent");
}
});
}
function DoPending()
{
if(curindx<=maxrow)
{
$("#btnundodone").hide();
if($("#chkcol"+curindx).length > 0)
{
var chk=$("#chkcol"+curindx);
if($(chk).attr("checked")=="checked")
{
uuid=$("#uuid"+curindx).val();
visit=$("#visit"+curindx).html();
visit=visit.trim();
usid=$("#usid").val();
$("#td"+curindx).html("<img src='/matrix/images/loading_small.gif' width='16' height='7' title='please wait, it will take few minutes' />");
RunAjax("POST","dooprpending","val0="+uuid+"&val1="+usid+"&val2="+visit+"&val3=0&val4=0",2);
}
else
{
curindx=curindx+1;
DoPending();
}
}
else
{
curindx=curindx+1;
DoPending();
}
}
else
{
$("#btnundodone").show();
curindx=0;
}
}
function manageRowSelection(ischecked)
{
$("#tabbody tr").each(function(){
rindx=$(this).index();
if($("#chkcol"+rindx).attr("checked")=="checked")
{
$(this).addClass('rowhover');
}
else
{
$(this).removeClass('rowhover');
}
});
}
function ValidateSearch()
{
var k=0;
var ver=$("#verlist").val();
var port=$("#portlist").val();
var optr=$("#optrlist").val();
var mvcode=$("#mvcode").val();
var applno=$("#applno").val();
var name=$("#customername").val();
var bid=$("#bid").val();
if(ver!='-1')
{
k=k+1;
}
if(port!='-1')
{
k=k+1;
}
if(optr!='-1')
{
k=k+1;
}
if(mvcode.replace(/,/g,'') != '')
{
k=k+1;
}
else
{
mvcode='';
}
if(applno.replace(/,/g,'') != '')
{
k=k+1;
}
else
{
applno='';
}
if(name.replace(/,/g,'') != '')
{
k=k+1;
}
else
{
name='';
}
if(k==0)
{
CallMessage('1020MQRY:error:Please provide any search key.',3000,200,300);
}
else
{
RunAjax("POST","oprpending","val0="+ver+"&val1="+port+"&val2="+optr+"&val3="+mvcode+"&val4="+applno+"&val5="+name+"&val6="+bid,1);
}
}
function AfterResponse(response,oprID)
{
var rindx=0;
var respHtml='';
if(oprID==1)
{
$("#tabbody").html("");
if(response.trim().search(':Error:')==-1)
{
var rows=response.split(RowDelim);
for(rindx=0;rindx<rows.length-1;rindx++)
{
var cols=rows[rindx].split(ColDelim);
respHtml+="<tr style='cursor:pointer' id='row'>";
respHtml+="<td style='font-size:9pt;font-weight:normal'><input type='hidden' id='uuid"+rindx+"' value='"+cols[0]+"'/>"+(rindx+1)+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'><input type='hidden' id='portid"+rindx+"' value='"+cols[1]+"'/>"+cols[2]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'>"+cols[3]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'>"+cols[4]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'>"+cols[5]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'>"+cols[6]+"</td>";
respHtml+="<td id='visit"+rindx+"' style='font-size:9pt;font-weight:normal'>"+cols[7]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'>"+cols[8]+"</td>";
respHtml+="<td style='font-size:9pt;font-weight:normal'><input type='hidden' id='opr"+rindx+"' value='"+cols[9]+"' />"+cols[10]+"</td>";
if(cols[11]=='1')
{
respHtml+="<td id='td"+rindx+"'><img src='/matrix/images/locked.png' id='imglck"+rindx+"' /></td>";
}
else
{
respHtml+="<td id='td"+rindx+"'><input type='checkbox' id='chkcol"+rindx+"' onclick='checkList(\"chkcol\",\"chkparent\");manageRowSelection(this.checked);' /></td>";
}
respHtml+="</tr>";
}
if(respHtml!='')
{
$("#tabbody").html(respHtml);
InitPage();
}
}
else
{
CallMessage(response,3000,200,300);
}
}
if(oprID==2)
{
if(response.trim().search("success")>=0)
{
$("#td"+curindx).html("<img src='/matrix/images/check.png' title='success' />");
}
else
{
$("#td"+curindx).html("<img src='/matrix/images/exclm_red.png' title='"+response+"' />");
}
curindx=curindx+1;
DoPending();
}
}