pridane ID reportu do zobrazenia na dashboard,

odstrany upload suboru pre vytvorenie noveho reportu,
pridane tlacitko na Hotovo pre bug,
pridane komfety a zvukove jingle pre Hotovo bug
This commit is contained in:
Igor Miňo 2025-05-17 15:55:48 +02:00
parent c7dcdf228e
commit 506e847b5d
10 changed files with 45 additions and 67 deletions

View File

@ -12,6 +12,7 @@
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
"js-confetti": "^0.12.0",
"mitt": "^3.0.1",
"vue": "^3.5.13",
"vue-router": "^4.5.0",
@ -1267,6 +1268,12 @@
"node": ">=8"
}
},
"node_modules/js-confetti": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/js-confetti/-/js-confetti-0.12.0.tgz",
"integrity": "sha512-1R0Akxn3Zn82pMqW65N1V2NwKkZJ75bvBN/VAb36Ya0YHwbaSiAJZVRr/19HBxH/O8x2x01UFAbYI18VqlDN6g==",
"license": "MIT"
},
"node_modules/magic-string": {
"version": "0.30.17",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz",

View File

@ -13,6 +13,7 @@
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
"js-confetti": "^0.12.0",
"mitt": "^3.0.1",
"vue": "^3.5.13",
"vue-router": "^4.5.0",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -279,6 +279,10 @@ button:focus-visible,
text-align: left;
padding: 5px;
}
#dashboard .report .report-id {
text-align: center;
padding: 5px;
}
#dashboard .report .report-date {
text-align: right;
padding: 5px;

View File

@ -22,6 +22,7 @@ defineProps({
</div>
<div class="report-footer">
<div class="report-group"><font-awesome-icon :icon="['fas', 'diagram-project']" /> {{ group }}</div>
<div class="report-id"><font-awesome-icon :icon="['fas', 'hashtag']" /> {{ report_id }}</div>
<div class="report-date"><font-awesome-icon :icon="['fas', 'calendar-days']" /> {{ date }}</div>
</div>

View File

@ -30,33 +30,6 @@
</div>
<div class="cols">
<div class="form-group">
<label for="files">Prílohy:</label>
<input
type="file"
id="files"
@change="handleFileUpload"
multiple
class="form-control file-input"
/>
<div class="selected-files" v-if="selectedFiles.length > 0">
<p>Vybrané súbory:</p>
<p v-for="(file, index) in selectedFiles" :key="index">
<button
type="button"
class="remove-file"
@click="removeFile(index)"
>
<font-awesome-icon :icon="['fas', 'circle-xmark']" /> Odober
súbor
</button>
&nbsp;&nbsp;
{{ file.name }} ({{ formatFileSize(file.size) }})
</p>
</div>
</div>
<div class="form-group">
<label for="priority">Priorita:</label>
<select
@ -88,18 +61,20 @@
<option value="antispam">Antispam</option>
</select>
</div>
</div>
<div class="form-actions">
<router-link to="/" class="button"
><font-awesome-icon :icon="['fas', 'circle-arrow-left']" />
Zrušiť</router-link
>
<button type="submit">
<font-awesome-icon :icon="['fas', 'circle-check']" /> Odoslať
</button>
<div class="form-actions">
<router-link to="/" class="button"
><font-awesome-icon :icon="['fas', 'circle-arrow-left']" />
Zrušiť</router-link
>
<button type="submit">
<font-awesome-icon :icon="['fas', 'circle-check']" /> Odoslať
</button>
</div>
</div>
</form>
<p>Poznamka: Subory je mozne pridat ako prilohy az po vytvoreni noveho reportu..</p>
</div>
</template>
@ -124,26 +99,6 @@ export default {
};
},
methods: {
handleFileUpload(event) {
const files = event.target.files;
if (files) {
for (let i = 0; i < files.length; i++) {
this.selectedFiles.push(files[i]);
}
}
},
removeFile(index) {
this.selectedFiles.splice(index, 1);
},
formatFileSize(size) {
if (size < 1024) {
return size + " B";
} else if (size < 1024 * 1024) {
return (size / 1024).toFixed(2) + " KB";
} else {
return (size / (1024 * 1024)).toFixed(2) + " MB";
}
},
submitForm() {
this.loading = true;
// Vytvorenie FormData objektu pre odoslanie súborov
@ -152,17 +107,11 @@ export default {
formData.append("description", this.bugReport.description);
formData.append("priority", this.bugReport.priority);
// Pridanie súborov do FormData
this.selectedFiles.forEach((file, index) => {
formData.append(`file${index}`, file);
});
// Tu by nasledovalo odoslanie dát na server
console.log("Odosielam bug report:", {
title: this.bugReport.title,
description: this.bugReport.description,
priority: this.bugReport.priority,
files: this.selectedFiles.map((f) => f.name),
});
backend
.add(
@ -175,7 +124,7 @@ export default {
.then((result) => {
console.log(result);
this.resetForm();
this.$router.push("/");
this.$router.push("/report/" + result.report_id);
})
.catch((error) => {
console.log(error);
@ -191,10 +140,6 @@ export default {
priority: "",
files: [],
};
this.selectedFiles = [];
// Resetovanie file input
const fileInput = document.getElementById("files");
if (fileInput) fileInput.value = "";
},
},
};

View File

@ -28,6 +28,11 @@
<font-awesome-icon :icon="['fas', 'trash-can']" /> Zmazať
</button>
</div>
<div>
<button @click="reportDone">
<font-awesome-icon :icon="['fas', 'circle-check']" /> Hotovo, presunut do archivu
</button>
</div>
</div>
<h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle">
{{ report.report_title }}
@ -142,6 +147,7 @@
<script>
import { backend } from "../backend";
import FullScreenLoader from "../components/FullScreenLoader.vue";
import JSConfetti from 'js-confetti'
export default {
name: "Report",
@ -203,6 +209,20 @@ export default {
this.$router.push("/");
});
},
reportDone() {
backend.update(this.report_id, {
report_status: 4,
}).then(() => {
let tadas = ['/sounds/tada.mp3', '/sounds/tada2.mp3', '/sounds/crazy-phrog-short.mp3'];
const audio = new Audio(tadas[Math.floor(Math.random() * tadas.length)]);
audio.play();
const confetti = new JSConfetti();
confetti.addConfetti();
setTimeout(() => {
this.$router.push("/");
}, 3000);
});
},
attachmentAdd() {
let comment = this.$refs.attachmentNewContent.value;
if (comment.trim().length > 0) {