librenms-librenms/includes/html/modal/alert_notes.inc.php
Tony Murray 3d62be5003 Jquery upgrade (#12802)
* WIP js upgrades

* trying 3.0

* Event handler changes

* fix alert rule collection loading

* blur fix

* jQuery 3.5
homescreen no warnings

* actually 3.6 include js

* Update bootstrap to 3.4.1

* missed file

* Update and test install process

* cleanup

* attempt to version js files that were updated.
2021-05-11 08:08:06 -05:00

68 lines
2.6 KiB
PHP

<form>
<?php echo csrf_field() ?>
<div class="modal fade" id="alert_notes_modal" tabindex="-1" role="dialog" aria-labelledby="alert_notes" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h5 class="modal-title" id="alert_notes">Alert notes</h5>
</div>
<div class="modal-body">
<div class="row">
<div class='col-sm-12'>
<div class="form-group">
<textarea class="form-control" id="note" name="note" rows="15"></textarea>
</div>
</div>
</div>
<div class="row">
<div class='col-sm-12'>
<div class="form-group">
<input type="hidden" id="alert_id" name="alert_id" value="">
<button class="btn btn-success" id="save-alert-notes" name="save-alert-notes">Save notes</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
$('#alert_notes_modal').on('show.bs.modal', function (event) {
var alert_id = $("#alert_id").val();
$.ajax({
type: "POST",
url: "ajax_form.php",
data: { type: "alert-notes", alert_id: alert_id, sub_type: 'get_note'},
dataType: "json",
success: function (data) {
$("#note").val(data.note);
}
});
});
$("#save-alert-notes").on("click", function(event) {
event.preventDefault();
var alert_id = $("#alert_id").val();
var note = $("#note").val();
$.ajax({
type: "POST",
url: "ajax_form.php",
data: { type: "alert-notes", alert_id: alert_id, sub_type: 'set_note', note: note},
dataType: "json",
success: function (data) {
if (data.status == 'ok') {
toastr.success(data.message);
$("#alert_notes_modal").modal('hide');
} else {
toastr.error(data.message);
}
},
error: function() {
toastr.error(data.message);
}
});
});
</script>