Notes: layout change

This commit is contained in:
Szymon Porwolik
2025-10-08 23:33:55 +02:00
parent 55bf57a851
commit 314889e991
4 changed files with 66 additions and 20 deletions

View File

@@ -302,6 +302,11 @@ function stopImpersonate_modal() {
<script src="<?php echo base_url() ;?>assets/js/sections/notes.js"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "qso" ) { ?>
<!-- Javascript used for QSO Notes Area -->
<script src="<?php echo base_url() ;?>assets/plugins/easymde/easymde.min.js"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "notes" && ($this->uri->segment(2) == "view") ) { ?>
<!-- Javascript used for Notes Area -->
<script src="<?php echo base_url() ;?>assets/plugins/easymde/easymde.min.js"></script>

View File

@@ -38,7 +38,7 @@
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/query-builder.default.min.css" />
<?php } ?>
<?php if ($this->uri->segment(1) == "notes" && ($this->uri->segment(2) == "add" || $this->uri->segment(2) == "edit" || $this->uri->segment(2) == "view")) { ?>
<?php if (($this->uri->segment(1) == "notes" && ($this->uri->segment(2) == "add" || $this->uri->segment(2) == "edit" || $this->uri->segment(2) == "view")) || $this->uri->segment(1) == "qso") { ?>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/plugins/easymde/easymde.css" />
<?php } ?>

View File

@@ -68,7 +68,7 @@ switch ($date_format) {
<?php } ?>
<li class="nav-item">
<a class="nav-link" id="notes-tab" data-bs-toggle="tab" href="#nav-notes" role="tab" aria-controls="notes" aria-selected="false"><?= __("Notes"); ?></a>
<a class="nav-link" id="notes-tab" data-bs-toggle="tab" href="#nav-notes" role="tab" aria-controls="notes" aria-selected="false"><?= __("Comment"); ?></a>
</li>
<li class="nav-item">
@@ -154,8 +154,7 @@ switch ($date_format) {
<!-- Callsign Input -->
<div class="row">
<div class="mb-3 col-md-12">
<label for="callsign"><?= __("Callsign"); ?></label>&nbsp;<i id="check_cluster" data-bs-toggle="tooltip" title="<?= __("Search DXCluster for latest Spot"); ?>" class="fas fa-search"></i></label>
<?php if ($this->session->userdata('user_show_notes')==1) { ?>&nbsp;<i id="note_create_edit" data-bs-toggle="tooltip" title="" class="fas fa-sticky-note text-secondary"></i><?php } ?>
<label for="callsign"><?= __("Callsign"); ?></label>&nbsp;<i id="check_cluster" data-bs-toggle="tooltip" title="<?= __("Search DXCluster for latest Spot"); ?>" class="fas fa-search"></i></label>&nbsp;<i id="note_create_edit" style="display:none;" data-bs-toggle="tooltip" title="" class="fas fa-sticky-note"></i>
<div class="input-group">
<input tabindex="7" type="text" class="form-control uppercase" id="callsign" name="callsign" autocomplete="off" required>
<span id="qrz_info" class="input-group-text btn-included-on-field d-none py-0"></span>
@@ -602,8 +601,6 @@ switch ($date_format) {
<input class="form-control" id="email" type="text" name="email" value="" />
<small id="MailHelp" class="form-text text-muted"><?= __("E-mail address of QSO-partner"); ?></small>
</div>
</div>
<!-- Satellite Panel -->
@@ -637,10 +634,10 @@ switch ($date_format) {
</div>
</div>
<!-- Notes Panel Contents -->
<!-- Comment Panel Contents -->
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="notes-tab">
<div class="mb-3">
<label for="notes"><?= __("Notes"); ?></label>
<label for="notes"><?= __("Comment"); ?></label>
<textarea type="text" class="form-control" id="notes" name="notes" rows="10"></textarea>
<div class="small form-text text-muted"><?= __("Note: Gets exported to third-party services.") ?></div>
</div>
@@ -710,9 +707,25 @@ switch ($date_format) {
</div>
</form>
</div>
<!--- Notes --->
<?php if ($this->session->userdata('user_show_notes')==1) { ?>
<div class="card callsign-notes" id="callsign-notes">
<div class="card-header">
<h4 style="font-size: 16px; font-weight: bold;" class="card-title">
<?= __("Callsign Notes"); ?>
<span class="ms-1" data-bs-toggle="tooltip" title="<?= __("Callsign Notes let you store information about your QSO partner. They are private, not shared, and never exported to external services.") ?>">
<i class="fa fa-question-circle"></i>
</span>
</h4>
</div>
<div class="card-body">
<textarea id="callsign_note_content" name="callsign_note_content"></textarea>
</div>
</div>
<?php } ?>
</div>
<div class="col-sm-7">
<div id="noticer" role="alert"></div>

View File

@@ -74,21 +74,29 @@ function getUTCDateStamp(el) {
}
// Note icon state logic
function setNoteIconState(state) {
function setNotesVisibility(state) {
var $icon = $('#note_create_edit');
$icon.removeClass('text-secondary text-info');
$icon.removeAttr('data-bs-original-title');
$icon.removeAttr('title');
if (state == 2) {
// Callsign with existing note
$icon.show();
$icon.addClass('text-info');
$icon.attr('data-bs-original-title', lang_qso_note_edit);
$('#callsign-notes').show();
} else if (state == 1) {
// Callsign, no note yet
$icon.show();
$icon.attr('data-bs-original-title', lang_qso_note_add);
// do nothing - white icon
$('#callsign-notes').show();
} else {
$icon.addClass('text-secondary');
// No callsign - hide icon
$icon.hide();
$icon.attr('data-bs-original-title', lang_qso_note_no_callsign);
$('#callsign-notes').hide();
}
// If Bootstrap tooltip is initialized, update it
if ($icon.data('bs.tooltip')) {
$icon.tooltip('dispose').tooltip();
@@ -912,7 +920,7 @@ function reset_fields() {
clearTimeout();
set_timers();
resetTimers(qso_manual);
setNoteIconState(0); // Always gray out note icon on reset
setNotesVisibility(0); // Always gray out note icon on reset
}
// Set note icon state: 0 = gray, 1 = empty, 2 = filled based on callsign
@@ -928,9 +936,9 @@ function get_note_icon(callsign){
try { data = JSON.parse(data); } catch (e) { data = {}; }
}
if (data && data.exists === true) {
setNoteIconState(2);
setNotesVisibility(2);
} else {
setNoteIconState(1);
setNotesVisibility(1);
}
}
);
@@ -2159,7 +2167,7 @@ function resetDefaultQSOFields() {
$('.awardpane').remove();
$('#timesWorked').html(lang_qso_title_previous_contacts);
setNoteIconState(0); // Always gray out note icon on reset
setNotesVisibility(0); // Always gray out note icon on reset
}
function closeModal() {
@@ -2222,7 +2230,7 @@ $(document).ready(function () {
set_timers();
updateStateDropdown('#dxcc_id', '#stateInputLabel', '#location_us_county', '#stationCntyInputQso');
setNoteIconState(0); /// Grey-out note icon
setNotesVisibility(0); /// Grey-out note icon
// Clear the localStorage for the qrg units, except the quicklogCallsign and a possible backlog
clearQrgUnits();
@@ -2482,6 +2490,26 @@ $(document).ready(function () {
);
});
if (document.getElementById('callsign_note_content')) {
if (typeof EasyMDE !== 'undefined') {
new EasyMDE({
element: document.getElementById('callsign_note_content'),
spellChecker: false,
toolbar: [
"bold", "italic", "heading", "|","preview", "|",
"quote", "unordered-list", "ordered-list", "|",
"link", "image", "|",
"guide"
],
forceSync: true,
status: false,
maxHeight: '250px',
autoDownloadFontAwesome: false,
});
}
}
// everything loaded and ready 2 go
bc.postMessage('ready');
});
bc.postMessage('ready');
});