| 
									
										
										
										
											2023-03-18 01:54:35 +08:00
										 |  |  | $(document).ready(function(){ | 
					
						
							|  |  |  | 	$('#markWebAdifAsExported').click(function(e){ | 
					
						
							|  |  |  | 		let form = $(this).closest('form'); | 
					
						
							|  |  |  | 		let station = form.find('select[name=station_profile]'); | 
					
						
							|  |  |  | 		if (station.val() == 0) { | 
					
						
							|  |  |  | 			station.addClass('is-invalid'); | 
					
						
							|  |  |  | 		}else{ | 
					
						
							|  |  |  | 			form.submit(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function ExportWebADIF(station_id) { | 
					
						
							|  |  |  | 	if ($(".alert").length > 0) { | 
					
						
							|  |  |  | 		$(".alert").remove(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if ($(".errormessages").length > 0) { | 
					
						
							|  |  |  | 		$(".errormessages").remove(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-08-16 04:32:49 +08:00
										 |  |  | 	$(".ld-ext-right-"+station_id).addClass('running'); | 
					
						
							|  |  |  | 	$(".ld-ext-right-"+station_id).prop('disabled', true); | 
					
						
							| 
									
										
										
										
											2023-03-18 01:54:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	$.ajax({ | 
					
						
							|  |  |  | 		url: base_url + 'index.php/webadif/upload_station', | 
					
						
							|  |  |  | 		type: 'post', | 
					
						
							|  |  |  | 		data: {'station_id': station_id}, | 
					
						
							|  |  |  | 		success: function (data) { | 
					
						
							| 
									
										
										
										
											2023-08-16 04:32:49 +08:00
										 |  |  | 			$(".ld-ext-right-"+station_id).removeClass('running'); | 
					
						
							|  |  |  | 			$(".ld-ext-right-"+station_id).prop('disabled', false); | 
					
						
							| 
									
										
										
										
											2023-03-18 01:54:35 +08:00
										 |  |  | 			if (data.status == 'OK') { | 
					
						
							|  |  |  | 				$.each(data.info, function(index, value){ | 
					
						
							|  |  |  | 					$('#notcount'+value.station_id).html(value.notcount); | 
					
						
							|  |  |  | 					$('#totcount'+value.station_id).html(value.totcount); | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 				$(".card-body").append('<div class="alert alert-success" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + data.infomessage + '</div>'); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			else { | 
					
						
							| 
									
										
										
										
											2023-12-16 18:42:56 +08:00
										 |  |  | 				$(".card-body").append('<div class="alert alert-danger" role="alert">' + data.info + '</div>'); | 
					
						
							| 
									
										
										
										
											2023-03-18 01:54:35 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (data.errormessages.length > 0) { | 
					
						
							| 
									
										
										
										
											2023-12-16 18:42:56 +08:00
										 |  |  | 				$("#adif_import").append( | 
					
						
							|  |  |  | 					'<div class="errormessages">\n' + | 
					
						
							|  |  |  | 					'    <div class="card mt-2">\n' + | 
					
						
							|  |  |  | 					'        <div class="card-header bg-danger">\n' + | 
					
						
							|  |  |  | 					'            Error Message\n' + | 
					
						
							|  |  |  | 					'        </div>\n' + | 
					
						
							|  |  |  | 					'        <div class="card-body">\n' + | 
					
						
							|  |  |  | 					'            <div class="errors"></div>\n' + | 
					
						
							|  |  |  | 					'        </div>\n' + | 
					
						
							|  |  |  | 					'    </div>\n' + | 
					
						
							|  |  |  | 					'</div>' | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				$.each(data.errormessages, function (index, value) { | 
					
						
							| 
									
										
										
										
											2023-03-18 01:54:35 +08:00
										 |  |  | 					$(".errors").append('<li>' + value); | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } |