feat: make "Twoja firma" card clickable on dashboard
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Single company: links directly to company profile.
Multiple companies: opens picker modal with company list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-19 14:13:22 +01:00
parent b5211c63d6
commit be04cc0348

View File

@ -641,7 +641,13 @@
<!-- Stats Row -->
<div class="stats-row">
{% if user_companies|length == 1 and user_companies[0].company %}
<a href="{{ url_for('company_detail', slug=user_companies[0].company.slug) }}" class="dashboard-card" style="text-decoration: none; color: inherit; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;" onmouseover="this.style.transform='translateY(-2px)';this.style.boxShadow='var(--shadow-lg, 0 4px 12px rgba(0,0,0,0.1))'" onmouseout="this.style.transform='';this.style.boxShadow=''">
{% elif user_companies|length > 1 %}
<div class="dashboard-card" style="cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;" onclick="document.getElementById('companyPickerModal').classList.add('active')" onmouseover="this.style.transform='translateY(-2px)';this.style.boxShadow='var(--shadow-lg, 0 4px 12px rgba(0,0,0,0.1))'" onmouseout="this.style.transform='';this.style.boxShadow=''">
{% else %}
<div class="dashboard-card">
{% endif %}
<div class="stat-card-body">
<div class="stat-icon bg-primary" style="margin: 0 auto var(--spacing-sm, 8px);">
<svg width="28" height="28" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
@ -656,7 +662,11 @@
{% endif %}
<small>{{ 'Profile firmowe' if user_companies|length > 1 else 'Profil firmowy' }}</small>
</div>
{% if user_companies|length == 1 and user_companies[0].company %}
</a>
{% else %}
</div>
{% endif %}
<div class="dashboard-card">
<div class="stat-card-body">
@ -1213,6 +1223,39 @@
</div>
</div>
<!-- Company Picker Modal (for users with multiple companies) -->
{% if user_companies|length > 1 %}
<div class="modal-overlay" id="companyPickerModal" onclick="if(event.target===this)this.classList.remove('active')">
<div class="modal" style="max-width: 480px; background: var(--surface, white); border-radius: var(--radius-lg, 12px); padding: var(--spacing-xl, 24px);">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--spacing-lg, 20px);">
<h3 style="margin: 0; font-size: 1.15rem;">Wybierz firmę</h3>
<button type="button" onclick="document.getElementById('companyPickerModal').classList.remove('active')" style="background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-secondary);">
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<div style="display: flex; flex-direction: column; gap: var(--spacing-sm, 8px);">
{% for uc in user_companies %}
{% if uc.company %}
<a href="{{ url_for('company_detail', slug=uc.company.slug) }}" style="display: flex; align-items: center; gap: var(--spacing-md, 12px); padding: var(--spacing-md, 12px); background: var(--background, #f9fafb); border-radius: var(--radius, 8px); text-decoration: none; color: inherit; border: 2px solid transparent; transition: border-color 0.15s, background 0.15s;" onmouseover="this.style.borderColor='var(--primary, #0066cc)';this.style.background='white'" onmouseout="this.style.borderColor='transparent';this.style.background=''">
<div style="width: 44px; height: 44px; border-radius: 10px; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
<svg width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/></svg>
</div>
<div style="flex: 1; min-width: 0;">
<div style="font-weight: 600; margin-bottom: 2px;">{{ uc.company.name }}</div>
<div style="font-size: 0.8rem; color: var(--text-secondary);">
{% if uc.role == 'MANAGER' %}Zarządzający{% elif uc.role == 'EMPLOYEE' %}Pracownik{% elif uc.role == 'VIEWER' %}Podgląd{% endif %}
{% if uc.is_primary %} · Główna{% endif %}
</div>
</div>
<svg width="18" height="18" fill="none" stroke="var(--text-secondary)" stroke-width="2" viewBox="0 0 24 24"><path d="M9 5l7 7-7 7"/></svg>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
<!-- Edit Permission Modal (for employees) -->
<div class="modal-overlay" id="editPermissionModal">
<div class="modal" style="max-width: 480px; background: var(--surface, white); border-radius: var(--radius-lg, 12px); padding: var(--spacing-xl, 24px);">
@ -1235,8 +1278,8 @@
</div>
<style>
.modal-overlay#editPermissionModal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1050; align-items: center; justify-content: center; }
.modal-overlay#editPermissionModal.active { display: flex; }
.modal-overlay#editPermissionModal, .modal-overlay#companyPickerModal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1050; align-items: center; justify-content: center; }
.modal-overlay#editPermissionModal.active, .modal-overlay#companyPickerModal.active { display: flex; }
</style>
<script>