diff --git a/script.js b/script.js
index 3f9c32e..714a64f 100644
--- a/script.js
+++ b/script.js
@@ -3274,12 +3274,12 @@ function renderIpam() {
// Vapaa-lohko (ei oikea entry, vaan laskettu vapaa tila)
if (r.isFree) {
- return `
+ return `
|
Vapaa
|
${esc(e.verkko)} |
- Käytettävissä |
+ Klikkaa varataksesi |
`;
}
@@ -3383,6 +3383,19 @@ function ipamDrillTo(index) {
renderIpam();
}
+async function ipamAddFromFree(verkko) {
+ document.getElementById('ipam-form-id').value = '';
+ document.getElementById('ipam-form').reset();
+ document.getElementById('ipam-form-tyyppi').value = 'subnet';
+ document.getElementById('ipam-form-verkko').value = verkko;
+ document.getElementById('ipam-form-tila').value = 'varattu';
+ await loadIpamSitesDropdown();
+ document.getElementById('ipam-modal-title').textContent = 'Lisää verkko / IP';
+ document.getElementById('ipam-modal').style.display = 'flex';
+ // Fokusoi nimi-kenttään koska verkko on jo täytetty
+ document.getElementById('ipam-form-nimi')?.focus();
+}
+
async function loadIpamSitesDropdown() {
try {
if (!sitesData || sitesData.length === 0) sitesData = await apiCall('sites');