op25/op25/gr-op25_repeater/apps/oplog/op25/templates/editsys.html

152 lines
3.8 KiB
HTML

<!--
Copyright 2017, 2018 Max H. Parke KA1RBI
Copyright 2020, 2021 Michael Rose
This file is part of OP25
OP25 is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
OP25 is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with OP25; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Boston, MA
02110-1301, USA.
-->
{% include 'base.html' %}
{% block extra_stylesheets %}
<link href="static/css/datatables/jquery.dataTables-dark.css" rel="stylesheet">
{% endblock %}
{% block content %}
<div class="row-main">
<div class="side">
&nbsp;
</div> <!-- end side -->
<div class="main">
<div class="card mb-3 border-primary">
<h4 class="card-header">System Tags</h4>
<div class="card-body">
<p class="card-text">
</p>
<table id="op25_esd" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Record ID</th>
<th>System ID</th>
<th>System Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody></tbody>
</table>
<br><br>
<table style="width: 65%; padding: 0px;" class="border-primary">
<tr>
<td style="vertical-align: top;">
<div class="form-floating mb-3 primary">
<input type="text" width="10" class="form-control" id="newSysId" placeholder="">
<label for="floatingInput">System ID (hex)</label>
</div>
</td>
<td>
<div class="form-floating mb-3">
<input type="text" class="form-control" size="25" id="newSysTag" placeholder="">
<label for="floatingInput">System Tag</label>
</div>
</td>
</tr>
<tr>
<td style="text-align: left; vertical-align: top;">
<button class="btn btn-primary" onclick="this.blur; addNewSystemTag();">Add New</button>
</td>
</table>
</div>
</div>
{% include 'footer-links.html' %}
</div> <!-- end main -->
<div class="side">
&nbsp;
</div>
</div> <!-- end row -->
<!-- end secondary -->
</div>
<!-- end content -->
</div>
<br>
{% endblock %}
<!-- js moved to op25.js -->
{% block extra_javascripts %}
<script src="static/js/datatables/jquery.dataTables.js"></script>
<script>
$(document).ready(function () {
$('#startDate').prop('disabled', true );
$('#endDate').prop('disabled', true );
$('#op25_esd').DataTable({
"processing": true,
"serverSide": true,
'bFilter': false,
'paging': false,
"ajax": '/esd',
"columns": [
null,
{
"data": [1],
"render": function(data, type, row, meta){
if(type === 'display'){
data = data + ' - ' + hex(data).toUpperCase();
}
return data;
}
},
null,
{
"data": [3],
"render": function(data, type, row, meta){
if(type === 'display'){
data = '<button type="button" class="btn btn-primary btn-sm" onclick="this.blur(); editTagName(' + data + ', \'' + row[2] + '\')">Edit Tag</button>&nbsp;\
<button type="button" class="btn btn-primary btn-sm" onclick="window.location.href=\'\/dsd?id=' + data + '\'">Delete</button>';
}
return data;
},
"width": "150px"
}
]
});
});
function editTagName(id, t) {
var tag = prompt("Enter new system tag:", t);
if (tag == null || tag == '') {
return;
}
window.location.href='/usd?id=' + id + '&tag=' + tag;
}
</script>
{% endblock %}