Noxus-logo + API-tabi piiloon ilman integraatioita
- Luotu Noxus SVG-logo (violetti heksagoni + N) - Demo-yritys nimetty uudelleen Noxukseksi violetilla värillä - API-tabi piilotettuna ellei yrityksellä ole integraatioita päällä (superadmin näkee aina) - check_auth palauttaa has_integrations-lipun Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
9
api.php
9
api.php
@@ -1612,6 +1612,14 @@ switch ($action) {
|
||||
if (!$branding) {
|
||||
$branding = ['found' => false, 'nimi' => 'Noxus Intra', 'primary_color' => '#0f3460', 'subtitle' => 'Hallintapaneeli', 'logo_url' => ''];
|
||||
}
|
||||
// Tarkista onko yrityksellä integraatioita päällä
|
||||
$hasIntegrations = false;
|
||||
if ($activeCompanyId) {
|
||||
$integrations = dbLoadIntegrations($activeCompanyId);
|
||||
foreach ($integrations as $integ) {
|
||||
if (!empty($integ['enabled'])) { $hasIntegrations = true; break; }
|
||||
}
|
||||
}
|
||||
echo json_encode([
|
||||
'authenticated' => true,
|
||||
'user_id' => $_SESSION['user_id'],
|
||||
@@ -1626,6 +1634,7 @@ switch ($action) {
|
||||
'branding' => $branding,
|
||||
'enabled_modules' => $enabledModules,
|
||||
'hidden_mailboxes' => $u ? ($u['hidden_mailboxes'] ?? []) : [],
|
||||
'has_integrations' => $hasIntegrations,
|
||||
]);
|
||||
} else {
|
||||
echo json_encode(['authenticated' => false]);
|
||||
|
||||
30
noxus-logo.svg
Normal file
30
noxus-logo.svg
Normal file
@@ -0,0 +1,30 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 280 60" fill="none">
|
||||
<defs>
|
||||
<linearGradient id="iconGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#6C3CE0"/>
|
||||
<stop offset="100%" style="stop-color:#3B82F6"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="dotGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#8B5CF6"/>
|
||||
<stop offset="100%" style="stop-color:#06B6D4"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Icon: Hexagonal N -->
|
||||
<g transform="translate(5, 3)">
|
||||
<!-- Hexagon background -->
|
||||
<path d="M27 0L50.38 13.5V40.5L27 54L3.62 40.5V13.5L27 0Z" fill="url(#iconGrad)" rx="3"/>
|
||||
<!-- Letter N inside -->
|
||||
<text x="27" y="36" text-anchor="middle" font-family="system-ui, -apple-system, 'Segoe UI', sans-serif" font-weight="800" font-size="32" fill="white" letter-spacing="-1">N</text>
|
||||
</g>
|
||||
|
||||
<!-- Wordmark: NOXUS -->
|
||||
<g transform="translate(65, 10)">
|
||||
<text y="34" font-family="system-ui, -apple-system, 'Segoe UI', sans-serif" font-weight="700" font-size="38" fill="#1E1B4B" letter-spacing="2">
|
||||
<tspan>NOX</tspan><tspan fill="url(#iconGrad)">US</tspan>
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Accent dot -->
|
||||
<circle cx="258" cy="44" r="4" fill="url(#dotGrad)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
21
script.js
21
script.js
@@ -145,7 +145,7 @@ async function checkAuth() {
|
||||
currentUserSignatures = data.signatures || {};
|
||||
currentHiddenMailboxes = data.hidden_mailboxes || [];
|
||||
if (data.branding) applyBranding(data.branding);
|
||||
applyModules(data.enabled_modules || []);
|
||||
applyModules(data.enabled_modules || [], data.has_integrations);
|
||||
showDashboard();
|
||||
return;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ async function switchCompany(companyId) {
|
||||
try {
|
||||
const auth = await apiCall('check_auth');
|
||||
if (auth.branding) applyBranding(auth.branding);
|
||||
applyModules(auth.enabled_modules || []);
|
||||
applyModules(auth.enabled_modules || [], auth.has_integrations);
|
||||
currentUser.company_role = auth.company_role || '';
|
||||
currentUserSignatures = auth.signatures || {};
|
||||
currentHiddenMailboxes = auth.hidden_mailboxes || [];
|
||||
@@ -2872,7 +2872,14 @@ document.getElementById('btn-save-company-settings').addEventListener('click', a
|
||||
nimi, subtitle, primary_color,
|
||||
logo_url: comp?.logo_file ? 'api.php?action=company_logo&company_id=' + encodeURIComponent(currentCompanyDetail) + '&t=' + Date.now() : ''
|
||||
});
|
||||
applyModules(enabled_modules);
|
||||
// Tarkista integraatiot API-tabin näkyvyydelle
|
||||
try {
|
||||
const integs = await apiCall('integrations');
|
||||
const hasIntegs = integs.some(i => i.enabled);
|
||||
applyModules(enabled_modules, hasIntegs);
|
||||
} catch (e2) {
|
||||
applyModules(enabled_modules, false);
|
||||
}
|
||||
}
|
||||
} catch (e) { alert(e.message); }
|
||||
});
|
||||
@@ -6229,7 +6236,7 @@ document.getElementById('laitetila-edit-form')?.addEventListener('submit', async
|
||||
const ALL_MODULES = ['customers', 'support', 'leads', 'tekniikka', 'ohjeet', 'todo', 'documents', 'laitetilat', 'netadmin', 'archive', 'changelog', 'settings'];
|
||||
const DEFAULT_MODULES = ['customers', 'support', 'archive', 'changelog', 'settings'];
|
||||
|
||||
function applyModules(modules) {
|
||||
function applyModules(modules, hasIntegrations) {
|
||||
// Yhteensopivuus: vanha 'devices' → 'tekniikka'
|
||||
if (modules && modules.includes('devices') && !modules.includes('tekniikka')) {
|
||||
modules = modules.map(m => m === 'devices' ? 'tekniikka' : m);
|
||||
@@ -6237,12 +6244,14 @@ function applyModules(modules) {
|
||||
// Jos tyhjä array → kaikki moduulit päällä (fallback)
|
||||
const enabled = (modules && modules.length > 0) ? modules : ALL_MODULES;
|
||||
const isAdminUser = isCurrentUserAdmin();
|
||||
const isSuperAdmin = currentUser?.role === 'superadmin';
|
||||
ALL_MODULES.forEach(mod => {
|
||||
const tabBtn = document.querySelector(`.tab[data-tab="${mod}"]`);
|
||||
if (tabBtn) {
|
||||
// settings-tabi näkyy vain adminille/superadminille
|
||||
// settings/API-tabi: adminille/superadminille, ja vain jos integraatioita on päällä (superadmin näkee aina)
|
||||
if (mod === 'settings') {
|
||||
tabBtn.style.display = (enabled.includes(mod) && isAdminUser) ? '' : 'none';
|
||||
const showSettings = enabled.includes(mod) && isAdminUser && (isSuperAdmin || hasIntegrations === true);
|
||||
tabBtn.style.display = showSettings ? '' : 'none';
|
||||
} else {
|
||||
tabBtn.style.display = enabled.includes(mod) ? '' : 'none';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user