Subversion Repositories SmartDukaan

Rev

Rev 18918 | Rev 18955 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18918 Rev 18950
Line 1... Line 1...
1
<script>
1
<script>
2
	$(document).ready(function(){
2
$(document).on('keyup','#pindet',function(){
-
 
3
	console.log($(this).val());	
-
 
4
    var pin_val = $(this).val().trim();
-
 
5
    if(pin_val.length == 6){
-
 
6
        $('#citydet').removeClass('hidden');
-
 
7
        $.ajax({
-
 
8
            method: "GET",
-
 
9
            url:  "<?php echo $base_url;?>shippings/getstate/"+pin_val,
-
 
10
        },'json')
-
 
11
        .done(function(msg){ 
-
 
12
        	msg = eval('('+msg+')');
-
 
13
        	if(msg=="{}")                  
-
 
14
        	{
-
 
15
        		$("#cities").empty();
-
 
16
//         		$("#state").val("");		
-
 
17
        	}
-
 
18
        	else
-
 
19
        	{
-
 
20
//         		$("#state").val(msg['state']);
-
 
21
        		$("#cities").empty();
-
 
22
        		for(var i in msg['cities']){
-
 
23
        			var html = "<option value="+msg['cities'][i]+">"+msg['cities'][i]+"</option>"
-
 
24
        			$("#cities").append(html);
-
 
25
        		}	
-
 
26
        	}
-
 
27
            
-
 
28
        });                     
-
 
29
    } 
-
 
30
    else{
-
 
31
    	$("#cities").empty();
-
 
32
    	$('#citydet').addClass('hidden');
-
 
33
    }
3
		
34
});
-
 
35
	$(document).ready(function(){	
4
		$('.tryagaintin').click(function(){
36
		$('.tryagaintin').click(function(){
5
			$('.searchres').removeClass('hidden');
37
			$('.searchres').removeClass('hidden');
6
			$('.tryagaintin').addClass('hidden');
38
			$('.tryagaintin').addClass('hidden');
7
			$('#tindetail').empty();
39
			$('#tindetail').empty();
8
			
40
			
Line 52... Line 84...
52
				
84
				
53
	
85
	
54
				
86
				
55
			});
87
			});
56
		});
88
		});
-
 
89
	$(document).on('click','#submit_det',function(){
-
 
90
		$('#alert_msg').empty();
-
 
91
		var gettindet = $('#tinres').data('tinres');
-
 
92
		var value = "true";
-
 
93
		var phone_data =  $('#phonedet').val().trim();
-
 
94
		if($('#pindet').length == 1){
-
 
95
			var pin_data =  $('#pindet').val().trim();
-
 
96
			var city_data =  $('#citydet').val().trim();
-
 
97
			
-
 
98
			 if(pin_data == '')
-
 
99
			    {
-
 
100
			        value = "false";
-
 
101
			        message = "Please fill pin field!";
-
 
102
			    }
-
 
103
			 else if(pin_data.match(/^\d{6}$/) == null)
-
 
104
			    {
-
 
105
			        value = "false";
-
 
106
			        message = "Invalid pin number!";    
-
 
107
			    }
-
 
108
			 else if(city_data == "")
-
 
109
			    {
-
 
110
				    debugger;
-
 
111
			        value = "false";
-
 
112
			        message = "Please fill city field!";    
-
 
113
			    }
-
 
114
		}
-
 
115
 
-
 
116
		if (phone_data == "")
-
 
117
		    {
-
 
118
		        value = "false";
-
 
119
		        message = "Please fill contact number field!";    
-
 
120
		        
-
 
121
		    }
-
 
122
 
-
 
123
	    else if(phone_data.match(/^\d{10}$/) == null)
-
 
124
	    {
-
 
125
	        value = "false";
-
 
126
	        message = "Invalid contact number";    
-
 
127
	    }
-
 
128
 
-
 
129
 
-
 
130
		if(value == "false"){
-
 
131
				$('#alert_msg').append(message);
-
 
132
				$('#alert_msg').removeClass('hidden');
-
 
133
				setTimeout(function() {
-
 
134
	                $('#alert_msg').addClass('hidden');
-
 
135
	            }, 2000);  
-
 
136
//	     return false;
-
 
137
			 }
-
 
138
	    else{
-
 
139
			 gettindet['pincode'] = $('#pindet').val();
-
 
140
			 gettindet['city'] = $('#citydet').val();
-
 
141
			 gettindet['phone'] = $('#phonedet').val();
-
 
142
			 $.ajax({
-
 
143
					        method: "POST",
-
 
144
					        url:  apihost + "tins/confirm",
-
 
145
					        data: gettindet,
-
 
146
					    },'json')
-
 
147
					    .done(function(msg){   
-
 
148
					        console.log(msg);                      
-
 
149
					    });
-
 
150
			 }
-
 
151
	});
57
</script>
152
</script>
58
<style>
153
<style>
59
/* 	#message{ */
154
 	#alert_msg{ 
60
/* 	position: fixed; */
155
 	position: fixed; 
61
/* 	top: 0px; */
156
 	top: 0px; 
62
/* 	left: 0px; */
157
 	left: 0px; 
63
/* 	right: 0px; */
158
 	right: 0px; 
64
/* 	margin-top: 0px; */
159
	margin-top: 0px; 
65
/* 	z-index: 10; */
160
 	z-index: 10; 
66
/* } */
161
 } 
67
#searchloader{
162
#searchloader{
68
    position:absolute;
163
    position:absolute;
69
    /*top:40%;*/
164
    /*top:40%;*/
70
    left:50%;
165
    left:50%;
71
    z-index:2001;
166
    z-index:2001;
72
}
167
}
73
</style>
168
</style>
74
<div class="alert alert-danger hidden" ></div>
169
<div class="alert alert-danger hidden" id="alert_msg"></div>
75
 
170
 
76
<div class="text-center hidden" id="searchloader">
171
<div class="text-center hidden" id="searchloader">
77
    <br><br><br><br>
172
    <br><br><br><br>
78
          <div class="hexdots-loader"></div>         
173
          <div class="hexdots-loader"></div>         
79
</div>
174
</div>