Skip to content

Commit

Permalink
webui: introduce scheduleActionButtonsFormatter function
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed Mar 11, 2020
1 parent f72ee69 commit b70b223
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions webui/module/Schedule/view/schedule/schedule/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ $this->headTitle($title);

var schedules = null;

function scheduleActionButtonsFormatter(value, row, index) {

let disableButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=disable&schedule='+row.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
let enableButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=enable&schedule='+row.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>';

if(row.enabled) {
return disableButton;
} else {
return enableButton;
}

}

function attachSchedulesTable() {

schedules = $('#schedules').bootstrapTable({
Expand Down Expand Up @@ -155,12 +168,7 @@ $this->headTitle($title);
{
field: 'action',
formatter: function(value, row, index) {
if(row.enabled) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=disable&schedule='+row.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
}
else {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=enable&schedule='+row.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>';
}
return scheduleActionButtonsFormatter(value, row, index);
}
}
]
Expand Down

0 comments on commit b70b223

Please sign in to comment.