Merge pull request #2371 from AndreasK79/qslprint_mark_as_printed
[QSLPrint] Fixed js. Added button to mark as sent
这个提交包含在:
		
						当前提交
						0f609593e6
					
				
					共有  5 个文件被更改,包括 148 次插入 和 114 次删除
				
			
		|  | @ -38,11 +38,16 @@ class QSLPrint extends CI_Controller { | ||||||
| 			$data['qsos'] = $this->qslprint_model->get_qsos_for_print(); | 			$data['qsos'] = $this->qslprint_model->get_qsos_for_print(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		$footerData = []; | ||||||
|  | 		$footerData['scripts'] = [ | ||||||
|  | 			'assets/js/sections/qslprint.js', | ||||||
|  | 		]; | ||||||
|  | 
 | ||||||
| 		$data['page_title'] = "Print Requested QSLs"; | 		$data['page_title'] = "Print Requested QSLs"; | ||||||
| 
 | 
 | ||||||
| 		$this->load->view('interface_assets/header', $data); | 		$this->load->view('interface_assets/header', $data); | ||||||
| 		$this->load->view('qslprint/index'); | 		$this->load->view('qslprint/index'); | ||||||
| 		$this->load->view('interface_assets/footer'); | 		$this->load->view('interface_assets/footer', $footerData); | ||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2808,118 +2808,6 @@ function viewEqsl(picture, callsign) { | ||||||
| 	</script> | 	</script> | ||||||
| <?php } ?>
 | <?php } ?>
 | ||||||
| 
 | 
 | ||||||
| <?php if ($this->uri->segment(1) == "qslprint") { ?>
 |  | ||||||
| 	<script> |  | ||||||
| 		function deleteFromQslQueue(id) { |  | ||||||
| 			BootstrapDialog.confirm({ |  | ||||||
| 				title: 'DANGER', |  | ||||||
| 				message: 'Warning! Are you sure you want to removes this QSL from the queue?', |  | ||||||
| 				type: BootstrapDialog.TYPE_DANGER, |  | ||||||
| 				closable: true, |  | ||||||
| 				draggable: true, |  | ||||||
| 				btnOKClass: 'btn-danger', |  | ||||||
| 				callback: function(result) { |  | ||||||
| 					$.ajax({ |  | ||||||
| 						url: base_url + 'index.php/qslprint/delete_from_qsl_queue', |  | ||||||
| 						type: 'post', |  | ||||||
| 						data: {'id': id	}, |  | ||||||
| 						success: function(html) { |  | ||||||
| 							$("#qslprint_"+id).remove(); |  | ||||||
| 						} |  | ||||||
| 					}); |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		function openQsoList(callsign) { |  | ||||||
| 			$.ajax({ |  | ||||||
| 				url: base_url + 'index.php/qslprint/open_qso_list', |  | ||||||
| 				type: 'post', |  | ||||||
| 				data: {'callsign': callsign}, |  | ||||||
| 				success: function(html) { |  | ||||||
| 					BootstrapDialog.show({ |  | ||||||
| 						title: 'QSO List', |  | ||||||
| 						size: BootstrapDialog.SIZE_WIDE, |  | ||||||
| 						cssClass: 'qso-dialog', |  | ||||||
| 						nl2br: false, |  | ||||||
| 						message: html, |  | ||||||
| 						onshown: function(dialog) { |  | ||||||
| 							$('[data-toggle="tooltip"]').tooltip(); |  | ||||||
| 						}, |  | ||||||
| 						buttons: [{ |  | ||||||
| 							label: 'Close', |  | ||||||
| 							action: function (dialogItself) { |  | ||||||
| 								dialogItself.close(); |  | ||||||
| 							} |  | ||||||
| 						}] |  | ||||||
| 					}); |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		function addQsoToPrintQueue(id) { |  | ||||||
| 			$.ajax({ |  | ||||||
| 				url: base_url + 'index.php/qslprint/add_qso_to_print_queue', |  | ||||||
| 				type: 'post', |  | ||||||
| 				data: {'id': id}, |  | ||||||
| 				success: function(html) { |  | ||||||
| 					var line = '<tr id="qslprint_'+id+'">'; |  | ||||||
| 					line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(0)").text()+'</td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(1)").text()+'</td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(2)").text()+'</td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(3)").text()+'</td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(4)").text()+'</td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'><span class="badge badge-light">'+$("#qsolist_"+id).find("td:eq(5)").text()+'</span></td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue('+id+')" class="btn btn-sm btn-danger">Delete from queue</button></td></td>'; |  | ||||||
| 					line += '<td style=\'text-align: center\'><button onclick="openQsoList(\''+$("#qsolist_"+id).find("td:eq(0)").text()+'\')" class="btn btn-sm btn-success">Open QSO list</button></td>'; |  | ||||||
| 					line += '</tr>'; |  | ||||||
| 					$('.table tr:last').after(line); |  | ||||||
| 					$("#qsolist_"+id).remove();'' |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		$(".station_id").change(function(){ |  | ||||||
| 			var station_id = $(".station_id").val(); |  | ||||||
| 			$.ajax({ |  | ||||||
| 				url: base_url + 'index.php/qslprint/get_qsos_for_print_ajax', |  | ||||||
| 				type: 'post', |  | ||||||
| 				data: {'station_id': station_id}, |  | ||||||
| 				success: function(html) { |  | ||||||
| 					$('.resulttable').empty(); |  | ||||||
| 					$('.resulttable').append(html); |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 		}); |  | ||||||
| 
 |  | ||||||
|         function showOqrs(id) { |  | ||||||
| 			$.ajax({ |  | ||||||
| 				url: base_url + 'index.php/qslprint/show_oqrs', |  | ||||||
| 				type: 'post', |  | ||||||
| 				data: {'id': id}, |  | ||||||
| 				success: function(html) { |  | ||||||
| 					BootstrapDialog.show({ |  | ||||||
| 						title: 'OQRS', |  | ||||||
| 						size: BootstrapDialog.SIZE_WIDE, |  | ||||||
| 						cssClass: 'qso-dialog', |  | ||||||
| 						nl2br: false, |  | ||||||
| 						message: html, |  | ||||||
| 						onshown: function(dialog) { |  | ||||||
| 							$('[data-toggle="tooltip"]').tooltip(); |  | ||||||
| 						}, |  | ||||||
| 						buttons: [{ |  | ||||||
| 							label: 'Close', |  | ||||||
| 							action: function (dialogItself) { |  | ||||||
| 								dialogItself.close(); |  | ||||||
| 							} |  | ||||||
| 						}] |  | ||||||
| 					}); |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 		} |  | ||||||
| 	</script> |  | ||||||
| <?php } ?>
 |  | ||||||
| 
 |  | ||||||
| <?php if ($this->uri->segment(1) == "awards") { | <?php if ($this->uri->segment(1) == "awards") { | ||||||
| 	// Get Date format
 | 	// Get Date format
 | ||||||
| 	if($this->session->userdata('user_date_format')) { | 	if($this->session->userdata('user_date_format')) { | ||||||
|  |  | ||||||
|  | @ -24,6 +24,7 @@ if ($qsos->result() != NULL) { | ||||||
| <th style=\'text-align: center\'>' . lang('gen_hamradio_qsl') . ' ' . lang('general_word_qslcard_via') . '</th> | <th style=\'text-align: center\'>' . lang('gen_hamradio_qsl') . ' ' . lang('general_word_qslcard_via') . '</th> | ||||||
| <th style=\'text-align: center\'>' . lang('gen_hamradio_station') . '</th> | <th style=\'text-align: center\'>' . lang('gen_hamradio_station') . '</th> | ||||||
| <th style=\'text-align: center\'>Sent method</th> | <th style=\'text-align: center\'>Sent method</th> | ||||||
|  | <th style=\'text-align: center\'>Mark as sent</th> | ||||||
| <th style=\'text-align: center\'>Delete</th> | <th style=\'text-align: center\'>Delete</th> | ||||||
| <th style=\'text-align: center\'>QSO List</th> | <th style=\'text-align: center\'>QSO List</th> | ||||||
| </tr> | </tr> | ||||||
|  | @ -48,11 +49,11 @@ if ($qsos->result() != NULL) { | ||||||
| 		echo '<td style=\'text-align: center\'>' . $qsl->COL_QSL_VIA . '</td>'; | 		echo '<td style=\'text-align: center\'>' . $qsl->COL_QSL_VIA . '</td>'; | ||||||
| 		echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>'; | 		echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>'; | ||||||
| 		echo '<td style=\'text-align: center\'>'; echo_qsl_sent_via($qsl->COL_QSL_SENT_VIA); echo '</td>'; | 		echo '<td style=\'text-align: center\'>'; echo_qsl_sent_via($qsl->COL_QSL_SENT_VIA); echo '</td>'; | ||||||
|  | 		echo '<td style=\'text-align: center\'><button onclick="mark_qsl_sent(\''.$qsl->COL_PRIMARY_KEY.'\', \'B\')" class="btn btn-sm btn-success"><i class="fa fa-check"></i></button></td>'; | ||||||
| 		echo '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i></button></td>'; | 		echo '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i></button></td>'; | ||||||
| 		echo '<td style=\'text-align: center\'><button onclick="openQsoList(\''.$qsl->COL_CALL.'\')" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button></td>'; | 		echo '<td style=\'text-align: center\'><button onclick="openQsoList(\''.$qsl->COL_CALL.'\')" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button></td>'; | ||||||
| 		echo '</tr>'; | 		echo '</tr>'; | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	echo '</tbody></table>'; | 	echo '</tbody></table>'; | ||||||
| 	?>
 | 	?>
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,6 +9,8 @@ if ($qsos->result() != NULL) { | ||||||
| 	<th style=\'text-align: center\'>' . lang('gen_hamradio_mode') . '</th> | 	<th style=\'text-align: center\'>' . lang('gen_hamradio_mode') . '</th> | ||||||
| 	<th style=\'text-align: center\'>' . lang('gen_hamradio_band') . '</th> | 	<th style=\'text-align: center\'>' . lang('gen_hamradio_band') . '</th> | ||||||
| 	<th style=\'text-align: center\'>' . lang('gen_hamradio_station') . '</th> | 	<th style=\'text-align: center\'>' . lang('gen_hamradio_station') . '</th> | ||||||
|  | 	<th style=\'text-align: center\'>' . lang('gen_hamradio_qsl') . ' ' . lang('general_word_qslcard_via') . '</th> | ||||||
|  | 	<th style=\'text-align: center\'>Sent method</th> | ||||||
| 	<th style=\'text-align: center\'>QSL</th>'; | 	<th style=\'text-align: center\'>QSL</th>'; | ||||||
| 	if ($this->session->userdata('user_eqsl_name') != "") { | 	if ($this->session->userdata('user_eqsl_name') != "") { | ||||||
| 		echo '<th style=\'text-align: center\'>eQSL</th>'; | 		echo '<th style=\'text-align: center\'>eQSL</th>'; | ||||||
|  | @ -37,6 +39,8 @@ if ($qsos->result() != NULL) { | ||||||
| 		echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>'; | 		echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>'; | ||||||
| 		echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>'; | 		echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>'; | ||||||
| 		echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>'; | 		echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>'; | ||||||
|  | 		echo '<td style=\'text-align: center\'>' . $qsl->COL_QSL_VIA . '</td>'; | ||||||
|  | 		echo '<td style=\'text-align: center\'>'; echo_qsl_sent_via($qsl->COL_QSL_SENT_VIA); echo '</td>'; | ||||||
| 		echo '<td style=\'text-align: center\' class="qsl">'; | 		echo '<td style=\'text-align: center\' class="qsl">'; | ||||||
| 		echo '<span '; | 		echo '<span '; | ||||||
| 		if ($qsl->COL_QSL_SENT != "N") { | 		if ($qsl->COL_QSL_SENT != "N") { | ||||||
|  | @ -192,4 +196,12 @@ if ($qsos->result() != NULL) { | ||||||
| } else { | } else { | ||||||
| 	echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>No additional QSO\'s were found. That means they are probably already in the queue.</div>'; | 	echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>No additional QSO\'s were found. That means they are probably already in the queue.</div>'; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | function echo_qsl_sent_via($method) { | ||||||
|  | 	switch($method) { | ||||||
|  | 		case 'B': echo 'Bureau'; break; | ||||||
|  | 		case 'D': echo 'Direct'; break; | ||||||
|  | 		case 'E': echo 'Electronic'; break; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| ?>
 | ?>
 | ||||||
|  |  | ||||||
							
								
								
									
										128
									
								
								assets/js/sections/qslprint.js
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										128
									
								
								assets/js/sections/qslprint.js
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,128 @@ | ||||||
|  | function deleteFromQslQueue(id) { | ||||||
|  | 	BootstrapDialog.confirm({ | ||||||
|  | 		title: 'DANGER', | ||||||
|  | 		message: 'Warning! Are you sure you want to removes this QSL from the queue?', | ||||||
|  | 		type: BootstrapDialog.TYPE_DANGER, | ||||||
|  | 		closable: true, | ||||||
|  | 		draggable: true, | ||||||
|  | 		btnOKClass: 'btn-danger', | ||||||
|  | 		callback: function(result) { | ||||||
|  | 			$.ajax({ | ||||||
|  | 				url: base_url + 'index.php/qslprint/delete_from_qsl_queue', | ||||||
|  | 				type: 'post', | ||||||
|  | 				data: {'id': id	}, | ||||||
|  | 				success: function(html) { | ||||||
|  | 					$("#qslprint_"+id).remove(); | ||||||
|  | 				} | ||||||
|  | 			}); | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function openQsoList(callsign) { | ||||||
|  | 	$.ajax({ | ||||||
|  | 		url: base_url + 'index.php/qslprint/open_qso_list', | ||||||
|  | 		type: 'post', | ||||||
|  | 		data: {'callsign': callsign}, | ||||||
|  | 		success: function(html) { | ||||||
|  | 			BootstrapDialog.show({ | ||||||
|  | 				title: 'QSO List', | ||||||
|  | 				size: BootstrapDialog.SIZE_WIDE, | ||||||
|  | 				cssClass: 'qso-dialog', | ||||||
|  | 				nl2br: false, | ||||||
|  | 				message: html, | ||||||
|  | 				onshown: function(dialog) { | ||||||
|  | 					$('[data-toggle="tooltip"]').tooltip(); | ||||||
|  | 				}, | ||||||
|  | 				buttons: [{ | ||||||
|  | 					label: 'Close', | ||||||
|  | 					action: function (dialogItself) { | ||||||
|  | 						dialogItself.close(); | ||||||
|  | 					} | ||||||
|  | 				}] | ||||||
|  | 			}); | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function addQsoToPrintQueue(id) { | ||||||
|  | 	$.ajax({ | ||||||
|  | 		url: base_url + 'index.php/qslprint/add_qso_to_print_queue', | ||||||
|  | 		type: 'post', | ||||||
|  | 		data: {'id': id}, | ||||||
|  | 		success: function(html) { | ||||||
|  | 			var line = '<tr id="qslprint_'+id+'">'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(0)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(1)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(2)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(3)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(4)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(6)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'><span class="badge badge-light">'+$("#qsolist_"+id).find("td:eq(5)").text()+'</span></td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(7)").text()+'</td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'><button onclick="mark_qsl_sent('+id+', \'B\')" class="btn btn-sm btn-success"><i class="fa fa-check"></i></button></td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue('+id+')" class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i></button></td></td>'; | ||||||
|  | 			line += '<td style=\'text-align: center\'><button onclick="openQsoList(\''+$("#qsolist_"+id).find("td:eq(0)").text()+'\')" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button></td>'; | ||||||
|  | 			line += '</tr>'; | ||||||
|  | 			$('.table tr:last').after(line); | ||||||
|  | 			$("#qsolist_"+id).remove();'' | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | $(".station_id").change(function(){ | ||||||
|  | 	var station_id = $(".station_id").val(); | ||||||
|  | 	$.ajax({ | ||||||
|  | 		url: base_url + 'index.php/qslprint/get_qsos_for_print_ajax', | ||||||
|  | 		type: 'post', | ||||||
|  | 		data: {'station_id': station_id}, | ||||||
|  | 		success: function(html) { | ||||||
|  | 			$('.resulttable').empty(); | ||||||
|  | 			$('.resulttable').append(html); | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | function showOqrs(id) { | ||||||
|  | 	$.ajax({ | ||||||
|  | 		url: base_url + 'index.php/qslprint/show_oqrs', | ||||||
|  | 		type: 'post', | ||||||
|  | 		data: {'id': id}, | ||||||
|  | 		success: function(html) { | ||||||
|  | 			BootstrapDialog.show({ | ||||||
|  | 				title: 'OQRS', | ||||||
|  | 				size: BootstrapDialog.SIZE_WIDE, | ||||||
|  | 				cssClass: 'qso-dialog', | ||||||
|  | 				nl2br: false, | ||||||
|  | 				message: html, | ||||||
|  | 				onshown: function(dialog) { | ||||||
|  | 					$('[data-toggle="tooltip"]').tooltip(); | ||||||
|  | 				}, | ||||||
|  | 				buttons: [{ | ||||||
|  | 					label: 'Close', | ||||||
|  | 					action: function (dialogItself) { | ||||||
|  | 						dialogItself.close(); | ||||||
|  | 					} | ||||||
|  | 				}] | ||||||
|  | 			}); | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function mark_qsl_sent(id, method) { | ||||||
|  |     $.ajax({ | ||||||
|  |         url: base_url + 'index.php/qso/qsl_sent_ajax', | ||||||
|  |         type: 'post', | ||||||
|  |         data: {'id': id, | ||||||
|  |             'method': method | ||||||
|  |         }, | ||||||
|  |         success: function(data) { | ||||||
|  |             if (data.message == 'OK') { | ||||||
|  |                 $("#qslprint_" + id).remove(); // removes choice from menu
 | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 $(".container").append('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>You are not allowed to update QSL status!</div>'); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | } | ||||||
		正在加载…
	
		在新工单中引用