[Refactor footer.php] Split modes functions to it's own file
这个提交包含在:
父节点
58f14d407a
当前提交
cf9e87c627
共有 2 个文件被更改,包括 98 次插入 和 104 次删除
|
|
@ -1540,110 +1540,7 @@ $(document).ready(function(){
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($this->uri->segment(1) == "mode") { ?>
|
<?php if ($this->uri->segment(1) == "mode") { ?>
|
||||||
<script>
|
<script src="<?php echo base_url(); ?>assets/js/sections/mode.js"></script>
|
||||||
$('.modetable').DataTable({
|
|
||||||
"pageLength": 25,
|
|
||||||
responsive: false,
|
|
||||||
ordering: false,
|
|
||||||
"scrollY": "500px",
|
|
||||||
"scrollCollapse": true,
|
|
||||||
"paging": false,
|
|
||||||
"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) {
|
|
||||||
var baseURL= "<?php echo base_url();?>";
|
|
||||||
$.ajax({
|
|
||||||
url: baseURL + 'index.php/mode/deactivate',
|
|
||||||
type: 'post',
|
|
||||||
data: {'id': modeid },
|
|
||||||
success: function(html) {
|
|
||||||
$(".mode_" + modeid).text('not active');
|
|
||||||
$('.btn_'+modeid).html('Activate');
|
|
||||||
$('.btn_'+modeid).attr('onclick', 'activateMode('+modeid+')')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function activateMode(modeid) {
|
|
||||||
var baseURL= "<?php echo base_url();?>";
|
|
||||||
$.ajax({
|
|
||||||
url: baseURL + 'index.php/mode/activate',
|
|
||||||
type: 'post',
|
|
||||||
data: {'id': modeid },
|
|
||||||
success: function(html) {
|
|
||||||
$('.mode_'+modeid).text('active');
|
|
||||||
$('.btn_'+modeid).html('Deactivate');
|
|
||||||
$('.btn_'+modeid).attr('onclick', 'deactivateMode('+modeid+')')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($this->uri->segment(1) == "accumulated") { ?>
|
<?php if ($this->uri->segment(1) == "accumulated") { ?>
|
||||||
|
|
|
||||||
97
assets/js/sections/mode.js
普通文件
97
assets/js/sections/mode.js
普通文件
|
|
@ -0,0 +1,97 @@
|
||||||
|
$('.modetable').DataTable({
|
||||||
|
"pageLength": 25,
|
||||||
|
responsive: false,
|
||||||
|
ordering: false,
|
||||||
|
"scrollY": "500px",
|
||||||
|
"scrollCollapse": true,
|
||||||
|
"paging": false,
|
||||||
|
"scrollX": true
|
||||||
|
});
|
||||||
|
|
||||||
|
function createModeDialog() {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + '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) {
|
||||||
|
if (form.mode.value != '') {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + '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) {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + 'index.php/mode/deactivate',
|
||||||
|
type: 'post',
|
||||||
|
data: {'id': modeid },
|
||||||
|
success: function(html) {
|
||||||
|
$(".mode_" + modeid).text('not active');
|
||||||
|
$('.btn_'+modeid).html('Activate');
|
||||||
|
$('.btn_'+modeid).attr('onclick', 'activateMode('+modeid+')')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateMode(modeid) {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + 'index.php/mode/activate',
|
||||||
|
type: 'post',
|
||||||
|
data: {'id': modeid },
|
||||||
|
success: function(html) {
|
||||||
|
$('.mode_'+modeid).text('active');
|
||||||
|
$('.btn_'+modeid).html('Deactivate');
|
||||||
|
$('.btn_'+modeid).attr('onclick', 'deactivateMode('+modeid+')')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + 'index.php/mode/delete',
|
||||||
|
type: 'post',
|
||||||
|
data: {'id': id
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$(".mode_" + id).parent("tr:first").remove(); // removes mode from table
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
正在加载…
在新工单中引用