webui: Minor visual changes in schedule maintenance window and its modal (#6934)

* webui: minor visual changes in schedule maintenance window and it's modal

* Removed unnecessary comments

* Auto close alerts
This commit is contained in:
Aldemir Akpinar
2017-07-05 00:29:54 +03:00
committed by Neil Lathwood
parent b56c6b6adf
commit 9c957ee1d4
4 changed files with 36 additions and 47 deletions

View File

@@ -46,17 +46,13 @@ if (is_admin() !== false) {
</div>
<div class="form-group">
<label for="recurring" class="col-sm-4 control-label">Recurring <strong class="text-danger">*</strong>: </label>
<div class="col-sm-2">
<input type="radio" class="form-control" id="recurring0" name="recurring" value="0" style="width: 20px;" checked="checked"/>
</div>
<div class="col-sm-2">
<label class="col-sm-for="recurring0">No</label>
</div>
<div class="col-sm-2">
<input type="radio" class="form-control" id="recurring1" name="recurring" value="1" style="width: 20px;" />
</div>
<div class="col-sm-2">
<div style="padding-top:10px;"><label for="recurring1">Yes</label></div>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" id="recurring0" name="recurring" value="0" checked="checked"/> No
</label>
<label class="radio-inline">
<input type="radio" id="recurring1" name="recurring" value="1"/> Yes
</label>
</div>
</div>
<div id="norecurringgroup">
@@ -117,7 +113,7 @@ if (is_admin() !== false) {
<input type='text' id='map-stub' name='map-stub' class='form-control'/>
</div>
<div class="col-sm-3">
<button class="btn btn-primary btn-sm" type="button" name="add-map" id="add-map" value="Add">Add</button>
<button class="btn btn-primary" type="button" name="add-map" id="add-map" value="Add">Add</button>
</div>
</div>
<div class="form-group">
@@ -152,6 +148,7 @@ $('#schedule-maintenance').on('hide.bs.modal', function (event) {
$('#recurring_day').prop('checked', false);
$('#norecurringgroup').show();
$('#recurringgroup').hide();
$('#schedulemodal-alert').remove('');
});
$('#schedule-maintenance').on('show.bs.modal', function (event) {
@@ -240,15 +237,17 @@ $('#sched-submit').click('', function(e) {
dataType: "json",
success: function(data){
if(data.status == 'ok') {
$("#message").html('<div class="alert alert-info">'+data.message+'</div>');
$("#message").html('<div id="schedulemsg" class="alert alert-info"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+data.message+'</div>');
window.setTimeout(function() { $('#schedulemsg').fadeOut().slideUp(); } , 5000);
$("#schedule-maintenance").modal('hide');
$("#schedulemodal-alert").remove();
$("#alert-schedule").bootgrid('reload');
} else {
$("#response").html('<div class="alert alert-info">'+data.message+'</div>');
$("#response").html('<div id="schedulemodal-alert" class="alert alert-danger">'+data.message+'</div>');
}
},
error: function(){
$("#response").html('<div class="alert alert-info">An error occurred.</div>');
$("#response").html('<div id="schedulemodal-alert" class="alert alert-danger">An error occurred.</div>');
}
});
});

View File

@@ -38,15 +38,6 @@ if (is_admin() !== false) {
</div>
</div>
<script>
$('#schedule-maintenance').on('hide.bs.modal', function (event) {
$('#map-tags').data('tagmanager').empty();
$('#schedule_id').val('');
$('#title').val('');
$('#notes').val('');
$('#start').val('');
$('#end').val('');
});
$('#sched-maintenance-removal').click('', function(e) {
e.preventDefault();
$.ajax({
@@ -56,11 +47,12 @@ $('#sched-maintenance-removal').click('', function(e) {
dataType: "json",
success: function(data){
if(data.status == 'ok') {
$("#message").html('<div class="alert alert-info">'+data.message+'</div>');
$("#message").html('<div class="alert alert-info" id="schedulemsg"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+data.message+'</div>');
window.setTimeout(function() { $('#schedulemsg').fadeOut().slideUp(); } , 5000);
$("#delete-maintenance").modal('hide');
$("#alert-schedule").bootgrid('reload');
} else {
$("#response").html('<div class="alert alert-info">'+data.message+'</div>');
$("#response").html('<div class="alert alert-danger" id="schedulemodal-alert">'+data.message+'</div>');
}
},
error: function(){

View File

@@ -14,10 +14,8 @@
$where = 1;
if ($_SESSION['userlevel'] >= '5') {
$sql = " FROM `alert_schedule` AS S WHERE $where";
} else {
$sql = " FROM `alert_schedule` AS S WHERE $where";
$sql = " FROM `alert_schedule` AS S WHERE $where";
if ($_SESSION['userlevel'] < '5') {
$param[] = $_SESSION['user_id'];
}

View File

@@ -41,6 +41,7 @@ if (is_admin() !== false) {
<th data-column-id="end_recurring_hr">End recurring hr</th>
<th data-column-id="recurring_day" data-sortable="false" data-searchable="false">Recurring on days</th>
<th data-column-id="actions" data-sortable="false" data-searchable="false" data-formatter="commands">Actions</th>
<th data-column-id="status" data-sortable="false" data-searchable="false" data-formatter="schedstatus">Status</th>
</tr>
</thead>
</table>
@@ -51,20 +52,23 @@ if (is_admin() !== false) {
var grid = $("#alert-schedule").bootgrid({
ajax: true,
formatters: {
"commands": function(column, row)
{
"commands": function(column, row) {
var response = "<button type=\"button\" class=\"btn btn-xs btn-primary command-edit\" data-toggle='modal' data-target='#schedule-maintenance' data-schedule_id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " +
"<button type=\"button\" class=\"btn btn-xs btn-danger command-delete\" data-schedule_id=\"" + row.id + "\"><span class=\"fa fa-trash-o\"></span></button>";
if (row.status == 1) {
response = response + '<button type="button" class="btn btn-xs btn-danger" disabled>Lapsed</button>';
} else if (row.status == 2) {
response = response + '<button type="button" class="btn btn-xs btn-success" disabled>Current</button>';
}
return response;
},
"schedstatus": function(column, row) {
if (row.status == "1") {
response = '<span class="label label-danger">Lapsed</span>';
} else if (row.status == "2") {
response = '<span class="label label-success">Current</span>';
} else if (row.status == "0") {
response = '<span class="label label-warning">Set</span>';
}
return response;
}
},
},
templates: {
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
"<div class=\"col-sm-8 actionBar\"><span class=\"pull-left\">"+
@@ -73,22 +77,18 @@ var grid = $("#alert-schedule").bootgrid({
"<div class=\"col-sm-4 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div></div></div>"
},
rowCount: [50, 100, 250, -1],
post: function ()
{
post: function () {
return {
id: "alert-schedule",
};
},
url: "ajax_table.php"
}).on("loaded.rs.jquery.bootgrid", function()
{
}).on("loaded.rs.jquery.bootgrid", function() {
/* Executes after data is loaded and rendered */
grid.find(".command-edit").on("click", function(e)
{
grid.find(".command-edit").on("click", function(e) {
$('#schedule_id').val($(this).data("schedule_id"));
$("#schedule-maintenance").modal('show');
}).end().find(".command-delete").on("click", function(e)
{
}).end().find(".command-delete").on("click", function(e) {
$('#del_schedule_id').val($(this).data("schedule_id"));
$('#delete-maintenance').modal('show');
});