add basic view for item history
This commit is contained in:
parent
eb9e9088ca
commit
2a2ef61fc4
18 changed files with 630 additions and 311 deletions
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="min-height: 100vh; display: flex; flex-direction: column;">
|
<div style="min-height: 100vh; display: flex; flex-direction: column;">
|
||||||
|
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="openLightboxModalWith(null)"/>
|
||||||
<AddItemModal v-if="addItemModalOpen && isLoggedIn" @close="closeAddItemModal()" isModal="true"/>
|
<AddItemModal v-if="addItemModalOpen && isLoggedIn" @close="closeAddItemModal()" isModal="true"/>
|
||||||
<AddTicketModal v-if="addTicketModalOpen && isLoggedIn" @close="closeAddTicketModal()" isModal="true"/>
|
<AddTicketModal v-if="addTicketModalOpen && isLoggedIn" @close="closeAddTicketModal()" isModal="true"/>
|
||||||
<AddBoxModal v-if="showAddBoxModal && isLoggedIn" @close="closeAddBoxModal()" isModal="true"/>
|
<AddBoxModal v-if="showAddBoxModal && isLoggedIn" @close="closeAddBoxModal()" isModal="true"/>
|
||||||
|
@ -16,20 +17,22 @@ import {mapState, mapMutations, mapActions, mapGetters} from 'vuex';
|
||||||
import AddTicketModal from "@/components/AddTicketModal.vue";
|
import AddTicketModal from "@/components/AddTicketModal.vue";
|
||||||
import AddBoxModal from "@/components/AddBoxModal.vue";
|
import AddBoxModal from "@/components/AddBoxModal.vue";
|
||||||
import AddEventModal from "@/components/AddEventModal.vue";
|
import AddEventModal from "@/components/AddEventModal.vue";
|
||||||
|
import Lightbox from "@/components/Lightbox.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {AddBoxModal, AddEventModal, Navbar, AddItemModal, AddTicketModal},
|
components: {Lightbox, AddBoxModal, AddEventModal, Navbar, AddItemModal, AddTicketModal},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['loadedItems', 'layout', 'toasts', 'showAddBoxModal', 'showAddEventModal']),
|
...mapState(['loadedItems', 'layout', 'toasts', 'showAddBoxModal', 'showAddEventModal', 'lightboxHash']),
|
||||||
...mapGetters(['isLoggedIn']),
|
...mapGetters(['isLoggedIn']),
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
addItemModalOpen: false,
|
addItemModalOpen: false,
|
||||||
addTicketModalOpen: false
|
addTicketModalOpen: false,
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['removeToast', 'createToast', 'closeAddBoxModal', 'openAddBoxModal', 'closeAddEventModal']),
|
...mapMutations(['removeToast', 'createToast', 'closeAddBoxModal', 'openAddBoxModal', 'closeAddEventModal',
|
||||||
|
'openLightboxModalWith']),
|
||||||
...mapActions(['loadEvents', 'scheduleAfterInit']),
|
...mapActions(['loadEvents', 'scheduleAfterInit']),
|
||||||
openAddItemModal() {
|
openAddItemModal() {
|
||||||
this.addItemModalOpen = true;
|
this.addItemModalOpen = true;
|
||||||
|
@ -42,7 +45,7 @@ export default {
|
||||||
},
|
},
|
||||||
closeAddTicketModal() {
|
closeAddTicketModal() {
|
||||||
this.addTicketModalOpen = false;
|
this.addTicketModalOpen = false;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
document.title = document.location.hostname;
|
document.title = document.location.hostname;
|
||||||
|
|
|
@ -42,9 +42,8 @@ export default {
|
||||||
url: this.src,
|
url: this.src,
|
||||||
data: this.image_data
|
data: this.image_data
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
deferImage() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.cached) {
|
if (this.cached) {
|
||||||
const c = this.getThumbnail(this.src);
|
const c = this.getThumbnail(this.src);
|
||||||
|
@ -56,5 +55,14 @@ export default {
|
||||||
this.loadImage();
|
this.loadImage();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
src: function (newVal, oldVal) {
|
||||||
|
this.deferImage()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.deferImage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -52,7 +52,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const query = this.$router.currentRoute ? (this.$router.currentRoute.query ? this.$router.currentRoute.query.collapsed : null) : null;
|
const query = this.route ? (this.route.query ? this.route.query.collapsed : null) : null;
|
||||||
if (query !== null && query !== undefined) {
|
if (query !== null && query !== undefined) {
|
||||||
this.collapsed = this.unpackInt(parseInt(query), this.sections.length);
|
this.collapsed = this.unpackInt(parseInt(query), this.sections.length);
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,8 +84,8 @@ export default {
|
||||||
const encoded = this.packInt(this.collapsed).toString()
|
const encoded = this.packInt(this.collapsed).toString()
|
||||||
if (this.route.query.collapsed !== encoded)
|
if (this.route.query.collapsed !== encoded)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
...this.$router.currentRoute,
|
...this.route,
|
||||||
query: {...this.$router.currentRoute.query, collapsed: encoded}
|
query: {...this.route.query, collapsed: encoded}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
field="description"
|
field="description"
|
||||||
:validation-fn="str => str && str.length > 0"
|
:validation-fn="str => str && str.length > 0"
|
||||||
/>
|
/>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="box">box</label>
|
||||||
<InputCombo
|
<InputCombo
|
||||||
label="box"
|
label="box"
|
||||||
:model="item"
|
:model="item"
|
||||||
|
@ -20,6 +22,7 @@
|
||||||
:options="boxes"
|
:options="boxes"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
<span class="timeline-item-icon faded-icon" v-else-if="item.type === 'shipping_voucher'">
|
<span class="timeline-item-icon faded-icon" v-else-if="item.type === 'shipping_voucher'">
|
||||||
<font-awesome-icon icon="truck"/>
|
<font-awesome-icon icon="truck"/>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="timeline-item-icon faded-icon" v-else-if="item.type === 'placement'">
|
||||||
|
<font-awesome-icon icon="archive"/>
|
||||||
|
</span>
|
||||||
<span class="timeline-item-icon faded-icon" v-else>
|
<span class="timeline-item-icon faded-icon" v-else>
|
||||||
<font-awesome-icon icon="pen"/>
|
<font-awesome-icon icon="pen"/>
|
||||||
</span>
|
</span>
|
||||||
|
@ -30,40 +33,15 @@
|
||||||
<TimelineAssignment v-else-if="item.type === 'assignment'" :item="item"/>
|
<TimelineAssignment v-else-if="item.type === 'assignment'" :item="item"/>
|
||||||
<TimelineRelatedItem v-else-if="item.type === 'item_relation'" :item="item"/>
|
<TimelineRelatedItem v-else-if="item.type === 'item_relation'" :item="item"/>
|
||||||
<TimelineShippingVoucher v-else-if="item.type === 'shipping_voucher'" :item="item"/>
|
<TimelineShippingVoucher v-else-if="item.type === 'shipping_voucher'" :item="item"/>
|
||||||
|
<TimelinePlacement v-else-if="item.type === 'placement'" :item="item"/>
|
||||||
|
<TimelineRelatedTicket v-else-if="item.type === 'issue_relation'" :item="item"/>
|
||||||
<p v-else>{{ item }}</p>
|
<p v-else>{{ item }}</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="timeline-item">
|
<li class="timeline-item">
|
||||||
<span class="timeline-item-icon | faded-icon">
|
<slot name="timeline_action1"/>
|
||||||
<font-awesome-icon icon="comment"/>
|
|
||||||
</span>
|
|
||||||
<div class="new-comment card bg-dark">
|
|
||||||
<div class="">
|
|
||||||
<textarea placeholder="add comment..." v-model="newComment" class="form-control">
|
|
||||||
</textarea>
|
|
||||||
<AsyncButton class="btn btn-primary float-right" :task="addCommentAndClear">
|
|
||||||
<font-awesome-icon icon="comment"/>
|
|
||||||
Save Comment
|
|
||||||
</AsyncButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="timeline-item">
|
<li class="timeline-item">
|
||||||
<span class="timeline-item-icon | faded-icon">
|
<slot name="timeline_action2"/>
|
||||||
<font-awesome-icon icon="envelope"/>
|
|
||||||
</span>
|
|
||||||
<div class="new-mail card bg-dark">
|
|
||||||
<div class="card-header">
|
|
||||||
{{ newestMailSubject }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<textarea placeholder="reply mail..." v-model="newMail" class="form-control">
|
|
||||||
</textarea>
|
|
||||||
<AsyncButton class="btn btn-primary float-right" :task="sendMailAndClear">
|
|
||||||
<font-awesome-icon icon="envelope"/>
|
|
||||||
Send Mail
|
|
||||||
</AsyncButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</template>
|
</template>
|
||||||
|
@ -78,12 +56,20 @@ import TimelineAssignment from "@/components/TimelineAssignment.vue";
|
||||||
import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue";
|
import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue";
|
||||||
import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue";
|
import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue";
|
||||||
import AsyncButton from "@/components/inputs/AsyncButton.vue";
|
import AsyncButton from "@/components/inputs/AsyncButton.vue";
|
||||||
|
import TimelinePlacement from "@/components/TimelinePlacement.vue";
|
||||||
|
import TimelineRelatedTicket from "@/components/TimelineRelatedTicket.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Timeline',
|
name: 'Timeline',
|
||||||
components: {
|
components: {
|
||||||
TimelineShippingVoucher, AsyncButton,
|
TimelineRelatedTicket,
|
||||||
TimelineRelatedItem, TimelineAssignment, TimelineStateChange, TimelineComment, TimelineMail
|
TimelinePlacement,
|
||||||
|
TimelineShippingVoucher,
|
||||||
|
TimelineRelatedItem,
|
||||||
|
TimelineAssignment,
|
||||||
|
TimelineStateChange,
|
||||||
|
TimelineComment,
|
||||||
|
TimelineMail
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
timeline: {
|
timeline: {
|
||||||
|
@ -91,33 +77,13 @@ export default {
|
||||||
default: () => []
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['sendMail', 'addComment'],
|
|
||||||
data: () => ({
|
|
||||||
newMail: "",
|
|
||||||
newComment: ""
|
|
||||||
}),
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['stateInfo']),
|
...mapGetters(['stateInfo'])
|
||||||
newestMailSubject() {
|
|
||||||
const mail = this.timeline.filter(item => item.type === 'mail').pop();
|
|
||||||
return mail ? mail.subject : "";
|
|
||||||
},
|
},
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions(['sendMail', 'postComment']),
|
|
||||||
sendMailAndClear: async function () {
|
|
||||||
await this.sendMail(this.newMail);
|
|
||||||
this.newMail = "";
|
|
||||||
},
|
|
||||||
addCommentAndClear: async function () {
|
|
||||||
await this.postComment(this.newComment);
|
|
||||||
this.newComment = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss">
|
||||||
|
|
||||||
*,
|
*,
|
||||||
*:before,
|
*:before,
|
||||||
|
@ -136,10 +102,10 @@ a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
/*img {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* End basic CSS override */
|
/* End basic CSS override */
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="timeline-item-wrapper">
|
<div class="timeline-item-wrapper">
|
||||||
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="closeLightboxModal()"/>
|
|
||||||
<div class="timeline-item-description">
|
<div class="timeline-item-description">
|
||||||
<i class="avatar | small">
|
<i class="avatar | small">
|
||||||
<font-awesome-icon icon="user"/>
|
<font-awesome-icon icon="user"/>
|
||||||
|
@ -23,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer" v-if="item.attachments.length">
|
<div class="card-footer" v-if="item.attachments.length">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="attachment in item.attachments" @click="openLightboxModalWith(attachment)">
|
<li v-for="attachment in item.attachments" @click="openLightboxModalWith(attachment.hash)">
|
||||||
<AuthenticatedImage :src="`/media/2/256/${attachment.hash}/`" :alt="attachment.name"
|
<AuthenticatedImage :src="`/media/2/256/${attachment.hash}/`" :alt="attachment.name"
|
||||||
v-if="attachment.mime_type.startsWith('image/')" cached/>
|
v-if="attachment.mime_type.startsWith('image/')" cached/>
|
||||||
<AuthenticatedDataLink :href="`/media/2/${attachment.hash}/`" :download="attachment.name"
|
<AuthenticatedDataLink :href="`/media/2/${attachment.hash}/`" :download="attachment.name"
|
||||||
|
@ -32,26 +31,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--button class="show-replies">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward"
|
|
||||||
width="44" height="44" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
|
|
||||||
stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
||||||
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"/>
|
|
||||||
</svg>
|
|
||||||
Show 3 replies
|
|
||||||
<span class="avatar-list">
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
</span>
|
|
||||||
</button-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -59,16 +38,11 @@
|
||||||
|
|
||||||
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||||
import AuthenticatedDataLink from "@/components/AuthenticatedDataLink.vue";
|
import AuthenticatedDataLink from "@/components/AuthenticatedDataLink.vue";
|
||||||
import Lightbox from "@/components/Lightbox.vue";
|
import {mapMutations} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TimelineMail',
|
name: 'TimelineMail',
|
||||||
components: {Lightbox, AuthenticatedImage, AuthenticatedDataLink},
|
components: {AuthenticatedImage, AuthenticatedDataLink},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
lightboxHash: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
'item': {
|
'item': {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -85,12 +59,7 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openLightboxModalWith(attachment) {
|
...mapMutations(['openLightboxModalWith'])
|
||||||
this.lightboxHash = attachment.hash;
|
|
||||||
},
|
|
||||||
closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
|
|
||||||
this.lightboxHash = null;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
85
web/src/components/TimelinePlacement.vue
Normal file
85
web/src/components/TimelinePlacement.vue
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
<template>
|
||||||
|
<div class="timeline-item-description">
|
||||||
|
<i class="avatar | small">
|
||||||
|
<font-awesome-icon icon="user"/>
|
||||||
|
</i>
|
||||||
|
<span><a href="#">$USER</a> has placed item in '{{item.box}}' (#{{item.cid}}) at <time
|
||||||
|
:datetime="timestamp">{{ timestamp }}</time>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TimelinePlacement',
|
||||||
|
props: {
|
||||||
|
'item': {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
'timestamp': function () {
|
||||||
|
return new Date(this.item.timestamp).toLocaleString();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End basic CSS override */
|
||||||
|
|
||||||
|
|
||||||
|
.timeline-item-description {
|
||||||
|
display: flex;
|
||||||
|
padding-top: 6px;
|
||||||
|
gap: 8px;
|
||||||
|
color: var(--gray);
|
||||||
|
|
||||||
|
img {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
/*color: var(--c-grey-500);*/
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
outline: 0; /* Don't actually do this */
|
||||||
|
color: var(--info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
|
@ -1,12 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="timeline-item-wrapper">
|
<div class="timeline-item-wrapper">
|
||||||
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="closeLightboxModal()"/>
|
|
||||||
<div class="timeline-item-description">
|
<div class="timeline-item-description">
|
||||||
<i class="avatar | small">
|
<i class="avatar | small">
|
||||||
<font-awesome-icon icon="user"/>
|
<font-awesome-icon icon="user"/>
|
||||||
</i>
|
</i>
|
||||||
<span><!--a href="#">$USER</a--> linked item <span class="badge badge-secondary">#{{ item.item.uid }} </span> on <time
|
<span><!--a href="#">$USER</a--> linked item <span class="badge badge-secondary">#{{
|
||||||
:datetime="timestamp">{{ timestamp }}</time> as <span class="badge badge-primary">{{ item.status }}</span>
|
item.item.id
|
||||||
|
}} </span> on <time
|
||||||
|
:datetime="timestamp">{{ timestamp }}</time> as <span class="badge badge-primary">{{
|
||||||
|
item.status
|
||||||
|
}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card bg-dark">
|
<div class="card bg-dark">
|
||||||
|
@ -15,56 +18,19 @@
|
||||||
<AuthenticatedImage v-if="item.item.file" cached
|
<AuthenticatedImage v-if="item.item.file" cached
|
||||||
:src="`/media/2/256/${item.item.file}/`"
|
:src="`/media/2/256/${item.item.file}/`"
|
||||||
class="d-block card-img-left"
|
class="d-block card-img-left"
|
||||||
@click="openLightboxModalWith(item.item)"
|
@click="openLightboxModalWith(item.item.file)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h6 class="card-subtitle text-secondary">uid: {{ item.item.uid }} box: {{ item.item.box }}</h6>
|
<h6 class="card-subtitle text-secondary">id: {{ item.item.id }} box: {{ item.item.box }}</h6>
|
||||||
|
<router-link :to="{name: 'item', params: {id: item.item.id}}">
|
||||||
<h6 class="card-title">{{ item.item.description }}</h6>
|
<h6 class="card-title">{{ item.item.description }}</h6>
|
||||||
<!--div class="row mx-auto mt-2">
|
</router-link>
|
||||||
<div class="btn-group">
|
|
||||||
<button class="btn btn-outline-success"
|
|
||||||
@click.stop="confirm('return Item?') && markItemReturned(item.item)"
|
|
||||||
title="returned">
|
|
||||||
<font-awesome-icon icon="check"/>
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item.item)"
|
|
||||||
title="edit">
|
|
||||||
<font-awesome-icon icon="edit"/>
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-outline-danger"
|
|
||||||
@click.stop="confirm('delete Item?') && deleteItem(item.item)"
|
|
||||||
title="delete">
|
|
||||||
<font-awesome-icon icon="trash"/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p>{{ item }}</p-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--button class="show-replies">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward"
|
|
||||||
width="44" height="44" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
|
|
||||||
stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
||||||
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"/>
|
|
||||||
</svg>
|
|
||||||
Show 3 replies
|
|
||||||
<span class="avatar-list">
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
<i class="avatar | small">
|
|
||||||
<font-awesome-icon icon="user"/>
|
|
||||||
</i>
|
|
||||||
</span>
|
|
||||||
</button-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -72,16 +38,11 @@
|
||||||
|
|
||||||
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||||
import AuthenticatedDataLink from "@/components/AuthenticatedDataLink.vue";
|
import AuthenticatedDataLink from "@/components/AuthenticatedDataLink.vue";
|
||||||
import Lightbox from "@/components/Lightbox.vue";
|
import {mapMutations} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TimelineRelatedItem',
|
name: 'TimelineRelatedItem',
|
||||||
components: {Lightbox, AuthenticatedImage, AuthenticatedDataLink},
|
components: {AuthenticatedImage, AuthenticatedDataLink},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
lightboxHash: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
'item': {
|
'item': {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -98,13 +59,8 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openLightboxModalWith(attachment) {
|
...mapMutations(['openLightboxModalWith'])
|
||||||
this.lightboxHash = attachment.hash;
|
}
|
||||||
},
|
|
||||||
closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
|
|
||||||
this.lightboxHash = null;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
94
web/src/components/TimelineRelatedTicket.vue
Normal file
94
web/src/components/TimelineRelatedTicket.vue
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<template>
|
||||||
|
<div class="timeline-item-wrapper">
|
||||||
|
<div class="timeline-item-description">
|
||||||
|
<i class="avatar | small">
|
||||||
|
<font-awesome-icon icon="user"/>
|
||||||
|
</i>
|
||||||
|
<span> linked ticket <span class="badge badge-secondary">#{{ item.issue_thread.id }} </span> on
|
||||||
|
<time :datetime="timestamp">{{ timestamp }}</time> as
|
||||||
|
<span class="badge badge-primary">{{ item.status }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="timeline-item-description">
|
||||||
|
<router-link :to="{name: 'ticket', params: {id: item.issue_thread.id}}">
|
||||||
|
<h6 class="card-title">Ticket #{{ item.issue_thread.id }} - {{ item.issue_thread.name }}</h6>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TimelineRelatedTicket',
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
'item': {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
'timestamp': function () {
|
||||||
|
return new Date(this.item.timestamp).toLocaleString();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item-description {
|
||||||
|
display: flex;
|
||||||
|
padding-top: 6px;
|
||||||
|
gap: 8px;
|
||||||
|
color: var(--gray);
|
||||||
|
|
||||||
|
img {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
/*color: var(--c-grey-500);*/
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
outline: 0; /* Don't actually do this */
|
||||||
|
color: var(--info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: 1px solid var(--gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -24,7 +24,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async handleClick() {
|
async handleClick() {
|
||||||
console.log("AsyncButton.handleClick() called");
|
|
||||||
if (this.task && typeof this.task === 'function') {
|
if (this.task && typeof this.task === 'function') {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="form-group">
|
|
||||||
<label :for="label">{{ label }}</label>
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<button
|
<button
|
||||||
|
@ -34,7 +32,6 @@
|
||||||
</div>
|
</div>
|
||||||
<Addon type="Combo Box" :is-valid="isValid"/>
|
<Addon type="Combo Box" :is-valid="isValid"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
<div>
|
<div>
|
||||||
<img
|
<img
|
||||||
v-if="!capturing"
|
v-if="!capturing"
|
||||||
class="img-fluid rounded mx-auto d-block mb-3 img-preview"
|
:class="imgClass || ['img-fluid', 'rounded', 'mx-auto', 'd-block', 'mb-3', 'img-preview']"
|
||||||
:src="dataImage"
|
:src="dataImage"
|
||||||
alt="Image not available."
|
alt="Image not available."
|
||||||
|
@click="e=>$emit('detail', e)"
|
||||||
/>
|
/>
|
||||||
<video
|
<video
|
||||||
v-if="capturing"
|
v-if="capturing"
|
||||||
|
@ -44,19 +45,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapMutations} from 'vuex';
|
import {mapActions, mapMutations} from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'InputPhoto',
|
name: 'InputPhoto',
|
||||||
props: ['model', 'field', 'onCapture'],
|
props: ['model', 'field', 'onCapture', 'imgClass'],
|
||||||
data: () => ({
|
data: () => ({
|
||||||
capturing: false,
|
capturing: false,
|
||||||
streaming: false,
|
streaming: false,
|
||||||
stream: undefined,
|
stream: undefined,
|
||||||
dataImage: undefined
|
dataImage: undefined
|
||||||
}),
|
}),
|
||||||
|
emits: ['detail'],
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['createToast']),
|
...mapMutations(['createToast']),
|
||||||
|
...mapActions(['fetchImage']),
|
||||||
openStream() {
|
openStream() {
|
||||||
if (!this.capturing) {
|
if (!this.capturing) {
|
||||||
this.capturing = true;
|
this.capturing = true;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import {createRouter, createWebHistory} from 'vue-router'
|
import {createRouter, createWebHistory} from 'vue-router'
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
|
||||||
import Items from './views/Items';
|
import Item from "@/views/Item.vue";
|
||||||
import Boxes from './views/Boxes';
|
import Items from '@/views/Items';
|
||||||
import Files from './views/Files';
|
import Boxes from '@/views/Boxes';
|
||||||
import HowTo from './views/HowTo';
|
import Files from '@/views/Files';
|
||||||
|
import HowTo from '@/views/HowTo';
|
||||||
import Login from '@/views/Login.vue';
|
import Login from '@/views/Login.vue';
|
||||||
import Register from '@/views/Register.vue';
|
import Register from '@/views/Register.vue';
|
||||||
import Dashboard from "@/views/admin/Dashboard.vue";
|
import Dashboard from "@/views/admin/Dashboard.vue";
|
||||||
|
@ -27,7 +28,7 @@ const routes = [
|
||||||
{requiresAuth: true, requiresPermission: 'view_item'}
|
{requiresAuth: true, requiresPermission: 'view_item'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/:event/item/:uid/', name: 'item', component: Items, meta:
|
path: '/:event/item/:id/', name: 'item', component: Item, meta:
|
||||||
{requiresAuth: true, requiresPermission: 'view_item'}
|
{requiresAuth: true, requiresPermission: 'view_item'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ const store = createStore({
|
||||||
expiry: null,
|
expiry: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
lightboxHash: null,
|
||||||
thumbnailCache: {},
|
thumbnailCache: {},
|
||||||
fetchedData: {
|
fetchedData: {
|
||||||
events: 0,
|
events: 0,
|
||||||
|
@ -145,38 +146,34 @@ const store = createStore({
|
||||||
setItems(state, {slug, items}) {
|
setItems(state, {slug, items}) {
|
||||||
state.loadedItems[slug] = items;
|
state.loadedItems[slug] = items;
|
||||||
state.loadedItems = {...state.loadedItems};
|
state.loadedItems = {...state.loadedItems};
|
||||||
console.log(state.loadedItems)
|
|
||||||
},
|
},
|
||||||
replaceItems(state, items) {
|
replaceItems(state, items) {
|
||||||
const groups = Object.groupBy(items, i => i.event ? i.event : 'none')
|
const groups = Object.groupBy(items, i => i.event ? i.event : 'none')
|
||||||
for (const [key, value] of Object.entries(groups)) state.loadedItems[key] = value;
|
for (const [key, value] of Object.entries(groups)) state.loadedItems[key] = value;
|
||||||
state.loadedItems = {...state.loadedItems};
|
state.loadedItems = {...state.loadedItems};
|
||||||
console.log(state.loadedItems)
|
|
||||||
},
|
},
|
||||||
updateItem(state, updatedItem) {
|
updateItem(state, updatedItem) {
|
||||||
const item = state.loadedItems[updatedItem.event?updatedItem.event:'none'].filter(
|
const item = state.loadedItems[updatedItem.event ? updatedItem.event : 'none'].filter(
|
||||||
({uid}) => uid === updatedItem.uid)[0];
|
({id}) => id === updatedItem.id)[0];
|
||||||
Object.assign(item, updatedItem);
|
Object.assign(item, updatedItem);
|
||||||
},
|
},
|
||||||
removeItem(state, item) {
|
removeItem(state, item) {
|
||||||
state.loadedItems[item.event?item.event:'none'] = state.loadedItems[item.event].filter(it => it !== item);
|
state.loadedItems[item.event ? item.event : 'none'] = state.loadedItems[item.event].filter(it => it !== item);
|
||||||
},
|
},
|
||||||
appendItem(state, item) {
|
appendItem(state, item) {
|
||||||
state.loadedItems[item.event?item.event:'none'].push(item);
|
state.loadedItems[item.event ? item.event : 'none'].push(item);
|
||||||
},
|
},
|
||||||
setTickets(state, {slug, tickets}) {
|
setTickets(state, {slug, tickets}) {
|
||||||
state.loadedTickets[slug] = tickets;
|
state.loadedTickets[slug] = tickets;
|
||||||
state.loadedTickets = {...state.loadedTickets};
|
state.loadedTickets = {...state.loadedTickets};
|
||||||
console.log(state.loadedTickets)
|
|
||||||
},
|
},
|
||||||
replaceTickets(state, tickets) {
|
replaceTickets(state, tickets) {
|
||||||
const groups = Object.groupBy(tickets, t => t.event ? t.event : 'none')
|
const groups = Object.groupBy(tickets, t => t.event ? t.event : 'none')
|
||||||
for (const [key, value] of Object.entries(groups)) state.loadedTickets[key] = value;
|
for (const [key, value] of Object.entries(groups)) state.loadedTickets[key] = value;
|
||||||
state.loadedTickets = {...state.loadedTickets};
|
state.loadedTickets = {...state.loadedTickets};
|
||||||
console.log(state.loadedTickets)
|
|
||||||
},
|
},
|
||||||
updateTicket(state, updatedTicket) {
|
updateTicket(state, updatedTicket) {
|
||||||
const ticket = state.loadedTickets[updatedTicket.event?updatedTicket.event:'none'].filter(
|
const ticket = state.loadedTickets[updatedTicket.event ? updatedTicket.event : 'none'].filter(
|
||||||
({id}) => id === updatedTicket.id)[0];
|
({id}) => id === updatedTicket.id)[0];
|
||||||
Object.assign(ticket, updatedTicket);
|
Object.assign(ticket, updatedTicket);
|
||||||
state.loadedTickets = {...state.loadedTickets};
|
state.loadedTickets = {...state.loadedTickets};
|
||||||
|
@ -189,6 +186,9 @@ const store = createStore({
|
||||||
state.groups = groups;
|
state.groups = groups;
|
||||||
state.fetchedData = {...state.fetchedData, groups: Date.now()};
|
state.fetchedData = {...state.fetchedData, groups: Date.now()};
|
||||||
},
|
},
|
||||||
|
openLightboxModalWith(state, hash) {
|
||||||
|
state.lightboxHash = hash;
|
||||||
|
},
|
||||||
openAddBoxModal(state) {
|
openAddBoxModal(state) {
|
||||||
state.showAddBoxModal = true;
|
state.showAddBoxModal = true;
|
||||||
},
|
},
|
||||||
|
@ -336,14 +336,13 @@ const store = createStore({
|
||||||
const {data, success} = await getters.session.delete(`/2/events/${event_id}/`);
|
const {data, success} = await getters.session.delete(`/2/events/${event_id}/`);
|
||||||
if (success) {
|
if (success) {
|
||||||
await dispatch('loadEvents')
|
await dispatch('loadEvents')
|
||||||
commit('replaceEvents', [...state.events.filter(e => e.eid !== event_id)])
|
commit('replaceEvents', [...state.events.filter(e => e.id !== event_id)])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async updateEvent({commit, dispatch, state}, {id, partial_event}){
|
async updateEvent({commit, dispatch, state}, {id, partial_event}){
|
||||||
console.log(id, partial_event);
|
|
||||||
const {data, success} = await http.patch(`/2/events/${id}/`, partial_event, state.user.token);
|
const {data, success} = await http.patch(`/2/events/${id}/`, partial_event, state.user.token);
|
||||||
if (success) {
|
if (success) {
|
||||||
commit('replaceEvents', [...state.events.filter(e => e.eid !== id), data])
|
commit('replaceEvents', [...state.events.filter(e => e.id !== id), data])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetchTicketStates({commit, state, getters}) {
|
async fetchTicketStates({commit, state, getters}) {
|
||||||
|
@ -354,7 +353,6 @@ const store = createStore({
|
||||||
},
|
},
|
||||||
async changeEvent({dispatch, getters, commit}, eventName) {
|
async changeEvent({dispatch, getters, commit}, eventName) {
|
||||||
await router.push({path: `/${eventName.slug}/${getters.getActiveView}/`});
|
await router.push({path: `/${eventName.slug}/${getters.getActiveView}/`});
|
||||||
//dispatch('loadEventItems');
|
|
||||||
},
|
},
|
||||||
async changeView({getters}, link) {
|
async changeView({getters}, link) {
|
||||||
await router.push({path: `/${getters.getEventSlug}/${link.path}/`});
|
await router.push({path: `/${getters.getEventSlug}/${link.path}/`});
|
||||||
|
@ -405,16 +403,16 @@ const store = createStore({
|
||||||
async updateItem({commit, getters, state}, item) {
|
async updateItem({commit, getters, state}, item) {
|
||||||
const {
|
const {
|
||||||
data, success
|
data, success
|
||||||
} = await getters.session.put(`/2/${getters.getEventSlug}/item/${item.uid}/`, item);
|
} = await getters.session.put(`/2/${getters.getEventSlug}/item/${item.id}/`, item);
|
||||||
commit('updateItem', data);
|
commit('updateItem', data);
|
||||||
},
|
},
|
||||||
async markItemReturned({commit, getters, state}, item) {
|
async markItemReturned({commit, getters, state}, item) {
|
||||||
await getters.session.patch(`/2/${getters.getEventSlug}/item/${item.uid}/`, {returned: true},
|
await getters.session.patch(`/2/${getters.getEventSlug}/item/${item.id}/`, {returned: true},
|
||||||
state.user.token);
|
state.user.token);
|
||||||
commit('removeItem', item);
|
commit('removeItem', item);
|
||||||
},
|
},
|
||||||
async deleteItem({commit, getters, state}, item) {
|
async deleteItem({commit, getters, state}, item) {
|
||||||
await getters.session.delete(`/2/${getters.getEventSlug}/item/${item.uid}/`, item);
|
await getters.session.delete(`/2/${getters.getEventSlug}/item/${item.id}/`, item);
|
||||||
commit('removeItem', item);
|
commit('removeItem', item);
|
||||||
},
|
},
|
||||||
async postItem({commit, getters, state}, item) {
|
async postItem({commit, getters, state}, item) {
|
||||||
|
@ -457,6 +455,13 @@ const store = createStore({
|
||||||
await dispatch('loadTickets');
|
await dispatch('loadTickets');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async postItemComment({commit, dispatch, state, getters}, {id, message}) {
|
||||||
|
const {data, success} = await getters.session.post(`/2/${getters.getEventSlug}/item/${id}/comment/`, {comment: message});
|
||||||
|
if (data && success) {
|
||||||
|
state.fetchedData.items = 0;
|
||||||
|
await dispatch('loadEventItems');
|
||||||
|
}
|
||||||
|
},
|
||||||
async loadUsers({commit, state, getters}) {
|
async loadUsers({commit, state, getters}) {
|
||||||
if (!state.user.token) return;
|
if (!state.user.token) return;
|
||||||
if (state.fetchedData.users > Date.now() - 1000 * 60 * 60 * 24) return;
|
if (state.fetchedData.users > Date.now() - 1000 * 60 * 60 * 24) return;
|
||||||
|
|
186
web/src/views/Item.vue
Normal file
186
web/src/views/Item.vue
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
<template>
|
||||||
|
<AsyncLoader :loaded="!!item.id">
|
||||||
|
<div class="container-fluid px-xl-5 mt-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 col-xl-2">
|
||||||
|
<div class="card bg-dark text-light mb-2" id="filters">
|
||||||
|
<div class="card bg-dark">
|
||||||
|
<InputPhoto
|
||||||
|
v-if="!!editingItem"
|
||||||
|
:model="editingItem"
|
||||||
|
field="file"
|
||||||
|
:on-capture="storeImage"
|
||||||
|
imgClass="d-block card-img"
|
||||||
|
/>
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-subtitle text-secondary">id: {{ item.id }} box: {{ item.box }}</h6>
|
||||||
|
<h6 class="card-title">{{ item.description }}</h6>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<InputString
|
||||||
|
v-if="!!editingItem"
|
||||||
|
label="description"
|
||||||
|
:model="editingItem"
|
||||||
|
field="description"
|
||||||
|
:validation-fn="str => str && str.length > 0"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-8">
|
||||||
|
<div class="card bg-dark text-light mb-2" id="filters">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3>Item #{{ item.id }} - {{ item.description }}</h3>
|
||||||
|
</div>
|
||||||
|
<Timeline :timeline="item.timeline">
|
||||||
|
<template v-slot:timeline_action1>
|
||||||
|
<span class="timeline-item-icon | faded-icon">
|
||||||
|
<font-awesome-icon icon="comment"/>
|
||||||
|
</span>
|
||||||
|
<div class="new-comment card bg-dark">
|
||||||
|
<div class="">
|
||||||
|
<textarea placeholder="add comment..." v-model="newComment"
|
||||||
|
class="form-control">
|
||||||
|
</textarea>
|
||||||
|
<AsyncButton class="btn btn-primary float-right" :task="addCommentAndClear">
|
||||||
|
<font-awesome-icon icon="comment"/>
|
||||||
|
Save Comment
|
||||||
|
</AsyncButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Timeline>
|
||||||
|
<div class="card-footer d-flex justify-content-between">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-outline-success"
|
||||||
|
@click.stop="confirm('return Item?') && markItemReturnedAndClose(item)"
|
||||||
|
title="returned">
|
||||||
|
<font-awesome-icon icon="check"/> mark returned
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-outline-danger"
|
||||||
|
@click.stop="confirm('delete Item?') && deleteItemAndClose(item)"
|
||||||
|
title="delete">
|
||||||
|
<font-awesome-icon icon="trash"/> delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<InputCombo
|
||||||
|
v-if="!!editingItem"
|
||||||
|
label="box"
|
||||||
|
:model="editingItem"
|
||||||
|
nameKey="box"
|
||||||
|
uniqueKey="cid"
|
||||||
|
:options="boxes"
|
||||||
|
style="width: auto;"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-success" @click="saveEditingItem()">Save Changes
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-xl-2" v-if="item.related_issues && item.related_issues.length">
|
||||||
|
<div class="card bg-dark text-light mb-2" id="filters">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title text-info">Related</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card bg-dark" v-for="issue in item.related_issues" v-bind:key="item.id">
|
||||||
|
<div class="card-body">
|
||||||
|
<router-link :to="{name: 'ticket', params: {id: issue.id}}">
|
||||||
|
<h6 class="card-title">Ticket #{{ issue.id }} - {{ issue.name }}</h6>
|
||||||
|
</router-link>
|
||||||
|
<h6 class="card-subtitle text-secondary">state: {{ issue.state }}</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</AsyncLoader>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex';
|
||||||
|
import router from "@/router";
|
||||||
|
import Timeline from "@/components/Timeline.vue";
|
||||||
|
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
||||||
|
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||||
|
import InputCombo from "@/components/inputs/InputCombo.vue";
|
||||||
|
import InputString from "@/components/inputs/InputString.vue";
|
||||||
|
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||||
|
import InputPhoto from "@/components/inputs/InputPhoto.vue";
|
||||||
|
import Modal from "@/components/Modal.vue";
|
||||||
|
import EditItem from "@/components/EditItem.vue";
|
||||||
|
import AsyncButton from "@/components/inputs/AsyncButton.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Item',
|
||||||
|
components: {
|
||||||
|
AsyncButton,
|
||||||
|
EditItem,
|
||||||
|
Modal, InputPhoto, AuthenticatedImage, InputString, InputCombo, AsyncLoader, ClipboardButton, Timeline
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
newComment: "",
|
||||||
|
editingItem: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['state_options', 'users']),
|
||||||
|
...mapGetters(['availableShippingVoucherTypes', 'getAllItems', 'route', 'getBoxes']),
|
||||||
|
item() {
|
||||||
|
const id = parseInt(this.route.params.id)
|
||||||
|
const ret = this.getAllItems.find(item => item.id === id);
|
||||||
|
return ret ? ret : {};
|
||||||
|
},
|
||||||
|
boxes() {
|
||||||
|
return this.getBoxes.map(obj => ({cid: obj.id, box: obj.name}));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['deleteItem', 'markItemReturned', 'updateTicketPartial', 'postItemComment']),
|
||||||
|
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit', 'updateItem']),
|
||||||
|
...mapActions(['claimShippingVoucher', 'fetchShippingVouchers', 'loadEventItems', 'loadBoxes']),
|
||||||
|
...mapMutations(['openLightboxModalWith']),
|
||||||
|
async addCommentAndClear() {
|
||||||
|
await this.postItemComment({
|
||||||
|
id: this.item.id,
|
||||||
|
message: this.newComment
|
||||||
|
})
|
||||||
|
this.newComment = "";
|
||||||
|
},
|
||||||
|
async saveEditingItem() { // Saves the edited copy of the item.
|
||||||
|
await this.updateItem(this.editingItem);
|
||||||
|
this.editingItem = {...this.item}
|
||||||
|
},
|
||||||
|
storeImage(image) {
|
||||||
|
this.editingItem.dataImage = image;
|
||||||
|
},
|
||||||
|
confirm(message) {
|
||||||
|
return window.confirm(message);
|
||||||
|
},
|
||||||
|
async markItemReturnedAndClose(item) {
|
||||||
|
await this.markItemReturned(item);
|
||||||
|
router.back();
|
||||||
|
},
|
||||||
|
async deleteItemAndClose(item) {
|
||||||
|
await this.deleteItem(item);
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.scheduleAfterInit(() => [Promise.all([this.loadEventItems(), this.loadBoxes()]).then(() => {
|
||||||
|
this.selected_state = this.item.state;
|
||||||
|
this.selected_assignee = this.item.assigned_to
|
||||||
|
this.editingItem = {...this.item}
|
||||||
|
})]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -1,26 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<AsyncLoader :loaded="isItemsLoaded">
|
<AsyncLoader :loaded="isItemsLoaded">
|
||||||
<div class="container-fluid px-xl-5 mt-3">
|
<div class="container-fluid px-xl-5 mt-3">
|
||||||
<Modal title="Edit Item" v-if="editingItem" @close="closeEditingModal()">
|
|
||||||
<template #body>
|
|
||||||
<EditItem
|
|
||||||
:item="editingItem"
|
|
||||||
badge="uid"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #buttons>
|
|
||||||
<button type="button" class="btn btn-secondary" @click="closeEditingModal()">Cancel</button>
|
|
||||||
<button type="button" class="btn btn-success" @click="saveEditingItem()">Save Changes</button>
|
|
||||||
</template>
|
|
||||||
</Modal>
|
|
||||||
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="closeLightboxModal()"/>
|
|
||||||
<div class="row" v-if="layout === 'table'">
|
<div class="row" v-if="layout === 'table'">
|
||||||
<div class="col-xl-8 offset-xl-2">
|
<div class="col-xl-8 offset-xl-2">
|
||||||
<Table
|
<Table
|
||||||
:columns="['uid', 'description', 'box']"
|
:columns="['id', 'description', 'box']"
|
||||||
:items="getEventItems"
|
:items="getEventItems"
|
||||||
:keyName="'uid'"
|
:keyName="'id'"
|
||||||
@itemActivated="openLightboxModalWith($event)"
|
@itemActivated="showItemDetail"
|
||||||
>
|
>
|
||||||
<template #actions="{ item }">
|
<template #actions="{ item }">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
@ -43,11 +30,11 @@
|
||||||
</div>
|
</div>
|
||||||
<Cards
|
<Cards
|
||||||
v-if="layout === 'cards'"
|
v-if="layout === 'cards'"
|
||||||
:columns="['uid', 'description', 'box']"
|
:columns="['id', 'description', 'box']"
|
||||||
:items="getEventItems"
|
:items="getEventItems"
|
||||||
:keyName="'uid'"
|
:keyName="'id'"
|
||||||
v-slot="{ item }"
|
v-slot="{ item }"
|
||||||
@itemActivated="openLightboxModalWith($event)"
|
@itemActivated="item => openLightboxModalWith(item.file)"
|
||||||
>
|
>
|
||||||
<AuthenticatedImage v-if="item.file" cached
|
<AuthenticatedImage v-if="item.file" cached
|
||||||
:src="`/media/2/256/${item.file}/`"
|
:src="`/media/2/256/${item.file}/`"
|
||||||
|
@ -55,14 +42,14 @@
|
||||||
/>
|
/>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h6 class="card-title">{{ item.description }}</h6>
|
<h6 class="card-title">{{ item.description }}</h6>
|
||||||
<h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6>
|
<h6 class="card-subtitle text-secondary">id: {{ item.id }} box: {{ item.box }}</h6>
|
||||||
<div class="row mx-auto mt-2">
|
<div class="row mx-auto mt-2">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-outline-success"
|
<button class="btn btn-outline-success"
|
||||||
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
||||||
<font-awesome-icon icon="check"/>
|
<font-awesome-icon icon="check"/>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)"
|
<button class="btn btn-outline-secondary" @click.stop="showItemDetail(item)"
|
||||||
title="edit">
|
title="edit">
|
||||||
<font-awesome-icon icon="edit"/>
|
<font-awesome-icon icon="edit"/>
|
||||||
</button>
|
</button>
|
||||||
|
@ -84,10 +71,10 @@ import Table from '@/components/Table';
|
||||||
import Cards from '@/components/Cards';
|
import Cards from '@/components/Cards';
|
||||||
import Modal from '@/components/Modal';
|
import Modal from '@/components/Modal';
|
||||||
import EditItem from '@/components/EditItem';
|
import EditItem from '@/components/EditItem';
|
||||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
import {mapActions, mapGetters, mapMutations} from 'vuex';
|
||||||
import Lightbox from '../components/Lightbox';
|
|
||||||
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Items',
|
name: 'Items',
|
||||||
|
@ -95,28 +82,15 @@ export default {
|
||||||
lightboxHash: null,
|
lightboxHash: null,
|
||||||
editingItem: null,
|
editingItem: null,
|
||||||
}),
|
}),
|
||||||
components: {AsyncLoader, AuthenticatedImage, Lightbox, Table, Cards, Modal, EditItem},
|
components: {AsyncLoader, AuthenticatedImage, Table, Cards, Modal, EditItem},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([]),
|
|
||||||
...mapGetters(['getEventItems', 'isItemsLoaded', 'layout']),
|
...mapGetters(['getEventItems', 'isItemsLoaded', 'layout']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['deleteItem', 'markItemReturned', 'loadEventItems', 'updateItem', 'scheduleAfterInit']),
|
...mapActions(['deleteItem', 'markItemReturned', 'loadEventItems', 'updateItem', 'scheduleAfterInit']),
|
||||||
openLightboxModalWith(item) {
|
...mapMutations(['openLightboxModalWith']),
|
||||||
this.lightboxHash = item.file;
|
showItemDetail(item) {
|
||||||
},
|
router.push({name: 'item', params: {id: item.id}});
|
||||||
closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
|
|
||||||
this.lightboxHash = null;
|
|
||||||
},
|
|
||||||
openEditingModalWith(item) { // Opens the editing modal with a copy of the selected item.
|
|
||||||
this.editingItem = item;
|
|
||||||
},
|
|
||||||
closeEditingModal() {
|
|
||||||
this.editingItem = null;
|
|
||||||
},
|
|
||||||
saveEditingItem() { // Saves the edited copy of the item.
|
|
||||||
this.updateItem(this.editingItem);
|
|
||||||
this.closeEditingModal();
|
|
||||||
},
|
},
|
||||||
confirm(message) {
|
confirm(message) {
|
||||||
return window.confirm(message);
|
return window.confirm(message);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<AsyncLoader :loaded="ticket.id">
|
<AsyncLoader :loaded="!!ticket.id">
|
||||||
<div class="container-fluid px-xl-5 mt-3">
|
<div class="container-fluid px-xl-5 mt-3">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-8 offset-xl-2">
|
<div class="col-xl-8 offset-xl-2">
|
||||||
|
@ -7,7 +7,42 @@
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3>Ticket #{{ ticket.id }} - {{ ticket.name }}</h3>
|
<h3>Ticket #{{ ticket.id }} - {{ ticket.name }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<Timeline :timeline="ticket.timeline" @sendMail="handleMail" @addComment="handleComment"/>
|
<Timeline :timeline="ticket.timeline">
|
||||||
|
<template v-slot:timeline_action1>
|
||||||
|
<span class="timeline-item-icon | faded-icon">
|
||||||
|
<font-awesome-icon icon="comment"/>
|
||||||
|
</span>
|
||||||
|
<div class="new-comment card bg-dark">
|
||||||
|
<div>
|
||||||
|
<textarea placeholder="add comment..." v-model="newComment"
|
||||||
|
class="form-control">
|
||||||
|
</textarea>
|
||||||
|
<AsyncButton class="btn btn-primary float-right" :task="addCommentAndClear">
|
||||||
|
<font-awesome-icon icon="comment"/>
|
||||||
|
Save Comment
|
||||||
|
</AsyncButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:timeline_action2>
|
||||||
|
<span class="timeline-item-icon | faded-icon">
|
||||||
|
<font-awesome-icon icon="envelope"/>
|
||||||
|
</span>
|
||||||
|
<div class="new-mail card bg-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
{{ newestMailSubject }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<textarea placeholder="reply mail..." v-model="newMail" class="form-control">
|
||||||
|
</textarea>
|
||||||
|
<AsyncButton class="btn btn-primary float-right" :task="sendMailAndClear">
|
||||||
|
<font-awesome-icon icon="envelope"/>
|
||||||
|
Send Mail
|
||||||
|
</AsyncButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Timeline>
|
||||||
<div class="card-footer d-flex justify-content-between">
|
<div class="card-footer d-flex justify-content-between">
|
||||||
<button class="btn btn-secondary mr-2" @click="$router.go(-1)">Back</button>
|
<button class="btn btn-secondary mr-2" @click="$router.go(-1)">Back</button>
|
||||||
<!--button class="btn btn-danger" @click="deleteItem({type: 'tickets', id: ticket.id})">
|
<!--button class="btn btn-danger" @click="deleteItem({type: 'tickets', id: ticket.id})">
|
||||||
|
@ -16,11 +51,14 @@
|
||||||
</button-->
|
</button-->
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<select class="form-control" v-model="selected_assignee">
|
<select class="form-control" v-model="selected_assignee">
|
||||||
<option v-for="user in users" :value="user.username">{{ user.username }}</option>
|
<option v-for="user in users" :value="user.username">{{
|
||||||
|
user.username
|
||||||
|
}}
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<button class="form-control btn btn-success"
|
<button class="form-control btn btn-success"
|
||||||
@click="assignTicket(ticket)"
|
@click="assignTicket(ticket)"
|
||||||
:disabled="!selected_assignee || (selected_assignee == ticket.assigned_to)">
|
:disabled="!selected_assignee || (selected_assignee === ticket.assigned_to)">
|
||||||
Assign Ticket
|
Assign Ticket
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +71,7 @@
|
||||||
</select>
|
</select>
|
||||||
<button class="form-control btn btn-success"
|
<button class="form-control btn btn-success"
|
||||||
@click="changeTicketStatus(ticket)"
|
@click="changeTicketStatus(ticket)"
|
||||||
:disabled="(selected_state == ticket.state)">
|
:disabled="(selected_state === ticket.state)">
|
||||||
Change Status
|
Change Status
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,25 +96,53 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-3 col-xl-2 d-lg-none d-xl-block"
|
||||||
|
v-if="ticket.related_items && ticket.related_items.length">
|
||||||
|
<div class="card bg-dark text-light mb-2" id="filters">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title text-info">Related</h5>
|
||||||
|
<div class="card bg-dark" v-for="item in ticket.related_items" v-bind:key="item.id">
|
||||||
|
<AuthenticatedImage v-if="item.file" cached
|
||||||
|
:src="`/media/2/256/${item.file}/`"
|
||||||
|
class="d-block card-img"
|
||||||
|
@click="openLightboxModalWith(item.file)"
|
||||||
|
/>
|
||||||
|
<div class="card-body">
|
||||||
|
<!--h6 class="card-title text-info"><span class="badge badge-primary">{{ item.relation_status }}</span></--h6-->
|
||||||
|
<h6 class="card-subtitle text-secondary">id: {{ item.id }} box: {{
|
||||||
|
item.box
|
||||||
|
}}</h6>
|
||||||
|
<router-link :to="{name: 'item', params: {id: item.id}}">
|
||||||
|
<h6 class="card-title">{{ item.description }}</h6>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</AsyncLoader>
|
</AsyncLoader>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex';
|
||||||
import Timeline from "@/components/Timeline.vue";
|
import Timeline from "@/components/Timeline.vue";
|
||||||
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
||||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||||
|
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||||
|
import AsyncButton from "@/components/inputs/AsyncButton.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Ticket',
|
name: 'Ticket',
|
||||||
components: {AsyncLoader, ClipboardButton, Timeline},
|
components: {AsyncButton, AuthenticatedImage, AsyncLoader, ClipboardButton, Timeline},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selected_state: null,
|
selected_state: null,
|
||||||
selected_assignee: null,
|
selected_assignee: null,
|
||||||
shipping_voucher_type: null,
|
shipping_voucher_type: null,
|
||||||
|
newMail: "",
|
||||||
|
newComment: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -90,46 +156,52 @@ export default {
|
||||||
shippingEmail() {
|
shippingEmail() {
|
||||||
const domain = document.location.hostname;
|
const domain = document.location.hostname;
|
||||||
return `ticket+${this.ticket.uuid}@${domain}`;
|
return `ticket+${this.ticket.uuid}@${domain}`;
|
||||||
}
|
},
|
||||||
|
newestMailSubject() {
|
||||||
|
const mail = this.ticket.timeline ? this.ticket.timeline.filter(item => item.type === 'mail').pop() : null;
|
||||||
|
return mail ? mail.subject : "";
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['deleteItem', 'markItemReturned', 'sendMail', 'updateTicketPartial', 'postComment']),
|
...mapActions(['deleteItem', 'markItemReturned', 'sendMail', 'updateTicketPartial', 'postComment']),
|
||||||
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit']),
|
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit']),
|
||||||
...mapActions(['claimShippingVoucher', 'fetchShippingVouchers']),
|
...mapActions(['claimShippingVoucher', 'fetchShippingVouchers']),
|
||||||
handleMail(mail) {
|
...mapMutations(['openLightboxModalWith']),
|
||||||
this.sendMail({
|
changeTicketStatus() {
|
||||||
id: this.ticket.id,
|
this.ticket.state = this.selected_state;
|
||||||
message: mail
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleComment(comment) {
|
|
||||||
this.postComment({
|
|
||||||
id: this.ticket.id,
|
|
||||||
message: comment
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeTicketStatus(ticket) {
|
|
||||||
ticket.state = this.selected_state;
|
|
||||||
this.updateTicketPartial({
|
this.updateTicketPartial({
|
||||||
id: ticket.id,
|
id: this.ticket.id,
|
||||||
state: this.selected_state,
|
state: this.selected_state,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
assignTicket(ticket) {
|
assignTicket() {
|
||||||
ticket.assigned_to = this.selected_assignee;
|
this.ticket.assigned_to = this.selected_assignee;
|
||||||
this.updateTicketPartial({
|
this.updateTicketPartial({
|
||||||
id: ticket.id,
|
id: this.ticket.id,
|
||||||
assigned_to: this.selected_assignee
|
assigned_to: this.selected_assignee
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
sendMailAndClear: async function () {
|
||||||
|
await this.sendMail({
|
||||||
|
id: this.ticket.id,
|
||||||
|
message: this.newMail,
|
||||||
|
})
|
||||||
|
this.newMail = "";
|
||||||
|
},
|
||||||
|
addCommentAndClear: async function () {
|
||||||
|
await this.postComment({
|
||||||
|
id: this.ticket.id,
|
||||||
|
message: this.newComment
|
||||||
|
})
|
||||||
|
this.newComment = "";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.scheduleAfterInit(() => [Promise.all([this.fetchTicketStates(), this.loadTickets(), this.loadUsers(), this.fetchShippingVouchers()]).then(() => {
|
this.scheduleAfterInit(() => [Promise.all([this.fetchTicketStates(), this.loadTickets(), this.loadUsers(), this.fetchShippingVouchers()]).then(() => {
|
||||||
if (this.ticket.state == "pending_new") {
|
if (this.ticket.state === "pending_new") {
|
||||||
this.selected_state = "pending_open";
|
this.selected_state = "pending_open";
|
||||||
this.changeTicketStatus(this.ticket)
|
this.changeTicketStatus()
|
||||||
}
|
}
|
||||||
;
|
|
||||||
this.selected_state = this.ticket.state;
|
this.selected_state = this.ticket.state;
|
||||||
this.selected_assignee = this.ticket.assigned_to
|
this.selected_assignee = this.ticket.assigned_to
|
||||||
})]);
|
})]);
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
>
|
>
|
||||||
<template v-slot:actions="{item}">
|
<template v-slot:actions="{item}">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-primary" :href="'/'+ getEventSlug + '/ticket/' + item.id" title="view"
|
<router-link :to="{name: 'ticket', params: {id: item.id}}" class="btn btn-primary"
|
||||||
@click.prevent="gotoDetail(item)">
|
title="view">
|
||||||
<font-awesome-icon icon="eye"/>
|
<font-awesome-icon icon="eye"/>
|
||||||
View
|
View
|
||||||
</a>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
<td v-if="getEventSlug==='all'">{{ item.event }}</td>
|
<td v-if="getEventSlug==='all'">{{ item.event }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-primary" :href="'/'+ getEventSlug + '/ticket/' + item.id" title="view"
|
<router-link :to="{name: 'ticket', params: {id: item.id}}" class="btn btn-primary"
|
||||||
@click.prevent="gotoDetail(item)">
|
title="view">
|
||||||
<font-awesome-icon icon="eye"/>
|
<font-awesome-icon icon="eye"/>
|
||||||
View
|
View
|
||||||
</a>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -55,24 +55,22 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Cards from '@/components/Cards';
|
import Cards from '@/components/Cards';
|
||||||
import Modal from '@/components/Modal';
|
|
||||||
import EditItem from '@/components/EditItem';
|
|
||||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||||
import Lightbox from '../components/Lightbox';
|
|
||||||
import Table from '@/components/Table';
|
import Table from '@/components/Table';
|
||||||
import CollapsableCards from "@/components/CollapsableCards.vue";
|
import CollapsableCards from "@/components/CollapsableCards.vue";
|
||||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Tickets',
|
name: 'Tickets',
|
||||||
components: {AsyncLoader, Lightbox, Table, Cards, Modal, EditItem, CollapsableCards},
|
components: {AsyncLoader, Table, Cards, CollapsableCards},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['getEventTickets', 'isTicketsLoaded', 'stateInfo', 'getEventSlug', 'layout']),
|
...mapGetters(['getEventTickets', 'isTicketsLoaded', 'stateInfo', 'getEventSlug', 'layout']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['loadTickets', 'fetchTicketStates', 'scheduleAfterInit']),
|
...mapActions(['loadTickets', 'fetchTicketStates', 'scheduleAfterInit']),
|
||||||
gotoDetail(ticket) {
|
gotoDetail(ticket) {
|
||||||
this.$router.push({name: 'ticket', params: {id: ticket.id}});
|
router.push({name: 'ticket', params: {id: ticket.id}});
|
||||||
},
|
},
|
||||||
formatTicket(ticket) {
|
formatTicket(ticket) {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue