uprava API metody update
aby bolo mozne aktualizovat len to co je potrebne,
pridany page pre Report, zobrazenie info o reporte s dynamickou editaciou nadpisu a popisu
This commit is contained in:
parent
58a7444da2
commit
745f6495d1
14
api.php
14
api.php
@ -16,7 +16,7 @@ switch ($action) {
|
|||||||
$result = array('report_id' => $report_id);
|
$result = array('report_id' => $report_id);
|
||||||
break;
|
break;
|
||||||
case 'update':
|
case 'update':
|
||||||
$suc = reportUpdate($_REQUEST['report_id'], $_REQUEST['title'], $_REQUEST['description'], $_REQUEST['status'], $_REQUEST['group'], $_REQUEST['priority']);
|
$suc = reportUpdate($_REQUEST['report_id'], json_decode($_REQUEST['report_data'], true));
|
||||||
if ($suc === false) $error = 'Update failed';
|
if ($suc === false) $error = 'Update failed';
|
||||||
$result = array('processed' => $suc);
|
$result = array('processed' => $suc);
|
||||||
break;
|
break;
|
||||||
@ -84,11 +84,13 @@ function help()
|
|||||||
'description' => 'Update report',
|
'description' => 'Update report',
|
||||||
'params' => [
|
'params' => [
|
||||||
'report_id' => 'Report id',
|
'report_id' => 'Report id',
|
||||||
'title' => 'Report title',
|
'report_data' => [
|
||||||
'description' => 'Report description',
|
'title' => 'Report title',
|
||||||
'status' => 'Report status',
|
'description' => 'Report description',
|
||||||
'group' => 'Report group',
|
'status' => 'Report status',
|
||||||
'priority' => 'Report priority',
|
'group' => 'Report group',
|
||||||
|
'priority' => 'Report priority',
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
|
1
data/README.md
Normal file
1
data/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Directory for files of report: database, images, etc.
|
@ -151,15 +151,9 @@ function reportAdd($title, $description, $status = 0, $group = null, $priority =
|
|||||||
return $db->id();
|
return $db->id();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportUpdate($report_id, $title, $description, $status = 0, $group = null, $priority = 0) {
|
function reportUpdate($report_id, $report_data) {
|
||||||
global $db;
|
global $db;
|
||||||
$stm = $db->update('reports', [
|
$stm = $db->update('reports', $report_data, [
|
||||||
'report_title' => $title,
|
|
||||||
'report_description' => $description,
|
|
||||||
'report_status' => $status,
|
|
||||||
'report_group' => $group,
|
|
||||||
'report_priority' => $priority,
|
|
||||||
], [
|
|
||||||
'report_id' => $report_id
|
'report_id' => $report_id
|
||||||
]);
|
]);
|
||||||
return ($stm->rowCount() > 0);
|
return ($stm->rowCount() > 0);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
05 - ARCHIVE
|
05 - ARCHIVE
|
||||||
06 - API
|
06 - API
|
||||||
07 - ABOUT
|
07 - ABOUT
|
||||||
|
08 - REPORT
|
||||||
80 - FORM
|
80 - FORM
|
||||||
99 - LIGHT MODE
|
99 - LIGHT MODE
|
||||||
|
|
||||||
@ -289,6 +290,41 @@ button:focus-visible,
|
|||||||
filter: brightness(1.2);
|
filter: brightness(1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------
|
||||||
|
08 - REPORT
|
||||||
|
*/
|
||||||
|
#report {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
#report .report-header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
/* justify-content: space-between; */
|
||||||
|
}
|
||||||
|
#report .report-header div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
#report .report-header div span {
|
||||||
|
background-color: var(--color-bg0);
|
||||||
|
color: var(--color-text0);
|
||||||
|
padding: 2px 10px;
|
||||||
|
}
|
||||||
|
#report .report-header div strong {
|
||||||
|
background-color: var(--color-bg1);
|
||||||
|
color: var(--color-text0);
|
||||||
|
padding: 2px 10px;
|
||||||
|
}
|
||||||
|
#report .description {
|
||||||
|
background-color: var(--color-bg2);
|
||||||
|
padding: 10px;
|
||||||
|
text-align: justify;
|
||||||
|
white-space: pre-line
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------
|
/* ----------------------------------------------------
|
||||||
80 - FORM
|
80 - FORM
|
||||||
*/
|
*/
|
||||||
|
@ -57,14 +57,8 @@ export const backend = {
|
|||||||
priority: priority});
|
priority: priority});
|
||||||
},
|
},
|
||||||
|
|
||||||
update(id, title, description, status, group, priority) {
|
update(id, report_data) {
|
||||||
return this.callPromise('update', {
|
return this.callPromise('update', {report_id: id, report_data: report_data});
|
||||||
report_id: id,
|
|
||||||
title: title,
|
|
||||||
description: description,
|
|
||||||
status: status,
|
|
||||||
group: group,
|
|
||||||
priority: priority});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
delete(id) {
|
delete(id) {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
defineProps({
|
defineProps({
|
||||||
|
report_id: Number,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
date: String,
|
date: String,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="report">
|
<div class="report" @click="goToReport(report_id)">
|
||||||
<div class="report-header">
|
<div class="report-header">
|
||||||
<div class="report-title">
|
<div class="report-title">
|
||||||
<h3><font-awesome-icon :icon="['fas', 'bug']" /> {{ title }}</h3>
|
<h3><font-awesome-icon :icon="['fas', 'bug']" /> {{ title }}</h3>
|
||||||
@ -20,3 +21,13 @@ defineProps({
|
|||||||
<div class="report-date"><font-awesome-icon :icon="['fas', 'calendar-days']" /> {{ date }}</div>
|
<div class="report-date"><font-awesome-icon :icon="['fas', 'calendar-days']" /> {{ date }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "ReportBox",
|
||||||
|
methods: {
|
||||||
|
goToReport(report_id) {
|
||||||
|
this.$router.push("/report/" + report_id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -5,6 +5,7 @@ import About from "./views/About.vue";
|
|||||||
import BugAdd from "./views/BugAdd.vue";
|
import BugAdd from "./views/BugAdd.vue";
|
||||||
import Archive from "./views/Archive.vue";
|
import Archive from "./views/Archive.vue";
|
||||||
import API from "./views/API.vue";
|
import API from "./views/API.vue";
|
||||||
|
import Report from "./views/Report.vue";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ path: "/", component: Dashboard },
|
{ path: "/", component: Dashboard },
|
||||||
@ -12,6 +13,7 @@ const routes = [
|
|||||||
{ path: "/add", component: BugAdd },
|
{ path: "/add", component: BugAdd },
|
||||||
{ path: "/archive", component: Archive },
|
{ path: "/archive", component: Archive },
|
||||||
{ path: "/api", component: API },
|
{ path: "/api", component: API },
|
||||||
|
{ path: "/report/:id", component: Report },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const router = createRouter({
|
export const router = createRouter({
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
dragging: isDragable(element),
|
dragging: isDragable(element),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Report
|
<ReportBox
|
||||||
|
:report_id="element.report_id"
|
||||||
:title="element.report_title"
|
:title="element.report_title"
|
||||||
:description="element.report_description"
|
:description="element.report_description"
|
||||||
:date="element.created_dt"
|
:date="element.created_dt"
|
||||||
@ -43,7 +44,8 @@
|
|||||||
dragging: isDragable(element),
|
dragging: isDragable(element),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Report
|
<ReportBox
|
||||||
|
:report_id="element.report_id"
|
||||||
:title="element.report_title"
|
:title="element.report_title"
|
||||||
:description="element.report_description"
|
:description="element.report_description"
|
||||||
:date="element.created_dt"
|
:date="element.created_dt"
|
||||||
@ -69,7 +71,8 @@
|
|||||||
dragging: isDragable(element),
|
dragging: isDragable(element),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Report
|
<ReportBox
|
||||||
|
:report_id="element.report_id"
|
||||||
:title="element.report_title"
|
:title="element.report_title"
|
||||||
:description="element.report_description"
|
:description="element.report_description"
|
||||||
:date="element.created_dt"
|
:date="element.created_dt"
|
||||||
@ -95,7 +98,8 @@
|
|||||||
dragging: isDragable(element),
|
dragging: isDragable(element),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Report
|
<ReportBox
|
||||||
|
:report_id="element.report_id"
|
||||||
:title="element.report_title"
|
:title="element.report_title"
|
||||||
:description="element.report_description"
|
:description="element.report_description"
|
||||||
:date="element.created_dt"
|
:date="element.created_dt"
|
||||||
@ -125,13 +129,13 @@ function isDragable(element) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Report from "../components/Report.vue";
|
import ReportBox from "../components/ReportBox.vue";
|
||||||
import draggable from "vuedraggable";
|
import draggable from "vuedraggable";
|
||||||
import { backend } from "../backend";
|
import { backend } from "../backend";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Report,
|
ReportBox,
|
||||||
draggable,
|
draggable,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
72
webapp/src/views/Report.vue
Normal file
72
webapp/src/views/Report.vue
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<div id="report">
|
||||||
|
<div class="report-header">
|
||||||
|
<div>
|
||||||
|
<span>Report</span>
|
||||||
|
<strong>{{ report_id }}</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Vytvorene</span>
|
||||||
|
<strong>{{ report.created_dt }}</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Stav</span>
|
||||||
|
<strong>{{ report.report_status }}</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Priorita</span>
|
||||||
|
<strong>{{ report.report_priority }}</strong>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>Skupina</span>
|
||||||
|
<strong>{{ report.report_group }}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle">
|
||||||
|
{{ report.report_title }}
|
||||||
|
</h1>
|
||||||
|
<p class="description" contenteditable="true" @blur="onDescriptionChange" ref="reportDescription">{{ report.report_description }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { backend } from "../backend";
|
||||||
|
export default {
|
||||||
|
name: "Report",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
report_id: this.$route.params.id,
|
||||||
|
report: {
|
||||||
|
report_id: 0,
|
||||||
|
report_title: "Nacitavam report",
|
||||||
|
report_description: "...",
|
||||||
|
report_status: 0,
|
||||||
|
report_group: "--",
|
||||||
|
report_priority: 1,
|
||||||
|
created_dt: "--",
|
||||||
|
ordnum: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log(this.report_id);
|
||||||
|
this.loadReportData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadReportData() {
|
||||||
|
backend.get(this.report_id).then((report) => {
|
||||||
|
this.report = report;
|
||||||
|
console.log(this.report);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onTitleChange(event) {
|
||||||
|
backend.update(this.report_id, { report_title: event.target.innerText });
|
||||||
|
},
|
||||||
|
onDescriptionChange(event) {
|
||||||
|
backend.update(this.report_id, { report_description: event.target.innerText });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
watch: {},
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user