|
@@ -1,151 +1,225 @@
|
|
|
<template>
|
|
|
- <modal title="Report">
|
|
|
- <template #body>
|
|
|
- <div class="edit-report-wrapper">
|
|
|
- <song-item
|
|
|
- :song="song"
|
|
|
- :disabled-actions="['report']"
|
|
|
- header="Selected Song.."
|
|
|
- />
|
|
|
-
|
|
|
- <div class="columns is-multiline">
|
|
|
- <div
|
|
|
- v-for="category in predefinedCategories"
|
|
|
- class="column is-half"
|
|
|
- :key="category.category"
|
|
|
- >
|
|
|
- <label class="label">{{ category.category }}</label>
|
|
|
-
|
|
|
- <p
|
|
|
- v-for="issue in category.issues"
|
|
|
- class="control checkbox-control"
|
|
|
- :key="issue.title"
|
|
|
- >
|
|
|
- <span class="align-horizontally">
|
|
|
- <span>
|
|
|
- <label class="switch">
|
|
|
- <input
|
|
|
- type="checkbox"
|
|
|
- :id="issue.title"
|
|
|
- v-model="issue.enabled"
|
|
|
- />
|
|
|
- <span class="slider round"></span>
|
|
|
- </label>
|
|
|
-
|
|
|
- <label :for="issue.title">
|
|
|
- <span></span>
|
|
|
- <p>{{ issue.title }}</p>
|
|
|
- </label>
|
|
|
- </span>
|
|
|
-
|
|
|
- <i
|
|
|
- class="material-icons"
|
|
|
- content="Provide More info"
|
|
|
- v-tippy
|
|
|
- @click="
|
|
|
- issue.showDescription = !issue.showDescription
|
|
|
- "
|
|
|
- >
|
|
|
- info
|
|
|
- </i>
|
|
|
- </span>
|
|
|
-
|
|
|
- <input
|
|
|
- type="text"
|
|
|
- class="input"
|
|
|
- v-model="issue.description"
|
|
|
- v-if="issue.showDescription"
|
|
|
- placeholder="Provide more information..."
|
|
|
- @keyup="issue.enabled = true"
|
|
|
- />
|
|
|
- </p>
|
|
|
- </div>
|
|
|
- <!-- allow for multiple custom issues with plus/add button and then a input textbox -->
|
|
|
- <!-- do away with textbox -->
|
|
|
-
|
|
|
- <div class="column is-half">
|
|
|
- <div id="custom-issues">
|
|
|
- <div id="custom-issues-title">
|
|
|
- <label class="label">Issues not listed</label>
|
|
|
-
|
|
|
- <button
|
|
|
- class="button tab-actionable-button "
|
|
|
- content="Add an issue that isn't listed"
|
|
|
- v-tippy
|
|
|
- @click="customIssues.push('')"
|
|
|
+ <div>
|
|
|
+ <modal class="report-modal" title="Report">
|
|
|
+ <template #body>
|
|
|
+ <div class="report-modal-inner-container">
|
|
|
+ <div id="left-part">
|
|
|
+ <song-item
|
|
|
+ :song="song"
|
|
|
+ :duration="false"
|
|
|
+ :disabled-actions="['report']"
|
|
|
+ header="Selected Song.."
|
|
|
+ />
|
|
|
+
|
|
|
+ <div class="columns is-multiline">
|
|
|
+ <div
|
|
|
+ v-for="category in predefinedCategories"
|
|
|
+ class="column is-half"
|
|
|
+ :key="category.category"
|
|
|
+ >
|
|
|
+ <label class="label">{{
|
|
|
+ category.category
|
|
|
+ }}</label>
|
|
|
+
|
|
|
+ <p
|
|
|
+ v-for="issue in category.issues"
|
|
|
+ class="control checkbox-control"
|
|
|
+ :key="issue.title"
|
|
|
>
|
|
|
- <i class="material-icons icon-with-button"
|
|
|
- >add</i
|
|
|
- >
|
|
|
- <span>
|
|
|
- Add Custom Issue
|
|
|
+ <span class="align-horizontally">
|
|
|
+ <span>
|
|
|
+ <label class="switch">
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ :id="issue.title"
|
|
|
+ v-model="issue.enabled"
|
|
|
+ />
|
|
|
+ <span
|
|
|
+ class="slider round"
|
|
|
+ ></span>
|
|
|
+ </label>
|
|
|
+
|
|
|
+ <label :for="issue.title">
|
|
|
+ <span></span>
|
|
|
+ <p>{{ issue.title }}</p>
|
|
|
+ </label>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <i
|
|
|
+ class="material-icons"
|
|
|
+ content="Provide More info"
|
|
|
+ v-tippy
|
|
|
+ @click="
|
|
|
+ issue.showDescription = !issue.showDescription
|
|
|
+ "
|
|
|
+ >
|
|
|
+ info
|
|
|
+ </i>
|
|
|
</span>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
|
|
|
- <div
|
|
|
- class="custom-issue control is-grouped input-with-button"
|
|
|
- v-for="(issue, index) in customIssues"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <p class="control is-expanded">
|
|
|
<input
|
|
|
type="text"
|
|
|
class="input"
|
|
|
- v-model="customIssues[index]"
|
|
|
- placeholder="Provide information..."
|
|
|
+ v-model="issue.description"
|
|
|
+ v-if="issue.showDescription"
|
|
|
+ placeholder="Provide more information..."
|
|
|
+ @keyup="issue.enabled = true"
|
|
|
/>
|
|
|
</p>
|
|
|
- <p class="control">
|
|
|
- <button
|
|
|
- class="button is-danger"
|
|
|
- content="Remove custom issue"
|
|
|
- v-tippy
|
|
|
- @click="customIssues.splice(index, 1)"
|
|
|
+ </div>
|
|
|
+ <!-- allow for multiple custom issues with plus/add button and then a input textbox -->
|
|
|
+ <!-- do away with textbox -->
|
|
|
+
|
|
|
+ <div class="column is-half">
|
|
|
+ <div id="custom-issues">
|
|
|
+ <div id="custom-issues-title">
|
|
|
+ <label class="label"
|
|
|
+ >Issues not listed</label
|
|
|
+ >
|
|
|
+
|
|
|
+ <button
|
|
|
+ class="button tab-actionable-button "
|
|
|
+ content="Add an issue that isn't listed"
|
|
|
+ v-tippy
|
|
|
+ @click="customIssues.push('')"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="material-icons icon-with-button"
|
|
|
+ >add</i
|
|
|
+ >
|
|
|
+ <span>
|
|
|
+ Add Custom Issue
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="custom-issue control is-grouped input-with-button"
|
|
|
+ v-for="(issue, index) in customIssues"
|
|
|
+ :key="index"
|
|
|
>
|
|
|
- <i class="material-icons">
|
|
|
- delete
|
|
|
- </i>
|
|
|
- </button>
|
|
|
- </p>
|
|
|
+ <p class="control is-expanded">
|
|
|
+ <input
|
|
|
+ type="text"
|
|
|
+ class="input"
|
|
|
+ v-model="customIssues[index]"
|
|
|
+ placeholder="Provide information..."
|
|
|
+ />
|
|
|
+ </p>
|
|
|
+ <p class="control">
|
|
|
+ <button
|
|
|
+ class="button is-danger"
|
|
|
+ content="Remove custom issue"
|
|
|
+ v-tippy
|
|
|
+ @click="
|
|
|
+ customIssues.splice(
|
|
|
+ index,
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <i class="material-icons">
|
|
|
+ delete
|
|
|
+ </i>
|
|
|
+ </button>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <p
|
|
|
+ id="no-issues-listed"
|
|
|
+ v-if="customIssues.length <= 0"
|
|
|
+ >
|
|
|
+ <em>
|
|
|
+ Add any issues that aren't listed
|
|
|
+ above.
|
|
|
+ </em>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div id="right-part" v-if="existingReports.length > 0">
|
|
|
+ <h4 class="section-title">Previous Reports</h4>
|
|
|
+
|
|
|
+ <p class="section-description">
|
|
|
+ You have made
|
|
|
+ {{
|
|
|
+ existingReports.length > 1
|
|
|
+ ? "multiple reports"
|
|
|
+ : "a report"
|
|
|
+ }}
|
|
|
+ about this song already.
|
|
|
+ </p>
|
|
|
|
|
|
- <p
|
|
|
- id="no-issues-listed"
|
|
|
- v-if="customIssues.length <= 0"
|
|
|
+ <hr class="section-horizontal-rule" />
|
|
|
+
|
|
|
+ <div class="report-items">
|
|
|
+ <div
|
|
|
+ class="report-item"
|
|
|
+ v-for="report in existingReports"
|
|
|
+ :key="report._id"
|
|
|
>
|
|
|
- <em>
|
|
|
- Add any issues that aren't listed above.
|
|
|
- </em>
|
|
|
- </p>
|
|
|
+ <report-info-item
|
|
|
+ :created-at="report.createdAt"
|
|
|
+ :created-by="report.createdBy"
|
|
|
+ >
|
|
|
+ <template #actions>
|
|
|
+ <i
|
|
|
+ class="material-icons"
|
|
|
+ content="View Report"
|
|
|
+ v-tippy
|
|
|
+ @click="view(report._id)"
|
|
|
+ >
|
|
|
+ open_in_full
|
|
|
+ </i>
|
|
|
+ </template>
|
|
|
+ </report-info-item>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template #footer>
|
|
|
- <a class="button is-success" @click="create()" href="#">
|
|
|
- <i class="material-icons save-changes">done</i>
|
|
|
- <span> Create</span>
|
|
|
- </a>
|
|
|
- <a class="button is-danger" href="#" @click="closeModal('report')">
|
|
|
- <span> Cancel</span>
|
|
|
- </a>
|
|
|
- </template>
|
|
|
- </modal>
|
|
|
+ </template>
|
|
|
+ <template #footer>
|
|
|
+ <a class="button is-success" @click="create()" href="#">
|
|
|
+ <i class="material-icons save-changes">done</i>
|
|
|
+ <span> Create</span>
|
|
|
+ </a>
|
|
|
+ <a
|
|
|
+ class="button is-danger"
|
|
|
+ href="#"
|
|
|
+ @click="closeModal('report')"
|
|
|
+ >
|
|
|
+ <span> Cancel</span>
|
|
|
+ </a>
|
|
|
+ </template>
|
|
|
+ </modal>
|
|
|
+ <view-report v-if="modals.viewReport" :report-id="viewingReportId" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { mapState, mapGetters, mapActions } from "vuex";
|
|
|
-
|
|
|
import Toast from "toasters";
|
|
|
+
|
|
|
+import ViewReport from "@/components/modals/ViewReport.vue";
|
|
|
import SongItem from "@/components/SongItem.vue";
|
|
|
+import ReportInfoItem from "@/components/ReportInfoItem.vue";
|
|
|
import Modal from "../Modal.vue";
|
|
|
|
|
|
export default {
|
|
|
- components: { Modal, SongItem },
|
|
|
+ components: { Modal, ViewReport, SongItem, ReportInfoItem },
|
|
|
data() {
|
|
|
return {
|
|
|
+ viewingReportId: "",
|
|
|
+ icons: {
|
|
|
+ duration: "timer",
|
|
|
+ video: "tv",
|
|
|
+ thumbnail: "image",
|
|
|
+ artists: "record_voice_over",
|
|
|
+ title: "title",
|
|
|
+ custom: "lightbulb"
|
|
|
+ },
|
|
|
+ existingReports: [],
|
|
|
customIssues: [],
|
|
|
predefinedCategories: [
|
|
|
{
|
|
@@ -267,17 +341,27 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- charactersRemaining() {
|
|
|
- return 400 - this.report.description.length;
|
|
|
- },
|
|
|
...mapState({
|
|
|
song: state => state.modals.report.song
|
|
|
}),
|
|
|
+ ...mapState("modalVisibility", {
|
|
|
+ modals: state => state.modals
|
|
|
+ }),
|
|
|
...mapGetters({
|
|
|
socket: "websockets/getSocket"
|
|
|
})
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.socket.dispatch("reports.myReportsForSong", this.song._id, res => {
|
|
|
+ if (res.status === "success")
|
|
|
+ this.existingReports = res.data.reports;
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ view(reportId) {
|
|
|
+ this.viewingReportId = reportId;
|
|
|
+ this.openModal("viewReport");
|
|
|
+ },
|
|
|
create() {
|
|
|
const issues = [];
|
|
|
|
|
@@ -314,37 +398,49 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
...mapActions("modals/report", ["reportSong"]),
|
|
|
- ...mapActions("modalVisibility", ["closeModal"])
|
|
|
+ ...mapActions("modalVisibility", ["openModal", "closeModal"])
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-.edit-report-wrapper .song-item {
|
|
|
- .song- {
|
|
|
- width: calc(100% - 150px);
|
|
|
+.report-modal {
|
|
|
+ .modal-card {
|
|
|
+ width: 1050px;
|
|
|
}
|
|
|
- .thumbnail {
|
|
|
- min-width: 130px;
|
|
|
- width: 130px;
|
|
|
- height: 130px;
|
|
|
+
|
|
|
+ .song-item {
|
|
|
+ .thumbnail {
|
|
|
+ min-width: 130px;
|
|
|
+ width: 130px;
|
|
|
+ height: 130px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.radio-controls .control {
|
|
|
+.report-modal-inner-container {
|
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
|
|
|
-.textarea-counter {
|
|
|
- text-align: right;
|
|
|
-}
|
|
|
+ #right-part {
|
|
|
+ border-left: 1px solid var(--light-grey-3);
|
|
|
+ padding-left: 20px;
|
|
|
+ margin-left: 20px;
|
|
|
+ min-width: 325px;
|
|
|
|
|
|
-@media screen and (min-width: 769px) {
|
|
|
- .radio-controls .control-label {
|
|
|
- padding-top: 0 !important;
|
|
|
+ @media screen and (max-width: 900px) {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .report-items {
|
|
|
+ max-height: 485px;
|
|
|
+ overflow: auto;
|
|
|
+
|
|
|
+ .report-item:not(:first-of-type) {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|