feat: attachments panel, file previews, print preview and history (#34)
Documents need to show, upload and generate their files from the interface, and users need to see who changed a record. This adds the attachment list (upload, preview, download, lock, trash and restore, older versions, ZIP, generate/regenerate), in-app previews for PDF, images, XML, text, CSV and XLSX, an A4 print preview with "save as attachment", and an audit history list read through a permission-checked AuditTrailService. Files are served by /files endpoints that require a signed-in user and the company permissions; only PDF and images open inline, with their own CSP that allows framing by this site only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f415dc37a8
commit
8198e0a754
20 files changed
+1786
-24
No files matched your search
@@ -241,3 +241,73 @@ h1[tabindex="-1"]:focus { outline: none; box-shadow: none; }
|
||||
.palette .hit > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.palette .hit .d:last-child { margin-left: auto; }
|
||||
@media (max-width: 899px) { .kh-help { grid-template-columns: 1fr; } .kh-help-index { position: static; max-height: 240px; } }
|
||||
|
||||
/* Attachments and generated files (SPEC §9.4, mockup 024). */
|
||||
.kh-tab-body { padding: 14px 16px; }
|
||||
.kh-att { display: flex; flex-direction: column; gap: 10px; }
|
||||
.kh-att-head { display: flex; align-items: center; gap: 8px; }
|
||||
.kh-att-title, .kh-att-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--kh-text-3); font-weight: 600; }
|
||||
.kh-att-section { margin-top: 6px; }
|
||||
.kh-att-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--kh-border); border-radius: 8px; }
|
||||
.kh-att-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--kh-border); }
|
||||
.kh-att-row:last-child { border-bottom: 0; }
|
||||
.kh-att-row.old { opacity: .72; }
|
||||
.kh-att-type { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 7px; display: grid; place-items: center; font: 600 10px var(--kh-mono); letter-spacing: .3px; background: var(--kh-surface-2); color: var(--kh-text-2); }
|
||||
.kh-att-type.pdf { background: var(--kh-err-soft); color: var(--kh-err); }
|
||||
.kh-att-type.xml { background: var(--kh-info-soft); color: var(--kh-info); }
|
||||
.kh-att-type.sheet { background: var(--kh-ok-soft); color: var(--kh-ok); }
|
||||
.kh-att-type.img { background: var(--kh-warn-soft); color: var(--kh-warn); }
|
||||
.kh-att-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||
.kh-att-main .t { font-weight: 600; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; }
|
||||
.kh-att-main .m { color: var(--kh-text-3); font-size: 12px; }
|
||||
.kh-att-actions { display: flex; gap: 2px; flex: 0 0 auto; }
|
||||
.kh-att-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.kh-att-upload { cursor: pointer; }
|
||||
.kh-att-upload input[type="file"] { display: none; }
|
||||
.kh-att-upload.disabled { opacity: .6; pointer-events: none; }
|
||||
|
||||
/* Preview of a file (mockup 024). */
|
||||
.kh-preview { min-height: 200px; }
|
||||
.kh-preview-frame { width: 100%; height: 70vh; border: 1px solid var(--kh-border); border-radius: 6px; background: #fff; }
|
||||
.kh-preview-img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
|
||||
.kh-preview-text { max-height: 70vh; overflow: auto; margin: 0; padding: 12px; background: var(--kh-surface-2); border-radius: 6px; font: 12px/1.5 var(--kh-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.kh-preview-table { max-height: 70vh; overflow: auto; }
|
||||
.kh-preview-table td { white-space: nowrap; }
|
||||
|
||||
/* History of a record (SPEC §7.4). */
|
||||
.kh-audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
|
||||
.kh-audit-item { display: flex; gap: 10px; align-items: flex-start; }
|
||||
.kh-audit-main { flex: 1; min-width: 0; }
|
||||
.kh-audit-main .t { font-weight: 600; margin-bottom: 4px; }
|
||||
.kh-audit-main .t .muted { font-weight: 400; }
|
||||
.kh-audit-changes { border-collapse: collapse; font-size: 12.5px; }
|
||||
.kh-audit-changes th { text-align: left; font-weight: 600; color: var(--kh-text-3); padding: 2px 14px 2px 0; }
|
||||
.kh-audit-changes td { padding: 2px 14px 2px 0; overflow-wrap: anywhere; }
|
||||
.kh-audit-changes td.old { color: var(--kh-text-3); text-decoration: line-through; }
|
||||
|
||||
/* Print preview (SPEC §9.4, mockup 025): an A4 sheet; printing shows the sheet only. */
|
||||
.kh-print { display: flex; flex-direction: column; gap: 12px; }
|
||||
.kh-print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.kh-print-stage { background: var(--kh-surface-2); border: 1px solid var(--kh-border); border-radius: 8px; padding: 24px; overflow: auto; }
|
||||
.kh-sheet { width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 16mm; background: #fff; color: #1d2433; box-shadow: 0 2px 12px rgba(0,0,0,.12); font: 10pt/1.45 var(--kh-font, system-ui), sans-serif; box-sizing: border-box; }
|
||||
.kh-sheet-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1F5F8B; padding-bottom: 10px; margin-bottom: 14px; }
|
||||
.kh-sheet-company { font-size: 15pt; font-weight: 700; }
|
||||
.kh-sheet-muted { color: #6b7280; font-size: 9pt; }
|
||||
.kh-sheet-title { text-align: right; }
|
||||
.kh-sheet-title .k { font-size: 16pt; font-weight: 700; color: #1F5F8B; }
|
||||
.kh-sheet-title .n { color: #6b7280; }
|
||||
.kh-sheet-intro { margin: 0 0 14px; }
|
||||
.kh-sheet-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
|
||||
.kh-sheet-table th { background: #eceff3; text-align: left; padding: 5px 6px; }
|
||||
.kh-sheet-table td { padding: 5px 6px; border-bottom: 1px solid #d9dde3; }
|
||||
.kh-sheet-table .num { text-align: right; white-space: nowrap; }
|
||||
.kh-sheet-table .mono { font-family: var(--kh-mono); }
|
||||
.kh-sheet-table tfoot td { border-bottom: 0; padding-top: 8px; }
|
||||
.kh-sheet-foot { margin-top: 24px; color: #6b7280; font-size: 8.5pt; }
|
||||
@media (max-width: 899px) { .kh-print-stage { padding: 8px; } .kh-sheet { width: 100%; min-height: 0; padding: 16px; } }
|
||||
@media print {
|
||||
@page { size: A4; margin: 0; }
|
||||
body * { visibility: hidden; }
|
||||
.kh-sheet, .kh-sheet * { visibility: visible; }
|
||||
.kh-sheet { position: absolute; left: 0; top: 0; zoom: 1 !important; width: 210mm; min-height: 0; box-shadow: none; margin: 0; }
|
||||
}
|
||||
Reference in new issue
Block a user