mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
Document page modernized: headings in proportion to the text with styled tables, code and quotes; folder, template, Markdown and the review under the name, the review's menu with Mark Reviewed and how often; Edit, Share and an Export menu for PDF, Markdown and Print, Template moved to the more menu; Contents marks the section being read; Linked, Versions and History as tabs of one card, Linked as counts that open to their lists; linkGroupsHtml compact mode; 26.12.3 changelog entries
This commit is contained in:
@@ -87,28 +87,63 @@ $page_title = $row['document_name'];
|
||||
<div class="card-body d-flex flex-wrap align-items-start gap-3">
|
||||
<?= documentTile('lg') ?>
|
||||
<div class="min-w-0 flex-grow-1">
|
||||
<h1 class="h3 mb-1 d-flex flex-wrap align-items-center column-gap-2">
|
||||
<h1 class="h4 fw-semibold mb-1 d-flex flex-wrap align-items-center column-gap-2">
|
||||
<span class="text-break"><?= $document_name ?></span>
|
||||
<?php if (intval($row['document_favorite'])) { ?><i class="fas fa-star text-warning fs-6" title="Favorite - on the client's overview"></i><?php } ?>
|
||||
<?php if ($document_archived) { ?><span class="badge rounded-pill text-bg-secondary fw-normal fs-6">Archived</span><?php } ?>
|
||||
<?php if ($document_visible) { ?><span class="badge rounded-pill bg-info-subtle text-info-emphasis fw-normal fs-6" title="Technical contacts can read this in the client portal">Portal</span><?php } ?>
|
||||
<?php if ($review && $review['due']) { ?><span class="badge rounded-pill bg-warning-subtle text-warning-emphasis border border-warning-subtle fw-normal fs-6" title="Due <?= date('M j, Y', strtotime($review['next'])) ?>"><i class="fas fa-calendar-check me-1"></i>Review due</span><?php } ?>
|
||||
</h1>
|
||||
<?php if ($document_description) { ?>
|
||||
<div class="text-body-secondary"><?= $document_description ?></div>
|
||||
<?php } ?>
|
||||
<?php if ($document_tags_display) { ?>
|
||||
<div class="mt-1"><?= $document_tags_display ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Where it lives, where it came from, when it's next looked over -->
|
||||
<div class="small text-body-secondary d-flex flex-wrap align-items-center column-gap-3 row-gap-1 mt-2 itflow-document-facts">
|
||||
<a class="text-reset text-truncate" href="files.php?client_id=<?= $client_id ?>&folder_id=<?= $document_folder_id ?>" title="Folder"><i class="fas fa-fw fa-folder me-1"></i><?= escapeHtml($folder_path ? implode(' / ', array_column($folder_path, 'folder_name')) : 'Top level') ?></a>
|
||||
<?php if ($row['document_template_name'] !== null) { ?>
|
||||
<span title="The template it was made from"><i class="fas fa-fw fa-puzzle-piece me-1"></i><?= $session_is_admin ? '<a class="text-reset" href="/admin/document_template.php?document_template_id=' . intval($row['document_template_id']) . '">' . escapeHtml($row['document_template_name']) . '</a>' : escapeHtml($row['document_template_name']) ?></span>
|
||||
<?php } ?>
|
||||
<?php if (intval($row['document_is_markdown'])) { ?>
|
||||
<span title="Written in Markdown - Edit shows the Markdown"><i class="fab fa-fw fa-markdown me-1"></i>Markdown</span>
|
||||
<?php } ?>
|
||||
<?php
|
||||
// Its review - due, or when it's next due - and for an agent who may change it, the choices
|
||||
$review_text = $review ? ($review['due'] ? 'Review due since ' . date('M j, Y', strtotime($review['next'])) : 'Next review ' . date('M j, Y', strtotime($review['next']))) : 'No review schedule';
|
||||
$review_can_set = $can_edit && !$document_archived && documentReviewOwnReady();
|
||||
if ($review_can_set) {
|
||||
$review_choices = ($template_review_months !== null ? ['template' => "As its template says - " . lcfirst(DOCUMENT_TEMPLATE_REVIEW_MONTHS[$template_review_months] ?? 'never')] : [])
|
||||
+ DOCUMENT_TEMPLATE_REVIEW_MONTHS;
|
||||
$review_current = $row['document_review_months'] !== null ? (string) intval($row['document_review_months']) : ($template_review_months !== null ? 'template' : '0'); ?>
|
||||
<span class="dropdown">
|
||||
<button type="button" class="btn btn-link btn-sm p-0 text-decoration-none dropdown-toggle <?= $review && $review['due'] ? 'text-warning-emphasis fw-semibold' : 'text-reset' ?>" data-bs-toggle="dropdown" aria-expanded="false" title="Review"><i class="fas fa-fw fa-calendar-check me-1"></i><?= $review_text ?></button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if ($review) { ?>
|
||||
<span class="dropdown-item-text small text-body-secondary">
|
||||
<?= $review['reviewed'] ? 'Reviewed' : (strtotime($review['last']) === strtotime($row['document_created_at']) ? 'Made' : 'Edited') ?> <?= timeAgo($review['last']) ?><?= $review['reviewed'] && $row['reviewed_by_name'] !== null ? ' by ' . escapeHtml($row['reviewed_by_name']) : '' ?>
|
||||
· <?= lcfirst(DOCUMENT_TEMPLATE_REVIEW_MONTHS[$review['months']] ?? '') ?><?= $review['own'] ? '' : ', as its template says' ?>
|
||||
</span>
|
||||
<a class="dropdown-item" href="post.php?mark_document_reviewed=<?= $document_id ?>&csrf_token=<?= $csrf ?>"><i class="fas fa-fw fa-check me-2"></i>Mark Reviewed</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<h6 class="dropdown-header">How often it's reviewed</h6>
|
||||
<?php foreach ($review_choices as $months => $label) { ?>
|
||||
<a class="dropdown-item<?= (string) $months === $review_current ? ' active' : '' ?>" href="post.php?set_document_review=<?= $document_id ?>&months=<?= $months ?>&csrf_token=<?= $csrf ?>"><?= escapeHtml($months === 0 && $template_review_months === null ? 'Never - not on a schedule' : $label) ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</span>
|
||||
<?php } elseif ($review) { ?>
|
||||
<span class="<?= $review['due'] ? 'text-warning-emphasis fw-semibold' : '' ?>"><i class="fas fa-fw fa-calendar-check me-1"></i><?= $review_text ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="small text-body-secondary mt-1">
|
||||
<span title="<?= formatDateTime($document_updated_at) ?>">Updated <?= timeAgo($document_updated_at) ?></span><?= $document_updated_by ? " by $document_updated_by" : '' ?>
|
||||
· Created <?= date('M j, Y', strtotime($row['document_created_at'])) ?><?= $row['created_by_name'] ? ' by ' . escapeHtml($row['created_by_name']) : '' ?>
|
||||
<?php if ($row['document_template_name'] !== null) { ?>
|
||||
· From template <?= $session_is_admin ? '<a class="text-reset" href="/admin/document_template.php?document_template_id=' . intval($row['document_template_id']) . '">' . escapeHtml($row['document_template_name']) . '</a>' : escapeHtml($row['document_template_name']) ?>
|
||||
<?php } ?>
|
||||
<?php if (intval($row['document_is_markdown'])) { ?>· <span title="Edit shows the Markdown it was written in"><i class="fab fa-markdown me-1"></i>Written in Markdown</span><?php } ?>
|
||||
<?php if ($versions) { ?>· <a class="text-reset" href="#documentHistory"><?= count($versions) ?> earlier version<?= count($versions) === 1 ? '' : 's' ?></a><?php } ?>
|
||||
<?php if ($versions) { ?>· <a class="text-reset" href="#documentVersions" data-document-tab="versions"><?= count($versions) ?> earlier version<?= count($versions) === 1 ? '' : 's' ?></a><?php } ?>
|
||||
</div>
|
||||
<?php if ($document_tags_display) { ?>
|
||||
<div class="mt-2"><?= $document_tags_display ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap gap-2 d-print-none">
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
@@ -118,7 +153,7 @@ $page_title = $row['document_name'];
|
||||
<?php } ?>
|
||||
<?php if (!$document_archived && aiReady('Documentation')) { ?>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-size="lg" data-modal-url="modals/document/document_review.php?id=<?= $document_id ?>" title="AI reads it and says what to fix or check, and what is out of date">
|
||||
<i class="fas fa-clipboard-check"></i><span class="d-none d-md-inline ms-2">Review with AI</span>
|
||||
<i class="fas fa-clipboard-check"></i><span class="d-none d-xl-inline ms-2">Review with AI</span>
|
||||
</button>
|
||||
<?php } ?>
|
||||
<?php if (!$document_archived && shareCanMake('Document')) { ?>
|
||||
@@ -126,9 +161,17 @@ $page_title = $row['document_name'];
|
||||
<i class="fas fa-share-alt me-2"></i>Share
|
||||
</button>
|
||||
<?php } ?>
|
||||
<a class="btn btn-outline-secondary" href="post.php?export_document=<?= $document_id ?>&csrf_token=<?= $csrf ?>" title="Export as PDF"><i class="fas fa-file-pdf"></i><span class="d-none d-md-inline ms-2">PDF</span></a>
|
||||
<a class="btn btn-outline-secondary" href="post.php?export_document_markdown=<?= $document_id ?>&csrf_token=<?= $csrf ?>" title="Download as a Markdown (.md) file"><i class="fab fa-markdown"></i><span class="d-none d-md-inline ms-2">Markdown</span></a>
|
||||
<button type="button" class="btn btn-outline-secondary" onclick="window.print();" title="Print"><i class="fas fa-print"></i></button>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" title="Download or print it">
|
||||
<i class="fas fa-download me-2"></i>Export
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item" href="post.php?export_document=<?= $document_id ?>&csrf_token=<?= $csrf ?>"><i class="fas fa-fw fa-file-pdf me-2"></i>PDF</a>
|
||||
<a class="dropdown-item" href="post.php?export_document_markdown=<?= $document_id ?>&csrf_token=<?= $csrf ?>"><i class="fab fa-fw fa-markdown me-2"></i>Markdown (.md)</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button type="button" class="dropdown-item" onclick="window.print();"><i class="fas fa-fw fa-print me-2"></i>Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-toggle="dropdown" title="More actions"><i class="fas fa-ellipsis-v"></i></button>
|
||||
@@ -142,6 +185,7 @@ $page_title = $row['document_name'];
|
||||
<?php if ($config_client_portal_enable) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_edit_visibility.php?document_id=<?= $document_id ?>"><i class="fas fa-fw fa-eye<?= $document_visible ? '-slash' : '' ?> me-2"></i><?= $document_visible ? 'Hide from' : 'Show in' ?> client portal</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_template_link.php?id=<?= $document_id ?>" title="The template it counts as made from"><i class="fas fa-fw fa-puzzle-piece me-2"></i>Template</a>
|
||||
<?php if (kbCan(2)) { ?>
|
||||
<a class="dropdown-item" href="post.php?copy_document_to_kb=<?= $document_id ?>&csrf_token=<?= $csrf ?>" title="A draft article from it, for every client"><i class="fas fa-fw fa-book me-2"></i>Copy to Knowledge Base</a>
|
||||
<?php } ?>
|
||||
@@ -166,7 +210,7 @@ $page_title = $row['document_name'];
|
||||
<!-- The document -->
|
||||
<div class="col-lg-8">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body prettyContent itflow-document-body">
|
||||
<div class="card-body prettyContent itflow-document-body itflow-prose">
|
||||
<?= documentHtmlPurify($row['document_content']) ?: '<p class="text-body-secondary">This document is empty.' . ($can_edit && !$document_archived ? ' <a href="document_edit.php?client_id=' . $client_id . '&document_id=' . $document_id . '">Start writing</a>' : '') . '</p>' ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,138 +247,83 @@ $page_title = $row['document_name'];
|
||||
<nav class="card-body py-2" aria-label="Contents"></nav>
|
||||
</div>
|
||||
|
||||
<!-- What goes with it -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h3 class="card-title mb-0 me-auto"><i class="fas fa-fw fa-link me-2 text-body-secondary"></i>Linked</h3>
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<?= linkPickerButton('document', $document_id, '', 'Link', 'small', 'fas fa-plus me-1') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?= linkGroupsHtml('document', $document_id, $client_id, $document_archived) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Where it lives, and where it came from -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<div class="itflow-glance-item" title="Template">
|
||||
<i class="fas fa-fw fa-puzzle-piece"></i>
|
||||
<span class="min-w-0 d-flex align-items-center">
|
||||
<?php if ($row['document_template_name'] !== null) { ?>
|
||||
<span class="text-truncate">From <?= $session_is_admin ? '<a href="/admin/document_template.php?document_template_id=' . intval($row['document_template_id']) . '">' . escapeHtml($row['document_template_name']) . '</a>' : escapeHtml($row['document_template_name']) ?></span>
|
||||
<?php } else { ?>
|
||||
<span class="text-body-secondary">Not from a template</span>
|
||||
<?php } ?>
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-url="modals/document/document_template_link.php?id=<?= $document_id ?>" title="Change the template it counts as made from"><i class="fas fa-pen"></i></a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php if ($review || ($can_edit && !$document_archived && documentReviewOwnReady())) { ?>
|
||||
<div class="itflow-glance-item<?= $review && $review['due'] ? ' text-warning-emphasis' : '' ?>" title="Review">
|
||||
<i class="fas fa-fw fa-calendar-check"></i>
|
||||
<span class="min-w-0">
|
||||
<?php if ($review) { ?>
|
||||
<span class="d-block"><?= $review['due'] ? '<strong>Review due</strong> since ' . date('M j, Y', strtotime($review['next'])) : 'Next review ' . date('M j, Y', strtotime($review['next'])) ?></span>
|
||||
<span class="d-block small text-body-secondary">
|
||||
<?= $review['reviewed'] ? 'Reviewed' : (strtotime($review['last']) === strtotime($row['document_created_at']) ? 'Made' : 'Edited') ?> <?= timeAgo($review['last']) ?><?= $review['reviewed'] && $row['reviewed_by_name'] !== null ? ' by ' . escapeHtml($row['reviewed_by_name']) : '' ?>
|
||||
· <?= lcfirst(DOCUMENT_TEMPLATE_REVIEW_MONTHS[$review['months']] ?? '') ?><?= $review['own'] ? '' : ', as its template says' ?>
|
||||
</span>
|
||||
<?php } else { ?>
|
||||
<span class="text-body-secondary">Not reviewed on a schedule</span>
|
||||
<?php } ?>
|
||||
<?php if ($can_edit) { ?>
|
||||
<span class="d-flex flex-wrap gap-2 mt-2">
|
||||
<?php if ($review) { ?>
|
||||
<a class="btn btn-sm <?= $review['due'] ? 'btn-warning' : 'btn-light border' ?>" href="post.php?mark_document_reviewed=<?= $document_id ?>&csrf_token=<?= $csrf ?>"><i class="fas fa-check me-1"></i>Mark Reviewed</a>
|
||||
<?php } ?>
|
||||
<?php if (documentReviewOwnReady()) {
|
||||
// How often - its template's, or its own
|
||||
$review_choices = ($template_review_months !== null ? ['template' => "As its template says - " . lcfirst(DOCUMENT_TEMPLATE_REVIEW_MONTHS[$template_review_months] ?? 'never')] : [])
|
||||
+ DOCUMENT_TEMPLATE_REVIEW_MONTHS;
|
||||
$review_current = $row['document_review_months'] !== null ? (string) intval($row['document_review_months']) : ($template_review_months !== null ? 'template' : '0'); ?>
|
||||
<span class="dropdown">
|
||||
<button type="button" class="btn btn-sm btn-light border dropdown-toggle" data-bs-toggle="dropdown" title="How often it's reviewed"><i class="fas fa-redo-alt me-1"></i>How Often</button>
|
||||
<span class="dropdown-menu">
|
||||
<?php foreach ($review_choices as $months => $label) { ?>
|
||||
<a class="dropdown-item<?= (string) $months === $review_current ? ' active' : '' ?>" href="post.php?set_document_review=<?= $document_id ?>&months=<?= $months ?>&csrf_token=<?= $csrf ?>"><?= escapeHtml($months === 0 && $template_review_months === null ? 'Never - not on a schedule' : $label) ?></a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="itflow-glance-item" title="Folder">
|
||||
<i class="fas fa-fw fa-folder"></i>
|
||||
<span class="min-w-0 d-flex align-items-center">
|
||||
<a class="text-truncate" href="files.php?client_id=<?= $client_id ?>&folder_id=<?= $document_folder_id ?>"><?= escapeHtml($folder_path ? implode(' / ', array_column($folder_path, 'folder_name')) : 'Top level') ?></a>
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-url="modals/document/document_move.php?id=<?= $document_id ?>" title="Move"><i class="fas fa-pen"></i></a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php if ($config_client_portal_enable) { ?>
|
||||
<div class="itflow-glance-item" title="Client portal">
|
||||
<i class="fas fa-fw fa-eye<?= $document_visible ? '' : '-slash' ?>"></i>
|
||||
<span class="d-flex align-items-center">
|
||||
<?= $document_visible ? 'Shown in the client portal' : 'Not in the client portal' ?>
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-url="modals/document/document_edit_visibility.php?document_id=<?= $document_id ?>" title="Change"><i class="fas fa-pen"></i></a>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Every earlier version -->
|
||||
<div class="card mb-3" id="documentHistory">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mb-0"><i class="fas fa-fw fa-layer-group me-2 text-body-secondary"></i>Versions</h3>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush itflow-document-history">
|
||||
<li class="list-group-item d-flex align-items-center gap-2">
|
||||
<div class="min-w-0 flex-grow-1">
|
||||
<div class="fw-semibold small">Now</div>
|
||||
<div class="small text-body-secondary">Updated <?= timeAgo($document_updated_at) ?><?= $document_updated_by ? " by $document_updated_by" : '' ?></div>
|
||||
</div>
|
||||
<?php if ($versions) { ?>
|
||||
<!-- What the last edit changed (modals/document/document_changes.php) -->
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_changes.php?document_id=<?= $document_id ?>" title="What changed"><i class="fas fa-exchange-alt"></i></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php foreach ($versions as $version) {
|
||||
$version_id = intval($version['document_version_id']); ?>
|
||||
<li class="list-group-item d-flex align-items-center gap-2">
|
||||
<div class="min-w-0 flex-grow-1">
|
||||
<a class="small fw-semibold ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_version_view.php?id=<?= $version_id ?>" title="<?= formatDateTime($version['document_version_created_at']) ?>">
|
||||
<?= date('M j, Y g:i A', strtotime($version['document_version_created_at'])) ?>
|
||||
</a>
|
||||
<div class="small text-body-secondary text-truncate">
|
||||
<?= escapeHtml($version['user_name'] ?: 'Unknown') ?>
|
||||
<?php if ($version['document_version_name'] !== $row['document_name']) { ?> · was "<?= escapeHtml($version['document_version_name']) ?>"<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_changes.php?document_id=<?= $document_id ?>&version_id=<?= $version_id ?>" title="What changed"><i class="fas fa-exchange-alt"></i></a>
|
||||
<?php if ($can_delete) { ?>
|
||||
<a class="itflow-copy confirm-link text-danger" href="post.php?delete_document_version=<?= $version_id ?>&csrf_token=<?= $csrf ?>" title="Delete this version" data-confirm-text="This version is removed from the history for good."><i class="fas fa-trash"></i></a>
|
||||
<?php } ?>
|
||||
<?php
|
||||
// What goes with it, its earlier versions and who did what to it - one card, a tab each
|
||||
$linked_html = linkGroupsHtml('document', $document_id, $client_id, $document_archived, true, $linked_total);
|
||||
$history = auditLogHistory('Document', $document_id, 10);
|
||||
?>
|
||||
<div class="card mb-3 itflow-asset-related itflow-document-side" id="documentVersions">
|
||||
<div class="card-header py-2">
|
||||
<ul class="nav nav-pills itflow-asset-pills" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link text-nowrap active <?= $linked_total ? '' : 'is-empty' ?>" data-bs-toggle="pill" data-bs-target="#document-pane-linked" data-document-tab="linked" type="button" role="tab">Linked <span class="badge rounded-pill ms-1"><?= $linked_total ?></span></button>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (!$versions) { ?>
|
||||
<li class="list-group-item small text-body-secondary">No earlier versions - each edit keeps the one before it here.</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link text-nowrap <?= $versions ? '' : 'is-empty' ?>" data-bs-toggle="pill" data-bs-target="#document-pane-versions" data-document-tab="versions" type="button" role="tab">Versions <span class="badge rounded-pill ms-1"><?= count($versions) ?></span></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link text-nowrap <?= $history['count'] ? '' : 'is-empty' ?>" data-bs-toggle="pill" data-bs-target="#document-pane-history" data-document-tab="history" type="button" role="tab">History <span class="badge rounded-pill ms-1"><?= number_format($history['count']) ?></span></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- Who did what to it, from the audit log -->
|
||||
<div class="d-print-none">
|
||||
<?= auditLogHistoryCard(auditLogHistory('Document', $document_id, 10), ['client_id' => $client_id]) ?>
|
||||
<!-- What it's about - assets, contacts, licenses and the rest -->
|
||||
<div class="tab-pane fade show active" id="document-pane-linked" role="tabpanel">
|
||||
<div class="card-body">
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<span class="small text-body-secondary me-auto">What this document is about</span>
|
||||
<?= linkPickerButton('document', $document_id, '', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-plus me-1') ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?= $linked_html ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Every earlier version -->
|
||||
<div class="tab-pane fade" id="document-pane-versions" role="tabpanel">
|
||||
<ul class="list-group list-group-flush itflow-document-history">
|
||||
<li class="list-group-item d-flex align-items-center gap-2">
|
||||
<div class="min-w-0 flex-grow-1">
|
||||
<div class="fw-semibold small">Now</div>
|
||||
<div class="small text-body-secondary">Updated <?= timeAgo($document_updated_at) ?><?= $document_updated_by ? " by $document_updated_by" : '' ?></div>
|
||||
</div>
|
||||
<?php if ($versions) { ?>
|
||||
<!-- What the last edit changed (modals/document/document_changes.php) -->
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_changes.php?document_id=<?= $document_id ?>" title="What changed"><i class="fas fa-exchange-alt"></i></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php foreach ($versions as $version) {
|
||||
$version_id = intval($version['document_version_id']); ?>
|
||||
<li class="list-group-item d-flex align-items-center gap-2">
|
||||
<div class="min-w-0 flex-grow-1">
|
||||
<a class="small fw-semibold ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_version_view.php?id=<?= $version_id ?>" title="<?= formatDateTime($version['document_version_created_at']) ?>">
|
||||
<?= date('M j, Y g:i A', strtotime($version['document_version_created_at'])) ?>
|
||||
</a>
|
||||
<div class="small text-body-secondary text-truncate">
|
||||
<?= escapeHtml($version['user_name'] ?: 'Unknown') ?>
|
||||
<?php if ($version['document_version_name'] !== $row['document_name']) { ?> · was "<?= escapeHtml($version['document_version_name']) ?>"<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<a class="itflow-copy ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/document/document_changes.php?document_id=<?= $document_id ?>&version_id=<?= $version_id ?>" title="What changed"><i class="fas fa-exchange-alt"></i></a>
|
||||
<?php if ($can_delete) { ?>
|
||||
<a class="itflow-copy confirm-link text-danger" href="post.php?delete_document_version=<?= $version_id ?>&csrf_token=<?= $csrf ?>" title="Delete this version" data-confirm-text="This version is removed from the history for good."><i class="fas fa-trash"></i></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (!$versions) { ?>
|
||||
<li class="list-group-item small text-body-secondary">No earlier versions - each edit keeps the one before it here.</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Who did what to it, from the audit log -->
|
||||
<div class="tab-pane fade" id="document-pane-history" role="tabpanel">
|
||||
<?= auditLogHistoryHtml($history, ['client_id' => $client_id, 'compact' => true]) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user