2019-01-15 13:21:24 +01:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<app-loader :show="isLoading" />
|
2019-01-21 20:58:25 +01:00
|
|
|
<v-container fluid grid-list-md v-if="isReady || isSubmitting || isSubmitted" class="app-fade-in">
|
|
|
|
|
<v-layout row wrap v-for="event in events" :key="event.id">
|
|
|
|
|
<v-flex xs12>
|
|
|
|
|
<Event :event="event" :has-user="hasUser" :ignore="ignore" />
|
|
|
|
|
</v-flex>
|
|
|
|
|
</v-layout>
|
|
|
|
|
</v-container>
|
2019-01-15 13:21:24 +01:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
findEvents,
|
|
|
|
|
ignoreBand,
|
|
|
|
|
ignoreDanceHall,
|
|
|
|
|
ignoreCity,
|
|
|
|
|
ignoreMunicipality,
|
|
|
|
|
ignoreState
|
|
|
|
|
} from "~/utils/graph-client";
|
|
|
|
|
|
|
|
|
|
import auth from "~/utils/auth";
|
|
|
|
|
|
2019-01-18 14:03:58 +01:00
|
|
|
import Event from "./Event";
|
2019-01-15 13:21:24 +01:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2019-01-18 14:03:58 +01:00
|
|
|
Event
|
2019-01-15 13:21:24 +01:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
status: "loading",
|
|
|
|
|
property: undefined,
|
|
|
|
|
propertyId: undefined,
|
|
|
|
|
order: undefined,
|
|
|
|
|
orderId: undefined,
|
|
|
|
|
originalProperty: undefined,
|
|
|
|
|
selectedPackage: undefined,
|
|
|
|
|
selectedImages: [],
|
|
|
|
|
submitError: "",
|
2019-01-18 14:03:58 +01:00
|
|
|
user: undefined
|
2019-01-15 13:21:24 +01:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
isLoading() {
|
|
|
|
|
return this.status === "loading";
|
|
|
|
|
},
|
|
|
|
|
isLoadFailed() {
|
|
|
|
|
return this.status === "load-failed";
|
|
|
|
|
},
|
|
|
|
|
isReady() {
|
|
|
|
|
return this.status === "ready";
|
|
|
|
|
},
|
|
|
|
|
isSubmitting() {
|
|
|
|
|
return this.status === "submitting";
|
|
|
|
|
},
|
|
|
|
|
isSubmitted() {
|
|
|
|
|
return this.status === "submitted";
|
|
|
|
|
},
|
|
|
|
|
isSubmitFailed() {
|
|
|
|
|
return this.status === "submit-failed";
|
|
|
|
|
},
|
|
|
|
|
isNotViewable() {
|
|
|
|
|
return this.status === "no-packages";
|
|
|
|
|
},
|
|
|
|
|
hasUser() {
|
2019-01-18 14:03:58 +01:00
|
|
|
return this.user !== undefined && this.user !== null;
|
2019-01-15 13:21:24 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// const { propertyId, orderId, id } = this.$route.query;
|
|
|
|
|
this.fetchEvents();
|
|
|
|
|
this.fetchUser();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
fetchEvents () {
|
|
|
|
|
this.status = "loading";
|
|
|
|
|
findEvents()
|
|
|
|
|
.then(this.eventsFetched)
|
|
|
|
|
.catch(this.eventsFailed);
|
|
|
|
|
},
|
|
|
|
|
eventsFetched(response) {
|
|
|
|
|
if (response.errors) {
|
|
|
|
|
throw new Error("Fetch failed");
|
|
|
|
|
}
|
|
|
|
|
this.events = response.data.events;
|
|
|
|
|
this.status = "ready";
|
|
|
|
|
},
|
|
|
|
|
eventsFailed() {
|
|
|
|
|
this.status = "load-failed";
|
|
|
|
|
},
|
|
|
|
|
fetchUser() {
|
|
|
|
|
this.user = auth.getUserInfo();
|
|
|
|
|
},
|
2019-01-18 14:03:58 +01:00
|
|
|
ignore(type, name) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'band':
|
|
|
|
|
ignoreBand({name: name})
|
|
|
|
|
.then(this.ignoreSuccess(name))
|
|
|
|
|
.catch(this.ignoreFailed);
|
|
|
|
|
break;
|
|
|
|
|
case 'danceHall':
|
|
|
|
|
ignoreDanceHall({name: name})
|
|
|
|
|
.then(this.ignoreSuccess(name))
|
|
|
|
|
.catch(this.ignoreFailed);
|
|
|
|
|
break;
|
|
|
|
|
case 'city':
|
|
|
|
|
ignoreCity({name: name})
|
|
|
|
|
.then(this.ignoreSuccess(name))
|
|
|
|
|
.catch(this.ignoreFailed);
|
|
|
|
|
break;
|
|
|
|
|
case 'municipality':
|
2019-01-18 14:19:18 +01:00
|
|
|
ignoreMunicipality({name: name})
|
2019-01-18 14:03:58 +01:00
|
|
|
.then(this.ignoreSuccess(name))
|
2019-01-18 14:19:18 +01:00
|
|
|
.catch(this.ignoreFailed);
|
2019-01-18 14:03:58 +01:00
|
|
|
break;
|
|
|
|
|
case 'state':
|
|
|
|
|
ignoreState({name: name})
|
|
|
|
|
.then(this.ignoreSuccess(name))
|
|
|
|
|
.catch(this.ignoreFailed);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-01-15 13:21:24 +01:00
|
|
|
},
|
2019-01-18 14:03:58 +01:00
|
|
|
ignoreSuccess(name) {
|
|
|
|
|
return () => {
|
|
|
|
|
this.fetchEvents();
|
2019-01-18 14:19:18 +01:00
|
|
|
this.$Message.success(`${name} har dolts`);
|
2019-01-18 14:03:58 +01:00
|
|
|
}
|
2019-01-15 13:21:24 +01:00
|
|
|
},
|
2019-01-18 14:03:58 +01:00
|
|
|
ignoreFailed(name) {
|
|
|
|
|
return () => {
|
|
|
|
|
this.$Message.error(`${name} kunde inte döljas`);
|
|
|
|
|
}
|
2019-01-15 13:21:24 +01:00
|
|
|
}
|
|
|
|
|
// switchPackage(pack) {
|
|
|
|
|
// this.selectedPackage = pack;
|
|
|
|
|
// },
|
|
|
|
|
// switchImage(image) {
|
|
|
|
|
// this.selectedImages = [image];
|
|
|
|
|
// },
|
|
|
|
|
// publishCampaign(products) {
|
|
|
|
|
// if (this.status !== "ready") {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// const packageToOrder = {
|
|
|
|
|
// products,
|
|
|
|
|
// packagePrice: this.selectedPackage.price,
|
|
|
|
|
// packageId: this.selectedPackage.id
|
|
|
|
|
// };
|
|
|
|
|
//
|
|
|
|
|
// this.status = "submitting";
|
|
|
|
|
// orderPackage({
|
|
|
|
|
// package: packageToOrder,
|
|
|
|
|
// propertyId: this.propertyId,
|
|
|
|
|
// orderId: this.orderId
|
|
|
|
|
// })
|
|
|
|
|
// .then(this.publishCampaignSuccess, this.publishCampaignFailed)
|
|
|
|
|
// .catch(this.publishCampaignFailed);
|
|
|
|
|
// },
|
|
|
|
|
// publishCampaignSuccess(response) {
|
|
|
|
|
// if (response.errors) {
|
|
|
|
|
// this.publishCampaignFailed();
|
|
|
|
|
// } else {
|
|
|
|
|
// this.status = "submitted";
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// publishCampaignFailed() {
|
|
|
|
|
// this.status = "submit-failed";
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2019-01-21 20:58:25 +01:00
|
|
|
/*.container {*/
|
|
|
|
|
/*display: flex;*/
|
|
|
|
|
/*will-change: opacity;*/
|
|
|
|
|
/*padding: 1.5rem 1rem;*/
|
|
|
|
|
/*}*/
|
2019-01-15 13:21:24 +01:00
|
|
|
|
|
|
|
|
.left {
|
|
|
|
|
padding: 1.5rem 1rem;
|
|
|
|
|
|
|
|
|
|
> * {
|
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hr {
|
|
|
|
|
border: 0;
|
|
|
|
|
border-top: 1px solid #eaeaea;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.left,
|
|
|
|
|
.right {
|
|
|
|
|
height: 100vh;
|
|
|
|
|
overflow: scroll;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-18 14:03:58 +01:00
|
|
|
.eventRow {
|
2019-01-21 12:21:04 +01:00
|
|
|
margin-bottom: 0.5rem;
|
2019-01-18 14:03:58 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-15 13:21:24 +01:00
|
|
|
@media screen and(max-width: 1200px) {
|
|
|
|
|
.left {
|
|
|
|
|
width: 40vw;
|
|
|
|
|
}
|
|
|
|
|
.right {
|
|
|
|
|
width: 60vw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and(max-width: 1024px) {
|
|
|
|
|
.left {
|
|
|
|
|
width: 50vw;
|
|
|
|
|
}
|
|
|
|
|
.right {
|
|
|
|
|
width: 50vw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and(min-width: 1200px) {
|
|
|
|
|
.left {
|
|
|
|
|
width: 35vw;
|
|
|
|
|
}
|
|
|
|
|
.right {
|
|
|
|
|
width: 65vw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|