Phase 113 complete (v3.7 Invoices): - DB: invoices, invoice_configs, invoice_number_counters, fakturownia_integration_settings + orders.invoice_requested - FakturowniaIntegrationRepository (multi-account via integrations.type='fakturownia') - FakturowniaApiClient (testConnection; createInvoice/downloadPdf STUBs) - IntegrationsRepository::updateTestResult() (reusable test-result writer) - /settings/integrations/fakturownia (list + edit + test + delete) - Karta Fakturownia w hubie /settings/integrations Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
104 lines
3.9 KiB
PHP
104 lines
3.9 KiB
PHP
<?php
|
|
/** @var array<int, array<string, mixed>> $rows */
|
|
$rows = is_array($rows ?? null) ? $rows : [];
|
|
$flashSave = trim((string) ($flashSave ?? ''));
|
|
$flashTest = trim((string) ($flashTest ?? ''));
|
|
$flashError = trim((string) ($flashError ?? ''));
|
|
?>
|
|
|
|
<section class="card">
|
|
<h2 class="section-title">Integracje Fakturownia</h2>
|
|
<p class="muted mt-12">Konfiguracja kont Fakturowni do wystawiania faktur dla zamowien.</p>
|
|
|
|
<?php if ($flashError !== ''): ?>
|
|
<div class="alert alert--danger mt-12" role="alert"><?= $e($flashError) ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($flashSave !== ''): ?>
|
|
<div class="alert alert--success mt-12" role="status"><?= $e($flashSave) ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($flashTest !== ''): ?>
|
|
<div class="alert alert--info mt-12" role="status"><?= $e($flashTest) ?></div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="card mt-16">
|
|
<h3 class="section-title">Lista integracji</h3>
|
|
|
|
<div class="form-actions mt-12">
|
|
<a class="btn btn--primary" href="/settings/integrations/fakturownia/new">Dodaj integracje</a>
|
|
</div>
|
|
|
|
<?php if ($rows === []): ?>
|
|
<p class="muted mt-12">Brak skonfigurowanych integracji Fakturowni. Dodaj pierwsza ponizej.</p>
|
|
<?php else: ?>
|
|
<div class="table-wrap mt-12">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Nazwa</th>
|
|
<th>Subdomena</th>
|
|
<th>Token</th>
|
|
<th>Status</th>
|
|
<th>Ostatni test</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($rows as $row):
|
|
$integrationId = (int) ($row['integration_id'] ?? 0);
|
|
$name = (string) ($row['name'] ?? '');
|
|
$prefix = (string) ($row['account_prefix'] ?? '');
|
|
$hasToken = (bool) ($row['has_api_token'] ?? false);
|
|
$isActive = (bool) ($row['is_active'] ?? false);
|
|
$lastTestAt = (string) ($row['last_test_at'] ?? '');
|
|
$lastTestStatus = (string) ($row['last_test_status'] ?? '');
|
|
?>
|
|
<tr>
|
|
<td><?= $e($name) ?></td>
|
|
<td>
|
|
<?php if ($prefix !== ''): ?>
|
|
<?= $e($prefix . '.fakturownia.pl') ?>
|
|
<?php else: ?>
|
|
<span class="muted">brak</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ($hasToken): ?>
|
|
<span class="badge badge--success">Zapisany</span>
|
|
<?php else: ?>
|
|
<span class="badge badge--muted">Brak</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ($isActive): ?>
|
|
<span class="badge badge--success">Aktywna</span>
|
|
<?php else: ?>
|
|
<span class="badge badge--muted">Nieaktywna</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ($lastTestAt !== ''): ?>
|
|
<?= $e($lastTestAt) ?>
|
|
<?php if ($lastTestStatus !== ''): ?>
|
|
<span class="badge badge--<?= $lastTestStatus === 'ok' ? 'success' : 'muted' ?>"><?= $e(strtoupper($lastTestStatus)) ?></span>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<span class="muted">nigdy</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td style="white-space:nowrap">
|
|
<a href="/settings/integrations/fakturownia/edit?id=<?= $integrationId ?>" class="btn btn--sm btn--secondary">Edytuj</a>
|
|
<form action="/settings/integrations/fakturownia/delete" method="post" style="display:inline" class="js-confirm-delete">
|
|
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
|
<input type="hidden" name="id" value="<?= $integrationId ?>">
|
|
<button type="button" class="btn btn--sm btn--danger js-delete-btn">Usun</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|