Dualside print update realisation + add backend versioning

This commit is contained in:
2026-09-18 03:07:25 +03:00
parent 10b78d5d81
commit 0bfeeadeb1
4 changed files with 59 additions and 37 deletions

View File

@ -1,6 +1,5 @@
<!-- lib/pages/print/PrintProgress.svelte -->
<script>
const currentStatus = $derived.by(() => {
if (!store.job) return 'idle';
const f = store.job.files.find(f => f.status === 'printing');
@ -13,10 +12,9 @@
const OFFICE_EXT = ['DOC', 'DOCX', 'ODT', 'XLS', 'XLSX', 'ODS', 'PPT', 'PPTX', 'ODP'];
const STATUS_LABEL = {
queued: 'В очереди',
queued: 'Ожидает',
printing: 'Печатается…',
awaiting_flip: 'Переверните',
awaiting: 'Далее',
awaiting_flip: 'Переложите бумагу',
done: 'Готово',
error: 'Ошибка',
cancelled: 'Отменено'
@ -79,7 +77,9 @@
{#if store.job}
{#each store.job.files as f, i (i + '-' + f.name)}
{@const b = badge(f.name)}
<section class="file-card" class:current={f.status === 'awaiting_flip' || f.status === 'awaiting' || f.status === 'printing'}>
{@const isLastDone = f.status === 'done' && !store.job.files.slice(i + 1).some(f => f.status === 'printing' || f.status === 'queued')}
{@const hasNextQueued = store.job.files.slice(i + 1).some(f => f.status === 'queued')}
<section class="file-card" class:current={f.status === 'awaiting_flip' || f.status === 'printing' || isLastDone}>
<div class="file-row">
{#if b}<span class="type-badge">{b}</span>{/if}
<span class="file-name" title={f.name}>{f.name}</span>
@ -89,15 +89,12 @@
<!-- ── Инструкция для РУЧНОГО ДУПЛЕКСА (после 1-го прохода) ── -->
{#if f.status === 'awaiting_flip'}
<ol class="pickup-hint flip-hint">
{#if f.remove_top_sheet}
<li>Уберите верхний листок</li>
{/if}
<li>Не переворачивая, положите остальные листы в слот ручной подачи</li>
</ol>
{/if}
<!-- ── Инструкция для обычного «забери документ» ── -->
{#if f.status === 'awaiting'}
{#if isLastDone && hasNextQueued}
<ol class="pickup-hint">
<li>Возьмите готовый документ</li>
<li>Нажмите далее</li>
@ -128,8 +125,8 @@
<button class="next-btn next-btn-flip" onclick={store.advanceJob}>
Готово — печатать обратную сторону
</button>
{:else if store.job?.phase === 'awaiting_pickup'}
<!-- Обычное: забрал документ → следующий -->
{:else if store.job?.phase === 'awaiting_pickup' && store.job.files.some(f => f.status === 'queued')}
<!-- Обычное: забрал документ → следующий (только если есть следующий) -->
<button class="next-btn" onclick={store.advanceJob}>Далее</button>
{:else}
<!-- Кнопка видна, но серая и disabled пока сервер не допечатал -->
@ -182,9 +179,8 @@
.file-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status { flex-shrink: 0; font-size: 14px; font-weight: 700; }
.st-done { color: #22c55e; }
.st-awaiting { color: #fbbf24; }
.st-printing { color: #a5b4fc; }
.st-queued { color: #8b93a1; }
.st-printing { color: #a5b4fc; }
.st-error { color: #ef4444; }
.st-cancelled { color: #6b7280; }