Make bot token also per-company with global fallback

Both bot_token and chat_id are now per-company. If a company
doesn't set its own bot_token, falls back to the global one.
Removed parenthetical hints from labels, all admins can now
configure their own Telegram bot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 19:08:58 +02:00
parent 20a2b78782
commit acd3591544
3 changed files with 34 additions and 29 deletions

View File

@@ -2735,12 +2735,9 @@ async function loadSettings() {
const key = config.api_key || 'AVAIN';
document.getElementById('api-example-url').textContent = `api.php?action=saatavuus&key=${key}&osoite=Esimerkkikatu+1&postinumero=00100&kaupunki=Helsinki`;
// Telegram-asetukset
// Telegram-asetukset (yrityskohtaiset)
document.getElementById('settings-telegram-token').value = config.telegram_bot_token || '';
document.getElementById('settings-telegram-chat').value = config.telegram_chat_id || '';
// Bot Token vain superadminille
const tokenGroup = document.getElementById('telegram-token-group');
if (tokenGroup) tokenGroup.style.display = currentUser?.role === 'superadmin' ? '' : 'none';
} catch (e) { console.error(e); }
// Lataa saatavuuskyselyt