back button and null selection
This commit is contained in:
@@ -92,10 +92,14 @@ window.sendCommand = async function() {
|
|||||||
if (!town) return alert('Select a town first.');
|
if (!town) return alert('Select a town first.');
|
||||||
|
|
||||||
const type = document.getElementById('cmd-type').value;
|
const type = document.getElementById('cmd-type').value;
|
||||||
|
if (!type) return alert('Παρακαλώ επιλέξτε Ενέργεια (Command Type) πρώτα.');
|
||||||
|
|
||||||
let payload = {};
|
let payload = {};
|
||||||
|
|
||||||
if (type === 'build') {
|
if (type === 'build') {
|
||||||
const building_id = document.getElementById('building-select').value;
|
const building_id = document.getElementById('building-select').value;
|
||||||
|
if (!building_id) return alert('Παρακαλώ επιλέξτε Κατασκευή πρώτα.');
|
||||||
|
|
||||||
const bData = town.build_data?.[building_id];
|
const bData = town.build_data?.[building_id];
|
||||||
|
|
||||||
// UI Validation logic
|
// UI Validation logic
|
||||||
@@ -123,6 +127,8 @@ window.sendCommand = async function() {
|
|||||||
payload = { building_id };
|
payload = { building_id };
|
||||||
} else if (type === 'recruit') {
|
} else if (type === 'recruit') {
|
||||||
const unit_id = document.getElementById('unit-select').value;
|
const unit_id = document.getElementById('unit-select').value;
|
||||||
|
if (!unit_id) return alert('Παρακαλώ επιλέξτε Μονάδα προς εκπαίδευση.');
|
||||||
|
|
||||||
const amount = parseInt(document.getElementById('recruit-amount').value) || 1;
|
const amount = parseInt(document.getElementById('recruit-amount').value) || 1;
|
||||||
const uData = town.unit_data?.[unit_id];
|
const uData = town.unit_data?.[unit_id];
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ window.renderBuildingDropdown = function() {
|
|||||||
const bData = town.build_data || {};
|
const bData = town.build_data || {};
|
||||||
|
|
||||||
const currentVal = bSelect.value;
|
const currentVal = bSelect.value;
|
||||||
bSelect.innerHTML = '';
|
bSelect.innerHTML = '<option value="" disabled selected>-- Επιλέξτε Κατασκευή --</option>';
|
||||||
|
|
||||||
for (const [key, nameGr] of Object.entries(window.BUILDING_NAMES_GR)) {
|
for (const [key, nameGr] of Object.entries(window.BUILDING_NAMES_GR)) {
|
||||||
const level = bLevels[key] !== undefined ? bLevels[key] : "?";
|
const level = bLevels[key] !== undefined ? bLevels[key] : "?";
|
||||||
@@ -82,7 +82,7 @@ window.renderUnitDropdown = function() {
|
|||||||
const uData = town.unit_data || {};
|
const uData = town.unit_data || {};
|
||||||
|
|
||||||
const currentVal = uSelect.value;
|
const currentVal = uSelect.value;
|
||||||
uSelect.innerHTML = '';
|
uSelect.innerHTML = '<option value="" disabled selected>-- Επιλέξτε Μονάδα --</option>';
|
||||||
|
|
||||||
for (const [key, nameGr] of Object.entries(window.UNIT_NAMES_GR)) {
|
for (const [key, nameGr] of Object.entries(window.UNIT_NAMES_GR)) {
|
||||||
if (key === 'militia') continue;
|
if (key === 'militia') continue;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<h1>⚔️ Grepolis Remote</h1>
|
<h1><a href="/" style="text-decoration: none; margin-right: 15px; cursor: pointer;" title="Back to Players">⬅️</a> ⚔️ Grepolis Remote</h1>
|
||||||
<div class="status-indicator">
|
<div class="status-indicator">
|
||||||
<div id="server-status" class="conn-badge">Server…</div>
|
<div id="server-status" class="conn-badge">Server…</div>
|
||||||
<div id="client-status" class="conn-badge">Client…</div>
|
<div id="client-status" class="conn-badge">Client…</div>
|
||||||
@@ -88,6 +88,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Command Type</label>
|
<label>Command Type</label>
|
||||||
<select id="cmd-type" onchange="onCmdTypeChange()">
|
<select id="cmd-type" onchange="onCmdTypeChange()">
|
||||||
|
<option value="" disabled selected>-- Επιλέξτε --</option>
|
||||||
<option value="build">Build / Upgrade</option>
|
<option value="build">Build / Upgrade</option>
|
||||||
<option value="recruit">Recruit Troops</option>
|
<option value="recruit">Recruit Troops</option>
|
||||||
<option value="market_offer">Παζάρι - Προσφορά</option>
|
<option value="market_offer">Παζάρι - Προσφορά</option>
|
||||||
|
|||||||
Reference in New Issue
Block a user