back button and null selection

This commit is contained in:
2026-04-22 20:07:51 +03:00
parent d35e10d2b7
commit ec2b0c631e
3 changed files with 10 additions and 3 deletions

View File

@@ -92,10 +92,14 @@ window.sendCommand = async function() {
if (!town) return alert('Select a town first.');
const type = document.getElementById('cmd-type').value;
if (!type) return alert('Παρακαλώ επιλέξτε Ενέργεια (Command Type) πρώτα.');
let payload = {};
if (type === 'build') {
const building_id = document.getElementById('building-select').value;
if (!building_id) return alert('Παρακαλώ επιλέξτε Κατασκευή πρώτα.');
const bData = town.build_data?.[building_id];
// UI Validation logic
@@ -123,6 +127,8 @@ window.sendCommand = async function() {
payload = { building_id };
} else if (type === 'recruit') {
const unit_id = document.getElementById('unit-select').value;
if (!unit_id) return alert('Παρακαλώ επιλέξτε Μονάδα προς εκπαίδευση.');
const amount = parseInt(document.getElementById('recruit-amount').value) || 1;
const uData = town.unit_data?.[unit_id];