diff --git a/erpnext/public/js/hub/App.vue b/erpnext/public/js/hub/App.vue
deleted file mode 100644
index 37ec4f343a5..00000000000
--- a/erpnext/public/js/hub/App.vue
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/erpnext/public/js/hub/components/DetailView.vue b/erpnext/public/js/hub/components/DetailView.vue
new file mode 100644
index 00000000000..b86468b83bf
--- /dev/null
+++ b/erpnext/public/js/hub/components/DetailView.vue
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+ {{ section.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/erpnext/public/js/hub/components/EmptyState.vue b/erpnext/public/js/hub/components/EmptyState.vue
index c0ad971aa72..3d35efc7979 100644
--- a/erpnext/public/js/hub/components/EmptyState.vue
+++ b/erpnext/public/js/hub/components/EmptyState.vue
@@ -4,6 +4,13 @@
:style="{ height: height + 'px' }"
>
-
-
-
-
-

-
-
-
-
${p.company}
-
-
${p.country}
-
${p.site_name}
-
${__(`Joined ${comment_when(p.creation)}`)}
-
-
-
- ${'description'
- ? `
${p.company_description}
`
- : `
__('No description')
-
-
-
-
`;
-
- return profile_html;
-}
-
export {
get_detail_view_html,
get_profile_html
diff --git a/erpnext/public/js/hub/components/empty_state.js b/erpnext/public/js/hub/components/empty_state.js
deleted file mode 100644
index 0e1ad46d2f1..00000000000
--- a/erpnext/public/js/hub/components/empty_state.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function get_empty_state(message, action) {
- return `
-
${message}
- ${action ? `
${action}
`: ''}
-
`;
-}
-
-export {
- get_empty_state
-}
diff --git a/erpnext/public/js/hub/components/item_card.js b/erpnext/public/js/hub/components/item_card.js
index 7cb228118c7..fdf2690be8c 100644
--- a/erpnext/public/js/hub/components/item_card.js
+++ b/erpnext/public/js/hub/components/item_card.js
@@ -1,108 +1,3 @@
-function get_item_card_html(item) {
- const item_name = item.item_name || item.name;
- const title = strip_html(item_name);
- const img_url = item.image;
- const company_name = item.company;
-
- // Subtitle
- let subtitle = [comment_when(item.creation)];
- const rating = item.average_rating;
-
- if (rating > 0) {
- subtitle.push(rating + `
`)
- }
-
- subtitle.push(company_name);
-
- let dot_spacer = '
· ';
- subtitle = subtitle.join(dot_spacer);
-
- // route
- if (!item.route) {
- item.route = `marketplace/item/${item.hub_item_code}`
- }
-
- const item_html = `
-
-
-
-
-
-

-
-
-
-
- `;
-
- return item_html;
-}
-
-function get_local_item_card_html(item) {
- const item_name = item.item_name || item.name;
- const title = strip_html(item_name);
- const img_url = item.image;
- const company_name = item.company;
-
- const is_active = item.publish_in_hub;
- const id = item.hub_item_code || item.item_code;
-
- // Subtitle
- let subtitle = [comment_when(item.creation)];
- const rating = item.average_rating;
-
- if (rating > 0) {
- subtitle.push(rating + `
`)
- }
-
- if (company_name) {
- subtitle.push(company_name);
- }
-
- let dot_spacer = '
· ';
- subtitle = subtitle.join(dot_spacer);
-
- const edit_item_button = `
-
-
`;
-
- const item_html = `
-
-
-
-
-

-
-
- ${edit_item_button}
-
-
-
-
-
- `;
-
- return item_html;
-}
-
function get_buying_item_message_card_html(item) {
const item_name = item.item_name || item.name;
const title = strip_html(item_name);
diff --git a/erpnext/public/js/hub/components/items_container.js b/erpnext/public/js/hub/components/items_container.js
deleted file mode 100644
index 61b8af6b0b8..00000000000
--- a/erpnext/public/js/hub/components/items_container.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { get_item_card_html } from './item_card';
-
-function get_item_card_container_html(items, title='', get_item_html = get_item_card_html, action='') {
- const items_html = (items || []).map(item => get_item_html(item)).join('');
- const title_html = title
- ? ``
- : '';
-
- const html = `
- ${title_html}
- ${items_html}
-
`;
-
- return html;
-}
-
-export {
- get_item_card_container_html
-}
diff --git a/erpnext/public/js/hub/components/profile_dialog.js b/erpnext/public/js/hub/components/profile_dialog.js
index 800e8c66f03..e76abfaa0fd 100644
--- a/erpnext/public/js/hub/components/profile_dialog.js
+++ b/erpnext/public/js/hub/components/profile_dialog.js
@@ -1,75 +1,75 @@
const ProfileDialog = (title = __('Edit Profile'), action={}, initial_values={}) => {
- const fields = [
- {
- fieldtype: 'Link',
- fieldname: 'company',
- label: __('Company'),
- options: 'Company',
- onchange: () => {
- const value = dialog.get_value('company');
+ const fields = [
+ {
+ fieldtype: 'Link',
+ fieldname: 'company',
+ label: __('Company'),
+ options: 'Company',
+ onchange: () => {
+ const value = dialog.get_value('company');
- if (value) {
- frappe.db.get_doc('Company', value)
- .then(company => {
- dialog.set_values({
- country: company.country,
- company_email: company.email,
- currency: company.default_currency
- });
- });
- }
- }
- },
- {
- fieldname: 'company_email',
- label: __('Email'),
- fieldtype: 'Data'
- },
- {
- fieldname: 'country',
- label: __('Country'),
- fieldtype: 'Read Only'
- },
- {
- fieldname: 'currency',
- label: __('Currency'),
- fieldtype: 'Read Only'
- },
- {
- fieldtype: 'Text',
- label: __('About your Company'),
- fieldname: 'company_description'
- }
- ];
+ if (value) {
+ frappe.db.get_doc('Company', value)
+ .then(company => {
+ dialog.set_values({
+ country: company.country,
+ company_email: company.email,
+ currency: company.default_currency
+ });
+ });
+ }
+ }
+ },
+ {
+ fieldname: 'company_email',
+ label: __('Email'),
+ fieldtype: 'Data'
+ },
+ {
+ fieldname: 'country',
+ label: __('Country'),
+ fieldtype: 'Read Only'
+ },
+ {
+ fieldname: 'currency',
+ label: __('Currency'),
+ fieldtype: 'Read Only'
+ },
+ {
+ fieldtype: 'Text',
+ label: __('About your Company'),
+ fieldname: 'company_description'
+ }
+ ];
- let dialog = new frappe.ui.Dialog({
- title: title,
- fields: fields,
- primary_action_label: action.label || __('Update'),
- primary_action: () => {
- const form_values = dialog.get_values();
- let values_filled = true;
- const mandatory_fields = ['company', 'company_email', 'company_description'];
- mandatory_fields.forEach(field => {
- const value = form_values[field];
- if (!value) {
- dialog.set_df_property(field, 'reqd', 1);
- values_filled = false;
- }
- });
- if (!values_filled) return;
+ let dialog = new frappe.ui.Dialog({
+ title: title,
+ fields: fields,
+ primary_action_label: action.label || __('Update'),
+ primary_action: () => {
+ const form_values = dialog.get_values();
+ let values_filled = true;
+ const mandatory_fields = ['company', 'company_email', 'company_description'];
+ mandatory_fields.forEach(field => {
+ const value = form_values[field];
+ if (!value) {
+ dialog.set_df_property(field, 'reqd', 1);
+ values_filled = false;
+ }
+ });
+ if (!values_filled) return;
- action.on_submit(form_values);
- }
- });
+ action.on_submit(form_values);
+ }
+ });
- dialog.set_values(initial_values);
+ dialog.set_values(initial_values);
- // Post create
- const default_company = frappe.defaults.get_default('company');
- dialog.set_value('company', default_company);
+ // Post create
+ const default_company = frappe.defaults.get_default('company');
+ dialog.set_value('company', default_company);
- return dialog;
+ return dialog;
}
export {
diff --git a/erpnext/public/js/hub/components/skeleton_state.js b/erpnext/public/js/hub/components/skeleton_state.js
deleted file mode 100644
index 7c6880224c5..00000000000
--- a/erpnext/public/js/hub/components/skeleton_state.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function get_detail_skeleton_html() {
- const skeleton = `
`;
-
- return skeleton;
-}
-
-export {
- get_detail_skeleton_html
-}
diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js
index 08cc01ae778..10a55aafcad 100644
--- a/erpnext/public/js/hub/marketplace.js
+++ b/erpnext/public/js/hub/marketplace.js
@@ -3,11 +3,8 @@ import './vue-plugins';
// pages
import './pages/item';
-import './pages/seller';
-import './pages/profile';
import './pages/messages';
import './pages/buying_messages';
-import './pages/not_found';
import PageContainer from './PageContainer.vue';
import Home from './pages/Home.vue';
@@ -16,6 +13,9 @@ 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';
+import Seller from './pages/Seller.vue';
+import NotFound from './pages/NotFound.vue';
// components
import { ProfileDialog } from './components/profile_dialog';
@@ -203,7 +203,7 @@ erpnext.hub.Marketplace = class Marketplace {
}
if (route[1] === 'seller' && !this.subpages['seller']) {
- this.subpages['seller'] = new erpnext.hub.Seller(this.$body);
+ this.subpages['seller'] = new erpnext.hub.SellerPage(this.$body);
}
if (route[1] === 'register' && !this.subpages.register) {
@@ -220,7 +220,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) {
@@ -248,7 +248,7 @@ erpnext.hub.Marketplace = class Marketplace {
if (!Object.keys(this.subpages).includes(route[1])) {
if (!this.subpages.not_found) {
- this.subpages.not_found = new erpnext.hub.NotFound(this.$body);
+ this.subpages.not_found = new erpnext.hub.NotFoundPage(this.$body);
}
route[1] = 'not_found';
}
@@ -391,3 +391,58 @@ 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();
+ }
+}
+
+erpnext.hub.SellerPage = class {
+ constructor(parent) {
+ this.$wrapper = $(`
`).appendTo($(parent));
+
+ new Vue({
+ render: h => h(Seller)
+ }).$mount('#vue-area-seller');
+ }
+
+ show() {
+ $('[data-page-name="seller"]').show();
+ }
+
+ hide() {
+ $('[data-page-name="seller"]').hide();
+ }
+}
+
+erpnext.hub.NotFoundPage = class {
+ constructor(parent) {
+ this.$wrapper = $(`
`).appendTo($(parent));
+
+ new Vue({
+ render: h => h(NotFound)
+ }).$mount('#vue-area-not-found');
+ }
+
+ show() {
+ $('[data-page-name="not-found"]').show();
+ }
+
+ hide() {
+ $('[data-page-name="not-found"]').hide();
+ }
+}
+
diff --git a/erpnext/public/js/hub/pages/NotFound.vue b/erpnext/public/js/hub/pages/NotFound.vue
new file mode 100644
index 00000000000..7a76437cfd9
--- /dev/null
+++ b/erpnext/public/js/hub/pages/NotFound.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/erpnext/public/js/hub/pages/Profile.vue b/erpnext/public/js/hub/pages/Profile.vue
new file mode 100644
index 00000000000..1767796d616
--- /dev/null
+++ b/erpnext/public/js/hub/pages/Profile.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/erpnext/public/js/hub/pages/SavedProducts.vue b/erpnext/public/js/hub/pages/SavedProducts.vue
index 6e5eeffc66a..f113a20c27c 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/Seller.vue b/erpnext/public/js/hub/pages/Seller.vue
new file mode 100644
index 00000000000..5a35812ccbc
--- /dev/null
+++ b/erpnext/public/js/hub/pages/Seller.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
{{ item_container_heading }}
+
+
+
+
+
+
+
+
diff --git a/erpnext/public/js/hub/pages/item.js b/erpnext/public/js/hub/pages/item.js
index 618c9585a81..f15d1be6351 100644
--- a/erpnext/public/js/hub/pages/item.js
+++ b/erpnext/public/js/hub/pages/item.js
@@ -1,6 +1,6 @@
import SubPage from './subpage';
import { get_detail_view_html } from '../components/detail_view';
-import { get_detail_skeleton_html } from '../components/skeleton_state';
+// import { get_detail_skeleton_html } from '../components/skeleton_state';
import { get_review_html } from '../components/reviews';
erpnext.hub.Item = class Item extends SubPage {
@@ -20,7 +20,7 @@ erpnext.hub.Item = class Item extends SubPage {
show_skeleton() {
- this.$wrapper.html(get_detail_skeleton_html());
+ // this.$wrapper.html(get_detail_skeleton_html());
}
diff --git a/erpnext/public/js/hub/pages/messages.js b/erpnext/public/js/hub/pages/messages.js
index f8faa99934c..6222f536482 100644
--- a/erpnext/public/js/hub/pages/messages.js
+++ b/erpnext/public/js/hub/pages/messages.js
@@ -1,5 +1,5 @@
import SubPage from './subpage';
-import { get_item_card_container_html } from '../components/items_container';
+// import { get_item_card_container_html } from '../components/items_container';
import { get_buying_item_message_card_html } from '../components/item_card';
import { get_selling_item_message_card_html } from '../components/item_card';
import { get_empty_state } from '../components/empty_state';
@@ -22,7 +22,7 @@ erpnext.hub.Buying = class Buying extends SubPage {
}
render(items = [], title) {
- const html = get_item_card_container_html(items, title, get_buying_item_message_card_html);
+ // const html = get_item_card_container_html(items, title, get_buying_item_message_card_html);
this.$wrapper.append(html);
}
@@ -54,7 +54,7 @@ erpnext.hub.Selling = class Selling extends SubPage {
}
render(items = [], title) {
- const html = get_item_card_container_html(items, title, get_selling_item_message_card_html);
+ // const html = get_item_card_container_html(items, title, get_selling_item_message_card_html);
this.$wrapper.append(html);
}
@@ -101,4 +101,4 @@ function get_message_html(message) {
${message.content}
`;
-}
\ No newline at end of file
+}
diff --git a/erpnext/public/js/hub/pages/not_found.js b/erpnext/public/js/hub/pages/not_found.js
deleted file mode 100644
index f7ccc2f5b37..00000000000
--- a/erpnext/public/js/hub/pages/not_found.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import SubPage from './subpage';
-import { get_empty_state } from '../components/empty_state';
-
-erpnext.hub.NotFound = class NotFound extends SubPage {
- refresh() {
- this.$wrapper.html(get_empty_state(
- __('Sorry! I could not find what you were looking for.'),
- `
`
- ));
- }
-}
diff --git a/erpnext/public/js/hub/pages/profile.js b/erpnext/public/js/hub/pages/profile.js
deleted file mode 100644
index 9bfa85d7a61..00000000000
--- 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`
- }
- }
- }
-}
diff --git a/erpnext/public/js/hub/pages/seller.js b/erpnext/public/js/hub/pages/seller.js
deleted file mode 100644
index b86e46e5446..00000000000
--- a/erpnext/public/js/hub/pages/seller.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import SubPage from './subpage';
-import { get_profile_html } from '../components/detail_view';
-import { get_item_card_container_html } from '../components/items_container';
-import { get_detail_skeleton_html } from '../components/skeleton_state';
-
-erpnext.hub.Seller = class Seller extends SubPage {
- make_wrapper() {
- super.make_wrapper();
- }
-
- refresh() {
- this.show_skeleton();
- this.company = frappe.get_route()[2];
- this.get_hub_seller_profile()
- .then(this.render.bind(this));
- }
-
- get_hub_seller_profile() {
- return hub.call('get_hub_seller_page_info', { company: this.company });
- }
-
- show_skeleton() {
- this.$wrapper.html(get_detail_skeleton_html());
- }
-
- render(data) {
- this.$wrapper.html(get_profile_html(data.profile));
-
- let html = get_item_card_container_html(data.items, __('Products by ' + p.company));
- this.$wrapper.append(html);
- }
-}