Travel: Poprawki w makiecie modułu faktur
This commit is contained in:
@@ -549,7 +549,7 @@ include '../../header-travel.php';
|
||||
<td class="text-end">
|
||||
<button class="btn btn-sm btn-icon btn-text-secondary" data-bs-toggle="tooltip"
|
||||
title="Podgląd dokumentu"><i class="bx bx-show"></i></button>
|
||||
<button class="btn btn-sm btn-primary ms-1">Połącz ze zleceniem</button>
|
||||
<button class="btn btn-sm btn-primary ms-1" data-bs-toggle="modal" data-bs-target="#modalLinkExistingInvoice">Połącz ze zleceniem</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -842,71 +842,228 @@ include '../../header-travel.php';
|
||||
</div>
|
||||
|
||||
<div class="row g-4">
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-none border h-100">
|
||||
<div class="card-header bg-lighter py-3 border-bottom">
|
||||
<h6 class="mb-0"><i class="bx bx-building-house me-2"></i>Dane dostawcy</h6>
|
||||
<!-- Lewa kolumna: Podgląd PDF -->
|
||||
<div class="col-lg-5">
|
||||
<div class="card shadow-none border h-100 bg-lighter d-flex flex-column">
|
||||
<div
|
||||
class="card-header py-3 border-bottom bg-white d-flex justify-content-between align-items-center">
|
||||
<h6 class="mb-0"><i class="bx bxs-file-pdf text-danger me-2"></i>Podgląd
|
||||
dokumentu</h6>
|
||||
<div class="badge bg-label-secondary">faktura_transport.pdf</div>
|
||||
</div>
|
||||
<div class="card-body pt-3">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nazwa dostawcy <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" value="Flixbus Polska Sp. z o.o.">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label d-flex justify-content-between">
|
||||
<span>NIP <span class="text-danger">*</span></span>
|
||||
<span class="text-success small"><i class="bx bx-check-circle"></i>
|
||||
Znaleziono w bazie</span>
|
||||
</label>
|
||||
<input type="text" class="form-control border-success" value="1234567890">
|
||||
</div>
|
||||
<div class="mb-0">
|
||||
<label class="form-label">Adres</label>
|
||||
<textarea class="form-control"
|
||||
rows="2">ul. Przykładowa 12, Warszawa</textarea>
|
||||
<div class="card-body p-0 flex-grow-1 d-flex align-items-center justify-content-center"
|
||||
style="min-height: 450px; background-color: #525659; border-bottom-left-radius: 0.375rem; border-bottom-right-radius: 0.375rem;">
|
||||
<!-- Placeholder for PDF viewer -->
|
||||
<div class="text-center text-white p-4">
|
||||
<i class="bx bx-file-blank" style="font-size: 4rem; opacity: 0.5;"></i>
|
||||
<p class="mt-2 mb-0">Podgląd pliku PDF</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-none border h-100">
|
||||
<div class="card-header bg-lighter py-3 border-bottom">
|
||||
<h6 class="mb-0"><i class="bx bx-receipt me-2"></i>Szczegóły dokumentu</h6>
|
||||
<!-- Prawa kolumna: Formularz (Dane dostawcy + Szczegóły) -->
|
||||
<div class="col-lg-7">
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-none border">
|
||||
<div class="card-header bg-lighter py-2 border-bottom">
|
||||
<h6 class="mb-0"><i class="bx bx-building-house me-2"></i>Dane dostawcy
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body pt-3 pb-2">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-6 mb-2">
|
||||
<label class="form-label small mb-1">Nazwa dostawcy <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm"
|
||||
value="Flixbus Polska Sp. z o.o.">
|
||||
</div>
|
||||
<div class="col-md-6 mb-2">
|
||||
<label
|
||||
class="form-label small mb-1 d-flex justify-content-between w-100">
|
||||
<span>NIP <span class="text-danger">*</span></span>
|
||||
<span class="text-success" style="font-size: 0.75rem;"><i
|
||||
class="bx bx-check-circle"></i> W bazie</span>
|
||||
</label>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm border-success"
|
||||
value="1234567890">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label small mb-1">Adres</label>
|
||||
<textarea class="form-control form-control-sm"
|
||||
rows="1">ul. Przykładowa 12, Warszawa</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-3">
|
||||
<div class="row g-3">
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label">Nr faktury <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" value="FV/2026/05/123">
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card shadow-none border">
|
||||
<div class="card-header bg-lighter py-2 border-bottom">
|
||||
<h6 class="mb-0"><i class="bx bx-receipt me-2"></i>Szczegóły dokumentu
|
||||
</h6>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label">Data wystawienia <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" value="2026-05-04">
|
||||
<div class="card-body pt-3 pb-2">
|
||||
<div class="row g-2">
|
||||
<div class="col-sm-6 mb-2">
|
||||
<label class="form-label small mb-1">Nr faktury <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm"
|
||||
value="FV/2026/05/123">
|
||||
</div>
|
||||
<div class="col-sm-6 mb-2">
|
||||
<label class="form-label small mb-1">Data wystawienia <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control form-control-sm"
|
||||
value="2026-05-04">
|
||||
</div>
|
||||
<div class="col-sm-4 mb-2">
|
||||
<label class="form-label small mb-1">Kwota netto</label>
|
||||
<input type="number" class="form-control form-control-sm"
|
||||
value="3414.63">
|
||||
</div>
|
||||
<div class="col-sm-4 mb-2">
|
||||
<label class="form-label small mb-1">Kwota VAT</label>
|
||||
<input type="number" class="form-control form-control-sm"
|
||||
value="785.37">
|
||||
</div>
|
||||
<div class="col-sm-4 mb-2">
|
||||
<label class="form-label small mb-1">Waluta</label>
|
||||
<select class="form-select form-select-sm">
|
||||
<option value="PLN" selected>PLN</option>
|
||||
<option value="EUR">EUR</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label class="form-label small mb-1">Kwota brutto <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="number"
|
||||
class="form-control form-control-lg fw-bold text-primary"
|
||||
id="invoiceGrossAmount" value="4200.00">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label">Kwota netto</label>
|
||||
<input type="number" class="form-control" value="3414.63">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="card shadow-none border">
|
||||
<div
|
||||
class="card-header bg-lighter py-2 border-bottom d-flex justify-content-between align-items-center">
|
||||
<h6 class="mb-0"><i class="bx bx-list-ul me-2"></i>Pozycje z faktury
|
||||
(OCR)</h6>
|
||||
<button type="button" class="btn btn-xs btn-outline-primary"><i
|
||||
class="bx bx-plus"></i> Dodaj</button>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label">Kwota VAT</label>
|
||||
<input type="number" class="form-control" value="785.37">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<label class="form-label">Kwota brutto <span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control fw-bold text-primary"
|
||||
id="invoiceGrossAmount" value="4200.00">
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label class="form-label">Waluta</label>
|
||||
<select class="form-select">
|
||||
<option value="PLN" selected>PLN</option>
|
||||
<option value="EUR">EUR</option>
|
||||
</select>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0"
|
||||
style="font-size: 0.75rem;">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 45%;" class="px-2">Nazwa</th>
|
||||
<th style="width: 10%;" class="px-1 text-center">Ilość
|
||||
</th>
|
||||
<th style="width: 15%;" class="px-1 text-end">Cena netto
|
||||
</th>
|
||||
<th style="width: 15%;" class="px-1 text-end">Kwota
|
||||
netto</th>
|
||||
<th style="width: 10%;" class="px-1">VAT</th>
|
||||
<th style="width: 5%;" class="px-2 text-center"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="px-2 py-1"><input type="text"
|
||||
class="form-control form-control-sm px-2 py-1"
|
||||
style="font-size: 0.75rem;"
|
||||
value="Przejazd autokarowy WWA-ZAK"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-center"
|
||||
style="font-size: 0.75rem;" value="24"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="108.33"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="2600.00">
|
||||
</td>
|
||||
<td class="px-1 py-1">
|
||||
<select class="form-select form-select-sm px-1 py-1"
|
||||
style="font-size: 0.75rem;">
|
||||
<option value="8" selected>8%</option>
|
||||
<option value="23">23%</option>
|
||||
<option value="0">0%</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="px-2 py-1 text-center">
|
||||
<button class="btn btn-xs btn-icon text-danger"
|
||||
title="Usuń"><i
|
||||
class="bx bx-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 py-1"><input type="text"
|
||||
class="form-control form-control-sm px-2 py-1"
|
||||
style="font-size: 0.75rem;"
|
||||
value="Przejazd autokarowy ZAK-WWA"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-center"
|
||||
style="font-size: 0.75rem;" value="24"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="25.00"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="600.00"></td>
|
||||
<td class="px-1 py-1">
|
||||
<select class="form-select form-select-sm px-1 py-1"
|
||||
style="font-size: 0.75rem;">
|
||||
<option value="8" selected>8%</option>
|
||||
<option value="23">23%</option>
|
||||
<option value="0">0%</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="px-2 py-1 text-center">
|
||||
<button class="btn btn-xs btn-icon text-danger"
|
||||
title="Usuń"><i
|
||||
class="bx bx-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 py-1"><input type="text"
|
||||
class="form-control form-control-sm px-2 py-1"
|
||||
style="font-size: 0.75rem;"
|
||||
value="Opłata za rezerwację + obsługa"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-center"
|
||||
style="font-size: 0.75rem;" value="1"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="214.63"></td>
|
||||
<td class="px-1 py-1"><input type="number"
|
||||
class="form-control form-control-sm px-1 py-1 text-end"
|
||||
style="font-size: 0.75rem;" value="214.63"></td>
|
||||
<td class="px-1 py-1">
|
||||
<select class="form-select form-select-sm px-1 py-1"
|
||||
style="font-size: 0.75rem;">
|
||||
<option value="8">8%</option>
|
||||
<option value="23" selected>23%</option>
|
||||
<option value="0">0%</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="px-2 py-1 text-center">
|
||||
<button class="btn btn-xs btn-icon text-danger"
|
||||
title="Usuń"><i
|
||||
class="bx bx-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -930,7 +1087,7 @@ include '../../header-travel.php';
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<label class="card border border-2 shadow-none cursor-pointer h-100 option-card"
|
||||
for="assignSingle">
|
||||
<div class="card-body text-center p-3">
|
||||
@@ -939,12 +1096,12 @@ include '../../header-travel.php';
|
||||
<h6 class="mb-1"><i
|
||||
class="bx bx-link-alt fs-4 d-block mb-2 text-primary"></i>Pojedyncze
|
||||
(1:1)</h6>
|
||||
<small class="text-muted">Jedna faktura na jedno zlecenie.</small>
|
||||
<small class="text-muted">Faktura na jedno zlecenie.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card bg-lighter"
|
||||
for="assignSplit">
|
||||
<div class="card-body text-center p-3">
|
||||
@@ -953,12 +1110,12 @@ include '../../header-travel.php';
|
||||
<h6 class="mb-1"><i
|
||||
class="bx bx-git-branch fs-4 d-block mb-2 text-primary"></i>Rozksięgowanie
|
||||
(1:N)</h6>
|
||||
<small class="text-muted">Faktura zbiorcza na kilka zleceń.</small>
|
||||
<small class="text-muted">Faktura na kilka zleceń.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card bg-lighter"
|
||||
for="assignPartial">
|
||||
<div class="card-body text-center p-3">
|
||||
@@ -967,7 +1124,21 @@ include '../../header-travel.php';
|
||||
<h6 class="mb-1"><i
|
||||
class="bx bx-layer-plus fs-4 d-block mb-2 text-primary"></i>Cząstkowe
|
||||
(N:1)</h6>
|
||||
<small class="text-muted">Zaliczka/Dopłata do zlecenia.</small>
|
||||
<small class="text-muted">Zaliczka do zlecenia.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card bg-lighter"
|
||||
for="assignGeneral">
|
||||
<div class="card-body text-center p-3">
|
||||
<input type="radio" name="assignType" id="assignGeneral" value="general"
|
||||
class="form-check-input mb-3" onchange="toggleAssignType('general')">
|
||||
<h6 class="mb-1"><i
|
||||
class="bx bx-buildings fs-4 d-block mb-2 text-primary"></i>Koszty
|
||||
ogólne</h6>
|
||||
<small class="text-muted">Bez przypisania do zlecenia.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
@@ -1071,7 +1242,7 @@ include '../../header-travel.php';
|
||||
</div>
|
||||
<!-- /Card: Podsumowanie odczytanej faktury -->
|
||||
|
||||
<div class="card shadow-sm border">
|
||||
<div class="card shadow-sm border" id="ordersListCard">
|
||||
<div
|
||||
class="card-header bg-label-secondary d-flex justify-content-between align-items-center py-3">
|
||||
<h6 class="mb-0">Dostępne zlecenia dla: Flixbus Polska</h6>
|
||||
@@ -1164,6 +1335,155 @@ include '../../header-travel.php';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal: Połącz istniejącą fakturę ze zleceniem -->
|
||||
<div class="modal fade" id="modalLinkExistingInvoice" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header border-bottom pb-3">
|
||||
<h5 class="modal-title d-flex align-items-center">
|
||||
<i class="bx bx-link text-primary fs-4 me-2"></i>
|
||||
Połącz fakturę ze zleceniem (lub w Koszty ogólne)
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<h6 class="mb-3">Wybierz sposób rozliczenia dokumentu</h6>
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-3">
|
||||
<label class="card border border-2 shadow-none cursor-pointer h-100 option-card-existing border-primary" for="assignSingleExisting">
|
||||
<div class="card-body text-center p-3">
|
||||
<input type="radio" name="assignTypeExisting" id="assignSingleExisting" value="single" class="form-check-input mb-3" checked onchange="toggleAssignTypeExisting('single')">
|
||||
<h6 class="mb-1"><i class="bx bx-link-alt fs-4 d-block mb-2 text-primary"></i>Pojedyncze (1:1)</h6>
|
||||
<small class="text-muted">Faktura na jedno zlecenie.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card-existing bg-lighter" for="assignSplitExisting">
|
||||
<div class="card-body text-center p-3">
|
||||
<input type="radio" name="assignTypeExisting" id="assignSplitExisting" value="split" class="form-check-input mb-3" onchange="toggleAssignTypeExisting('split')">
|
||||
<h6 class="mb-1"><i class="bx bx-git-branch fs-4 d-block mb-2 text-primary"></i>Rozksięgowanie (1:N)</h6>
|
||||
<small class="text-muted">Faktura na kilka zleceń.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card-existing bg-lighter" for="assignPartialExisting">
|
||||
<div class="card-body text-center p-3">
|
||||
<input type="radio" name="assignTypeExisting" id="assignPartialExisting" value="partial" class="form-check-input mb-3" onchange="toggleAssignTypeExisting('partial')">
|
||||
<h6 class="mb-1"><i class="bx bx-layer-plus fs-4 d-block mb-2 text-primary"></i>Cząstkowe (N:1)</h6>
|
||||
<small class="text-muted">Zaliczka do zlecenia.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="card border shadow-none cursor-pointer h-100 option-card-existing bg-lighter" for="assignGeneralExisting">
|
||||
<div class="card-body text-center p-3">
|
||||
<input type="radio" name="assignTypeExisting" id="assignGeneralExisting" value="general" class="form-check-input mb-3" onchange="toggleAssignTypeExisting('general')">
|
||||
<h6 class="mb-1"><i class="bx bx-buildings fs-4 d-block mb-2 text-primary"></i>Koszty ogólne</h6>
|
||||
<small class="text-muted">Bez przypisania do zlecenia.</small>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Podsumowanie faktury -->
|
||||
<div class="card shadow-none border mb-3">
|
||||
<div class="card-header py-2 px-3 d-flex align-items-center justify-content-between" style="background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%); border-bottom: 1px solid #d0deff;">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<i class="bx bx-receipt text-primary fs-5"></i>
|
||||
<span class="fw-semibold text-dark small">Szczegóły wybranej faktury</span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="text-muted small">Nr faktury:</span>
|
||||
<span class="badge bg-label-primary fw-semibold">FV/2026/05/1234</span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="text-muted small">Dostawca:</span>
|
||||
<span class="fw-semibold small text-dark">Flixbus Polska Sp. z o.o.</span>
|
||||
</div>
|
||||
<div class="vr opacity-25"></div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="text-muted small">Brutto:</span>
|
||||
<span class="fw-bold text-primary">4 200,00 PLN</span>
|
||||
<input type="hidden" id="invoiceGrossAmountExisting" value="4200.00">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm border" id="ordersListCardExisting">
|
||||
<div class="card-header bg-label-secondary d-flex justify-content-between align-items-center py-3">
|
||||
<h6 class="mb-0">Dostępne zlecenia dla: Flixbus Polska</h6>
|
||||
<div class="input-group input-group-sm w-auto">
|
||||
<span class="input-group-text"><i class="bx bx-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="Szukaj wycieczki...">
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive" style="max-height: 300px;">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light sticky-top text-nowrap">
|
||||
<tr>
|
||||
<th width="40"></th>
|
||||
<th>Zlecenie / Wycieczka</th>
|
||||
<th>Data real.</th>
|
||||
<th class="text-end">Kwota zlecenia</th>
|
||||
<th width="150" class="text-end split-col-existing d-none">Przypisz kwotę</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="assign-order-row-existing" data-order-amount="4200.00">
|
||||
<td><input class="form-check-input" type="radio" name="orderSelectExisting"></td>
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="fw-semibold text-primary d-flex align-items-center gap-2">ZL/2026/05/089
|
||||
<span class="badge bg-label-success order-suggestion-badge">Sugerowane zlecenie</span>
|
||||
</span>
|
||||
<small class="text-muted">#WYC-098 (Tatry)</small>
|
||||
</div>
|
||||
</td>
|
||||
<td>05.05.2026</td>
|
||||
<td class="text-end fw-semibold">4 200,00 PLN</td>
|
||||
<td class="split-col-existing d-none text-end"><input type="number" class="form-control form-control-sm text-end split-amount-input-existing" placeholder="0.00" min="0" step="0.01"></td>
|
||||
</tr>
|
||||
<tr class="assign-order-row-existing" data-order-amount="2100.00">
|
||||
<td><input class="form-check-input" type="radio" name="orderSelectExisting"></td>
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="fw-semibold text-primary d-flex align-items-center gap-2">ZL/2026/05/156
|
||||
<span class="badge bg-label-success order-suggestion-badge d-none">Sugerowane zlecenie</span>
|
||||
</span>
|
||||
<small class="text-muted">#WYC-103 (Kraków)</small>
|
||||
</div>
|
||||
</td>
|
||||
<td>08.05.2026</td>
|
||||
<td class="text-end fw-semibold">2 100,00 PLN</td>
|
||||
<td class="split-col-existing d-none text-end"><input type="number" class="form-control form-control-sm text-end split-amount-input-existing" placeholder="0.00" min="0" step="0.01"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr id="splitTotalRowExisting" class="table-light d-none">
|
||||
<td colspan="4" class="text-end fw-semibold">Suma przypisanych kwot:</td>
|
||||
<td class="text-end fw-bold" id="splitTotalValueExisting">0,00 PLN</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger d-none mt-3 mb-0" id="splitValidationAlertExisting" role="alert">
|
||||
Suma przypisanych pozycji musi być równa kwocie faktury.
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer border-top pt-3">
|
||||
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal">Anuluj</button>
|
||||
<button type="button" class="btn btn-success" id="btnSaveAssignExisting"><i class="bx bx-check me-1"></i> Zapisz powiązanie</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// --- OBSŁUGA PANELU FILTRÓW ---
|
||||
var filtersVisible = true; // początkowo widoczne
|
||||
@@ -1302,6 +1622,16 @@ include '../../header-travel.php';
|
||||
activeCard.classList.add('border-2', 'border-primary');
|
||||
activeCard.classList.remove('bg-lighter');
|
||||
|
||||
// Pokaz/ukryj listę zleceń w przypadku kosztów ogólnych
|
||||
const ordersListCard = document.getElementById('ordersListCard');
|
||||
if (ordersListCard) {
|
||||
if (type === 'general') {
|
||||
ordersListCard.classList.add('d-none');
|
||||
} else {
|
||||
ordersListCard.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
// Pokaż/ukryj kolumnę z kwotami w tabeli (dla 1:N)
|
||||
const splitCols = document.querySelectorAll('.split-col');
|
||||
if (type === 'split') {
|
||||
@@ -1422,6 +1752,90 @@ include '../../header-travel.php';
|
||||
});
|
||||
updateSuggestedOrder();
|
||||
updateSplitAmountSummary();
|
||||
|
||||
// --- JS DLA MODALA: Połącz istniejącą fakturę ze zleceniem ---
|
||||
function toggleAssignTypeExisting(type) {
|
||||
document.querySelectorAll('.option-card-existing').forEach(card => {
|
||||
card.classList.remove('border-2', 'border-primary');
|
||||
card.classList.add('bg-lighter');
|
||||
});
|
||||
|
||||
const activeInput = document.querySelector(`input[id="assign${type.charAt(0).toUpperCase() + type.slice(1)}Existing"]`);
|
||||
if (activeInput) {
|
||||
const activeCard = activeInput.closest('.option-card-existing');
|
||||
activeCard.classList.add('border-2', 'border-primary');
|
||||
activeCard.classList.remove('bg-lighter');
|
||||
}
|
||||
|
||||
const ordersListCard = document.getElementById('ordersListCardExisting');
|
||||
if (ordersListCard) {
|
||||
ordersListCard.classList.toggle('d-none', type === 'general');
|
||||
}
|
||||
|
||||
const splitCols = document.querySelectorAll('.split-col-existing');
|
||||
if (type === 'split') {
|
||||
splitCols.forEach(col => col.classList.remove('d-none'));
|
||||
document.querySelectorAll('input[name="orderSelectExisting"]').forEach(el => el.type = 'checkbox');
|
||||
} else {
|
||||
splitCols.forEach(col => col.classList.add('d-none'));
|
||||
document.querySelectorAll('input[name="orderSelectExisting"]').forEach(el => el.type = 'radio');
|
||||
}
|
||||
|
||||
updateSplitAmountSummaryExisting();
|
||||
}
|
||||
|
||||
function updateSplitAmountSummaryExisting() {
|
||||
const isSplit = document.getElementById('assignSplitExisting')?.checked;
|
||||
const totalRow = document.getElementById('splitTotalRowExisting');
|
||||
const alertBox = document.getElementById('splitValidationAlertExisting');
|
||||
const saveBtn = document.getElementById('btnSaveAssignExisting');
|
||||
|
||||
if (!isSplit) {
|
||||
totalRow?.classList.add('d-none');
|
||||
alertBox?.classList.add('d-none');
|
||||
if (saveBtn) saveBtn.disabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
totalRow?.classList.remove('d-none');
|
||||
let sum = 0;
|
||||
document.querySelectorAll('.split-amount-input-existing').forEach(input => {
|
||||
const val = parseFloat(input.value);
|
||||
if (!isNaN(val)) sum += val;
|
||||
});
|
||||
|
||||
const totalValueEl = document.getElementById('splitTotalValueExisting');
|
||||
if (totalValueEl) totalValueEl.textContent = formatPln(sum);
|
||||
|
||||
const invoiceInput = document.getElementById('invoiceGrossAmountExisting');
|
||||
const invoiceGross = parseFloat(invoiceInput ? invoiceInput.value : 0) || 0;
|
||||
|
||||
if (Math.abs(sum - invoiceGross) > 0.01) {
|
||||
alertBox?.classList.remove('d-none');
|
||||
if (saveBtn) saveBtn.disabled = true;
|
||||
} else {
|
||||
alertBox?.classList.add('d-none');
|
||||
if (saveBtn) saveBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelectorAll('input[name="orderSelectExisting"], .split-amount-input-existing').forEach(el => {
|
||||
el.addEventListener('change', updateSplitAmountSummaryExisting);
|
||||
el.addEventListener('input', updateSplitAmountSummaryExisting);
|
||||
});
|
||||
|
||||
document.querySelectorAll('.split-amount-input-existing').forEach(input => {
|
||||
input.addEventListener('input', function () {
|
||||
const row = input.closest('tr');
|
||||
const selector = row ? row.querySelector('input[name="orderSelectExisting"]') : null;
|
||||
const value = parseFloat(input.value);
|
||||
if (selector && Number.isFinite(value) && value > 0) {
|
||||
selector.checked = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
toggleAssignTypeExisting('single'); // inicjalizacja
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user