2018-08-25 10:24:43 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="marketplace-page"
|
|
|
|
:data-page-name="page_name"
|
|
|
|
>
|
2019-11-25 08:26:00 +00:00
|
|
|
<search-input
|
|
|
|
:placeholder="search_placeholder"
|
|
|
|
:on_search="set_search_route"
|
|
|
|
v-model="search_value"
|
|
|
|
/>
|
|
|
|
|
2018-08-25 10:24:43 +00:00
|
|
|
<h5>{{ page_title }}</h5>
|
|
|
|
|
|
|
|
<item-cards-container
|
2018-08-25 16:24:49 +00:00
|
|
|
:container_name="page_title"
|
2018-08-25 10:24:43 +00:00
|
|
|
:items="items"
|
|
|
|
:item_id_fieldname="item_id_fieldname"
|
|
|
|
:on_click="go_to_item_details_page"
|
|
|
|
:empty_state_message="empty_state_message"
|
|
|
|
>
|
|
|
|
</item-cards-container>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
page_name: frappe.get_route()[1],
|
|
|
|
category: frappe.get_route()[2],
|
|
|
|
items: [],
|
2018-08-27 08:41:48 +00:00
|
|
|
item_id_fieldname: 'name',
|
2018-08-25 10:24:43 +00:00
|
|
|
|
|
|
|
// Constants
|
2019-11-25 08:26:00 +00:00
|
|
|
empty_state_message: __(`No items in this category yet.`),
|
|
|
|
|
|
|
|
search_value: '',
|
|
|
|
|
|
|
|
// Constants
|
|
|
|
search_placeholder: __('Search for anything ...'),
|
|
|
|
|
2018-08-25 10:24:43 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
page_title() {
|
|
|
|
return __(this.category);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
2019-11-25 08:26:00 +00:00
|
|
|
this.search_value = '';
|
2018-08-25 10:24:43 +00:00
|
|
|
this.get_items();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
get_items() {
|
|
|
|
hub.call('get_items', {
|
|
|
|
filters: {
|
|
|
|
hub_category: this.category
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then((items) => {
|
|
|
|
this.items = items;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2018-08-27 08:41:48 +00:00
|
|
|
go_to_item_details_page(hub_item_name) {
|
|
|
|
frappe.set_route(`marketplace/item/${hub_item_name}`);
|
2019-11-25 08:26:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set_search_route() {
|
2019-11-28 13:27:42 +00:00
|
|
|
frappe.set_route('marketplace', 'search', this.category, this.search_value);
|
2019-11-25 08:26:00 +00:00
|
|
|
},
|
2018-08-25 10:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|