| 
									
										
										
										
											2022-09-20 16:49:49 +08:00
										 |  |  | $('.bandtable').on('click', 'input[type="checkbox"]', function() { | 
					
						
							|  |  |  | 	var clickedbandid = $(this).closest('td').attr("class"); | 
					
						
							|  |  |  | 	clickedbandid = clickedbandid.match(/\d+/)[0]; | 
					
						
							|  |  |  | 	saveBand(clickedbandid); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-06 17:41:01 +08:00
										 |  |  | $('.bandtable tfoot').on('click', 'input[type="checkbox"]', function() { | 
					
						
							|  |  |  | 	var clickedaward = $(this).closest('th').attr("class"); | 
					
						
							|  |  |  | 	var status = $(this).is(":checked"); | 
					
						
							|  |  |  | 	clickedaward = clickedaward.replace('master_', ''); | 
					
						
							|  |  |  | 	$('[class^='+clickedaward+'_] input[type="checkbox').each(function() { | 
					
						
							|  |  |  | 		$(this).prop( "checked", status ); | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | 	saveBandAward(clickedaward, status); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function saveBandAward(award, status) { | 
					
						
							|  |  |  | 	$.ajax({ | 
					
						
							|  |  |  | 		url: base_url + 'index.php/band/saveBandAward', | 
					
						
							|  |  |  | 		type: 'post', | 
					
						
							|  |  |  | 		data: {'award': award,   | 
					
						
							|  |  |  | 			'status': status,   | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		success: function (html) { | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | $('.bandtable').DataTable({ | 
					
						
							|  |  |  | 	"pageLength": 25, | 
					
						
							|  |  |  | 	responsive: false, | 
					
						
							|  |  |  | 	ordering: false, | 
					
						
							|  |  |  | 	"scrollY": "500px", | 
					
						
							|  |  |  | 	"scrollCollapse": true, | 
					
						
							|  |  |  | 	"paging": false, | 
					
						
							|  |  |  | 	"scrollX": true | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function createBandDialog() { | 
					
						
							|  |  |  | 	$.ajax({ | 
					
						
							|  |  |  | 		url: base_url + 'index.php/band/create', | 
					
						
							|  |  |  | 		type: 'post', | 
					
						
							|  |  |  | 		success: function (html) { | 
					
						
							|  |  |  | 			BootstrapDialog.show({ | 
					
						
							|  |  |  | 				title: 'Create band', | 
					
						
							| 
									
										
										
										
											2022-09-07 02:18:17 +08:00
										 |  |  | 				size: BootstrapDialog.SIZE_NORMAL, | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 				cssClass: 'create-band-dialog', | 
					
						
							|  |  |  | 				nl2br: false, | 
					
						
							|  |  |  | 				message: html, | 
					
						
							|  |  |  | 				buttons: [{ | 
					
						
							|  |  |  | 					label: 'Close', | 
					
						
							|  |  |  | 					action: function (dialogItself) { | 
					
						
							|  |  |  | 						dialogItself.close(); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}] | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function createBand(form) { | 
					
						
							| 
									
										
										
										
											2022-09-07 02:18:17 +08:00
										 |  |  | 	$(".alert").remove(); | 
					
						
							|  |  |  | 	if (form.band.value == "") { | 
					
						
							|  |  |  | 		$('#create_mode').prepend('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Please enter a band!</div>'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 		$.ajax({ | 
					
						
							|  |  |  | 			url: base_url + 'index.php/band/create', | 
					
						
							|  |  |  | 			type: 'post', | 
					
						
							|  |  |  | 			data: { | 
					
						
							| 
									
										
										
										
											2022-09-10 05:11:52 +08:00
										 |  |  | 				'band': form.band.value, | 
					
						
							|  |  |  | 				'bandgroup': form.bandgroup.value, | 
					
						
							|  |  |  | 				'ssbqrg': form.ssbqrg.value, | 
					
						
							|  |  |  | 				'dataqrg': form.dataqrg.value, | 
					
						
							|  |  |  | 				'cwqrg': form.cwqrg.value | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			success: function (html) { | 
					
						
							|  |  |  | 				location.reload(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-07 02:18:17 +08:00
										 |  |  | function editBandDialog(id) { | 
					
						
							|  |  |  | 	$.ajax({ | 
					
						
							|  |  |  | 		url: base_url + 'index.php/band/edit', | 
					
						
							|  |  |  | 		type: 'post', | 
					
						
							|  |  |  | 		data: { | 
					
						
							|  |  |  | 			'id': id | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		success: function (html) { | 
					
						
							|  |  |  | 			BootstrapDialog.show({ | 
					
						
							|  |  |  | 				title: 'Edit band', | 
					
						
							|  |  |  | 				size: BootstrapDialog.SIZE_NORMAL, | 
					
						
							|  |  |  | 				cssClass: 'edit-band-dialog', | 
					
						
							|  |  |  | 				nl2br: false, | 
					
						
							|  |  |  | 				message: html, | 
					
						
							|  |  |  | 				buttons: [{ | 
					
						
							|  |  |  | 					label: 'Close', | 
					
						
							|  |  |  | 					action: function (dialogItself) { | 
					
						
							|  |  |  | 						dialogItself.close(); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}] | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function saveUpdatedBand(form) { | 
					
						
							|  |  |  | 	$(".alert").remove(); | 
					
						
							|  |  |  | 	if (form.band.value == "") { | 
					
						
							|  |  |  | 		$('#edit_band_dialog').prepend('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Please enter a band!</div>'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							|  |  |  | 		$.ajax({ | 
					
						
							|  |  |  | 			url: base_url + 'index.php/band/saveupdatedband', | 
					
						
							|  |  |  | 			type: 'post', | 
					
						
							|  |  |  | 			data: {'id': form.id.value,   | 
					
						
							| 
									
										
										
										
											2022-09-10 05:11:52 +08:00
										 |  |  | 				'band': form.band.value, | 
					
						
							|  |  |  | 				'bandgroup': form.bandgroup.value, | 
					
						
							|  |  |  | 				'ssbqrg': form.ssbqrg.value, | 
					
						
							|  |  |  | 				'dataqrg': form.dataqrg.value, | 
					
						
							|  |  |  | 				'cwqrg': form.cwqrg.value | 
					
						
							| 
									
										
										
										
											2022-09-07 02:18:17 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			success: function (html) { | 
					
						
							|  |  |  | 				location.reload(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | function deleteBand(id, band) { | 
					
						
							|  |  |  | 	BootstrapDialog.confirm({ | 
					
						
							|  |  |  | 		title: 'DANGER', | 
					
						
							|  |  |  | 		message: 'Warning! Are you sure you want to delete the following band: ' + band + '?', | 
					
						
							|  |  |  | 		type: BootstrapDialog.TYPE_DANGER, | 
					
						
							|  |  |  | 		closable: true, | 
					
						
							|  |  |  | 		draggable: true, | 
					
						
							|  |  |  | 		btnOKClass: 'btn-danger', | 
					
						
							|  |  |  | 		callback: function (result) { | 
					
						
							|  |  |  | 			if (result) { | 
					
						
							|  |  |  | 				$.ajax({ | 
					
						
							|  |  |  | 					url: base_url + 'index.php/band/delete', | 
					
						
							|  |  |  | 					type: 'post', | 
					
						
							|  |  |  | 					data: { | 
					
						
							|  |  |  | 						'id': id | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					success: function (data) { | 
					
						
							| 
									
										
										
										
											2022-09-07 02:18:17 +08:00
										 |  |  | 						$(".band_" + id).parent("tr:first").remove(); // removes band from table
 | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function activateAllBands() { | 
					
						
							|  |  |  | 	BootstrapDialog.confirm({ | 
					
						
							|  |  |  | 		title: 'DANGER', | 
					
						
							|  |  |  | 		message: 'Warning! Are you sure you want to activate all bands?', | 
					
						
							|  |  |  | 		type: BootstrapDialog.TYPE_DANGER, | 
					
						
							|  |  |  | 		closable: true, | 
					
						
							|  |  |  | 		draggable: true, | 
					
						
							|  |  |  | 		btnOKClass: 'btn-danger', | 
					
						
							|  |  |  | 		callback: function (result) { | 
					
						
							|  |  |  | 			if (result) { | 
					
						
							|  |  |  | 				$.ajax({ | 
					
						
							|  |  |  | 					url: base_url + 'index.php/band/activateall', | 
					
						
							|  |  |  | 					type: 'post', | 
					
						
							|  |  |  | 					success: function (data) { | 
					
						
							|  |  |  | 						location.reload(); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function deactivateAllBands() { | 
					
						
							|  |  |  | 	BootstrapDialog.confirm({ | 
					
						
							|  |  |  | 		title: 'DANGER', | 
					
						
							|  |  |  | 		message: 'Warning! Are you sure you want to deactivate all bands?', | 
					
						
							|  |  |  | 		type: BootstrapDialog.TYPE_DANGER, | 
					
						
							|  |  |  | 		closable: true, | 
					
						
							|  |  |  | 		draggable: true, | 
					
						
							|  |  |  | 		btnOKClass: 'btn-danger', | 
					
						
							|  |  |  | 		callback: function (result) { | 
					
						
							|  |  |  | 			if (result) { | 
					
						
							|  |  |  | 				$.ajax({ | 
					
						
							|  |  |  | 					url: base_url + 'index.php/band/deactivateall', | 
					
						
							|  |  |  | 					type: 'post', | 
					
						
							|  |  |  | 					success: function (data) { | 
					
						
							|  |  |  | 						location.reload(); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function saveBand(id) { | 
					
						
							|  |  |  | 	$.ajax({ | 
					
						
							|  |  |  | 		url: base_url + 'index.php/band/saveBand', | 
					
						
							|  |  |  | 		type: 'post', | 
					
						
							|  |  |  | 		data: {'id': id,   | 
					
						
							|  |  |  | 			'status': $(".band_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'cq': $(".cq_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'dok': $(".dok_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'dxcc': $(".dxcc_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'iota': $(".iota_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							| 
									
										
										
										
											2022-10-06 04:13:12 +08:00
										 |  |  | 			'pota': $(".pota_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 			'sig': $(".sig_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							|  |  |  | 			'was': $(".was_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							| 
									
										
										
										
											2022-09-20 23:27:58 +08:00
										 |  |  | 			'wwff': $(".wwff_"+id+" input[type='checkbox']").is(":checked"), | 
					
						
							| 
									
										
										
										
											2022-09-06 02:26:08 +08:00
										 |  |  | 			'vucc': $(".vucc_"+id+" input[type='checkbox']").is(":checked") | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		success: function (html) { | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2022-10-06 04:13:12 +08:00
										 |  |  | } |