brotherton-erpnext/erpnext/public/js/hub/pages/Seller.vue

105 lines
2.1 KiB
Vue
Raw Normal View History

2018-08-26 10:59:32 +00:00
<template>
<div
class="marketplace-page"
:data-page-name="page_name"
v-if="init || profile"
2018-08-26 10:59:32 +00:00
>
<detail-view
2018-08-26 10:59:32 +00:00
:title="title"
:image="image"
:sections="sections"
:show_skeleton="init"
2018-08-26 10:59:32 +00:00
>
<detail-header-item slot="detail-header-item"
:value="country"
></detail-header-item>
<detail-header-item slot="detail-header-item"
:value="site_name"
></detail-header-item>
<detail-header-item slot="detail-header-item"
:value="joined_when"
></detail-header-item>
2018-08-26 10:59:32 +00:00
</detail-view>
<h5 v-if="profile">{{ item_container_heading }}</h5>
2018-08-26 10:59:32 +00:00
<item-cards-container
:container_name="item_container_heading"
:items="items"
:item_id_fieldname="item_id_fieldname"
:on_click="go_to_item_details_page"
>
</item-cards-container>
</div>
</template>
<script>
export default {
name: 'seller-page',
data() {
return {
page_name: frappe.get_route()[1],
seller_company: frappe.get_route()[2],
init: true,
2018-08-26 10:59:32 +00:00
profile: null,
items:[],
2018-08-27 08:41:48 +00:00
item_id_fieldname: 'name',
2018-08-26 10:59:32 +00:00
title: null,
image: null,
sections: [],
country: '',
site_name: '',
joined_when: '',
2018-08-26 10:59:32 +00:00
};
},
created() {
this.get_seller_profile_and_items();
},
computed: {
item_container_heading() {
2018-08-30 10:05:06 +00:00
return __('Items by ' + this.seller_company);
2018-08-26 10:59:32 +00:00
}
},
methods: {
get_seller_profile_and_items() {
hub.call(
'get_hub_seller_page_info',
{ company: this.seller_company }
).then(data => {
this.init = false;
2018-08-26 10:59:32 +00:00
this.profile = data.profile;
this.items = data.items;
const profile = this.profile;
this.title = profile.company;
this.country = __(profile.country);
this.site_name = __(profile.site_name);
this.joined_when = __(`Joined ${comment_when(profile.creation)}`);
2018-08-26 10:59:32 +00:00
this.image = profile.logo;
this.sections = [
{
title: __('About the Company'),
content: profile.company_description
? __(profile.company_description)
: __('No description')
}
];
});
},
2018-08-27 08:41:48 +00:00
go_to_item_details_page(hub_item_name) {
frappe.set_route(`marketplace/item/${hub_item_name}`);
2018-08-26 10:59:32 +00:00
}
}
}
</script>
<style scoped></style>