Merge branch 'hub-multiuser' of https://github.com/frappe/erpnext into hub-multiuser
This commit is contained in:
commit
2b80bbbe16
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="menu_items" class="col-md-1">
|
<div v-if="menu_items && menu_items.length" class="col-md-1">
|
||||||
<div class="dropdown pull-right hub-item-dropdown">
|
<div class="dropdown pull-right hub-item-dropdown">
|
||||||
<a class="dropdown-toggle btn btn-xs btn-default" data-toggle="dropdown">
|
<a class="dropdown-toggle btn btn-xs btn-default" data-toggle="dropdown">
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
|
@ -29,14 +29,11 @@ erpnext.hub.Marketplace = class Marketplace {
|
|||||||
this.setup_events();
|
this.setup_events();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
||||||
if (is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
|
|
||||||
// show buttons only to System Manager
|
|
||||||
if (!hub.is_seller_registered()) {
|
if (!hub.is_seller_registered()) {
|
||||||
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))
|
||||||
} else {
|
} else {
|
||||||
this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
|
this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +95,11 @@ erpnext.hub.Marketplace = class Marketplace {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
|
||||||
|
frappe.msgprint(__('You need to be a user with System Manager and Item Manager roles to register on Marketplace.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.register_dialog = ProfileDialog(
|
this.register_dialog = ProfileDialog(
|
||||||
__('Become a Seller'),
|
__('Become a Seller'),
|
||||||
{
|
{
|
||||||
@ -126,6 +128,11 @@ erpnext.hub.Marketplace = class Marketplace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_add_user_dialog() {
|
show_add_user_dialog() {
|
||||||
|
if (!is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
|
||||||
|
frappe.msgprint(__('You need to be a user with System Manager and Item Manager roles to add users to Marketplace.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.get_unregistered_users()
|
this.get_unregistered_users()
|
||||||
.then(r => {
|
.then(r => {
|
||||||
const user_list = r.message;
|
const user_list = r.message;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
:value="item_views_and_ratings"
|
:value="item_views_and_ratings"
|
||||||
></detail-header-item>
|
></detail-header-item>
|
||||||
|
|
||||||
<button slot="detail-header-item"
|
<button v-if="primary_action" slot="detail-header-item"
|
||||||
class="btn btn-primary btn-sm margin-top"
|
class="btn btn-primary btn-sm margin-top"
|
||||||
@click="primary_action.action"
|
@click="primary_action.action"
|
||||||
>
|
>
|
||||||
@ -56,7 +56,7 @@ export default {
|
|||||||
menu_items: [
|
menu_items: [
|
||||||
{
|
{
|
||||||
label: __('Save Item'),
|
label: __('Save Item'),
|
||||||
condition: !this.is_own_item,
|
condition: hub.is_user_registered() && !this.is_own_item,
|
||||||
action: this.add_to_saved_items
|
action: this.add_to_saved_items
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,12 +66,12 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Edit Details'),
|
label: __('Edit Details'),
|
||||||
condition: this.is_own_item,
|
condition: hub.is_user_registered() && this.is_own_item,
|
||||||
action: this.edit_details
|
action: this.edit_details
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Unpublish Item'),
|
label: __('Unpublish Item'),
|
||||||
condition: this.is_own_item,
|
condition: hub.is_user_registered() && this.is_own_item,
|
||||||
action: this.unpublish_item
|
action: this.unpublish_item
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -125,10 +125,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
primary_action() {
|
primary_action() {
|
||||||
|
if (hub.is_user_registered()) {
|
||||||
return {
|
return {
|
||||||
label: __('Contact Seller'),
|
label: __('Contact Seller'),
|
||||||
action: this.contact_seller.bind(this)
|
action: this.contact_seller.bind(this)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user