166 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			166 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% extends 'base.html' %}
 | 
						|
{% block title %}Ustawienia globalne{% endblock %}
 | 
						|
 | 
						|
{% block content %}
 | 
						|
<div class="container my-4">
 | 
						|
  <form method="post" novalidate id="form-global-settings">
 | 
						|
    {# {{ form.csrf_token }} jeśli używasz Flask-WTF #}
 | 
						|
 | 
						|
    <!-- SEKCJA: Dane płatności -->
 | 
						|
    <div class="card shadow-sm mb-4">
 | 
						|
      <div class="card-header bg-secondary text-white d-flex align-items-center justify-content-between gap-2">
 | 
						|
        <h3 class="card-title mb-0">Dane płatności</h3>
 | 
						|
        <small class="opacity-75">Używane jako wartości domyślne przy dodawaniu/edycji zbiórek</small>
 | 
						|
      </div>
 | 
						|
 | 
						|
      <div class="card-body">
 | 
						|
        <div class="row g-3">
 | 
						|
          <div class="col-12">
 | 
						|
            <label for="numer_konta" class="form-label">Globalny numer konta (IBAN)</label>
 | 
						|
            <div class="input-group">
 | 
						|
              <span class="input-group-text">PL</span>
 | 
						|
              <input type="text" class="form-control" id="numer_konta" name="numer_konta"
 | 
						|
                value="{{ settings.numer_konta if settings else '' }}" inputmode="numeric" autocomplete="off"
 | 
						|
                placeholder="12 3456 7890 1234 5678 9012 3456" required aria-describedby="ibanHelp">
 | 
						|
            </div>
 | 
						|
            <div id="ibanHelp" class="form-text">Wpisz ciąg cyfr — spacje dodadzą się automatycznie co 4 znaki.</div>
 | 
						|
          </div>
 | 
						|
 | 
						|
          <div class="col-12 col-md-6">
 | 
						|
            <label for="numer_telefonu_blik" class="form-label">Globalny numer telefonu BLIK</label>
 | 
						|
            <div class="input-group">
 | 
						|
              <span class="input-group-text">+48</span>
 | 
						|
              <input type="tel" class="form-control" id="numer_telefonu_blik" name="numer_telefonu_blik"
 | 
						|
                value="{{ settings.numer_telefonu_blik if settings else '' }}" inputmode="tel" pattern="[0-9 ]{9,13}"
 | 
						|
                placeholder="123 456 789" required aria-describedby="blikHelp">
 | 
						|
            </div>
 | 
						|
            <div id="blikHelp" class="form-text">9 cyfr. Spacje i format 3-3-3 dodajemy dla czytelności.</div>
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <!-- SEKCJA: Dostępy / biała lista IP -->
 | 
						|
    <div class="card shadow-sm mb-4">
 | 
						|
      <div class="card-header bg-secondary text-white d-flex align-items-center justify-content-between gap-2">
 | 
						|
        <h3 class="card-title mb-0">Dostęp — dozwolone adresy IP / hosty</h3>
 | 
						|
        <small class="opacity-75">Zależnie od konfiguracji, logowanie może wymagać dopasowania do białej listy</small>
 | 
						|
      </div>
 | 
						|
 | 
						|
      <div class="card-body">
 | 
						|
        <div class="row g-3 align-items-end">
 | 
						|
          <div class="col-12 col-md-6">
 | 
						|
            <label for="host_input" class="form-label">Dodaj pojedynczy IP/host</label>
 | 
						|
            <input type="text" class="form-control" id="host_input" placeholder="np. 203.0.113.42 lub corp.example.com"
 | 
						|
              aria-describedby="hostAddHelp">
 | 
						|
            <div id="hostAddHelp" class="form-text">Po wpisaniu kliknij „Dodaj do listy”. Duplikaty są pomijane.</div>
 | 
						|
          </div>
 | 
						|
          <div class="col-12 col-md-6 d-flex gap-2">
 | 
						|
            <button type="button" class="btn btn-outline-light border" id="btn-add-host">Dodaj do listy</button>
 | 
						|
            <button type="button" class="btn btn-light text-dark" id="btn-add-my-ip" data-my-ip="{{ client_ip }}">Dodaj
 | 
						|
              moje IP ({{ client_ip }})</button>
 | 
						|
            <button type="button" class="btn btn-outline-light border" id="btn-dedupe">Usuń duplikaty</button>
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
 | 
						|
        <div class="mt-3">
 | 
						|
          <label for="allowed_login_hosts" class="form-label">Dozwolone hosty logowania (jeden na linię lub rozdzielone
 | 
						|
            przecinkami)</label>
 | 
						|
          <textarea class="form-control" id="allowed_login_hosts" name="allowed_login_hosts" rows="6"
 | 
						|
            placeholder="Adresy IP lub nazwy domen — każdy w osobnej linii lub rozdzielony przecinkiem">{{ settings.allowed_login_hosts if settings and settings.allowed_login_hosts else '' }}</textarea>
 | 
						|
          <div class="d-flex justify-content-between mt-1">
 | 
						|
            <small class="text-muted">Akceptowane separatory: przecinek (`,`), średnik (`;`) i nowa linia.</small>
 | 
						|
            <small class="text-muted">Pozycji na liście: <span id="hostsCount">0</span></small>
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <!-- SEKCJA: Branding -->
 | 
						|
    <div class="card shadow-sm mb-4">
 | 
						|
      <div class="card-header bg-secondary text-white d-flex align-items-center justify-content-between gap-2">
 | 
						|
        <h3 class="card-title mb-0">Branding</h3>
 | 
						|
        <small class="opacity-75">Logo i tytuły wyświetlane w menu i stopce</small>
 | 
						|
      </div>
 | 
						|
 | 
						|
      <div class="card-body">
 | 
						|
        <!-- Wspólne zasoby: logo + tytuł serwisu -->
 | 
						|
        <div class="row g-3 align-items-end">
 | 
						|
          <div class="col-md-6">
 | 
						|
            <label for="logo_url" class="form-label">Logo (URL PNG/SVG)</label>
 | 
						|
            <input type="text" class="form-control" id="logo_url" name="logo_url"
 | 
						|
              value="{{ settings.logo_url if settings else '' }}" placeholder="https://example.com/logo.svg">
 | 
						|
            <div class="form-text">Transparentne, do ~60px wysokości.</div>
 | 
						|
            {% if settings and settings.logo_url %}
 | 
						|
            <div class="mt-2">
 | 
						|
              <img src="{{ settings.logo_url }}" alt="Logo preview" style="max-height:50px">
 | 
						|
            </div>
 | 
						|
            {% endif %}
 | 
						|
          </div>
 | 
						|
 | 
						|
          <div class="col-md-6">
 | 
						|
            <label for="site_title" class="form-label">Tytuł serwisu</label>
 | 
						|
            <input type="text" class="form-control" id="site_title" name="site_title"
 | 
						|
              value="{{ settings.site_title if settings else '' }}" placeholder="Np. Zbiórki unitraklub.pl">
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
 | 
						|
        <hr class="my-4">
 | 
						|
 | 
						|
        <!-- NAVBAR -->
 | 
						|
        <div class="row g-3">
 | 
						|
          <div class="col-md-6">
 | 
						|
            <h6 class="mb-2">Menu (navbar)</h6>
 | 
						|
            <div class="form-check">
 | 
						|
              <input class="form-check-input" type="radio" name="navbar_brand_mode" id="navbar_mode_logo" value="logo"
 | 
						|
                {% if settings and settings.navbar_brand_mode=='logo' or (settings and settings.show_logo_in_navbar)
 | 
						|
                %}checked{% endif %}>
 | 
						|
              <label class="form-check-label" for="navbar_mode_logo">Pokaż logo</label>
 | 
						|
            </div>
 | 
						|
            <div class="form-check">
 | 
						|
              <input class="form-check-input" type="radio" name="navbar_brand_mode" id="navbar_mode_text" value="text"
 | 
						|
                {% if not settings or (settings and settings.navbar_brand_mode !='logo' and not
 | 
						|
                settings.show_logo_in_navbar) %}checked{% endif %}>
 | 
						|
              <label class="form-check-label" for="navbar_mode_text">Pokaż tekst</label>
 | 
						|
            </div>
 | 
						|
            <div class="form-text mt-1">Jeśli wybierzesz logo, użyjemy adresu z pola "Tytuł serwisu".</div>
 | 
						|
          </div>
 | 
						|
 | 
						|
          <!-- STOPKA -->
 | 
						|
          <div class="col-md-6">
 | 
						|
            <h6 class="mb-2">Stopka</h6>
 | 
						|
            <div class="form-check">
 | 
						|
              <input class="form-check-input" type="radio" name="footer_brand_mode" id="footer_mode_logo" value="logo"
 | 
						|
                {% if settings and settings.footer_brand_mode=='logo' %}checked{% endif %}>
 | 
						|
              <label class="form-check-label" for="footer_mode_logo">Logo</label>
 | 
						|
            </div>
 | 
						|
            <div class="form-check">
 | 
						|
              <input class="form-check-input" type="radio" name="footer_brand_mode" id="footer_mode_text" value="text"
 | 
						|
                {% if not settings or (settings and settings.footer_brand_mode !='logo' ) %}checked{% endif %}>
 | 
						|
              <label class="form-check-label" for="footer_mode_text">Tekst</label>
 | 
						|
            </div>
 | 
						|
 | 
						|
            <label for="footer_text" class="form-label mt-2">Tekst w stopce (gdy wybrano „Tekst”)</label>
 | 
						|
            <input type="text" class="form-control" id="footer_text" name="footer_text"
 | 
						|
              value="{{ settings.footer_text if settings and settings.footer_text else '' }}"
 | 
						|
              placeholder="Np. © {{ now().year if now else '2025' }} Zbiórki">
 | 
						|
            <div class="form-text">Pozostaw pusty, by użyć domyślnego.</div>
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
 | 
						|
 | 
						|
    <!-- CTA -->
 | 
						|
    <div class="d-flex justify-content-between">
 | 
						|
      <a href="{{ url_for('admin_dashboard') }}" class="btn btn-outline-light border">Powrót</a>
 | 
						|
      <button type="submit" class="btn btn-primary">Zapisz ustawienia</button>
 | 
						|
    </div>
 | 
						|
  </form>
 | 
						|
</div>
 | 
						|
{% endblock %}
 | 
						|
 | 
						|
{% block extra_scripts %}
 | 
						|
{{ super() }}
 | 
						|
<script src="{{ url_for('static', filename='js/ustawienia.js') }}"></script>
 | 
						|
{% endblock %} |