searchable dxcc for station profiles

This commit is contained in:
HB9HIL
2024-08-14 00:28:47 +02:00
parent 6915033c29
commit baf72b28e1
5 changed files with 41 additions and 3 deletions

View File

@@ -236,6 +236,7 @@ if($this->session->userdata('user_id') != null) {
<?php if ($this->uri->segment(1) == "station") { ?>
<script language="javascript" src="<?php echo base_url() ;?>assets/js/HamGridSquare.js"></script>
<script src="<?php echo base_url() ;?>assets/js/sections/station_locations.js"></script>
<script src="<?php echo base_url() ;?>assets/js/bootstrap-multiselect.js"></script>
<script>
var position;
function getLocation() {

View File

@@ -67,7 +67,7 @@ if ($dxcc_list->result() > 0) {
<div class="mb-3">
<label for="stationDXCCInput"><?= __("Station DXCC"); ?></label>
<?php if ($dxcc_list->num_rows() > 0) { ?>
<select class="form-select" id="dxcc_id" name="dxcc" aria-describedby="stationCallsignInputHelp">
<select class="form-control" id="dxcc_id" name="dxcc" aria-describedby="stationCallsignInputHelp">
<option value="0" selected><?php echo "- " . _pgettext("DXCC selection", "None") . " -"; ?></option>
<?php foreach ($dxcc_list->result() as $dxcc) { ?>
<option value="<?php echo $dxcc->adif; ?>"><?php echo ucwords(strtolower($dxcc->name)) . ' - ' . $dxcc->prefix; if ($dxcc->end != NULL) echo ' ('.__("Deleted DXCC").')';?>

View File

@@ -1,3 +1,23 @@
<script>
var dxccarray = [];
<?php
if ($dxcc_list->result() > 0) {
foreach ($dxcc_list->result() as $dxcc) {
?>
var dxcc = {
adif: <?php echo $dxcc->adif; ?>,
name: "<?php echo $dxcc->name; ?>",
cq: <?php echo $dxcc->cqz; ?>,
itu: <?php echo $dxcc->ituz; ?>,
};
dxccarray.push(dxcc);
<?php
}
}
?>
</script>
<div class="container" id="create_station_profile">
<br>
@@ -68,7 +88,7 @@
<div class="mb-3">
<label for="stationDXCCInput"><?= __("Station DXCC"); ?></label>
<?php if ($dxcc_list->num_rows() > 0) { ?>
<select class="form-select" id="dxcc_id" name="dxcc" aria-describedby="stationCallsignInputHelp">
<select class="form-control" id="dxcc_id" name="dxcc" aria-describedby="stationCallsignInputHelp">
<option value="0" <?php if($my_station_profile->station_dxcc == "0") { ?>selected<?php } ?>><?php echo "- " . _pgettext("DXCC selection", "None") . " -"; ?></option>
<?php foreach ($dxcc_list->result() as $dxcc) { ?>
<?php $isDeleted = $dxcc->end !== NULL; ?>

View File

@@ -1068,6 +1068,6 @@ label {
--bs-dropdown-padding-y: 0;
}
#dxcc + .btn-group .multiselect-container .multiselect-option input[type="radio"] {
.btn-group .multiselect-container .multiselect-option input[type="radio"] {
display: none;
}

View File

@@ -6,6 +6,23 @@ $(document).ready(function () {
},
});
$('#dxcc_id').multiselect({
// template is needed for bs5 support
templates: {
button: '<button type="button" style="text-align: left !important;" class="multiselect dropdown-toggle btn btn-secondary w-auto" data-bs-toggle="dropdown" aria-expanded="false"><span class="multiselect-selected-text"></span></button>',
},
enableFiltering: true,
enableFullValueFiltering: false,
enableCaseInsensitiveFiltering: true,
numberDisplayed: 1,
inheritClass: true,
buttonWidth: '100%',
maxHeight: 600
});
$('.multiselect-container .multiselect-filter', $('#dxcc_id').parent()).css({
'position': 'sticky', 'top': '0px', 'z-index': 1, 'background-color':'inherit', 'width':'100%', 'height':'37px'
})
if (window.location.pathname.indexOf("/station/edit") !== -1 || window.location.pathname.indexOf("/station/create") !== -1 || window.location.pathname.indexOf("/station/copy") !== -1) {
selectize_usa_county('#stateDropdown', '#stationCntyInputEdit');
updateStateDropdown('#dxcc_id', '#stateInputLabel', '#location_us_county', '#stationCntyInputEdit');