mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added JS-Handling and language-vars
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
<script>
|
||||
var lang_edge_invalid_number = "<?= __("Please enter valid numbers for frequency"); ?>";
|
||||
var lang_edge_from_gt_to = "<?= __("The 'From' frequency must be less than the 'To' frequency."); ?>";
|
||||
var lang_edge_overlap = "<?= __("The Frequency overlaps with an existing entry."); ?>";
|
||||
var lang_edge_remove = "<?= __("Are you sure you want to delete this band edge?"); ?>";
|
||||
</script>
|
||||
<div class="container">
|
||||
|
||||
<br>
|
||||
|
||||
@@ -45,7 +45,7 @@ function saveChanges(id) {
|
||||
if (!$.isNumeric(frequencyfrom) || !$.isNumeric(frequencyto)) {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: "Please enter valid numbers for frequency.",
|
||||
message: lang_edge_invalid_number,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
@@ -59,7 +59,7 @@ function saveChanges(id) {
|
||||
if (frequencyfrom >= frequencyto) {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: "The 'From' frequency must be less than the 'To' frequency.",
|
||||
message: lang_edge_from_gt_to,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
@@ -81,12 +81,24 @@ function saveChanges(id) {
|
||||
'mode': mode,
|
||||
},
|
||||
success: function (data) {
|
||||
// todo: reload table if data.message == 'OK'
|
||||
// todo: else show warning "oerlap" and reload aswell
|
||||
response=JSON.parse(data);
|
||||
console.log(response);
|
||||
if ((response.message ?? '') !== 'OK') {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: lang_edge_overlap,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
btnOKClass: 'btn-info',
|
||||
callback: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
restoreLine(id);
|
||||
restoreLine(id);
|
||||
}
|
||||
|
||||
function cancelChanges(id) {
|
||||
@@ -120,7 +132,7 @@ function restoreLine(id) {
|
||||
function deleteBandEdge(id) {
|
||||
BootstrapDialog.confirm({
|
||||
title: lang_general_word_danger,
|
||||
message: 'Are you sure you want to delete this band edge?',
|
||||
message: lang_edge_remove,
|
||||
type: BootstrapDialog.TYPE_DANGER,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
@@ -170,14 +182,14 @@ function addBandEdgeRow() {
|
||||
}
|
||||
|
||||
function saveNewBandEdgeRow() {
|
||||
var frequencyfrom = $('#new_frequencyfrom').val();
|
||||
var frequencyto = $('#new_frequencyto').val();
|
||||
var mode = $('#new_mode').val();
|
||||
var frequencyfrom = $('#new_frequencyfrom').val();
|
||||
var frequencyto = $('#new_frequencyto').val();
|
||||
var mode = $('#new_mode').val();
|
||||
|
||||
if (!$.isNumeric(frequencyfrom) || !$.isNumeric(frequencyto)) {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: "Please enter valid numbers for frequency.",
|
||||
message: lang_edge_invalid_number,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
@@ -191,7 +203,7 @@ function saveNewBandEdgeRow() {
|
||||
if (frequencyfrom >= frequencyto) {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: "The 'From' frequency must be less than the 'To' frequency.",
|
||||
message: lang_edge_from_gt_to,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
@@ -204,17 +216,33 @@ function saveNewBandEdgeRow() {
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/band/savebandedge',
|
||||
type: 'post',
|
||||
data: {
|
||||
'frequencyfrom': frequencyfrom,
|
||||
'frequencyto': frequencyto,
|
||||
'mode': mode,
|
||||
url: base_url + 'index.php/band/saveBandEdge',
|
||||
type: 'post',
|
||||
data: {
|
||||
'frequencyfrom': frequencyfrom,
|
||||
'frequencyto': frequencyto,
|
||||
'mode': mode,
|
||||
},
|
||||
success: function (html) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
success: function (data) {
|
||||
response=JSON.parse(data);
|
||||
console.log(response);
|
||||
if ((response.message ?? '') !== 'OK') {
|
||||
BootstrapDialog.alert({
|
||||
title: 'INFO',
|
||||
message: lang_edge_overlap,
|
||||
type: BootstrapDialog.TYPE_INFO,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
btnOKClass: 'btn-info',
|
||||
callback: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelNewBandEdgeRow() {
|
||||
|
||||
Reference in New Issue
Block a user