Implemented toast notifications, improved translation

This commit is contained in:
Szymon Porwolik
2025-10-28 19:14:18 +01:00
parent ea9f06c80c
commit 68f43b33e5
3 changed files with 16 additions and 21 deletions

View File

@@ -35,6 +35,8 @@
var lang_general_word_error = "<?= __("ERROR"); ?>";
var lang_general_word_attention = "<?= __("Attention"); ?>";
var lang_general_word_warning = "<?= __("Warning"); ?>";
var lang_general_word_success = "<?= __("Success"); ?>";
var lang_general_word_info = "<?= __("Info"); ?>";
var lang_general_word_cancel = "<?= __("Cancel"); ?>";
var lang_general_word_ok = "<?= __("OK"); ?>";
var lang_general_word_search = "<?= __("Search"); ?>";
@@ -74,6 +76,8 @@
var lang_qso_note_created = "<?= __("Note created successfully"); ?>";
var lang_qso_note_saved = "<?= __("Note saved successfully"); ?>";
var lang_qso_note_error_saving = "<?= __("Error saving note"); ?>";
var lang_qso_added = "<?= __("QSO with %s by %s was added to logbook."); ?>";
var lang_qso_added_to_backlog = "<?= __("QSO Added to Backlog"); ?>";
</script>
<!-- General JS Files used across Wavelog -->

View File

@@ -737,7 +737,6 @@ switch ($date_format) {
</div>
<div class="col-sm-7">
<div id="noticer" role="alert"></div>
<?php if($notice) { ?>
<div id="notice-alerts" class="alert alert-info" role="alert">
<?php echo $notice; ?>

View File

@@ -252,10 +252,7 @@ function set_timers() {
function invalidAntEl() {
var saveQsoButtonText = $("#saveQso").html();
$("#noticer").removeClass("");
$("#noticer").addClass("alert alert-warning");
$("#noticer").html(lang_invalid_ant_el+" "+parseFloat($("#ant_el").val()).toFixed(1));
$("#noticer").show();
showToast(lang_general_word_warning, lang_invalid_ant_el+" "+parseFloat($("#ant_el").val()).toFixed(1), 'bg-warning text-dark', 5000);
$("#saveQso").html(saveQsoButtonText).prop("disabled", false);
}
@@ -281,29 +278,26 @@ $("#qso_input").off('submit').on('submit', function (e) {
activeStationId = result.activeStationId;
activeStationOP = result.activeStationOP;
activeStationTXPower = result.activeStationTXPower;
$("#noticer").removeClass("");
$("#noticer").addClass("alert alert-info");
$("#noticer").html("QSO Added");
$("#noticer").show();
// Build dynamic success message
var contactCallsign = $("#callsign").val().toUpperCase();
var operatorCallsign = activeStationOP || station_callsign;
var successMessage = lang_qso_added
.replace('%s', contactCallsign)
.replace('%s', operatorCallsign);
showToast(lang_general_word_success, successMessage, 'bg-success text-white', 5000);
prepare_next_qso(saveQsoButtonText);
$("#noticer").fadeOut(2000);
processBacklog(); // If we have success with the live-QSO, we could also process the backlog
} else {
$("#noticer").removeClass("");
$("#noticer").addClass("alert alert-warning");
$("#noticer").html(result.errors);
$("#noticer").show();
showToast(lang_general_word_error, result.errors, 'bg-danger text-white', 5000);
$("#saveQso").html(saveQsoButtonText).prop("disabled", false);
}
},
error: function () {
saveToBacklog(JSON.stringify(this.data),manual_addon);
prepare_next_qso(saveQsoButtonText);
$("#noticer").removeClass("");
$("#noticer").addClass("alert alert-info");
$("#noticer").html("QSO Added to Backlog");
$("#noticer").show();
$("#noticer").fadeOut(5000);
showToast(lang_general_word_info, lang_qso_added_to_backlog, 'bg-info text-dark', 5000);
}
});
}
@@ -1048,8 +1042,6 @@ function get_note_status(callsign){
$("#callsign").on("focusout", function () {
if ($(this).val().length >= 3 && preventLookup == false) {
$("#noticer").fadeOut(1000);
/* Find and populate DXCC */
$('.callsign-suggest').hide();