Files
magico.prototype/prototype/magico-pracownik/vacations.php

380 lines
20 KiB
PHP

<?php
$enablePrototypeComments = true;
include 'header.php';
?>
<!-- Główny Topbar -->
<div class="app-topbar">
<div class="d-flex align-items-center">
<div class="d-flex justify-content-center align-items-center bg-primary-custom rounded-circle me-2" style="width: 32px; height: 32px;">
<i class='bx bx-cube-alt text-white'></i>
</div>
<h1 class="app-title">Acme Corp</h1>
</div>
<div class="d-flex align-items-center gap-3">
<!-- Powiadomienia -->
<div class="dropdown">
<div class="position-relative" style="cursor: pointer;" data-bs-toggle="dropdown" aria-expanded="false">
<i class='bx bx-bell fs-4 text-muted'></i>
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger border border-white" style="font-size: 0.65rem; padding: 0.3em 0.45em;">
1
</span>
</div>
<div class="dropdown-menu dropdown-menu-end p-0 border-0 mt-2" style="border-radius: 16px; width: 340px; box-shadow: 0 0.5rem 1.5rem rgba(105, 108, 255, 0.15); overflow: hidden; z-index: 1050; margin-right: -40px;">
<div class="p-3 border-bottom d-flex justify-content-between align-items-center" style="background-color: #fcfcfd;">
<h6 class="mb-0 fw-bold" style="color: #566A7F;">Powiadomienia</h6>
<span class="badge bg-label-danger rounded-pill">1 nowe</span>
</div>
<div class="list-group list-group-flush" style="max-height: 350px; overflow-y: auto;">
<!-- Nieprzeczytane -->
<a href="vacations.php" class="list-group-item list-group-item-action d-flex align-items-start p-3 border-0" style="background-color: rgba(105, 108, 255, 0.03); border-bottom: 1px solid rgba(0,0,0,0.03) !important;">
<div class="d-flex justify-content-center align-items-center rounded-circle flex-shrink-0 me-3" style="width: 40px; height: 40px; background-color: rgba(255, 62, 29, 0.1); color: #ff3e1d;">
<i class='bx bx-x-circle fs-5'></i>
</div>
<div class="flex-grow-1">
<h6 class="mb-1 fw-bold" style="font-size: 0.9rem; color: #566A7F;">Wniosek odrzucony</h6>
<p class="mb-1 small text-muted" style="line-height: 1.4;">Kierownik odrzucił Twój wniosek o urlop na żądanie (05 Wrz).</p>
<small class="text-primary-custom fw-semibold" style="font-size: 0.75rem;">10 min temu</small>
</div>
<div class="flex-shrink-0 ms-2 mt-2">
<div style="width: 8px; height: 8px; background-color: #696cff; border-radius: 50%;"></div>
</div>
</a>
<!-- Przeczytane -->
<a href="vacations.php" class="list-group-item list-group-item-action d-flex align-items-start p-3 border-0">
<div class="d-flex justify-content-center align-items-center rounded-circle flex-shrink-0 me-3" style="width: 40px; height: 40px; background-color: rgba(113, 221, 55, 0.1); color: #71dd37;">
<i class='bx bx-check-circle fs-5'></i>
</div>
<div class="flex-grow-1">
<h6 class="mb-1 fw-semibold" style="font-size: 0.9rem; color: #566A7F;">Wniosek zaakceptowany</h6>
<p class="mb-1 small text-muted" style="line-height: 1.4;">Twój urlop wypoczynkowy (12-16 Sie) został pomyślnie zatwierdzony.</p>
<small class="text-muted" style="font-size: 0.75rem;">Wczoraj</small>
</div>
</a>
</div>
<div class="p-3 border-top text-center" style="background-color: #fcfcfd;">
<button class="btn btn-primary btn-sm w-100 fw-bold" style="border-radius: 8px;">Zobacz wszystkie</button>
</div>
</div>
</div>
<div class="user-avatar shadow-sm">
<i class='bx bx-user'></i>
</div>
</div>
</div>
<!-- Pasek tytułowy sekcji -->
<div class="container pt-4">
<div class="d-flex justify-content-between align-items-center pb-3 mb-4" style="border-bottom: 1px solid var(--border-color);">
<div class="d-flex align-items-center">
<a href="home.php" class="text-dark me-2 d-flex align-items-center justify-content-center" style="width: 32px; height: 32px; background: rgba(0,0,0,0.05); border-radius: 50%;">
<i class='bx bx-arrow-back fs-4'></i>
</a>
<h2 class="fw-bold mb-0" style="font-size: 1.25rem;">Moje Urlopy</h2>
</div>
</div>
</div>
<div class="container pb-4">
<!-- Statystyki Urlopowe (Dashboard Widget) -->
<div class="card border-0 shadow-sm mb-4" style="border-radius: 16px;">
<div class="card-body p-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="d-flex align-items-center">
<div class="d-flex justify-content-center align-items-center me-2" style="width: 32px; height: 32px; border-radius: 8px; background-color: rgba(105, 108, 255, 0.1);">
<i class='bx bx-pie-chart-alt-2' style="color: #696cff; font-size: 1.2rem;"></i>
</div>
<h6 class="fw-bold mb-0" style="color: #566A7F; font-size: 1.05rem;">Pula urlopowa</h6>
</div>
<select class="form-select form-select-sm border-0 bg-light text-muted fw-semibold" style="width: auto; border-radius: 8px; cursor: pointer;">
<option value="2024" selected>Rok: 2024</option>
<option value="2023">Rok: 2023</option>
</select>
</div>
<div class="d-flex justify-content-between align-items-end mb-2 mt-1">
<div>
<span class="text-muted small d-block mb-1">Dostępne do wykorzystania</span>
<h3 class="mb-0 fw-bold" style="color: #696cff;">14 <span class="fs-6 fw-semibold text-muted">z 26 dni</span></h3>
</div>
</div>
<!-- Progress Bar -->
<div class="progress mb-2 mt-3" style="height: 10px; border-radius: 10px; background-color: rgba(105, 108, 255, 0.15);">
<div class="progress-bar" role="progressbar" style="width: 46%; background-color: #696cff; border-radius: 10px;" aria-valuenow="12" aria-valuemin="0" aria-valuemax="26"></div>
</div>
<div class="d-flex justify-content-between text-muted" style="font-size: 0.8rem;">
<span class="fw-medium">Wykorzystano: 12 dni</span>
<span class="fw-medium">Zaległy: 0 dni</span>
</div>
</div>
</div>
<!-- Tabs: Nadchodzące / Historia -->
<ul class="nav nav-pills nav-justified mb-4" id="vacationTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active fw-bold shadow-sm" id="upcoming-tab" data-bs-toggle="pill" data-bs-target="#upcoming" type="button" role="tab" aria-controls="upcoming" aria-selected="true" style="border-radius: 8px;">Nadchodzące</button>
</li>
<li class="nav-item ms-2" role="presentation">
<button class="nav-link fw-bold shadow-sm" id="history-tab" data-bs-toggle="pill" data-bs-target="#history" type="button" role="tab" aria-controls="history" aria-selected="false" style="border-radius: 8px;">Historia</button>
</li>
</ul>
<div class="tab-content p-0 m-0 border-0" id="vacationTabsContent">
<!-- ZAKŁADKA 1: Nadchodzące -->
<div class="tab-pane fade show active" id="upcoming" role="tabpanel" aria-labelledby="upcoming-tab">
<!-- Wniosek 1: Zaakceptowany -->
<div class="card-custom mb-3 border-0 shadow-sm" style="border-left: 4px solid #71dd37 !important;">
<div class="p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-label-success mb-1">Zaakceptowany</span>
<h5 class="fw-bold mb-0" style="font-size: 1.1rem;">Urlop wypoczynkowy</h5>
</div>
<div class="text-end">
<span class="fw-bold text-dark fs-5">5</span>
<span class="text-muted small d-block" style="margin-top: -5px;">dni</span>
</div>
</div>
<div class="d-flex align-items-center text-muted small mt-3">
<i class='bx bx-calendar me-2 fs-5 text-primary-custom'></i>
<span class="fw-semibold">12 Sierpnia 2026 - 16 Sierpnia 2026</span>
</div>
</div>
</div>
<!-- Wniosek 2: Oczekujący -->
<div class="card-custom mb-3 border-0 shadow-sm" style="border-left: 4px solid #8592a3 !important;">
<div class="p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-label-secondary mb-1">Oczekuje na akceptację</span>
<h5 class="fw-bold mb-0" style="font-size: 1.1rem;">Urlop wypoczynkowy</h5>
</div>
<div class="text-end">
<span class="fw-bold text-dark fs-5">2</span>
<span class="text-muted small d-block" style="margin-top: -5px;">dni</span>
</div>
</div>
<div class="d-flex align-items-center text-muted small mt-3">
<i class='bx bx-calendar me-2 fs-5 text-primary-custom'></i>
<span class="fw-semibold">27 Sierpnia 2026 - 28 Sierpnia 2026</span>
</div>
</div>
</div>
<!-- Wniosek 3: Odrzucony -->
<div class="card-custom mb-3 border-0 shadow-sm" style="border-left: 4px solid #ff3e1d !important;">
<div class="p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-label-danger mb-1">Odrzucony</span>
<h5 class="fw-bold mb-0" style="font-size: 1.1rem;">Urlop na żądanie</h5>
</div>
<div class="text-end">
<span class="fw-bold text-dark fs-5">1</span>
<span class="text-muted small d-block" style="margin-top: -5px;">dzień</span>
</div>
</div>
<div class="d-flex align-items-center text-muted small mt-3 mb-2">
<i class='bx bx-calendar me-2 fs-5 text-primary-custom'></i>
<span class="fw-semibold">05 Września 2026</span>
</div>
<div class="bg-light p-2 rounded text-muted small d-flex align-items-start gap-2 mt-2">
<i class='bx bx-info-circle text-danger mt-1'></i>
<div>
<strong class="text-dark">Kierownik:</strong> Niestety w tym terminie mamy inwentaryzację, brak możliwości udzielenia urlopu.
</div>
</div>
</div>
</div>
</div>
<!-- ZAKŁADKA 2: Historia -->
<div class="tab-pane fade" id="history" role="tabpanel" aria-labelledby="history-tab">
<!-- FILTRY HISTORII -->
<div class="d-flex justify-content-between align-items-center mb-4 gap-2">
<select class="form-select bg-white shadow-sm border-0" style="border-radius: 8px; color: #566A7F; font-weight: 500;">
<option value="2024" selected>Rok: 2024</option>
<option value="2023">Rok: 2023</option>
<option value="2022">Rok: 2022</option>
</select>
<select class="form-select bg-white shadow-sm border-0" style="border-radius: 8px; color: #566A7F; font-weight: 500;">
<option value="all" selected>Status: Wszystkie</option>
<option value="accepted">Wykorzystane</option>
<option value="rejected">Odrzucone</option>
</select>
</div>
<!-- Historia: Wykorzystany -->
<div class="card-custom mb-3 border-0 shadow-sm" style="border-left: 4px solid #d9dee3 !important;">
<div class="p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-label-secondary mb-1">Wykorzystany</span>
<h5 class="fw-bold mb-0 text-muted" style="font-size: 1.1rem;">Urlop wypoczynkowy</h5>
</div>
<div class="text-end text-muted">
<span class="fw-bold fs-5">14</span>
<span class="small d-block" style="margin-top: -5px;">dni</span>
</div>
</div>
<div class="d-flex align-items-center text-muted small mt-3">
<i class='bx bx-calendar me-2 fs-5'></i>
<span>01 Lipca 2024 - 14 Lipca 2024</span>
</div>
</div>
</div>
<!-- Historia: Odrzucony -->
<div class="card-custom mb-3 border-0 shadow-sm" style="border-left: 4px solid #d9dee3 !important; opacity: 0.8;">
<div class="p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-label-danger mb-1 opacity-75">Odrzucony</span>
<h5 class="fw-bold mb-0 text-muted" style="font-size: 1.1rem;">Urlop na żądanie</h5>
</div>
<div class="text-end text-muted">
<span class="fw-bold fs-5">1</span>
<span class="small d-block" style="margin-top: -5px;">dzień</span>
</div>
</div>
<div class="d-flex align-items-center text-muted small mt-3">
<i class='bx bx-calendar me-2 fs-5'></i>
<span>15 Maja 2024</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal: Nowy Wniosek -->
<div class="modal fade" id="vacationModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content border-0 shadow" style="border-radius: var(--radius-lg);">
<div class="modal-header border-bottom-0 pb-0">
<h5 class="modal-title fw-bold">Nowy wniosek o urlop</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="vacation-form">
<div class="mb-3 text-start">
<label class="form-label fw-semibold">Początek urlopu</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i class="bx bx-calendar"></i></span>
<input type="text" id="date-start" class="form-control datepicker" placeholder="Wybierz datę początkową">
</div>
</div>
<div class="mb-3 text-start">
<label class="form-label fw-semibold">Koniec urlopu</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i class="bx bx-calendar"></i></span>
<input type="text" id="date-end" class="form-control datepicker" placeholder="Wybierz datę końcową">
</div>
</div>
<div class="mb-3 text-start">
<label class="form-label fw-semibold">Powód</label>
<select class="form-select">
<option value="2">Urlop wypoczynkowy</option>
<option value="4">Zwolnienie - opieka</option>
<option value="3">Zwolnienie lekarskie</option>
<option value="9">Służba wojskowa</option>
<option value="8" selected>Urlop bezpłatny</option>
<option value="5">Urlop macierzyński</option>
<option value="7">Urlop rehabilitacyjny</option>
<option value="6">Urlop wychowawczy</option>
</select>
</div>
<div class="mb-4 text-start">
<label class="form-label fw-semibold">Dodatkowe informacje</label>
<textarea class="form-control" rows="3" placeholder="Opcjonalna uwaga do przełożonego..."></textarea>
</div>
<button type="button" class="btn btn-primary w-100 py-3 fw-bold fs-6" id="btn-submit-vacation">
Wyślij wniosek
</button>
</form>
</div>
</div>
</div>
</div>
<!-- Flatpickr CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<!-- Flatpickr Theme (optional, fits well) -->
<link rel="stylesheet" type="text/css" href="https://npmcdn.com/flatpickr/dist/themes/airbnb.css">
<!-- Floating Action Button (FAB) dla nowego wniosku -->
<div class="fab-wrapper">
<button class="btn btn-primary fab-btn" data-bs-toggle="modal" data-bs-target="#vacationModal" aria-label="Nowy wniosek o urlop">
<i class='bx bx-plus'></i>
</button>
</div>
<?php include 'footer.php'; ?>
<!-- Flatpickr JS -->
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script src="https://npmcdn.com/flatpickr/dist/l10n/pl.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Inicjalizacja datepickera (Flatpickr) z polskim językiem
flatpickr(".datepicker", {
locale: "pl",
dateFormat: "Y-m-d",
disableMobile: "true" // Pozwala na ładny natywny wygląd flatpickr na mobilkach
});
// Symulacja wysyłania
const btnSubmit = document.getElementById('btn-submit-vacation');
if (btnSubmit) {
btnSubmit.addEventListener('click', function() {
const originalText = this.innerHTML;
this.innerHTML = "<i class='bx bx-loader-alt bx-spin me-2'></i> Wysyłanie...";
this.disabled = true;
setTimeout(() => {
this.innerHTML = "<i class='bx bx-check me-2'></i> Wysłano pomyślnie!";
this.classList.replace('btn-primary', 'btn-success');
setTimeout(() => {
const modalEl = document.getElementById('vacationModal');
const modal = bootstrap.Modal.getInstance(modalEl);
if (modal) modal.hide();
// Reset buttona
this.innerHTML = originalText;
this.classList.replace('btn-success', 'btn-primary');
this.disabled = false;
}, 1500);
}, 1500);
});
}
});
</script>