Subversion Repositories SmartDukaan

Rev

Rev 18968 | Rev 18993 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18898 naman 1
<script>
18968 naman 2
var request;
18950 naman 3
$(document).on('keyup','#pindet',function(){
4
	console.log($(this).val());	
5
    var pin_val = $(this).val().trim();
18968 naman 6
    if(request) {
7
        request.abort();
8
    };
18950 naman 9
    if(pin_val.length == 6){
18968 naman 10
 
11
     request =   $.ajax({
18950 naman 12
            method: "GET",
13
            url:  "<?php echo $base_url;?>shippings/getstate/"+pin_val,
14
        },'json')
15
        .done(function(msg){ 
16
        	msg = eval('('+msg+')');
18968 naman 17
        	if(msg=="{}" || $('#tinstate').html().trim() != msg['state'].trim() )                  
18950 naman 18
        	{
19
        		$("#cities").empty();
18968 naman 20
        		$('#alert_msg').empty();
21
        		$('#alert_msg').html("Pincode does not belong to "+$('#tinstate').html().trim());
22
				$('#alert_msg').removeClass('hidden');
23
				setTimeout(function() {
24
	                $('#alert_msg').addClass('hidden');
25
	            }, 2000); 
18950 naman 26
//         		$("#state").val("");		
27
        	}
28
        	else
29
        	{
18968 naman 30
 
31
            		$("#cities").empty();
32
            		for(var i in msg['cities']){
33
            			var html = "<option value="+msg['cities'][i]+">"+msg['cities'][i]+"</option>"
34
            			$("#cities").append(html);
35
            		}
36
            		 $('#citydet').removeClass('hidden');
37
 
18950 naman 38
//         		$("#state").val(msg['state']);
18968 naman 39
//         		$("#cities").empty();
40
//         		for(var i in msg['cities']){
41
//         			var html = "<option value="+msg['cities'][i]+">"+msg['cities'][i]+"</option>"
42
//         			$("#cities").append(html);
43
//         		}	
18950 naman 44
        	}
45
 
46
        });                     
47
    } 
48
    else{
49
    	$("#cities").empty();
50
    	$('#citydet').addClass('hidden');
51
    }
52
});
53
	$(document).ready(function(){	
18898 naman 54
		$('.tryagaintin').click(function(){
55
			$('.searchres').removeClass('hidden');
56
			$('.tryagaintin').addClass('hidden');
57
			$('#tindetail').empty();
58
 
59
		});
18968 naman 60
// 		$('#gettin').click(function(){
61
		$(document).on('submit', '#tinform', function(e){
18898 naman 62
 
63
			var tin = $('#tin').val();
64
// 			alert(tin);
65
			var value = "true";
66
			if(tin == '')
67
		    {
68
		        value = "false";
18917 naman 69
		        message = "*Please enter tin number";    
18898 naman 70
 
71
		    }
72
 
73
		    else if(tin.match(/^\d{11}$/) == null)
74
		    {
75
		        value = "false";
18917 naman 76
		        message = "*Tin number should be of 11 digit.Delhi user add 0 before tin no.";    
18898 naman 77
		    }
78
 
79
		    if(value == "false"){
80
		    	$('#message').html(message);
81
		        $('#message').removeClass('hidden');
18917 naman 82
// 		        setTimeout(function() {
83
// 		                    $('#message').addClass('hidden');
84
// 		                }, 2000);  
18968 naman 85
		        return false;
18898 naman 86
			    }
87
		    else{
88
		    	$('#searchloader').removeClass('hidden');
18918 naman 89
		    	$('#message').addClass('hidden');
18898 naman 90
		    	$.ajax({
91
	                method: "GET",
92
	                url:  "<?php echo $base_url;?>tins/tin_search/"+tin,
93
	            },'json')
94
	            .done(function(msg){
95
	                console.log(msg);
96
	                $('#tindetail').html(msg);
97
	                $('#searchloader').addClass('hidden');
98
					$('.tryagaintin').removeClass('hidden');
99
					$('.searchres').addClass('hidden');
100
					});
18968 naman 101
		    	return false;	
18898 naman 102
			    }
103
 
104
 
105
 
106
			});
107
		});
18950 naman 108
	$(document).on('click','#submit_det',function(){
109
		$('#alert_msg').empty();
110
		var gettindet = $('#tinres').data('tinres');
111
		var value = "true";
112
		var phone_data =  $('#phonedet').val().trim();
113
		if($('#pindet').length == 1){
114
			var pin_data =  $('#pindet').val().trim();
115
			var city_data =  $('#citydet').val().trim();
116
 
117
			 if(pin_data == '')
118
			    {
119
			        value = "false";
120
			        message = "Please fill pin field!";
121
			    }
122
			 else if(pin_data.match(/^\d{6}$/) == null)
123
			    {
124
			        value = "false";
125
			        message = "Invalid pin number!";    
126
			    }
127
			 else if(city_data == "")
128
			    {
129
			        value = "false";
130
			        message = "Please fill city field!";    
131
			    }
132
		}
133
 
134
		if (phone_data == "")
135
		    {
136
		        value = "false";
137
		        message = "Please fill contact number field!";    
138
 
139
		    }
140
 
141
	    else if(phone_data.match(/^\d{10}$/) == null)
142
	    {
143
	        value = "false";
144
	        message = "Invalid contact number";    
145
	    }
146
 
147
 
148
		if(value == "false"){
149
				$('#alert_msg').append(message);
150
				$('#alert_msg').removeClass('hidden');
151
				setTimeout(function() {
152
	                $('#alert_msg').addClass('hidden');
153
	            }, 2000);  
154
//	     return false;
155
			 }
156
	    else{
18955 naman 157
			 gettindet['pin'] = $('#pindet').val();
18950 naman 158
			 gettindet['city'] = $('#citydet').val();
18955 naman 159
			 gettindet['mobile'] = $('#phonedet').val();
18950 naman 160
			 $.ajax({
161
					        method: "POST",
162
					        url:  apihost + "tins/confirm",
163
					        data: gettindet,
164
					    },'json')
18968 naman 165
					    .done(function(msg){  
166
					    	var newmsg = JSON.parse(msg)
167
					    	var showcontent =""; 
168
					    	if(newmsg["response"]["isError"] == false)
169
					    	{
170
					    		showcontent= "<div style='padding:5px;'>Your tin has been registered.</div><div>Redirecting to deals... </div>";		   
171
 
172
						    }
173
					    	else{
174
					    		showcontent= "<div style='padding:5px;'>Some problem occurred while registering.Please try again after some time</div><div>Redirecting to deals... </div>";
175
						    }
176
					    	$('#tin_response').html(showcontent);
177
					    	$("#tinModal").modal('show');;
178
 
179
					    	setTimeout(function(){ document.location = apihost+"category/3" ;}, 5000);
18950 naman 180
					        console.log(msg);                      
181
					    });
182
			 }
183
	});
18898 naman 184
</script>
185
<style>
18950 naman 186
 	#alert_msg{ 
187
 	position: fixed; 
188
 	top: 0px; 
189
 	left: 0px; 
190
 	right: 0px; 
191
	margin-top: 0px; 
192
 	z-index: 10; 
193
 } 
18898 naman 194
#searchloader{
195
    position:absolute;
196
    /*top:40%;*/
197
    left:50%;
198
    z-index:2001;
199
}
200
</style>
18950 naman 201
<div class="alert alert-danger hidden" id="alert_msg"></div>
18898 naman 202
 
203
<div class="text-center hidden" id="searchloader">
204
    <br><br><br><br>
205
          <div class="hexdots-loader"></div>         
206
</div>
207
 
208
 
209
<div class = "container">	      
18917 naman 210
	<div class = "row card" style='padding-bottom:15px;'>
18898 naman 211
		<div class="tryagaintin hidden" style='padding:5px;'>
212
			Not your tax details? <span style="color:#58d936;" ><u>Try Again</u></span>
213
		</div>
214
 
215
 
18968 naman 216
		<form method="post" action="#" name='tinform' id='tinform'> 
18898 naman 217
 
18917 naman 218
			<div class="input-group col-xs-12 text-right searchres" style="padding:10px 0px 1px;">
219
 
18968 naman 220
	            <input type="text" class="form-control" autocomplete="off" placeholder="Enter tin number*" id="tin" name="tin" style="width:98%;">
18917 naman 221
 
18898 naman 222
	            <div class="input-group-btn w25px">
18968 naman 223
	               <!--  <button class="btn" id='gettin' style="background-color:#58d936;color:white;">OK</button> -->
224
	               <input type="submit" value="OK" style="background-color:#58d936;color:white;" id='gettin' class="btn">
18898 naman 225
	            </div>
226
	        </div>
18917 naman 227
 
228
	            <span id="message" class="hidden" style="color:red;font-size:12px;float:left;"></span>
18968 naman 229
 
230
	    </form>
18987 naman 231
 
232
	    <div style="border:1px solid #58d936; padding:2px;margin:20px 0px 5px;font-size:12px;" class="searchres">
233
 
234
								<div style="line-height: 15px;">
235
									<b>*</b> Tax invoice will be available only for Delhi.<br>
236
									<b>*</b> Available only on purchase through ProfitMandi and billed by Saholic.com.<br>
237
									<b>*</b> Not available on purchase from other sites ie. Snapdeal,Flipkart,Shopclues,Paytm and Homeshop18.
238
								</div>
239
								<div style="line-height: 15px;margin-top: 4px;">
240
									<b>*</b> टैक्स बिल केवल दिल्ली के लिए ही उपलब्ध है।<br> 
241
									<b>*</b> ProfitMandi से खरीदने पर और Saholic.com द्वारा बिलिंग पर उपलब्ध  है ।<br>
242
									<b>*</b> दूसरी अन्य वेबसाइट से खरीदारी पे उपलब्ध नहीं है । जैसे - Snapdeal,Flipkart,Shopclues,Paytm और Homeshop18 । 
243
								</div>
18898 naman 244
 
18987 naman 245
		</div>
246
 
18898 naman 247
 
248
<!-- 			<input type="text" id="tin" name="tin" placeholder="Enter tin number*" required/> -->
249
<!-- 			<button id='gettin'>Get Detail</button> -->
250
 
251
	</div>
252
 
253
	<div id='tindetail'>
254
 
255
	</div>
256
</div>
257
<link rel="stylesheet" href="/css/hexdots.css" type="text/css">
258