Apply LoTW hint color to advanced logbook

pull/2219/head
phl0 2023-06-20 21:39:16 +02:00
rodzic 2994012543
commit 64eddd3b24
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 48EA1E640798CA9A
2 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -26,7 +26,7 @@ function updateRow(qso) {
let c = 1;
cells.eq(c++).text(qso.qsoDateTime);
cells.eq(c++).text(qso.de);
cells.eq(c++).html('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + '">L</small>'));
cells.eq(c++).html('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success'+qso.lotw_hint+'" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + '">L</small>'));
cells.eq(c++).text(qso.mode);
cells.eq(c++).text(qso.rstS);
cells.eq(c++).text(qso.rstR);
@ -81,7 +81,7 @@ function loadQSOTable(rows) {
data.push('<div class="form-check"><input class="form-check-input" type="checkbox" /></div>');
data.push(qso.qsoDateTime);
data.push(qso.de);
data.push('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + ' ">L</small>'));
data.push('<a id="edit_qso" href="javascript:displayQso('+qso.qsoID+')">'+qso.dx+'</a>' + (qso.callsign == '' ? '' : ' <small id="lotw_info" class="badge badge-success'+qso.lotw_hint+'" data-toggle="tooltip" data-original-title="LoTW User. Last upload was ' + qso.lastupload + ' ">L</small>'));
data.push(qso.mode);
data.push(qso.rstS);
data.push(qso.rstR);

Wyświetl plik

@ -62,6 +62,7 @@ class QSO
/** Lotw callsign info **/
private string $callsign;
private string $lastupload;
private string $lotw_hint;
/**
* @param array $data Does no validation, it's assumed to be a row from the database in array format
@ -195,6 +196,19 @@ class QSO
}
$this->callsign = ($data['callsign'] === null) ? '' :$data['callsign'];
$this->lastupload = ($data['lastupload'] === null) ? '' : date($custom_date_format . " H:i", strtotime($data['lastupload']));
$lotw_hint = '';
if ($data['lastupload'] !== null) {
$diff = time();
$diff = (time() - strtotime($data['lastupload'])) / 86400;
if ($diff > 365) {
$lotw_hint = ' lotw_info_red';
} elseif ($diff > 30) {
$lotw_hint = ' lotw_info_orange';
} elseif ($diff > 7) {
$lotw_hint = ' lotw_info_yellow';
}
}
$this->lotw_hint = $lotw_hint;
}
@ -776,6 +790,7 @@ class QSO
'end' => $this->end === null ? null : $this->end->format("Y-m-d"),
'callsign' => $this->callsign,
'lastupload' => $this->lastupload,
'lotw_hint' => $this->lotw_hint,
];
}