Added AJAX-delete of mode as well.
这个提交包含在:
父节点
529c81575c
当前提交
337caa1424
共有 3 个文件被更改,包括 28 次插入 和 4 次删除
|
|
@ -80,11 +80,10 @@ class Mode extends CI_Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id) {
|
public function delete() {
|
||||||
|
$id = $this->input->post('id');
|
||||||
$this->load->model('modes');
|
$this->load->model('modes');
|
||||||
$this->modes->delete($id);
|
$this->modes->delete($id);
|
||||||
|
|
||||||
redirect('mode');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activate() {
|
public function activate() {
|
||||||
|
|
|
||||||
|
|
@ -1888,6 +1888,31 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteMode(id, mode) {
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'DANGER',
|
||||||
|
message: 'Warning! Are you sure you want to delete the following mode: ' + mode + '?' ,
|
||||||
|
type: BootstrapDialog.TYPE_DANGER,
|
||||||
|
closable: true,
|
||||||
|
draggable: true,
|
||||||
|
btnOKClass: 'btn-danger',
|
||||||
|
callback: function(result) {
|
||||||
|
if(result) {
|
||||||
|
var baseURL= "<?php echo base_url();?>";
|
||||||
|
$.ajax({
|
||||||
|
url: baseURL + 'index.php/mode/delete',
|
||||||
|
type: 'post',
|
||||||
|
data: {'id': id
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$(".mode_" + id).parent("tr:first").remove(); // removes mode from table
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
<a href="<?php echo site_url('mode/edit')."/".$row->id; ?>" class="btn btn-info btn-sm"><i class="fas fa-edit-alt"></i> Edit</a>
|
<a href="<?php echo site_url('mode/edit')."/".$row->id; ?>" class="btn btn-info btn-sm"><i class="fas fa-edit-alt"></i> Edit</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo site_url('mode/delete')."/".$row->id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode <?php echo $row->mode; ?> ');"><i class="fas fa-trash-alt"></i> Delete</a>
|
<a href="javascript:deleteMode('<?php echo $row->id; ?>', '<?php echo $row->mode; ?>');" class="btn btn-danger btn-sm" ><i class="fas fa-trash-alt"></i> Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用