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