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 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">
|
||||
<a class="dropdown-toggle btn btn-xs btn-default" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
|
@ -29,13 +29,10 @@ erpnext.hub.Marketplace = class Marketplace {
|
||||
this.setup_events();
|
||||
this.refresh();
|
||||
|
||||
if (is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
|
||||
// show buttons only to System Manager
|
||||
if (!hub.is_seller_registered()) {
|
||||
this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
|
||||
} else {
|
||||
this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
|
||||
}
|
||||
if (!hub.is_seller_registered()) {
|
||||
this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
|
||||
} else {
|
||||
this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -98,6 +95,11 @@ erpnext.hub.Marketplace = class Marketplace {
|
||||
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(
|
||||
__('Become a Seller'),
|
||||
{
|
||||
@ -126,6 +128,11 @@ erpnext.hub.Marketplace = class Marketplace {
|
||||
}
|
||||
|
||||
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()
|
||||
.then(r => {
|
||||
const user_list = r.message;
|
||||
|
@ -19,7 +19,7 @@
|
||||
:value="item_views_and_ratings"
|
||||
></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"
|
||||
@click="primary_action.action"
|
||||
>
|
||||
@ -56,7 +56,7 @@ export default {
|
||||
menu_items: [
|
||||
{
|
||||
label: __('Save Item'),
|
||||
condition: !this.is_own_item,
|
||||
condition: hub.is_user_registered() && !this.is_own_item,
|
||||
action: this.add_to_saved_items
|
||||
},
|
||||
{
|
||||
@ -66,12 +66,12 @@ export default {
|
||||
},
|
||||
{
|
||||
label: __('Edit Details'),
|
||||
condition: this.is_own_item,
|
||||
condition: hub.is_user_registered() && this.is_own_item,
|
||||
action: this.edit_details
|
||||
},
|
||||
{
|
||||
label: __('Unpublish Item'),
|
||||
condition: this.is_own_item,
|
||||
condition: hub.is_user_registered() && this.is_own_item,
|
||||
action: this.unpublish_item
|
||||
}
|
||||
]
|
||||
@ -125,9 +125,13 @@ export default {
|
||||
},
|
||||
|
||||
primary_action() {
|
||||
return {
|
||||
label: __('Contact Seller'),
|
||||
action: this.contact_seller.bind(this)
|
||||
if (hub.is_user_registered()) {
|
||||
return {
|
||||
label: __('Contact Seller'),
|
||||
action: this.contact_seller.bind(this)
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user