<th>${building.display}</th>
<td>${city[building.slug]}</td>
<td>
- <form hx-post="/build">
- <input type="number" size="6" name="amount" hx-post="/cost/construction" hx-trigger="keyup" hx-target="#${building.slug}-cost">
+ <form hx-post="/build" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" size="6" name="amount" hx-post="/cost/construction" hx-trigger="keyup" hx-target="#${building.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="building_type" value="${building.slug}">
<button type="submit">Build</button>
</form>
<th>Soldiers</th>
<td>${city.soldiers}</td>
<td>
- <form hx-post="/units">
- <input type="number" name="amount" size="6" max="${city.population}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.soldiers.slug}-cost">
+ <form hx-post="/units" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" name="amount" size="6" max="${city.population}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.soldiers.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="type" value="${unit.soldiers.slug}">
<button type="submit" ${city.population ? '' : 'disabled'}>Train</button>
</form>
<th>Attackers</th>
<td>${city.attackers}</td>
<td>
- <form hx-post="/units">
- <input type="number" name="amount" size="6" max="${city.soldiers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.attackers.slug}-cost">
+ <form hx-post="/units" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" name="amount" size="6" max="${city.soldiers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.attackers.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="type" value="${unit.attackers.slug}">
<button type="submit" ${city.soldiers ? '' : 'disabled'}>Train</button>
</form>
<th>Defenders</th>
<td>${city.defenders}</td>
<td>
- <form hx-post="/units">
- <input type="number" name="amount" size="6" max="${city.soldiers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.defenders.slug}-cost">
+ <form hx-post="/units" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" name="amount" size="6" max="${city.soldiers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.defenders.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="type" value="${unit.defenders.slug}">
<button type="submit" ${city.soldiers ? '' : 'disabled'}>Train</button>
</form>
<th>Special Attackers</th>
<td>${city.sp_attackers}</td>
<td>
- <form hx-post="/units">
- <input type="number" name="amount" size="6" max="${city.attackers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.sp_attackers.slug}-cost">
+ <form hx-post="/units" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" name="amount" size="6" max="${city.attackers}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.sp_attackers.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="type" value="${unit.sp_attackers.slug}">
<button type="submit" ${city.attackers ? '': 'disabled'}>Train</button>
</form>
<th>Special Defenders</th>
<td>${city.sp_defenders}</td>
<td>
- <form hx-post="/units">
- <input type="number" name="amount" size="6" max="${city.defenders}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.sp_defenders.slug}-cost">
+ <form hx-post="/units" hx-swap="innerHTML" hx-target="#notifications">
+ <input type="number" name="amount" size="6" max="${city.defenders}" hx-trigger="keyup" hx-post="/cost/training" hx-target="#${unit.sp_defenders.slug}-cost" hx-swap="innerHTML">
<input type="hidden" name="type" value="${unit.sp_defenders.slug}">
<button type="submit" ${city.defenders ? '': 'disabled'}>Train</button>
</form>
// validate that they have enough empty construction queues
const concurrentConstruction = await this.buildQueue.list(city.owner);
if(concurrentConstruction.length >= city.max_construction_queue) {
- throw new InsufficientResourceError('Training queues', concurrentConstruction.length + 1, city.max_construction_queue);
+ throw new InsufficientResourceError('Construction queues', concurrentConstruction.length + 1, city.max_construction_queue);
}
city.usedSpace += (building.land * amount);