Rev 19774 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<script>$(document).on('click','.getcode',function(){var ret_id = $(this).data('id');$.ajax({'url' : "<?php echo $base_url;?>users/getcode/"+ret_id,'type': "GET"},'json').done(function(msg){val = JSON.parse(msg);if(val["code"] != ""){alert("Retailer code is : "+ val["code"]);}else{alert("No code found..");}});});$(document).ready(function(){$('.userretailer').click(function(){var searchfor = $('.userretailer').val();var sendata = "";var that = this.id;if(that == "usertype"){sendata = $('#userform').serialize();}else if(that == "retailertype"){sendata = $('#retailerform').serialize();}// debugger;$.ajax({'url' : "<?php echo $base_url;?>admin/users/searchuserretailer?"+sendata,'type': "GET"},'json').done(function(msg){val = eval(msg);if(that == "usertype"){$(".usertable tbody").empty();for(var i in val){var html = "<tr><td>"+val[i]['User']['email']+"</td><td>"+val[i]['User']['first_name']+"</td><td>"+val[i]['User']['referrer']+"</td><td>"+val[i]['User']['utm_campaign']+"</td><td>"+val[i]['User']['mobile_number']+"</td><td>"+val[i]['User']['activated']+"</td><tr>";$(".usertable tbody").append(html);}$('.usertable').removeClass('hidden');}else if(that == "retailertype"){$(".retailertable tbody").empty();var codebutton;for(var i in val){if(val[i]['Retailer']['isvalidated'] == "1"){codebutton = "<button type='button' class='btn btn-primary btn-xs getcode' data-id="+val[i]['Retailer']['id']+">Get Code</button>";}else{codebutton = "";}var getstatus = val[i]['Retailer']['status'];var getcomment = "";if(getstatus == "pending_verification" || getstatus == "not_verified"){getcomment = val[i]['Retailer']['comments'];}var html = "<tr><td>"+val[i]['Retailer']['title']+"</td><td>"+val[i]['Retailer']['address']+"</td><td>"+val[i]['Retailer']['contact1']+"</td><td>"+val[i]['Retailer']['contact2']+"</td><td>"+val[i]['Retailer']['pin']+"</td><td>"+val[i]['Retailer']['city']+"</td><td>"+val[i]['Retailer']['state']+"</td><td>"+val[i]['Retailer']['tinnumber']+"</td><td>"+getcomment+"</td><td>"+codebutton+"</td><tr>";$(".retailertable tbody").append(html);}$('.retailertable').removeClass('hidden');}});return false;});});</script><div class="container"><div class="row"><div class="col-lg-12 table-responsive"><a href="<?php echo $base_url;?>admin/users/addretailer" style="float:right;" class="btn btn-primary">Create New Retailer</a><br><br><form class="navbar-form" role="search" method="GET" name="search" action="#" id="userform"><div class="input-group col-xs-6 text-left">Search User By:<input type="hidden" name="searchfor" value="usertype" class="searchfor"><input type="radio" name="type" value="mobile_number" checked="checked"/>Mobile<input type="radio" name="type" value="email"/>Email</div><div class="input-group col-xs-6 text-right" id="remote"><input autocomplete="off" type="text" class="form-control" placeholder="Search for users" name="search" id="srch-term"><div class="input-group-btn w25px"><button class="btn btn-default userretailer" id="usertype" type=""><i class="glyphicon glyphicon-search"></i></button></div></div></form><?php //if(!empty($users)):?><div style="height:40%;"><table class="table table-striped usertable hidden"><thead><tr><th><?php echo 'Email';?></th><th><?php echo 'Name';?></th><th><?php echo 'Referrer';?></th><th><?php echo 'Utm Campaign';?></th><th><?php echo 'Mobile Number';?></th><th><?php echo 'Activated';?></th></tr></thead><tbody></tbody></table></div><?php //endif;?></div></div><div class="row"><div class="col-lg-12 table-responsive"><form class="navbar-form" role="search" method="GET" name="search" id="retailerform" action="<?php echo $base_url;?>admin/users/userretailer"><div class="input-group col-xs-6 text-left">Search Retailer By:<input type="hidden" name="searchfor" value="retailertype"><input type="radio" name="type" value="tinnumber"/>Tin<input type="radio" name="type" value="contact" checked="checked"/>Mobile</div><div class="input-group col-xs-6 text-right" id="remote"><input autocomplete="off" type="text" class="form-control" placeholder="Search for retailer" name="search" id="srch-term"><div class="input-group-btn w25px"><button class="btn btn-default userretailer" id="retailertype" type="submit"><i class="glyphicon glyphicon-search"></i></button></div></div></form><?php //if(!empty($retailers)):?><table class="table table-striped retailertable hidden"><thead><tr><th><?php echo 'Title';?></th><th><?php echo 'Address';?></th><th><?php echo 'Contact1';?></th><th><?php echo 'Contact2';?></th><th><?php echo 'Pin';?></th><th><?php echo 'City';?></th><th><?php echo 'State';?></th><th><?php echo 'Tin';?></th><th><?php echo 'Comment';?></th><th> </th></tr></thead><tbody></tbody></table><?php //endif;?></div></div></div>