| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  | function loadYears() { | 
					
						
							|  |  |  |     $(".contestyear").empty(); | 
					
						
							|  |  |  |     $(".contestname").empty(); | 
					
						
							|  |  |  |     $(".contestdates").empty(); | 
					
						
							| 
									
										
										
										
											2023-04-13 18:30:12 +08:00
										 |  |  |     $(".additionalinfo").attr("hidden", true); | 
					
						
							| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  |     $.ajax({ | 
					
						
							|  |  |  |         url: base_url+'index.php/cabrillo/getYears', | 
					
						
							|  |  |  |         type: 'post', | 
					
						
							|  |  |  |         data: {'station_id': $("#station_id").val()}, | 
					
						
							|  |  |  |         success: function (data) { | 
					
						
							| 
									
										
										
										
											2023-04-12 21:01:53 +08:00
										 |  |  |             if (data.length > 0) { | 
					
						
							| 
									
										
										
										
											2023-04-12 21:07:05 +08:00
										 |  |  |                 $(".contestyear").append('<div class="col-md-3 control-label" for="year">Select year: </div>' + | 
					
						
							| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  |                 '<select id="year" class="custom-select my-1 mr-sm-2 col-md-2" name="year">' + | 
					
						
							|  |  |  |                 '</select>' + | 
					
						
							|  |  |  |                 '  <button onclick="loadContests();" class="btn btn-sm btn-primary" type="button">Proceed</button>');  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 $.each(data, function(key, value) { | 
					
						
							|  |  |  |                     $('#year') | 
					
						
							|  |  |  |                         .append($("<option></option>") | 
					
						
							|  |  |  |                         .attr("value",value.year) | 
					
						
							|  |  |  |                         .text(value.year)); | 
					
						
							|  |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2023-04-12 21:01:53 +08:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 $(".contestyear").append("No contests were found for this station location!"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  | function loadContests() { | 
					
						
							| 
									
										
										
										
											2023-04-12 18:12:14 +08:00
										 |  |  |     $(".contestname").empty(); | 
					
						
							|  |  |  |     $(".contestdates").empty(); | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |     $.ajax({ | 
					
						
							|  |  |  |         url: base_url+'index.php/cabrillo/getContests', | 
					
						
							|  |  |  |         type: 'post', | 
					
						
							| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  |         data: {'year': $("#year").val(), | 
					
						
							|  |  |  |                 'station_id': $("#station_id").val() | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |         success: function (data) { | 
					
						
							| 
									
										
										
										
											2023-04-12 21:07:05 +08:00
										 |  |  |                 $(".contestname").append('<div class="col-md-3 control-label" for="contestid">Select contest: </div>' + | 
					
						
							|  |  |  |                 '<select class="custom-select my-1 mr-sm-2 col-md-4" id="contestid" name="contestid">' + | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |                 '</select>' + | 
					
						
							|  |  |  |                 '  <button onclick="loadContestDates();" class="btn btn-sm btn-primary" type="button">Proceed</button>');  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 $.each(data, function(key, value) { | 
					
						
							|  |  |  |                     $('#contestid') | 
					
						
							|  |  |  |                         .append($("<option></option>") | 
					
						
							|  |  |  |                         .attr("value",value.col_contest_id) | 
					
						
							|  |  |  |                         .text(value.col_contest_id)); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function loadContestDates() { | 
					
						
							| 
									
										
										
										
											2023-04-12 18:12:14 +08:00
										 |  |  |     $(".contestdates").empty(); | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |     $.ajax({ | 
					
						
							|  |  |  |         url: base_url+'index.php/cabrillo/getContestDates', | 
					
						
							|  |  |  |         type: 'post', | 
					
						
							|  |  |  |         data: {'year': $("#year").val(), | 
					
						
							| 
									
										
										
										
											2023-04-12 20:24:03 +08:00
										 |  |  |                 'contestid': $("#contestid").val(), | 
					
						
							|  |  |  |                 'station_id': $("#station_id").val()}, | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |         success: function (data) { | 
					
						
							| 
									
										
										
										
											2023-04-12 21:07:05 +08:00
										 |  |  |                 $(".contestdates").append('<div class="col-md-3 control-label" for="contestdates">Select date range: </div>' + | 
					
						
							|  |  |  |                 '<select class="custom-select my-1 mr-sm-2 col-md-2" id="contestdatesfrom" name="contestdatesfrom">' + | 
					
						
							| 
									
										
										
										
											2023-04-12 21:01:53 +08:00
										 |  |  |                 '</select>' + | 
					
						
							| 
									
										
										
										
											2023-04-12 21:07:05 +08:00
										 |  |  |                 '<select class="custom-select my-1 mr-sm-2 col-md-2" id="contestdatesto" name="contestdatesto">' + | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |                 '</select>' + | 
					
						
							| 
									
										
										
										
											2023-04-13 18:30:12 +08:00
										 |  |  |                 '  <button class="btn btn-sm btn-primary" onclick="addAdditionalInfo();" type="button">Proceed</button>');  | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 $.each(data, function(key, value) { | 
					
						
							| 
									
										
										
										
											2023-04-12 21:01:53 +08:00
										 |  |  |                     $('#contestdatesfrom') | 
					
						
							|  |  |  |                         .append($("<option></option>") | 
					
						
							|  |  |  |                         .attr("value", value.date) | 
					
						
							|  |  |  |                         .text(value.date)); | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                  | 
					
						
							|  |  |  |                 $.each(data, function(key, value) { | 
					
						
							|  |  |  |                     $('#contestdatesto') | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |                         .append($("<option></option>") | 
					
						
							| 
									
										
										
										
											2023-04-12 21:01:53 +08:00
										 |  |  |                         .attr("value", value.date) | 
					
						
							|  |  |  |                         .text(value.date)); | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  |                 }); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2023-04-13 18:30:12 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function addAdditionalInfo() { | 
					
						
							|  |  |  |     $(".additionalinfo").removeAttr("hidden"); | 
					
						
							| 
									
										
										
										
											2023-04-12 17:58:47 +08:00
										 |  |  | } |