Dialog with ajax to create a new mode.
这个提交包含在:
		
							父节点
							
								
									d2a668dde2
								
							
						
					
					
						当前提交
						529c81575c
					
				
					共有  4 个文件被更改,包括 44 次插入 和 21 次删除
				
			
		|  | @ -39,15 +39,11 @@ class Mode extends CI_Controller { | ||||||
| 		if ($this->form_validation->run() == FALSE) | 		if ($this->form_validation->run() == FALSE) | ||||||
| 		{ | 		{ | ||||||
| 			$data['page_title'] = "Create Mode"; | 			$data['page_title'] = "Create Mode"; | ||||||
| 			$this->load->view('interface_assets/header', $data); | 			$this->load->view('mode/create', $data); | ||||||
| 			$this->load->view('mode/create'); |  | ||||||
| 			$this->load->view('interface_assets/footer'); |  | ||||||
| 		} | 		} | ||||||
| 		else | 		else | ||||||
| 		{	 | 		{	 | ||||||
| 			$this->modes->add(); | 			$this->modes->add(); | ||||||
| 			 |  | ||||||
| 			redirect('mode'); |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1821,6 +1821,46 @@ $(document).ready(function(){ | ||||||
|                 "scrollX": true |                 "scrollX": true | ||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
|  |             function createModeDialog() { | ||||||
|  |                 var baseURL= "<?php echo base_url();?>"; | ||||||
|  |                 $.ajax({ | ||||||
|  |                     url: baseURL + 'index.php/mode/create', | ||||||
|  |                     type: 'post', | ||||||
|  |                     success: function(html) { | ||||||
|  |                         BootstrapDialog.show({ | ||||||
|  |                             title: 'Create mode', | ||||||
|  |                             size: BootstrapDialog.SIZE_WIDE, | ||||||
|  |                             cssClass: 'create-mode-dialog', | ||||||
|  |                             nl2br: false, | ||||||
|  |                             message: html, | ||||||
|  |                             buttons: [{ | ||||||
|  |                                 label: 'Close', | ||||||
|  |                                 action: function (dialogItself) { | ||||||
|  |                                     dialogItself.close(); | ||||||
|  |                                 } | ||||||
|  |                             }] | ||||||
|  |                         }); | ||||||
|  |                     } | ||||||
|  |                 }); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             function createMode(form) { | ||||||
|  |                 var baseURL= "<?php echo base_url();?>"; | ||||||
|  |                 if (form.mode.value != '') { | ||||||
|  |                     $.ajax({ | ||||||
|  |                         url: baseURL + 'index.php/mode/create', | ||||||
|  |                         type: 'post', | ||||||
|  |                         data: {'mode': form.mode.value, | ||||||
|  |                             'submode': form.submode.value, | ||||||
|  |                             'qrgmode': form.qrgmode.value, | ||||||
|  |                             'active': form.active.value}, | ||||||
|  |                         success: function(html) { | ||||||
|  |                             location.reload(); | ||||||
|  |                         } | ||||||
|  |                     }); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             function deactivateMode(modeid) { |             function deactivateMode(modeid) { | ||||||
|                 var baseURL= "<?php echo base_url();?>"; |                 var baseURL= "<?php echo base_url();?>"; | ||||||
|                 $.ajax({ |                 $.ajax({ | ||||||
|  |  | ||||||
|  | @ -9,14 +9,6 @@ | ||||||
| 		</div> | 		</div> | ||||||
| 	<?php } ?>
 | 	<?php } ?>
 | ||||||
| 
 | 
 | ||||||
| <div class="card"> |  | ||||||
|   <div class="card-header"> |  | ||||||
|     <?php echo $page_title; ?>
 |  | ||||||
|   </div> |  | ||||||
|   <div class="card-body"> |  | ||||||
|     <h5 class="card-title"></h5> |  | ||||||
|     <p class="card-text"></p> |  | ||||||
| 
 |  | ||||||
| 		<?php if($this->session->flashdata('notice')) { ?>
 | 		<?php if($this->session->flashdata('notice')) { ?>
 | ||||||
| 			<div id="message" > | 			<div id="message" > | ||||||
| 			<?php echo $this->session->flashdata('notice'); ?>
 | 			<?php echo $this->session->flashdata('notice'); ?>
 | ||||||
|  | @ -27,7 +19,7 @@ | ||||||
| 
 | 
 | ||||||
| 		<?php echo validation_errors(); ?>
 | 		<?php echo validation_errors(); ?>
 | ||||||
| 
 | 
 | ||||||
| 		<form method="post" action="<?php echo site_url('mode/create'); ?>" name="create_profile"> | 		<form method="post" name="create_profile"> | ||||||
| 		<div class="form-group"> | 		<div class="form-group"> | ||||||
| 		    <label for="modeInput">ADIF Mode</label> | 		    <label for="modeInput">ADIF Mode</label> | ||||||
| 		    <input type="text" class="form-control" name="mode" id="modeInput" aria-describedby="modeInputHelp" required> | 		    <input type="text" class="form-control" name="mode" id="modeInput" aria-describedby="modeInputHelp" required> | ||||||
|  | @ -59,12 +51,7 @@ | ||||||
| 		    <small id="activeInputHelp" class="form-text text-muted">Set to active if to be listed in Modes-list</small> | 		    <small id="activeInputHelp" class="form-text text-muted">Set to active if to be listed in Modes-list</small> | ||||||
| 		  </div> | 		  </div> | ||||||
| 
 | 
 | ||||||
| 			<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create mode</button> | 			<button onclick="createMode(this.form);" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create mode</button> | ||||||
| 
 | 
 | ||||||
| 		</form> | 		</form> | ||||||
|   </div> |  | ||||||
| </div> |  | ||||||
| 
 |  | ||||||
| <br> |  | ||||||
| 
 |  | ||||||
| </div> | </div> | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
|   </div> |   </div> | ||||||
|   <div class="card-body"> |   <div class="card-body"> | ||||||
|     <p class="card-text">This is the place you can customize your modes-list by activating/deactivating modes to be shown in the select-list.</p> |     <p class="card-text">This is the place you can customize your modes-list by activating/deactivating modes to be shown in the select-list.</p> | ||||||
|       <p><a href="<?php echo site_url('mode/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Mode</a></p> |       <p><button onclick="createModeDialog();" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Mode</button></p> | ||||||
|     <div class="table-responsive"> |     <div class="table-responsive"> | ||||||
| 		<table style="width:100%" class="modetable table table-striped"> | 		<table style="width:100%" class="modetable table table-striped"> | ||||||
| 			<thead> | 			<thead> | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用