Subversion Repositories SmartDukaan

Rev

Rev 19737 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19725 naman 1
<script>
2
	$(document).ready(function(){
3
		$('.userretailer').click(function(){
4
			var searchfor = $('.userretailer').val();
5
			var sendata = "";
6
			var that = this.id;
7
			if(that == "usertype"){
8
				sendata = $('#userform').serialize();
9
			}else if(that == "retailertype"){
10
				sendata = $('#retailerform').serialize();
11
			}
12
// 			debugger;
13
	 		$.ajax({
14
			'url' : "<?php echo $base_url;?>admin/users/searchuserretailer?"+sendata,
15
			'type': "GET"
16
			},'json')
17
			.done(function(msg){
18
				val = eval(msg);
19
				if(that == "usertype"){
20
					$(".usertable tbody").empty();
21
					for(var i in val){
22
						var html = "<tr><td>"+val[i]['User']['id']+"</td><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>";
23
						$(".usertable tbody").append(html);
24
					}
25
					$('.usertable').removeClass('hidden');
26
				}
27
				else if(that == "retailertype"){
28
					$(".retailertable tbody").empty();
29
					for(var i in val){
30
						var html = "<tr><td>"+val[i]['Retailer']['id']+"</td><td>"+val[i]['Retailer']['identifier']+"</td><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']['tin']+"</td><tr>";
31
						$(".retailertable tbody").append(html);
32
					}
33
					$('.retailertable').removeClass('hidden');
34
				}
35
 
36
			});
37
 
38
	 		return false;
39
		});
40
 
41
 
42
	});
43
</script>
44
 
45
<div class="container">
46
    <div class="row">
47
        <div class="col-lg-12 table-responsive">	
48
            <form class="navbar-form" role="search" method="GET" name="search" action="#" id="userform">
49
        		<div class="input-group col-xs-6 text-left">
50
        			Search User By:         			
51
        			<input type="hidden" name="searchfor" value="usertype" class="searchfor">
52
        			<input type="radio" name="type" value="mobile_number" checked="checked"/>Mobile
53
                    <input type="radio" name="type" value="email"/>Email                    
54
        		</div>
55
                <div class="input-group col-xs-6 text-right" id="remote">
56
                    <input autocomplete="off" type="text" class="form-control" placeholder="Search for users" name="search" id="srch-term">
57
                    <div class="input-group-btn w25px">
58
                        <button class="btn btn-default userretailer" id="usertype" type=""><i class="glyphicon glyphicon-search"></i></button>
59
                    </div>
60
                </div>
61
            </form>
62
            <?php //if(!empty($users)):?>
63
            <div style="height:50%;">
64
	            <table class="table table-striped usertable hidden">
65
	                <thead>
66
	                    <tr>
67
	                        <th><?php echo 'Id';?></th>
68
	                        <th><?php echo 'Email';?></th>
69
	                        <th><?php echo 'Name';?></th>
70
	                        <th><?php echo 'Referrer';?></th>                        
71
	                        <th><?php echo 'Utm Campaign';?></th>
72
	                        <th><?php echo 'Mobile Number';?></th>
73
	                        <th><?php echo 'Activated';?></th>                        
74
 
75
	                    </tr>
76
	                </thead>
77
	                <tbody>
78
 
79
	                </tbody>
80
	            </table>
81
	         </div>
82
 
83
            <?php //endif;?>
84
        </div>      
85
    </div>
86
 
87
    <div class="row">
88
        <div class="col-lg-12 table-responsive">	
89
            <form class="navbar-form" role="search" method="GET" name="search" id="retailerform" action="<?php echo $base_url;?>admin/users/userretailer">
90
        		<div class="input-group col-xs-6 text-left">
91
        			Search Retailer By: 
92
        			<input type="hidden" name="searchfor" value="retailertype">        			
93
                    <input type="radio" name="type" value="tin"/>Tin
94
        			<input type="radio" name="type" value="contact" checked="checked"/>Mobile
95
        		</div>
96
                <div class="input-group col-xs-6 text-right" id="remote">	
97
                    <input autocomplete="off" type="text" class="form-control" placeholder="Search for retailer" name="search" id="srch-term">
98
                    <div class="input-group-btn w25px">
99
                        <button class="btn btn-default userretailer" id="retailertype" type="submit"><i class="glyphicon glyphicon-search"></i></button>
100
                    </div>
101
                </div>
102
            </form>
103
            <?php //if(!empty($retailers)):?>
104
            <table class="table table-striped retailertable hidden">
105
                <thead>
106
                    <tr>
107
                        <th><?php echo 'Id';?></th>
108
                        <th><?php echo 'Identifier';?></th>
109
                        <th><?php echo 'Title';?></th>
110
                        <th><?php echo 'Address';?></th>                        
111
                        <th><?php echo 'Contact1';?></th>
112
                        <th><?php echo 'Contact2';?></th>
113
                        <th><?php echo 'Pin';?></th>  
114
                        <th><?php echo 'City';?></th>
115
                        <th><?php echo 'State';?></th>
116
                        <th><?php echo 'Tin';?></th>                     
117
 
118
                    </tr>
119
                </thead>
120
                <tbody>
121
 
122
                </tbody>
123
            </table>
124
 
125
 
126
            <?php //endif;?>
127
        </div>      
128
    </div>
129
</div>