Fix US County entry

This commit is contained in:
2026-01-20 05:08:28 -07:00
parent aa392272bd
commit 17713e08e5
2 changed files with 44 additions and 45 deletions

View File

@@ -110,7 +110,7 @@ if ($dxcc_list->result() > 0) {
<!-- US County -->
<div class="mb-3" id="location_us_county">
<label for="stationCntyInput"><?= __("Station County"); ?></label>
<label for="stationCntyInputEdit"><?= __("Station County"); ?></label>
<input type="text" class="form-control" name="station_cnty" id="stationCntyInputEdit" aria-describedby="stationCntyInputHelp" value="">
<small id="stationCntyInputHelp" class="form-text text-muted"><?= __("Station County (Only used for specific DXCCs)."); ?></small>
</div>

View File

@@ -10,7 +10,7 @@ $(document).ready(function () {
}
$('.btn-pwd-showhide').off('click').on('click', btn_pwd_showhide );
$("#station_locations_table").DataTable({
$('#station_locations_table').DataTable({
stateSave: true,
language: {
url: getDataTablesLanguageUrl(),
@@ -36,16 +36,15 @@ $(document).ready(function () {
'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) {
if (window.location.pathname.indexOf('/station/edit') !== -1 || window.location.pathname.indexOf('/station/create') !== -1 || window.location.pathname.indexOf('/station/copy') !== -1) {
updateStateDropdown('#dxcc_id', '#stateInputLabel', '#location_us_county', '#stationCntyInputEdit');
$('#location_us_county_edit').show();
$('#location_us_county').show();
var dxcc = $('#dxcc_id').val();
switch (dxcc) {
case '6':
case '110':
case '291':
$("#stationCntyInputEdit").prop('disabled', false);
$('#stationCntyInputEdit').prop('disabled', false);
selectize_usa_county('#stateDropdown', '#stationCntyInputEdit');
break;
case '15':
@@ -60,12 +59,13 @@ $(document).ready(function () {
case '29':
case '32':
case '281':
$("#stationCntyInputEdit").prop('disabled', false);
break;
$('#stationCntyInputEdit').prop('disabled', false);
break;
default:
$("#stationCntyInputEdit").prop('disabled', true);
}
$("#dxcc_id").change(function () {
$('#stationCntyInputEdit').prop('disabled', true);
}
$('#dxcc_id').change(function () {
updateStateDropdown('#dxcc_id', '#stateInputLabel', '#location_us_county', '#stationCntyInputEdit');
});
@@ -102,40 +102,39 @@ $(document).ready(function () {
},
});
});
}
});
$("#stateDropdown").change(function () {
var dxcc = $('#dxcc_id').val();
var state = $("#stateDropdown.form-select").val();
if (state != '') {
switch (dxcc) {
case '6':
case '110':
case '291':
$("#stationCntyInputEdit").prop('disabled', false);
break;
case '15':
case '54':
case '61':
case '126':
case '151':
case '288':
case '339':
case '170':
case '21':
case '29':
case '32':
case '281':
$("#stationCntyInputEdit").prop('disabled', false);
break;
default:
$("#stationCntyInputEdit").prop('disabled', true);
}
} else {
$("#stationCntyInputEdit").val('');
$("#stationCntyInputEdit").prop('disabled', true);
}
});
$('#stateDropdown').change(function () {
var dxcc = $('#dxcc_id').val();
var state = $('#stateDropdown.form-select').val();
if (state != '') {
switch (dxcc) {
case '6':
case '110':
case '291':
$('#stationCntyInputEdit').prop('disabled', false);
selectize_usa_county('#stateDropdown', '#stationCntyInputEdit');
break;
case '15':
case '54':
case '61':
case '126':
case '151':
case '288':
case '339':
case '170':
case '21':
case '29':
case '32':
case '281':
$('#stationCntyInputEdit').prop('disabled', false);
break;
default:
$('#stationCntyInputEdit').prop('disabled', true);
}
} else {
$('#stationCntyInputEdit').val('');
$('#stationCntyInputEdit').prop('disabled', true);
}
});