Subversion Repositories SmartDukaan

Rev

Rev 19774 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
19725 naman 1
<script>
19737 naman 2
	$(document).on('click','.getcode',function(){
3
		var ret_id = $(this).data('id');
4
		$.ajax({
5
			'url' : "<?php echo $base_url;?>users/getcode/"+ret_id,
6
			'type': "GET"
7
		},'json')
8
		.done(function(msg){
9
			val = JSON.parse(msg);
10
			if(val["code"] != ""){
11
				alert("Retailer code is : "+ val["code"]);
12
			}	
13
			else{
14
				alert("No code found..");
15
			}
16
		});
17
	});
19725 naman 18
	$(document).ready(function(){
19
		$('.userretailer').click(function(){
20
			var searchfor = $('.userretailer').val();
21
			var sendata = "";
22
			var that = this.id;
23
			if(that == "usertype"){
24
				sendata = $('#userform').serialize();
25
			}else if(that == "retailertype"){
26
				sendata = $('#retailerform').serialize();
27
			}
28
// 			debugger;
29
	 		$.ajax({
30
			'url' : "<?php echo $base_url;?>admin/users/searchuserretailer?"+sendata,
31
			'type': "GET"
32
			},'json')
33
			.done(function(msg){
34
				val = eval(msg);
35
				if(that == "usertype"){
36
					$(".usertable tbody").empty();
37
					for(var i in val){
19737 naman 38
						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>";
19725 naman 39
						$(".usertable tbody").append(html);
40
					}
41
					$('.usertable').removeClass('hidden');
42
				}
43
				else if(that == "retailertype"){
44
					$(".retailertable tbody").empty();
19737 naman 45
					var codebutton;
19725 naman 46
					for(var i in val){
19737 naman 47
						if(val[i]['Retailer']['isvalidated'] == "1"){
48
							codebutton = "<button type='button' class='btn btn-primary btn-xs getcode' data-id="+val[i]['Retailer']['id']+">Get Code</button>";
49
						}
50
						else{
51
							codebutton = "";
52
						}
19781 naman 53
						var getstatus = val[i]['Retailer']['status'];
54
						var getcomment = "";
55
						if(getstatus == "pending_verification" || getstatus == "not_verified"){
56
							getcomment = val[i]['Retailer']['comments']; 
57
						}
58
						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>";
19725 naman 59
						$(".retailertable tbody").append(html);
60
					}
61
					$('.retailertable').removeClass('hidden');
62
				}
63
 
64
			});
65
 
66
	 		return false;
67
		});
68
 
69
 
70
	});
71
</script>
72
 
73
<div class="container">
74
    <div class="row">
75
        <div class="col-lg-12 table-responsive">	
19737 naman 76
 
77
        	<a href="<?php echo $base_url;?>admin/users/addretailer" style="float:right;" class="btn btn-primary">Create New Retailer</a>
78
  			<br><br>      
19725 naman 79
            <form class="navbar-form" role="search" method="GET" name="search" action="#" id="userform">
80
        		<div class="input-group col-xs-6 text-left">
81
        			Search User By:         			
82
        			<input type="hidden" name="searchfor" value="usertype" class="searchfor">
83
        			<input type="radio" name="type" value="mobile_number" checked="checked"/>Mobile
84
                    <input type="radio" name="type" value="email"/>Email                    
85
        		</div>
86
                <div class="input-group col-xs-6 text-right" id="remote">
87
                    <input autocomplete="off" type="text" class="form-control" placeholder="Search for users" name="search" id="srch-term">
88
                    <div class="input-group-btn w25px">
89
                        <button class="btn btn-default userretailer" id="usertype" type=""><i class="glyphicon glyphicon-search"></i></button>
90
                    </div>
91
                </div>
92
            </form>
93
            <?php //if(!empty($users)):?>
19737 naman 94
            <div style="height:40%;">
19725 naman 95
	            <table class="table table-striped usertable hidden">
96
	                <thead>
97
	                    <tr>
19737 naman 98
 
19725 naman 99
	                        <th><?php echo 'Email';?></th>
100
	                        <th><?php echo 'Name';?></th>
101
	                        <th><?php echo 'Referrer';?></th>                        
102
	                        <th><?php echo 'Utm Campaign';?></th>
103
	                        <th><?php echo 'Mobile Number';?></th>
104
	                        <th><?php echo 'Activated';?></th>                        
105
 
106
	                    </tr>
107
	                </thead>
108
	                <tbody>
109
 
110
	                </tbody>
111
	            </table>
112
	         </div>
113
 
114
            <?php //endif;?>
115
        </div>      
116
    </div>
117
 
118
    <div class="row">
119
        <div class="col-lg-12 table-responsive">	
120
            <form class="navbar-form" role="search" method="GET" name="search" id="retailerform" action="<?php echo $base_url;?>admin/users/userretailer">
121
        		<div class="input-group col-xs-6 text-left">
122
        			Search Retailer By: 
123
        			<input type="hidden" name="searchfor" value="retailertype">        			
19774 naman 124
                    <input type="radio" name="type" value="tinnumber"/>Tin
19725 naman 125
        			<input type="radio" name="type" value="contact" checked="checked"/>Mobile
126
        		</div>
127
                <div class="input-group col-xs-6 text-right" id="remote">	
128
                    <input autocomplete="off" type="text" class="form-control" placeholder="Search for retailer" name="search" id="srch-term">
129
                    <div class="input-group-btn w25px">
130
                        <button class="btn btn-default userretailer" id="retailertype" type="submit"><i class="glyphicon glyphicon-search"></i></button>
131
                    </div>
132
                </div>
133
            </form>
134
            <?php //if(!empty($retailers)):?>
135
            <table class="table table-striped retailertable hidden">
136
                <thead>
137
                    <tr>
19737 naman 138
 
19725 naman 139
                        <th><?php echo 'Title';?></th>
140
                        <th><?php echo 'Address';?></th>                        
141
                        <th><?php echo 'Contact1';?></th>
142
                        <th><?php echo 'Contact2';?></th>
143
                        <th><?php echo 'Pin';?></th>  
144
                        <th><?php echo 'City';?></th>
145
                        <th><?php echo 'State';?></th>
146
                        <th><?php echo 'Tin';?></th>                     
19781 naman 147
                        <th><?php echo 'Comment';?></th>
19737 naman 148
                        <th>&nbsp;</th>
19725 naman 149
                    </tr>
150
                </thead>
151
                <tbody>
152
 
153
                </tbody>
154
            </table>
155
 
156
 
157
            <?php //endif;?>
158
        </div>      
159
    </div>
160
</div>