[hub] Merge conflicts
This commit is contained in:
commit
ff52e93e69
@ -9,8 +9,8 @@
|
|||||||
import Home from './pages/Home.vue';
|
import Home from './pages/Home.vue';
|
||||||
import Search from './pages/Search.vue';
|
import Search from './pages/Search.vue';
|
||||||
import Category from './pages/Category.vue';
|
import Category from './pages/Category.vue';
|
||||||
import SavedProducts from './pages/SavedProducts.vue';
|
import SavedItems from './pages/SavedItems.vue';
|
||||||
import PublishedProducts from './pages/PublishedProducts.vue';
|
import PublishedItems from './pages/PublishedItems.vue';
|
||||||
import Item from './pages/Item.vue';
|
import Item from './pages/Item.vue';
|
||||||
import Seller from './pages/Seller.vue';
|
import Seller from './pages/Seller.vue';
|
||||||
import Publish from './pages/Publish.vue';
|
import Publish from './pages/Publish.vue';
|
||||||
@ -30,9 +30,9 @@ const route_map = {
|
|||||||
|
|
||||||
// Registered seller routes
|
// Registered seller routes
|
||||||
'marketplace/profile': Profile,
|
'marketplace/profile': Profile,
|
||||||
'marketplace/saved-products': SavedProducts,
|
'marketplace/saved-items': SavedItems,
|
||||||
'marketplace/publish': Publish,
|
'marketplace/publish': Publish,
|
||||||
'marketplace/my-products': PublishedProducts,
|
'marketplace/published-items': PublishedItems,
|
||||||
'marketplace/buying': Buying,
|
'marketplace/buying': Buying,
|
||||||
'marketplace/buying/:item': Messages,
|
'marketplace/buying/:item': Messages,
|
||||||
'marketplace/selling': Selling,
|
'marketplace/selling': Selling,
|
||||||
@ -58,7 +58,6 @@ export default {
|
|||||||
get_current_page() {
|
get_current_page() {
|
||||||
const curr_route = frappe.get_route_str();
|
const curr_route = frappe.get_route_str();
|
||||||
let route = Object.keys(route_map).filter(route => route == curr_route)[0];
|
let route = Object.keys(route_map).filter(route => route == curr_route)[0];
|
||||||
|
|
||||||
if (!route) {
|
if (!route) {
|
||||||
// find route by matching it with dynamic part
|
// find route by matching it with dynamic part
|
||||||
const curr_route_parts = curr_route.split('/');
|
const curr_route_parts = curr_route.split('/');
|
||||||
@ -70,7 +69,7 @@ export default {
|
|||||||
let weight = 0;
|
let weight = 0;
|
||||||
route_parts.forEach((part, i) => {
|
route_parts.forEach((part, i) => {
|
||||||
const curr_route_part = curr_route_parts[i];
|
const curr_route_part = curr_route_parts[i];
|
||||||
if (part === curr_route_part || curr_route_part.includes(':')) {
|
if (part === curr_route_part || part.includes(':')) {
|
||||||
weight += 1;
|
weight += 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -80,12 +79,13 @@ export default {
|
|||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
// get the route with the highest weight
|
// get the route with the highest weight
|
||||||
let weight = 0
|
|
||||||
for (let key in weighted_routes) {
|
for (let key in weighted_routes) {
|
||||||
const route_weight = weighted_routes[key];
|
const route_weight = weighted_routes[key];
|
||||||
if (route_weight > weight) {
|
if (route_weight === curr_route_parts.length) {
|
||||||
route = key;
|
route = key;
|
||||||
weight = route_weight;
|
break;
|
||||||
|
} else {
|
||||||
|
route = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
hub_registered: hub.settings.registered,
|
hub_registered: hub.settings.registered && frappe.session.user === hub.settings.company_email,
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: __('Browse'),
|
label: __('Browse'),
|
||||||
route: 'marketplace/home'
|
route: 'marketplace/home'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Saved Products'),
|
label: __('Saved Items'),
|
||||||
route: 'marketplace/saved-products',
|
route: 'marketplace/saved-items',
|
||||||
condition: () => this.hub_registered
|
condition: () => this.hub_registered
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -36,12 +36,12 @@ export default {
|
|||||||
condition: () => this.hub_registered
|
condition: () => this.hub_registered
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Your Products'),
|
label: __('Your Items'),
|
||||||
route: 'marketplace/my-products',
|
route: 'marketplace/published-items',
|
||||||
condition: () => this.hub_registered
|
condition: () => this.hub_registered
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Publish Products'),
|
label: __('Publish Items'),
|
||||||
route: 'marketplace/publish',
|
route: 'marketplace/publish',
|
||||||
condition: () => this.hub_registered
|
condition: () => this.hub_registered
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="media timeline-item notification-content">
|
<div class="media timeline-item notification-content">
|
||||||
<div class="small">
|
<div class="small">
|
||||||
<i class="octicon octicon-bookmark fa-fw"></i>
|
<i class="octicon octicon-bookmark fa-fw"></i>
|
||||||
<span title="Administrator"><b>4 weeks ago</b> Published 1 product to Marketplace</span>
|
<span title="Administrator"><b>4 weeks ago</b> Published 1 item to Marketplace</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -94,7 +94,7 @@ function get_detail_view_html(item, allow_edit) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="row hub-item-description">
|
<div class="row hub-item-description">
|
||||||
<h6 class="col-md-12 margin-top">
|
<h6 class="col-md-12 margin-top">
|
||||||
<b class="text-muted">Product Description</b>
|
<b class="text-muted">Item Description</b>
|
||||||
</h6>
|
</h6>
|
||||||
<p class="col-md-12">
|
<p class="col-md-12">
|
||||||
${description ? description : __('No details')}
|
${description ? description : __('No details')}
|
||||||
|
@ -23,13 +23,14 @@ erpnext.hub.Marketplace = class Marketplace {
|
|||||||
frappe.db.get_doc('Hub Settings')
|
frappe.db.get_doc('Hub Settings')
|
||||||
.then(doc => {
|
.then(doc => {
|
||||||
hub.settings = doc;
|
hub.settings = doc;
|
||||||
const is_registered = hub.settings.registered
|
const is_registered = hub.settings.registered;
|
||||||
|
const is_registered_seller = hub.settings.company_email === frappe.session.user;
|
||||||
this.setup_header();
|
this.setup_header();
|
||||||
this.make_sidebar();
|
this.make_sidebar();
|
||||||
this.make_body();
|
this.make_body();
|
||||||
this.setup_events();
|
this.setup_events();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
if (!is_registered && frappe.user_roles.includes('System Manager')) {
|
if (!is_registered && !is_registered_seller && frappe.user_roles.includes('System Manager')) {
|
||||||
this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
|
this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'saved-products-page',
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page_name: frappe.get_route()[1],
|
page_name: frappe.get_route()[1],
|
||||||
@ -27,7 +26,7 @@ export default {
|
|||||||
item_id_fieldname: 'name',
|
item_id_fieldname: 'name',
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
empty_state_message: __(`No products in this category yet.`)
|
empty_state_message: __(`No items in this category yet.`)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -61,7 +61,7 @@ export default {
|
|||||||
action: this.add_to_saved_items
|
action: this.add_to_saved_items
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Report this Product'),
|
label: __('Report this Item'),
|
||||||
condition: !this.is_own_item,
|
condition: !this.is_own_item,
|
||||||
action: this.report_item
|
action: this.report_item
|
||||||
},
|
},
|
||||||
@ -71,7 +71,7 @@ export default {
|
|||||||
action: this.edit_details
|
action: this.edit_details
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Unpublish Product'),
|
label: __('Unpublish Item'),
|
||||||
condition: this.is_own_item,
|
condition: this.is_own_item,
|
||||||
action: this.unpublish_item
|
action: this.unpublish_item
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ export default {
|
|||||||
|
|
||||||
this.sections = [
|
this.sections = [
|
||||||
{
|
{
|
||||||
title: __('Product Description'),
|
title: __('Item Description'),
|
||||||
content: this.item.description
|
content: this.item.description
|
||||||
? __(this.item.description)
|
? __(this.item.description)
|
||||||
: __('No description')
|
: __('No description')
|
||||||
@ -188,6 +188,7 @@ export default {
|
|||||||
|
|
||||||
make_dialogs() {
|
make_dialogs() {
|
||||||
this.make_contact_seller_dialog();
|
this.make_contact_seller_dialog();
|
||||||
|
this.make_report_item_dialog();
|
||||||
},
|
},
|
||||||
|
|
||||||
add_to_saved_items() {
|
add_to_saved_items() {
|
||||||
@ -196,7 +197,7 @@ export default {
|
|||||||
hub_seller: hub.settings.company_email
|
hub_seller: hub.settings.company_email
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const saved_items_link = `<b><a href="#marketplace/saved-products">${__('Saved')}</a></b>`
|
const saved_items_link = `<b><a href="#marketplace/saved-items">${__('Saved')}</a></b>`
|
||||||
frappe.show_alert(saved_items_link);
|
frappe.show_alert(saved_items_link);
|
||||||
erpnext.hub.trigger('action:item_save');
|
erpnext.hub.trigger('action:item_save');
|
||||||
})
|
})
|
||||||
@ -239,10 +240,34 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
make_report_item_dialog() {
|
||||||
|
this.report_item_dialog = new frappe.ui.Dialog({
|
||||||
|
title: __('Report Item'),
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: __('Why do think this Item should be removed?'),
|
||||||
|
fieldtype: 'Text',
|
||||||
|
fieldname: 'message'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
primary_action: ({ message }) => {
|
||||||
|
hub.call('add_reported_item', { hub_item_name: this.item.name, message })
|
||||||
|
.then(() => {
|
||||||
|
d.hide();
|
||||||
|
frappe.show_alert(__('Item Reported'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
contact_seller() {
|
contact_seller() {
|
||||||
this.contact_seller_dialog.show();
|
this.contact_seller_dialog.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
report_item() {
|
||||||
|
this.report_item_dialog.show();
|
||||||
|
},
|
||||||
|
|
||||||
edit_details() {
|
edit_details() {
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
>
|
>
|
||||||
</item-cards-container>
|
</item-cards-container>
|
||||||
|
|
||||||
<p class="text-muted">{{ valid_products_instruction }}</p>
|
<p class="text-muted">{{ valid_items_instruction }}</p>
|
||||||
|
|
||||||
<search-input
|
<search-input
|
||||||
:placeholder="search_placeholder"
|
:placeholder="search_placeholder"
|
||||||
@ -73,16 +73,16 @@ export default {
|
|||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
// TODO: multiline translations don't work
|
// TODO: multiline translations don't work
|
||||||
page_title: __('Publish Products'),
|
page_title: __('Publish Items'),
|
||||||
search_placeholder: __('Search Items ...'),
|
search_placeholder: __('Search Items ...'),
|
||||||
empty_state_message: __(`No Items selected yet. Browse and click on products below to publish.`),
|
empty_state_message: __(`No Items selected yet. Browse and click on items below to publish.`),
|
||||||
valid_products_instruction: __(`Only products with an image and description can be published. Please update them if an item in your inventory does not appear.`),
|
valid_items_instruction: __(`Only items with an image and description can be published. Please update them if an item in your inventory does not appear.`),
|
||||||
last_sync_message: (hub.settings.last_sync_datetime)
|
last_sync_message: (hub.settings.last_sync_datetime)
|
||||||
? __(`Last sync was
|
? __(`Last sync was
|
||||||
<a href="#marketplace/profile">
|
<a href="#marketplace/profile">
|
||||||
${comment_when(hub.settings.last_sync_datetime)}</a>.
|
${comment_when(hub.settings.last_sync_datetime)}</a>.
|
||||||
<a href="#marketplace/my-products">
|
<a href="#marketplace/published-items">
|
||||||
See your Published Products</a>.`)
|
See your Published Items</a>.`)
|
||||||
: ''
|
: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -93,14 +93,14 @@ export default {
|
|||||||
|
|
||||||
publish_button_text() {
|
publish_button_text() {
|
||||||
const number = this.selected_items.length;
|
const number = this.selected_items.length;
|
||||||
let text = 'Publish';
|
let text = __('Publish');
|
||||||
if(number === 1) {
|
if(number === 1) {
|
||||||
text = 'Publish 1 Product';
|
text = __('Publish 1 Item');
|
||||||
}
|
}
|
||||||
if(number > 1) {
|
if(number > 1) {
|
||||||
text = `Publish ${number} Products`;
|
text = __('Publish {0} Items', [number]);
|
||||||
}
|
}
|
||||||
return __(text);
|
return text;
|
||||||
},
|
},
|
||||||
|
|
||||||
items_dict() {
|
items_dict() {
|
||||||
@ -150,8 +150,8 @@ export default {
|
|||||||
this.last_sync_message = __(`Last sync was
|
this.last_sync_message = __(`Last sync was
|
||||||
<a href="#marketplace/profile">
|
<a href="#marketplace/profile">
|
||||||
${comment_when(hub.settings.last_sync_datetime)}</a>.
|
${comment_when(hub.settings.last_sync_datetime)}</a>.
|
||||||
<a href="#marketplace/my-products">
|
<a href="#marketplace/published-items">
|
||||||
See your Published Products</a>.`);
|
See your Published Items</a>.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
clear_last_sync_message() {
|
clear_last_sync_message() {
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'saved-products-page',
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page_name: frappe.get_route()[1],
|
page_name: frappe.get_route()[1],
|
||||||
@ -54,7 +53,7 @@ export default {
|
|||||||
publish_button_text: __('Publish More Items'),
|
publish_button_text: __('Publish More Items'),
|
||||||
published_items_message: __('You can publish upto 200 items.'),
|
published_items_message: __('You can publish upto 200 items.'),
|
||||||
// TODO: Add empty state action
|
// TODO: Add empty state action
|
||||||
empty_state_message: __(`You haven't published any products yet. Publish.`)
|
empty_state_message: __('You haven\'t published any items yet.')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'saved-products-page',
|
name: 'saved-items-page',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page_name: frappe.get_route()[1],
|
page_name: frappe.get_route()[1],
|
||||||
@ -28,8 +28,8 @@ export default {
|
|||||||
item_id_fieldname: 'name',
|
item_id_fieldname: 'name',
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
page_title: __('Saved Products'),
|
page_title: __('Saved Items'),
|
||||||
empty_state_message: __(`You haven't favourited any items yet.`)
|
empty_state_message: __(`You haven't saved any items yet.`)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -76,12 +76,12 @@ export default {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(!reverted) {
|
if(!reverted) {
|
||||||
this.remove_item_from_saved_products(hub_item_name);
|
this.remove_item_from_saved_items(hub_item_name);
|
||||||
}
|
}
|
||||||
}, grace_period);
|
}, grace_period);
|
||||||
},
|
},
|
||||||
|
|
||||||
remove_item_from_saved_products(hub_item_name) {
|
remove_item_from_saved_items(hub_item_name) {
|
||||||
erpnext.hub.trigger('action:item_save');
|
erpnext.hub.trigger('action:item_save');
|
||||||
hub.call('remove_item_from_seller_saved_items', {
|
hub.call('remove_item_from_seller_saved_items', {
|
||||||
hub_item_name,
|
hub_item_name,
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'saved-products-page',
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
page_name: frappe.get_route()[1],
|
page_name: frappe.get_route()[1],
|
||||||
@ -42,7 +41,7 @@ export default {
|
|||||||
page_title() {
|
page_title() {
|
||||||
return this.items.length
|
return this.items.length
|
||||||
? __(`Results for "${this.search_value}"`)
|
? __(`Results for "${this.search_value}"`)
|
||||||
: __(`No Products found.`);
|
: __('No Items found.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -61,7 +61,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
item_container_heading() {
|
item_container_heading() {
|
||||||
return __('Products by ' + this.seller_company);
|
return __('Items by ' + this.seller_company);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -48,7 +48,7 @@ erpnext.hub.Item = class Item extends SubPage {
|
|||||||
edit_details() {
|
edit_details() {
|
||||||
if (!this.edit_dialog) {
|
if (!this.edit_dialog) {
|
||||||
this.edit_dialog = new frappe.ui.Dialog({
|
this.edit_dialog = new frappe.ui.Dialog({
|
||||||
title: "Edit Your Product",
|
title: "Edit Your Item",
|
||||||
fields: []
|
fields: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ erpnext.hub.Item = class Item extends SubPage {
|
|||||||
unpublish_item() {
|
unpublish_item() {
|
||||||
if (!this.unpublish_dialog) {
|
if (!this.unpublish_dialog) {
|
||||||
this.unpublish_dialog = new frappe.ui.Dialog({
|
this.unpublish_dialog = new frappe.ui.Dialog({
|
||||||
title: "Edit Your Product",
|
title: "Edit Your Item",
|
||||||
fields: []
|
fields: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user