diff --git a/api.php b/api.php index e2f1ec3..b0d2e90 100644 --- a/api.php +++ b/api.php @@ -32,7 +32,10 @@ switch ($action) { $result = reportGetAll($_REQUEST['status']); break; case 'getAllGrouped': - $result = reportGetAllGrouped($_REQUEST['status']); + $result = reportGetAllGrouped(json_decode($_REQUEST['status'], true), $_REQUEST['page'] == 'null' ? null : $_REQUEST['page']); + break; + case 'getArchived': + $result = reportGetArchived($_REQUEST['page'] == 'null' ? null : $_REQUEST['page']); break; case 'updateOrdNum': $suc = reportUpdateOrdnum($_REQUEST['ordnums']); @@ -137,6 +140,14 @@ function help() 'description' => 'Get all reports grouped by group', 'params' => [ 'status' => '(ptional) Report status, default: 0,1,2,3', + 'page' => '(ptional) Page number, default: null = vsetky', + ] + ], + 'getArchived' => [ + 'name' => 'getArchived', + 'description' => 'Get archived reports', + 'params' => [ + 'page' => '(ptional) Page number, default: null = vsetky', ] ], 'updateOrdNum' => [ diff --git a/lib/functions.inc.php b/lib/functions.inc.php index bec96be..f0bec4b 100644 --- a/lib/functions.inc.php +++ b/lib/functions.inc.php @@ -235,19 +235,21 @@ function reportGet($report_id) ]); } -function reportGetAll($status = null) +function reportGetAll($status = null, $page = null) { global $db; if ($status === null) $status = array(0, 1, 2, 3); - return $db->select('reports', '*', [ + $params = [ 'ORDER' => ['report_priority' => 'DESC', 'ordnum' => 'ASC'], 'report_status' => $status - ]); + ]; + if ($page !== null) $params['LIMIT'] = [$page * 10, 10]; + return $db->select('reports', '*', $params); } -function reportGetAllGrouped($status = null) +function reportGetAllGrouped($status = null, $page = null) { - $all = reportGetAll($status); + $all = reportGetAll($status, $page); $groups = []; foreach ($all as $report) { $groups[$report['report_status']][] = $report; @@ -255,6 +257,17 @@ function reportGetAllGrouped($status = null) return $groups; } +function reportGetArchived($page = null) +{ + global $db; + $params = [ + 'ORDER' => ['created_dt' => 'DESC'], + 'report_status' => '4' + ]; + if ($page !== null) $params['LIMIT'] = [$page * 10, 10]; + return $db->select('reports', '*', $params); +} + /** * Attachments */ diff --git a/webapp/src/assets/css/style.css b/webapp/src/assets/css/style.css index cbb4df9..53fb7e2 100644 --- a/webapp/src/assets/css/style.css +++ b/webapp/src/assets/css/style.css @@ -358,6 +358,72 @@ button:focus-visible, /* ---------------------------------------------------- 05 - ARCHIVE */ +#archive { + margin: 0 auto; + padding: 20px; +} +#archive .reports { + /* border: 1px red solid; */ + display: flex; + flex-direction: column; + gap: 10px; +} +#archive .report-row { + /* border: 1px blue solid; */ + display: flex; + flex-direction: row; + background-color: var(--color-bg2); + justify-content: space-between; + align-content: stretch; + transition: all 0.3s; + cursor: pointer; +} +#archive .report-row:hover { + filter: brightness(1.4); +} +#archive .report-row .report-id, +#archive .report-row .title, +#archive .report-row .date, +#archive .report-row .group { + /* border: 1px yellow solid; */ + width: auto; + padding: 10px; + flex: 1; +} +#archive .report-row .report-id { + width: 50px; + text-align: center; + background-color: var(--color-bg0); + flex: 0 1 auto; +} +@media (max-width: 900px) { + #archive .report-row { + flex-wrap: wrap; + justify-content: left; + } + #archive .report-row .title, + #archive .report-row .date, + #archive .report-row .group { + flex: 0 0 auto; + } + #archive .report-row .title { + width: calc(100% - 100px); + } + #archive .report-row .date { + margin-left: 70px; + } + #archive .report-row .date, + #archive .report-row .group { + width: calc((100% - 140px) / 2); + } +} +@media (max-width: 600px) { + #archive .report-row .date, + #archive .report-row .group { + margin-left: 70px; + width: calc(100% - 100px); + } +} /* ---------------------------------------------------- diff --git a/webapp/src/backend.js b/webapp/src/backend.js index 8e1c53c..3945fbe 100644 --- a/webapp/src/backend.js +++ b/webapp/src/backend.js @@ -73,8 +73,12 @@ export const backend = { return this.callPromise('getAll', {}); }, - getAllGrouped(status) { - return this.callPromise('getAllGrouped', {}); + getAllGrouped(status, page = null) { + return this.callPromise('getAllGrouped', {status: status, page: page}); + }, + + getArchived(page = null) { + return this.callPromise('getArchived', {page: page}); }, updateOrdnum(ordnums) { diff --git a/webapp/src/components/FullScreenLoader.vue b/webapp/src/components/FullScreenLoader.vue index 42eff65..f82cb96 100644 --- a/webapp/src/components/FullScreenLoader.vue +++ b/webapp/src/components/FullScreenLoader.vue @@ -11,11 +11,16 @@ left: 0; width: 100vw; height: 100vh; - background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center; z-index: 9999; + /* zatmavene */ + /* background-color: rgba(0, 0, 0, 0.8); */ + /* rozmazane */ + background-color: rgba(255, 255, 255, 0.1); /* jemne priehľadné alebo aj 0 */ + backdrop-filter: blur(8px); /* rozmazanie pozadia */ + -webkit-backdrop-filter: blur(8px); /* podpora pre Safari */ } .spinner { diff --git a/webapp/src/views/Archive.vue b/webapp/src/views/Archive.vue index cbf0f2c..738ce62 100644 --- a/webapp/src/views/Archive.vue +++ b/webapp/src/views/Archive.vue @@ -1,6 +1,41 @@ + + diff --git a/webapp/src/views/Report.vue b/webapp/src/views/Report.vue index a07e905..7600a54 100644 --- a/webapp/src/views/Report.vue +++ b/webapp/src/views/Report.vue @@ -28,18 +28,18 @@ Zmazať -
+
-

+

{{ report.report_title }}

@@ -77,7 +77,7 @@ v-if="attachment.attachment_type == 'comment'" class="attachment-content" :contenteditable="attachment.editable ?? false" - @dblclick="attachment.editable = true" + @dblclick="attachment.editable = true && editable" @blur=" attachment.editable = false; updateAttachmentContent($event, attachment); @@ -98,7 +98,7 @@ -

+