{% extends "indy_hub/base.html" %}
{% load i18n %}
{% load static %}

{% block page_title %}{% trans "Indy Hub" %}{% endblock page_title %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'indy_hub/css/components.css' %}">
<link rel="stylesheet" href="{% static 'indy_hub/css/index.css' %}">
{% endblock extra_css %}

{% block content %}
<div class="container-fluid py-4">
    {% include "indy_hub/includes/popup.html" %}

    <section class="hero-section mb-4">
        <div class="row g-4 align-items-center">
            <div class="col-xl-7">
                <span class="hero-badge text-uppercase">{% trans "Corporate command center" %}</span>
                <h1 class="hero-title d-flex align-items-center">
                    <span class="hero-icon me-3">
                        <i class="fas fa-building"></i>
                    </span>
                    {% trans "Direct your industrial network" %}
                </h1>
                <p class="hero-lead mb-0">
                    {% trans "Align director token coverage, watch corporate production, and configure copy sharing from one dashboard." %}
                </p>
            </div>
            {% if show_corporation_tab and corporation_overview %}
            <div class="col-xl-5">
                <div class="hero-stats">
                    <div class="d-flex align-items-center justify-content-between mb-3">
                        <span class="hero-stats-heading">{% trans "Across your corporations" %}</span>
                        <span class="hero-stats-dot"></span>
                    </div>
                    <div class="row g-3">
                        <div class="col-sm-6">
                            <div class="stat-tile">
                                <div class="stat-value">
                                    <span>{{ corp_blueprint_count|default:0 }}</span>
                                </div>
                                <span class="stat-label">{% trans "Blueprints tracked" %}</span>
                                <span class="stat-meta">
                                    {% if corporation_share_summary and corporation_share_summary.total %}
                                        {% blocktrans with total=corporation_share_summary.total %}{{ total }} corporations connected{% endblocktrans %}
                                    {% else %}
                                        {% trans "Awaiting director tokens" %}
                                    {% endif %}
                                </span>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="stat-tile">
                                <div class="stat-value">
                                    <span>{{ corp_jobs_total|default:0 }}</span>
                                </div>
                                <span class="stat-label">{% trans "Industry jobs indexed" %}</span>
                                <span class="stat-meta">
                                    {% if corp_active_jobs_count %}
                                        {% blocktrans with active=corp_active_jobs_count %}{{ active }} running now{% endblocktrans %}
                                    {% else %}
                                        {% trans "No active runs detected" %}
                                    {% endif %}
                                </span>
                            </div>
                        </div>
                        <div class="col-sm-12">
                            <div class="stat-tile">
                                <div class="stat-value">
                                    <span>{{ corporation_share_summary.enabled|default:0 }}</span>
                                </div>
                                <span class="stat-label">{% trans "Corporations sharing copies" %}</span>
                                <span class="stat-meta">
                                    {% if corporation_share_summary and corporation_share_summary.total %}
                                        {% blocktrans with enabled=corporation_share_summary.enabled total=corporation_share_summary.total %}{{ enabled }} of {{ total }} sharing{% endblocktrans %}
                                    {% else %}
                                        {% trans "Configure sharing scopes below" %}
                                    {% endif %}
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {% endif %}
        </div>
    </section>

    {% if show_corporation_tab %}
    <section class="dashboard-section mb-5">
        <header class="section-heading">
            <div>
                <h2>{% trans "Director readiness" %}</h2>
                <p class="text-muted small mb-0">{% trans "Confirm which corporations have live director tokens before reviewing production metrics." %}</p>
            </div>
        </header>
        <div class="row g-4 align-items-stretch">
            <div class="col-xxl-7 col-xl-6 col-lg-12">
                <div class="card focus-card h-100">
                    <div class="card-body p-4 d-flex flex-column">
                        <div class="d-flex justify-content-between align-items-start mb-3">
                            <div>
                                <h5 class="card-title mb-1">{% trans "Token coverage" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Blueprint and industry director tokens unlock every insight on this page." %}</p>
                            </div>
                            <div class="focus-icon bg-primary bg-opacity-10 text-primary">
                                <i class="fas fa-id-badge"></i>
                            </div>
                        </div>
                        <div class="token-status d-flex flex-column gap-2 mb-4">
                            <div class="token-pill {% if corp_scope_status %}token-pill-ready{% else %}token-pill-missing{% endif %}">
                                <i class="fas fa-building me-2"></i>
                                {% if corp_scope_status %}
                                    {% blocktrans with total=corp_scope_status|length %}{{ total }} corporations detected{% endblocktrans %}
                                {% else %}
                                    {% trans "No corporations detected yet" %}
                                {% endif %}
                            </div>
                            <div class="token-pill {% if has_corp_blueprint_tokens %}token-pill-ready{% else %}token-pill-missing{% endif %}">
                                <i class="fas fa-scroll me-2"></i>
                                {% if has_corp_blueprint_tokens %}
                                    {% trans "At least one blueprint director token active" %}
                                {% else %}
                                    {% trans "Blueprint director token missing" %}
                                {% endif %}
                            </div>
                            <div class="token-pill {% if has_corp_job_tokens %}token-pill-ready{% else %}token-pill-missing{% endif %}">
                                <i class="fas fa-industry me-2"></i>
                                {% if has_corp_job_tokens %}
                                    {% trans "At least one industry director token active" %}
                                {% else %}
                                    {% trans "Industry director token missing" %}
                                {% endif %}
                            </div>
                        </div>
                        {% if corp_scope_status %}
                        <p class="text-muted text-uppercase small fw-semibold mb-2">{% trans "Coverage highlights" %}</p>
                        <ul class="list-unstyled small text-muted d-flex flex-column gap-3 mb-0">
                            {% for corp in corp_scope_status|slice:":5" %}
                            <li class="d-flex justify-content-between align-items-start gap-3">
                                <div>
                                    <span class="fw-semibold d-block">{{ corp.corporation_name }}</span>
                                    <div class="d-flex flex-wrap gap-2 mt-1">
                                        <span class="badge rounded-pill {% if corp.blueprint.has_scope %}bg-success-subtle text-success{% else %}bg-warning-subtle text-warning{% endif %}">
                                            <i class="fas fa-scroll me-1"></i>
                                            {% if corp.blueprint.has_scope %}
                                                {% if corp.blueprint.character_name %}
                                                    {% blocktrans with name=corp.blueprint.character_name %}Blueprint via {{ name }}{% endblocktrans %}
                                                {% else %}
                                                    {% trans "Blueprint ready" %}
                                                {% endif %}
                                            {% else %}
                                                {% trans "Blueprint missing" %}
                                            {% endif %}
                                        </span>
                                        <span class="badge rounded-pill {% if corp.jobs.has_scope %}bg-success-subtle text-success{% else %}bg-warning-subtle text-warning{% endif %}">
                                            <i class="fas fa-industry me-1"></i>
                                            {% if corp.jobs.has_scope %}
                                                {% if corp.jobs.character_name %}
                                                    {% blocktrans with name=corp.jobs.character_name %}Industry via {{ name }}{% endblocktrans %}
                                                {% else %}
                                                    {% trans "Industry ready" %}
                                                {% endif %}
                                            {% else %}
                                                {% trans "Industry missing" %}
                                            {% endif %}
                                        </span>
                                    </div>
                                </div>
                            </li>
                            {% endfor %}
                        </ul>
                        {% else %}
                        <div class="focus-empty text-center py-4 mt-auto">
                            <i class="fas fa-key fa-3x mb-3 text-primary opacity-75"></i>
                            <p class="text-muted mb-3">{% trans "Authorize a director blueprint or industry token to populate your corporations." %}</p>
                            <a href="{% url 'indy_hub:token_management' %}" class="btn btn-outline-primary btn-slim">
                                <i class="fas fa-key me-2"></i>{% trans "Manage ESI tokens" %}
                            </a>
                        </div>
                        {% endif %}
                        <div class="mt-4">
                            <a href="{% url 'indy_hub:token_management' %}" class="btn btn-accent btn-slim">
                                <i class="fas fa-arrow-right me-2"></i>{% trans "Open token management" %}
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xxl-5 col-xl-6 col-lg-12">
                <div class="card focus-card h-100">
                    <div class="card-body p-4 d-flex flex-column">
                        <div class="d-flex justify-content-between align-items-start mb-3">
                            <div>
                                <h5 class="card-title mb-1">{% trans "Director checklist" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Share these requirements with leadership so every director provides the right access." %}</p>
                            </div>
                            <div class="focus-icon bg-info bg-opacity-10 text-info">
                                <i class="fas fa-clipboard-check"></i>
                            </div>
                        </div>
                        {% if corporation_overview and corporation_overview.required_roles %}
                        <div class="mb-4">
                            <span class="step-badge">{% trans "Corporate roles" %}</span>
                            <ul class="list-unstyled small text-muted d-flex flex-column gap-2 mb-0">
                                {% for role in corporation_overview.required_roles %}
                                <li class="d-flex align-items-start gap-2">
                                    <i class="fas fa-user-shield mt-1 text-primary opacity-75"></i>
                                    <span>{{ role }}</span>
                                </li>
                                {% endfor %}
                            </ul>
                        </div>
                        {% endif %}
                        <div class="border rounded-4 p-3 bg-light-subtle">
                            <p class="mini-title mb-2">{% trans "ESI scopes in use" %}</p>
                            {% if corporation_overview and corporation_overview.scopes %}
                            <ul class="list-unstyled small text-muted d-flex flex-column gap-2 mb-0">
                                {% if corporation_overview.scopes.blueprints %}
                                <li class="d-flex align-items-center gap-2">
                                    <i class="fas fa-scroll text-primary opacity-75"></i>
                                    <span><code class="bg-body-secondary rounded px-2 py-1">{{ corporation_overview.scopes.blueprints }}</code></span>
                                </li>
                                {% endif %}
                                {% if corporation_overview.scopes.jobs %}
                                <li class="d-flex align-items-center gap-2">
                                    <i class="fas fa-industry text-success opacity-75"></i>
                                    <span><code class="bg-body-secondary rounded px-2 py-1">{{ corporation_overview.scopes.jobs }}</code></span>
                                </li>
                                {% endif %}
                                {% if corporation_overview.scopes.roles %}
                                <li class="d-flex align-items-center gap-2">
                                    <i class="fas fa-user-gear text-secondary opacity-75"></i>
                                    <span><code class="bg-body-secondary rounded px-2 py-1">{{ corporation_overview.scopes.roles }}</code></span>
                                </li>
                                {% endif %}
                                {% if corporation_overview.scopes.structures %}
                                <li class="d-flex align-items-center gap-2">
                                    <i class="fas fa-warehouse text-warning opacity-75"></i>
                                    <span><code class="bg-body-secondary rounded px-2 py-1">{{ corporation_overview.scopes.structures }}</code></span>
                                </li>
                                {% endif %}
                            </ul>
                            {% else %}
                            <p class="text-muted small mb-0">{% trans "Scopes will appear once a director token is linked." %}</p>
                            {% endif %}
                        </div>
                        <div class="mt-4">
                            <a href="{{ corporation_overview.token_management_url|default:request.path }}" class="btn btn-soft-primary btn-slim">
                                <i class="fas fa-arrow-up-right-from-square me-2"></i>{% trans "Share setup instructions" %}
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="dashboard-section mb-5">
        <header class="section-heading">
            <div>
                <h2>{% trans "Corporate operations" %}</h2>
                <p class="text-muted small mb-0">{% trans "Monitor blueprint holdings and factory throughput across every corporation you manage." %}</p>
            </div>
        </header>
        <div class="row g-4 align-items-stretch">
            <div class="col-xxl-6 col-xl-6 col-lg-12">
                <div class="card focus-card h-100">
                    <div class="card-body p-4 d-flex flex-column">
                        <div class="d-flex justify-content-between align-items-start mb-3">
                            <div>
                                <h5 class="card-title mb-1">{% trans "Blueprint library" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Corporate originals, copies, and reactions." %}</p>
                            </div>
                            <div class="d-flex align-items-center gap-2">
                                <span class="badge rounded-pill bg-info-subtle text-info">
                                    <i class="fas fa-building me-1"></i>{{ corp_blueprint_count|default:0 }}
                                </span>
                                <div class="focus-icon bg-primary bg-opacity-10 text-primary">
                                    <i class="fas fa-layer-group"></i>
                                </div>
                            </div>
                        </div>
                        {% if corporation_overview and corporation_overview.has_corporations %}
                        <div class="stat-pair mb-3">
                            <div class="stat-chip">
                                <span class="stat-chip-label">{% trans "Originals" %}</span>
                                <span class="stat-chip-value">{{ corp_original_blueprints|default:0 }}</span>
                            </div>
                            <div class="stat-chip">
                                <span class="stat-chip-label">{% trans "Copies" %}</span>
                                <span class="stat-chip-value">{{ corp_copy_blueprints|default:0 }}</span>
                            </div>
                        </div>
                        <div class="stat-chip mb-3">
                            <span class="stat-chip-label">{% trans "Reactions" %}</span>
                            <span class="stat-chip-value">{{ corp_reaction_blueprints|default:0 }}</span>
                        </div>
                        <p class="text-muted small mb-3">{% trans "Directors with corporate tokens keep the shared library current." %}</p>
                        <div>
                            <p class="text-muted text-uppercase small fw-semibold mb-2">{% trans "Recent corporations" %}</p>
                            <ul class="list-unstyled small text-muted d-flex flex-column gap-2 mb-0">
                                {% for corp in corporation_overview.corporations|slice:":4" %}
                                <li class="d-flex justify-content-between align-items-center">
                                    <span>{{ corp.name }}</span>
                                    <span class="badge rounded-pill bg-primary-subtle text-primary">{{ corp.blueprints.total|default:0 }}</span>
                                </li>
                                {% empty %}
                                <li class="small text-muted">{% trans "No corporate blueprints detected yet." %}</li>
                                {% endfor %}
                            </ul>
                        </div>
                        <div class="mt-3">
                            <a href="{% url 'indy_hub:corporation_bp_list' %}" class="btn btn-outline-primary btn-slim">
                                <i class="fas fa-arrow-up-right-from-square me-2"></i>{% trans "Open corporate blueprint library" %}
                            </a>
                        </div>
                        {% else %}
                        <div class="focus-empty text-center py-4 mt-auto">
                            <i class="fas fa-key fa-3x mb-3 text-primary opacity-75"></i>
                            <p class="text-muted mb-3">{% trans "Authorize a director blueprint token to surface corporate holdings." %}</p>
                            <a href="{% url 'indy_hub:token_management' %}" class="btn btn-outline-primary btn-slim">
                                <i class="fas fa-key me-2"></i>{% trans "Manage ESI tokens" %}
                            </a>
                        </div>
                        {% endif %}
                    </div>
                </div>
            </div>
            <div class="col-xxl-6 col-xl-6 col-lg-12">
                <div class="card focus-card h-100">
                    <div class="card-body p-4 d-flex flex-column">
                        <div class="d-flex justify-content-between align-items-start mb-3">
                            <div>
                                <h5 class="card-title mb-1">{% trans "Industry jobs" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Track active runs and delivered work across the corporation hangars." %}</p>
                            </div>
                            <div class="d-flex align-items-center gap-2">
                                <span class="badge rounded-pill bg-success-subtle text-success">{{ corp_jobs_total|default:0 }}</span>
                                <div class="focus-icon bg-success bg-opacity-10 text-success">
                                    <i class="fas fa-industry"></i>
                                </div>
                            </div>
                        </div>
                        {% if corporation_overview and corporation_overview.has_corporations %}
                        <div class="job-status-row mb-3">
                            <div class="status-pill success">
                                <i class="fas fa-play-circle"></i>
                                <div>
                                    <strong>{{ corp_active_jobs_count|default:0 }}</strong>
                                    <span>{% trans "Active jobs" %}</span>
                                </div>
                            </div>
                            <div class="status-pill">
                                <i class="fas fa-check-circle"></i>
                                <div>
                                    <strong>{{ corp_jobs_completed|default:0 }}</strong>
                                    <span>{% trans "Completed" %}</span>
                                </div>
                            </div>
                        </div>
                        <p class="text-muted small mb-3">{% trans "Use director industry tokens to watch factory throughput in real time." %}</p>
                        <div>
                            <p class="text-muted text-uppercase small fw-semibold mb-2">{% trans "Active corporations" %}</p>
                            <ul class="list-unstyled small text-muted d-flex flex-column gap-2 mb-0">
                                {% for corp in corporation_overview.corporations|slice:":4" %}
                                <li class="d-flex justify-content-between align-items-center">
                                    <span>{{ corp.name }}</span>
                                    <span class="badge rounded-pill bg-success-subtle text-success">{{ corp.jobs.active|default:0 }}</span>
                                </li>
                                {% empty %}
                                <li class="small text-muted">{% trans "No corporate industry jobs detected yet." %}</li>
                                {% endfor %}
                            </ul>
                        </div>
                        <div class="mt-3">
                            <a href="{% url 'indy_hub:corporation_job_list' %}" class="btn btn-outline-success btn-slim">
                                <i class="fas fa-arrow-up-right-from-square me-2"></i>{% trans "Open corporate job board" %}
                            </a>
                        </div>
                        {% else %}
                        <div class="focus-empty text-center py-4 mt-auto">
                            <i class="fas fa-industry fa-3x mb-3 text-success opacity-75"></i>
                            <p class="text-muted mb-3">{% trans "Authorize a director industry token to populate corporate jobs." %}</p>
                            <a href="{% url 'indy_hub:token_management' %}" class="btn btn-outline-success btn-slim">
                                <i class="fas fa-key me-2"></i>{% trans "Manage ESI tokens" %}
                            </a>
                        </div>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="dashboard-section mb-5">
        <header class="section-heading">
            <div>
                <h2>{% trans "Corporation collaboration" %}</h2>
                <p class="text-muted small mb-0">{% trans "Set copy sharing scopes per corporation and verify that every hangar has the right visibility." %}</p>
            </div>
        </header>
        <div class="card preference-card focus-card">
            <div class="card-body p-4 d-flex flex-column">
                <div class="d-flex align-items-start justify-content-between gap-3 mb-3">
                    <div>
                        <span class="preference-label">{% trans "Corporation sharing" %}</span>
                        {% if corporation_share_summary and corporation_share_summary.total %}
                        <p class="preference-hint mb-1">
                            {% blocktrans with enabled=corporation_share_summary.enabled total=corporation_share_summary.total %}{{ enabled }} of {{ total }} corporations sharing copies{% endblocktrans %}
                        </p>
                        {% else %}
                        <p class="preference-hint mb-1">{% trans "Authorize a director token to share corporate hangars and industry activity." %}</p>
                        {% endif %}
                        <p class="text-muted small mb-0">{% trans "Use the controls below to align every corporation's sharing scope." %}</p>
                        {% if can_manage_corporate_assets %}
                        <div class="alert alert-light border-0 mt-3 mb-0 text-muted small">
                            <i class="fas fa-building me-2 text-info"></i>
                            {% trans "Corporate blueprint sharing stays per corporation. Review each corporation's status in the preferences panel below before enabling copy queues." %}
                        </div>
                        {% endif %}
                    </div>
                    <div class="focus-icon bg-info bg-opacity-10 text-info">
                        <i class="fas fa-share-alt"></i>
                    </div>
                </div>
                {% if corporation_share_controls %}
                <div class="corporation-share-list d-flex flex-column gap-3">
                    {% for corp in corporation_share_controls %}
                    <div class="corp-share-control border rounded-4 p-3" data-corp-id="{{ corp.corporation_id }}">
                        <div class="d-flex justify-content-between align-items-start gap-3">
                            <div>
                                <span class="fw-semibold d-block">{{ corp.corporation_name }}</span>
                                <p class="text-muted small mb-1 corp-share-hint">{{ corp.status_hint }}</p>
                                <ul class="list-unstyled text-muted small mb-0 d-flex flex-column gap-1">
                                    <li class="d-flex align-items-center gap-2">
                                        <i class="fas fa-scroll text-primary opacity-75"></i>
                                        <span>
                                            {% if corp.has_blueprint_scope %}
                                                {% blocktrans with name=corp.blueprint_character|default:_("Director token") %}Blueprint token: {{ name }}{% endblocktrans %}
                                            {% else %}
                                                {% trans "Blueprint token missing" %}
                                            {% endif %}
                                        </span>
                                    </li>
                                    <li class="d-flex align-items-center gap-2">
                                        <i class="fas fa-industry text-success opacity-75"></i>
                                        <span>
                                            {% if corp.has_jobs_scope %}
                                                {% blocktrans with name=corp.jobs_character|default:_("Director token") %}Industry token: {{ name }}{% endblocktrans %}
                                            {% else %}
                                                {% trans "Industry token missing" %}
                                            {% endif %}
                                        </span>
                                    </li>
                                </ul>
                            </div>
                            <span class="badge rounded-pill corp-share-badge {{ corp.badge_class }}">{{ corp.status_label }}</span>
                        </div>
                        <div
                            class="share-mode-group corp-share-mode-group mt-3"
                            data-corp-id="{{ corp.corporation_id }}"
                            data-has-blueprint-scope="{% if corp.has_blueprint_scope %}true{% else %}false{% endif %}"
                            data-has-blueprint-scope="{% if corp.has_blueprint_scope %}true{% else %}false{% endif %}"
                            role="group"
                            aria-label="{% blocktrans with name=corp.corporation_name %}{{ name }} blueprint sharing scope{% endblocktrans %}"
                            data-current-scope="{{ corp.share_scope }}"
                        >
                            <button
                                type="button"
                                class="share-mode-chip {% if corp.share_scope == 'none' %}is-active{% endif %}"
                                data-share-scope="none"
                                aria-pressed="{% if corp.share_scope == 'none' %}true{% else %}false{% endif %}"
                            >
                                <i class="fas fa-lock"></i>
                                <span>{% trans "Private" %}</span>
                            </button>
                            <button
                                type="button"
                                class="share-mode-chip {% if corp.share_scope == 'corporation' %}is-active{% endif %}"
                                data-share-scope="corporation"
                                aria-pressed="{% if corp.share_scope == 'corporation' %}true{% else %}false{% endif %}"
                            >
                                <i class="fas fa-building"></i>
                                <span>{% trans "Corporation" %}</span>
                            </button>
                            <button
                                type="button"
                                class="share-mode-chip {% if corp.share_scope == 'alliance' %}is-active{% endif %}"
                                data-share-scope="alliance"
                                aria-pressed="{% if corp.share_scope == 'alliance' %}true{% else %}false{% endif %}"
                            >
                                <i class="fas fa-people-group"></i>
                                <span>{% trans "Alliance" %}</span>
                            </button>
                            <button
                                type="button"
                                class="share-mode-chip {% if corp.share_scope == 'everyone' %}is-active{% endif %}"
                                data-share-scope="everyone"
                                aria-pressed="{% if corp.share_scope == 'everyone' %}true{% else %}false{% endif %}"
                            >
                                <i class="fas fa-globe"></i>
                                <span>{% trans "Everyone" %}</span>
                            </button>
                        </div>
                    </div>
                    {% endfor %}
                </div>
                {% else %}
                <p class="text-muted small mb-3">{% trans "No corporation tokens detected yet." %}</p>
                <a href="{% url 'indy_hub:token_management' %}" class="btn btn-outline-primary btn-slim align-self-start">
                    <i class="fas fa-key me-2"></i>{% trans "Manage ESI tokens" %}
                </a>
                {% endif %}
            </div>
        </div>
    </section>
    {% else %}
    <div class="alert alert-warning-soft">
        {% trans "You do not have permission to manage corporation copy sharing." %}
    </div>
    {% endif %}

    <footer class="dashboard-footer text-center text-muted small">
        <div class="container">
            <span>Indy Hub &copy; {{ year|default:2025 }} &mdash; {% trans "Powered by Alliance Auth" %}</span>
            <span class="mx-2">|</span>
            <a href="https://github.com/Erkaek/aa-Indy_Hub" target="_blank" class="text-muted">
                <i class="fab fa-github me-1"></i>{% trans "Source" %}
            </a>
        </div>
    </footer>
</div>
{% endblock content %}

{% block extra_javascript %}
<script src="{% static 'indy_hub/js/index.js' %}"></script>
<script>
// Configure URLs and text for the JavaScript module
window.csrfToken = '{{ csrf_token }}';
window.toggleJobNotificationsUrl = '{% url 'indy_hub:toggle_job_notifications' %}';
window.toggleCopySharingUrl = '{% url 'indy_hub:toggle_copy_sharing' %}';
window.toggleCorporationCopySharingUrl = '{% url 'indy_hub:toggle_corporation_copy_sharing' %}';
window.notificationsOnText = '{% trans "Notifications ON" %}';
window.notificationsOffText = '{% trans "Notifications OFF" %}';
window.copySharingStates = JSON.parse('{{ copy_sharing_states_json|escapejs }}');
window.corporationShareControls = JSON.parse('{{ corporation_share_controls_json|escapejs }}');
</script>
{% endblock extra_javascript %}
