Add module visibility fix and configurable postal codes for saatavuus API

- Add 'hallinta' to ALL_MODULES so it appears in company settings
- Change fallback from ALL_MODULES to DEFAULT_MODULES (new modules not enabled by default)
- Hallinta tab requires both module enabled + superadmin role
- Add per-company configurable postal codes for "todennäköinen" availability
- Saatavuus API returns true/todennäköinen/false based on customer data + postal codes
- Show "Todennäköinen" badge in availability queries list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 20:10:21 +02:00
parent 6ea62b075f
commit 50f34ac37b
3 changed files with 52 additions and 11 deletions

View File

@@ -1760,6 +1760,11 @@
<label>Sallitut originit (CORS) - yksi per rivi</label>
<textarea id="settings-cors" rows="3" style="font-family:monospace;font-size:0.85rem;" placeholder="https://www.yritys.fi&#10;https://yritys.fi"></textarea>
</div>
<div class="form-group full-width">
<label>Todennäköinen saatavuus — postinumerot (yksi per rivi)</label>
<textarea id="settings-probable-postcodes" rows="3" style="font-family:monospace;font-size:0.85rem;" placeholder="20100&#10;20360&#10;20500"></textarea>
<small style="color:#888;">Jos osoitetta ei löydy asiakasrekisteristä, mutta postinumero on tällä listalla, palautetaan <code>"todennäköinen"</code>.</small>
</div>
<div class="form-group full-width">
<button class="btn-primary" id="btn-save-settings">Tallenna asetukset</button>
</div>
@@ -1777,7 +1782,9 @@
<div style="margin-bottom:0.75rem;"><strong>Esimerkki:</strong><br>
<code id="api-example-url">api.php?action=saatavuus&key=AVAIN&osoite=Esimerkkikatu+1&postinumero=00100&kaupunki=Helsinki</code></div>
<div><strong>Vastaus:</strong><br>
<code>{"saatavilla":true}</code> tai <code>{"saatavilla":false}</code></div>
<code>{"saatavilla":true}</code> — löytyy asiakasrekisteristä<br>
<code>{"saatavilla":"todennäköinen"}</code> — postinumero saatavuusalueella<br>
<code>{"saatavilla":false}</code> — ei löydy</div>
</div>
<h3 style="color:#0f3460;margin:1.5rem 0 1rem;border-bottom:2px solid #f0f2f5;padding-bottom:0.5rem;">Testaa API</h3>
<div style="display:grid;grid-template-columns:1fr;gap:0.5rem;max-width:500px;">
@@ -1965,6 +1972,9 @@
<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem;cursor:pointer;">
<input type="checkbox" data-module="netadmin"> NetAdmin
</label>
<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem;cursor:pointer;">
<input type="checkbox" data-module="hallinta"> Hallinta
</label>
<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem;cursor:pointer;">
<input type="checkbox" data-module="settings" checked> Asetukset / API
</label>