mirror of https://github.com/itflow-org/itflow
Show related documents in asset details
This commit is contained in:
parent
2467274f7b
commit
206dfc2426
|
|
@ -153,6 +153,17 @@ if (isset($_GET['asset_id'])) {
|
|||
$query_images = '';
|
||||
}
|
||||
|
||||
// Related Documents
|
||||
$sql_related_documents = mysqli_query($mysqli, "SELECT * FROM asset_documents, documents
|
||||
LEFT JOIN users ON document_created_by = user_id
|
||||
WHERE asset_documents.asset_id = $asset_id
|
||||
AND asset_documents.document_id = documents.document_id
|
||||
AND document_template = 0
|
||||
AND document_archived_at IS NULL
|
||||
ORDER BY document_name ASC"
|
||||
);
|
||||
$document_count = mysqli_num_rows($sql_related_documents);
|
||||
|
||||
|
||||
// Related Logins Query
|
||||
$sql_related_logins = mysqli_query($mysqli, "
|
||||
|
|
@ -684,6 +695,67 @@ if (isset($_GET['asset_id'])) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-dark <?php if ($document_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-folder mr-2"></i>Documents</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#linkDocumentModal">
|
||||
<i class="fas fa-link mr-2"></i>Link Document
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Document Title</th>
|
||||
<th>By</th>
|
||||
<th>Created</th>
|
||||
<th>Updated</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_documents)) {
|
||||
$document_id = intval($row['document_id']);
|
||||
$document_name = nullable_htmlentities($row['document_name']);
|
||||
$document_description = nullable_htmlentities($row['document_description']);
|
||||
$document_created_by = nullable_htmlentities($row['user_name']);
|
||||
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||
|
||||
$linked_documents[] = $document_id;
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div><a href="client_document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><?php echo $document_name; ?></a></div>
|
||||
<div class="text-secondary"><?php echo $document_description; ?></div>
|
||||
</td>
|
||||
<td><?php echo $document_created_by; ?></td>
|
||||
<td><?php echo $document_created_at; ?></td>
|
||||
<td><?php echo $document_updated_at; ?></td>
|
||||
<td class="text-center">
|
||||
<a href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>" class="btn btn-secondary btn-sm" title="Unlink"><i class="fas fa-fw fa-unlink"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-dark <?php if ($files_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-cube mr-2"></i>Files</h3>
|
||||
|
|
|
|||
Loading…
Reference in New Issue