2018-08-26 14:39:02 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<section-header>
|
|
|
|
<h4>{{ __('Buying') }}</h4>
|
|
|
|
</section-header>
|
2018-08-28 11:49:35 +00:00
|
|
|
<div class="row" v-if="items && items.length">
|
2018-08-27 14:21:36 +00:00
|
|
|
<div class="col-md-7 margin-bottom"
|
2018-08-26 14:39:02 +00:00
|
|
|
v-for="item of items"
|
|
|
|
:key="item.name"
|
|
|
|
>
|
|
|
|
<item-list-card
|
|
|
|
:item="item"
|
|
|
|
v-route="'marketplace/buying/' + item.name"
|
2018-08-27 14:21:36 +00:00
|
|
|
>
|
|
|
|
<div slot="subtitle">
|
2018-09-03 10:12:00 +00:00
|
|
|
<span>{{ get_sender(item.recent_message) }}: </span>
|
|
|
|
<span>{{ item.recent_message.message | striphtml }}</span>
|
2018-08-27 14:21:36 +00:00
|
|
|
</div>
|
|
|
|
</item-list-card>
|
2018-08-26 14:39:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-27 14:27:12 +00:00
|
|
|
<empty-state v-else :message="__('This page keeps track of items you want to buy from sellers.')" :centered="false" />
|
2018-08-26 14:39:02 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2018-08-27 14:21:36 +00:00
|
|
|
import EmptyState from '../components/EmptyState.vue';
|
2018-08-26 14:39:02 +00:00
|
|
|
import SectionHeader from '../components/SectionHeader.vue';
|
|
|
|
import ItemListCard from '../components/ItemListCard.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
SectionHeader,
|
2018-08-27 14:21:36 +00:00
|
|
|
ItemListCard,
|
|
|
|
EmptyState
|
2018-08-26 14:39:02 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2018-08-27 14:21:36 +00:00
|
|
|
items: null
|
2018-08-26 14:39:02 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.get_items_for_messages()
|
|
|
|
.then(items => {
|
|
|
|
this.items = items;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
get_items_for_messages() {
|
|
|
|
return hub.call('get_buying_items_for_messages', {}, 'action:send_message');
|
2018-09-03 10:12:00 +00:00
|
|
|
},
|
|
|
|
get_sender(message) {
|
|
|
|
return message.sender === frappe.session.user ? __('You') : (message.sender_name || message.sender);
|
2018-08-26 14:39:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|