`;
-
- return profile_html;
-}
-
export {
get_detail_view_html,
get_profile_html
diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js
index d8bfea8a1b..433f7da85b 100644
--- a/erpnext/public/js/hub/marketplace.js
+++ b/erpnext/public/js/hub/marketplace.js
@@ -3,7 +3,6 @@ import Vue from 'vue/dist/vue.js';
// pages
import './pages/item';
import './pages/seller';
-import './pages/profile';
import './pages/messages';
import './pages/buying_messages';
import './pages/not_found';
@@ -14,6 +13,7 @@ import Publish from './pages/Publish.vue';
import Category from './pages/Category.vue';
import Search from './pages/Search.vue';
import PublishedProducts from './pages/PublishedProducts.vue';
+import Profile from './pages/Profile.vue';
// components
import { ProfileDialog } from './components/profile_dialog';
@@ -203,7 +203,7 @@ erpnext.hub.Marketplace = class Marketplace {
}
if (route[1] === 'profile' && !this.subpages.profile) {
- this.subpages.profile = new erpnext.hub.Profile(this.$body);
+ this.subpages.profile = new erpnext.hub.ProfilePage(this.$body);
}
if (route[1] === 'publish' && !this.subpages.publish) {
@@ -374,3 +374,21 @@ erpnext.hub.SearchPage = class {
$('[data-page-name="search"]').hide();
}
}
+
+erpnext.hub.ProfilePage = class {
+ constructor(parent) {
+ this.$wrapper = $(`
`).appendTo($(parent));
+
+ new Vue({
+ render: h => h(Profile)
+ }).$mount('#vue-area-profile');
+ }
+
+ show() {
+ $('[data-page-name="profile"]').show();
+ }
+
+ hide() {
+ $('[data-page-name="profile"]').hide();
+ }
+}
diff --git a/erpnext/public/js/hub/pages/Profile.vue b/erpnext/public/js/hub/pages/Profile.vue
new file mode 100644
index 0000000000..2f3c9d59fa
--- /dev/null
+++ b/erpnext/public/js/hub/pages/Profile.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/erpnext/public/js/hub/pages/SavedProducts.vue b/erpnext/public/js/hub/pages/SavedProducts.vue
index 6e5eeffc66..f113a20c27 100644
--- a/erpnext/public/js/hub/pages/SavedProducts.vue
+++ b/erpnext/public/js/hub/pages/SavedProducts.vue
@@ -71,7 +71,7 @@ export default {
}
alert = frappe.show_alert(__(`
${hub_item_code} removed.
- Undo`),
+
Undo`),
grace_period/1000,
{
'undo-remove': undo_remove.bind(this)
diff --git a/erpnext/public/js/hub/pages/profile.js b/erpnext/public/js/hub/pages/profile.js
deleted file mode 100644
index 9bfa85d7a6..0000000000
--- a/erpnext/public/js/hub/pages/profile.js
+++ /dev/null
@@ -1,148 +0,0 @@
-import SubPage from './subpage';
-import { get_detail_skeleton_html } from '../components/skeleton_state';
-import { ProfileDialog } from '../components/profile_dialog';
-
-erpnext.hub.Profile = class Profile extends SubPage {
- make_wrapper() {
- super.make_wrapper();
- this.make_edit_profile_dialog();
- }
-
- refresh() {
- this.show_skeleton();
- this.get_hub_seller_profile(this.keyword)
- .then(profile => {
- this.edit_profile_dialog.set_values(profile);
- this.render(profile);
- });
- }
-
- get_hub_seller_profile() {
- return hub.call('get_hub_seller_profile', { hub_seller: hub.settings.company_email });
- }
-
- show_skeleton() {
- this.$wrapper.html(get_detail_skeleton_html());
- }
-
- render(profile) {
- const p = profile;
- const content_by_log_type = this.get_content_by_log_type();
-
- let activity_logs = (p.hub_seller_activity || []).sort((a, b) => {
- return new Date(b.creation) - new Date(a.creation);
- });
-
- const timeline_items_html = activity_logs
- .map(log => {
- const stats = JSON.parse(log.stats);
- const no_of_items = stats && stats.push_update || '';
-
- const content = content_by_log_type[log.type];
- const message = content.get_message(no_of_items);
- const icon = content.icon;
- return this.get_timeline_log_item(log.pretty_date, message, icon);
- })
- .join('');
-
- const profile_html = `
-
-
-
-
-

-
-
-
-
${p.company}
-
-
${p.country}
-
${p.site_name}
-
-
-
- ${'description'
- ? `
${p.company_description}
`
- : `
__('No description')
-
-
-
-
-
-
- ${timeline_items_html}
-
-
-
-
`;
-
- this.$wrapper.html(profile_html);
- }
-
- make_edit_profile_dialog() {
- this.edit_profile_dialog = ProfileDialog(
- __('Edit Profile'),
- {
- label: __('Update'),
- on_submit: this.update_profile.bind(this)
- }
- );
-
- this.edit_profile_dialog.set_df_property('company_email', 'read_only', 1);
- }
-
- edit_profile() {
- this.edit_profile_dialog.set_values({
- company_email: hub.settings.company_email
- });
- this.edit_profile_dialog.show();
- }
-
- update_profile(new_values) {
- hub.call('update_profile', {
- hub_seller: hub.settings.company_email,
- updated_profile: new_values
- }).then(new_profile => {
- this.edit_profile_dialog.hide();
- this.render(new_profile);
- });
- }
-
- get_timeline_log_item(pretty_date, message, icon) {
- return `
-
-
- ${pretty_date} ${message}
-
-
`;
- }
-
- get_content_by_log_type() {
- return {
- "Created": {
- icon: 'octicon-heart',
- get_message: () => 'Joined Marketplace'
- },
- "Items Publish": {
- icon: 'octicon-bookmark',
- get_message: (no_of_items) =>
- `Published ${no_of_items} product${no_of_items > 1 ? 's' : ''} to Marketplace`
- }
- }
- }
-}