From 4a050b0ff79d41de8c8dcfec6375f65c7ca3a685 Mon Sep 17 00:00:00 2001 From: igor Date: Sat, 17 May 2025 13:46:26 +0200 Subject: [PATCH] pridane tlacitko na zmazanie prilohy, implementovany upload a zobrazenie suboru obrazku --- api.php | 12 +++ webapp/src/assets/css/style.css | 1 + webapp/src/backend.js | 4 + webapp/src/views/Report.vue | 127 ++++++++++++++++++++++++++++---- 4 files changed, 130 insertions(+), 14 deletions(-) diff --git a/api.php b/api.php index 38b31b6..e2f1ec3 100644 --- a/api.php +++ b/api.php @@ -57,6 +57,11 @@ switch ($action) { case 'attachmentGetAll': $result = attachmentGetAll($_REQUEST['report_id']); break; + case 'attachmentDelete': + $suc = attachmentDelete($_REQUEST['attachment_id']); + if ($suc === false) $error = 'Attachment delete failed'; + $result = array('processed' => $suc); + break; } header('Content-Type: application/json'); @@ -172,6 +177,13 @@ function help() 'params' => [ 'report_id' => 'Report id', ] + ], + 'attachmentGet' => [ + 'name' => 'attachmentGet', + 'description' => 'Get attachment', + 'params' => [ + 'attachment_id' => 'Attachment id', + ] ] ] ]; diff --git a/webapp/src/assets/css/style.css b/webapp/src/assets/css/style.css index 7a21471..fb5b276 100644 --- a/webapp/src/assets/css/style.css +++ b/webapp/src/assets/css/style.css @@ -473,6 +473,7 @@ button:focus-visible, flex-direction: row; justify-content: space-between; background-color: var(--color-bg0); + align-items: center; } #report .attachments .attachment .attachment-header .created, #report .attachments .attachment .attachment-header .author { diff --git a/webapp/src/backend.js b/webapp/src/backend.js index cbe10f3..8e1c53c 100644 --- a/webapp/src/backend.js +++ b/webapp/src/backend.js @@ -97,4 +97,8 @@ export const backend = { return this.callPromise('attachmentGetAll', {report_id: report_id}); }, + attachmentDelete(attachment_id) { + return this.callPromise('attachmentDelete', {attachment_id: attachment_id}); + }, + }; diff --git a/webapp/src/views/Report.vue b/webapp/src/views/Report.vue index b88e8ce..1a20ad3 100644 --- a/webapp/src/views/Report.vue +++ b/webapp/src/views/Report.vue @@ -47,12 +47,12 @@ :key="attachment.attachment_id" >
- {{ attachment.created_dt }} - @@ -62,8 +62,14 @@ > {{ attachment.attachment_author }} + + +
{{ attachment.attachment_content }}
+
+ +
+
+ Neznamy typ prilohy: {{ attachment.attachment_type }} +
@@ -87,6 +102,32 @@ required >
+
+ + +
+

Vybrané súbory:

+ +

+ +    + {{ file.name }} ({{ formatFileSize(file.size) }}) +

+
+