diff --git a/application/views/alterpurchaseorder.php b/application/views/alterpurchaseorder.php index 06357708..9ae1aa87 100755 --- a/application/views/alterpurchaseorder.php +++ b/application/views/alterpurchaseorder.php @@ -8710,10 +8710,14 @@ var specialservicerow=0; var counter = 0; var counterConstant = 0; + + + + $("#addmorebutton").click(function(){ - + //alert('sda'); @@ -8724,23 +8728,25 @@ $("#addmorebutton").click(function(){ else{ counter++; - counterConstant++; + counterConstant++; var div = document.createElement('div'); -div.id = "divid"+counterConstant; +div.id = "divid"+counter; div.className="row"; div.innerHTML='
'+ - // '
'+ - // ''+ - // ''+ - // '
'+ - '
'+ + + '
'+ ''+ '
'+ '
'+ - '
'+ + '
'+ ''+ - '
'+ + '
'+ + '
'+ + + '
'+ + ''+ + '
'+ '
'+ ''; @@ -8748,13 +8754,110 @@ div.innerHTML='
'+ $('#hidecounter').val(counter); - $('#hideconstant').val(counterConstant); + $('#hideconstant').val(counterConstant); + + if(counter > 1){ + alert("Add button click here");//this allows only 5 files; + return false; + } + else { + + $('#addmorebutton').hide(); + + } + + + // if(counter > 1){ + // alert("Add button click here");//this allows only 5 files; + // return false; + // } + // else { + + // $('#addemorebutton').hide(); + + // } + + + } }); +// var count = 0; +// var countConstant = 0; + +function addRow(input) +{ if(input <5){ + if(input ==0){ + input = input+1; + $("#addbtn"+input).hide(); + $("#removebtn"+input).hide(); + }else{ + $("#addbtn"+input).hide(); + $("#removebtn"+input).hide(); + } + }else{ + $("#addbtn"+input).show(); + $("#removebtn"+input).show(); + } + // alert(s); + if(counter>4){ + alert("No more files to add");//this allows only 5 files; + return false; + } +else{ + counter++; + counterConstant++; + //alert("count"+counterConstants); +var div = document.createElement('div'); +div.id = "divid"+counter; +div.className="row"; +div.innerHTML='
'+ + + '
'+ + ''+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + + + '
'+ + ''+ + '
'+ + '
'+ + + + + ''; + $('#newdiv').append(div); + + + $('#hidecounter').val(counter); + $('#hideconstant').val(counterConstant); + + + if(counter > 1){ + //alert("Next File choose + button click here");//this allows only 5 files; + //return false; + $('#addbtn').hide(); + $("#removebtn").hide(); + } + else { + + $('#addmorebutton').hide(); + + + } + +} + +} + function rfilealert() { @@ -8797,20 +8900,45 @@ function Copyfilename(id) -function removeRow(input) { +// function removeRow(input) { - var number = input.replace(/[^0-9]+/ig,""); +// var number = input.replace(/[^0-9]+/ig,""); - if(counter >= 1){ - counter--; +// if(counter >= 1){ +// counter--; - $("#divid"+number).remove(); +// $("#divid"+number).remove(); +// $('#hidecounter').val(counter); +// } + +// } + +function removeRow(input) { + // alert(input); + var number = input.replace(/[^0-9]+/ig,""); + //alert(number); + if(counter >= 1){ + counter --; + + $("#divid"+number).remove(); $('#hidecounter').val(counter); } - + + var rm_count = $("#hideconstant").val(); + if(counter !=0){ + if(number != rm_count){ + // alert("if"); + $("#addbtn"+counter).show(); + $("#removebtn"+counter).show(); +}else{ + //alert('else'); + $("#addbtn"+counter).show(); + $("#removebtn"+counter).show(); +} + }else{ + $("#addmorebutton").show(); + } } - - @@ -8838,20 +8966,21 @@ else{ counterConstants++; var div = document.createElement('div'); -div.id = "divid"+counterConstants; +div.id = "divid"+counters; div.className="row"; -div.innerHTML='
'+ - // '
'+ - // ''+ - // ''+ - // '
'+ - '
'+ +div.innerHTML='
'+ + + '
'+ ''+ '
'+ '
'+ - '
'+ + '
'+ ''+ - '
'+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ '
'+ '
'; $('#newsdiv').append(div); @@ -8861,7 +8990,15 @@ div.innerHTML='
'+ $('#hidecounters').val(counters); $('#hideconstants').val(counterConstants); - + if(counters > 1){ + alert("Add button click here");//this allows only 5 files; + return false; + } + else { + + $('#addemorebutton').hide(); + + } @@ -8870,6 +9007,79 @@ div.innerHTML='
'+ }); + + +function addRows(inputs) +{ if(inputs <5){ + if(inputs ==0){ + inputs = inputs+1; + $("#addbtns"+inputs).hide(); + $("#removebtns"+inputs).hide(); + }else{ + $("#addbtns"+inputs).hide(); + $("#removebtns"+inputs).hide(); + } + }else{ + $("#addbtns"+inputs).show(); + $("#removebtns"+inputs).show(); + } + // alert(s); + if(counters>4){ + alert("No more files to add");//this allows only 5 files; + return false; + } +else{ + counters++; + counterConstants++; + //alert("count"+counterConstants); +var div = document.createElement('div'); +div.id = "divid"+counters; +div.className="row"; +div.innerHTML='
'+ + + '
'+ + ''+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + + + '
'+ + ''+ + '
'+ + '
'+ + + + + '
'; + $('#newsdiv').append(div); + + + $('#hidecounters').val(counters); + $('#hideconstants').val(counterConstants); + + + if(counters > 1){ + //alert("Next File choose + button click here");//this allows only 5 files; + //return false; + $('#addbtns').hide(); + $("#removebtns").hide(); + } + else { + + $('#addemorebutton').hide(); + + + } + +} + +} + + function sfilealert() { @@ -8908,18 +9118,48 @@ function Copyfilenames(id) -function removeRows(input) { +// function removeRows(input) { - var number = input.replace(/[^0-9]+/ig,""); +// var number = input.replace(/[^0-9]+/ig,""); - if(counters>= 1){ +// if(counters>= 1){ +// counters --; + +// $("#divid"+number).remove(); +// $('#hidecounters').val(counters); +// } + +// } + + +function removeRows(inputs) { + // alert(input); + var number = inputs.replace(/[^0-9]+/ig,""); + //alert(number); + if(counters >= 1){ counters --; $("#divid"+number).remove(); $('#hidecounters').val(counters); } - + + var rm_count = $("#hideconstants").val(); + if(counters !=0){ + if(number != rm_count){ + // alert("if"); + $("#addbtns"+counters).show(); + $("#removebtns"+counters).show(); + }else{ + //alert('else'); + $("#addbtns"+counters).show(); + $("#removebtns"+counters).show(); + } + }else{ + $("#addemorebutton").show(); + } +} +