[hub][publish] select/deselect all items
This commit is contained in:
parent
9685d7c37a
commit
505f6f14e9
@ -487,20 +487,12 @@ erpnext.hub.Register = class Register extends SubPage {
|
|||||||
.appendTo(this.$wrapper);
|
.appendTo(this.$wrapper);
|
||||||
this.$form_container = $('<div class="col-md-8 col-md-offset-1 form-container">')
|
this.$form_container = $('<div class="col-md-8 col-md-offset-1 form-container">')
|
||||||
.appendTo(this.$wrapper);
|
.appendTo(this.$wrapper);
|
||||||
|
|
||||||
// const title = __('Become a Seller');
|
|
||||||
// this.$register_container.append($(`<h5>${title}</h5>`));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
// company, company_email, logo, description
|
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// make_input() {
|
|
||||||
// //
|
|
||||||
// }
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.make_field_group();
|
this.make_field_group();
|
||||||
}
|
}
|
||||||
@ -576,9 +568,53 @@ erpnext.hub.Register = class Register extends SubPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
erpnext.hub.Publish = class Publish extends SubPage {
|
erpnext.hub.Publish = class Publish extends SubPage {
|
||||||
constructor(parent) {
|
make_wrapper() {
|
||||||
super(parent);
|
super.make_wrapper();
|
||||||
// this.selected_items = [];
|
const title_html = `<b>${__('Select Products to Publish')}</b>`;
|
||||||
|
const subtitle_html = `<p class="text-muted">
|
||||||
|
${__(`Only products with an image and description can be published.
|
||||||
|
Please update them if an item in your inventory does not appear.`)}
|
||||||
|
</p>`;
|
||||||
|
const publish_button_html = `<button class="btn btn-primary btn-sm publish-button">
|
||||||
|
<i class="visible-xs octicon octicon-check"></i>
|
||||||
|
<span class="hidden-xs">Publish</span>
|
||||||
|
</button>`;
|
||||||
|
|
||||||
|
const select_all_button = `<button class="btn btn-secondary btn-default btn-xs margin-right select-all">Select All</button>`;
|
||||||
|
const deselect_all_button = `<button class="btn btn-secondary btn-default btn-xs deselect-all">Deselect All</button>`;
|
||||||
|
|
||||||
|
const search_html = `<div class="hub-search-container">
|
||||||
|
<input type="text" class="form-control" placeholder="Search Items">
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
const subpage_header = $(`
|
||||||
|
<div class='subpage-title flex'>
|
||||||
|
<div>
|
||||||
|
${title_html}
|
||||||
|
${subtitle_html}
|
||||||
|
</div>
|
||||||
|
${publish_button_html}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
${search_html}
|
||||||
|
|
||||||
|
${select_all_button}
|
||||||
|
${deselect_all_button}
|
||||||
|
`);
|
||||||
|
|
||||||
|
this.$wrapper.append(subpage_header);
|
||||||
|
|
||||||
|
this.setup_events();
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_events() {
|
||||||
|
this.$wrapper.find('.select-all').on('click', () => {
|
||||||
|
this.$wrapper.find('.hub-card').addClass('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$wrapper.find('.deselect-all').on('click', () => {
|
||||||
|
this.$wrapper.find('.hub-card').removeClass('active');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
@ -589,26 +625,13 @@ erpnext.hub.Publish = class Publish extends SubPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render(items) {
|
render(items) {
|
||||||
const html = get_item_card_container_html(
|
const items_container = $(get_item_card_container_html(items));
|
||||||
items,
|
items_container.addClass('static').on('click', '.hub-card', (e) => {
|
||||||
|
|
||||||
__('Select Products to Publish'),
|
|
||||||
|
|
||||||
__(`Only products with an image and description can be published.
|
|
||||||
Please update them if an item in your inventory does not appear.`),
|
|
||||||
|
|
||||||
`<div class="hub-search-container">
|
|
||||||
<input type="text" class="form-control" placeholder="Search Items">
|
|
||||||
</div>`
|
|
||||||
);
|
|
||||||
|
|
||||||
const container = $(html);
|
|
||||||
container.addClass('static').on('click', '.hub-card', (e) => {
|
|
||||||
const $target = $(e.currentTarget);
|
const $target = $(e.currentTarget);
|
||||||
$target.toggleClass('active');
|
$target.toggleClass('active');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$wrapper.append(container);
|
this.$wrapper.append(items_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
get_valid_items() {
|
get_valid_items() {
|
||||||
@ -616,20 +639,14 @@ erpnext.hub.Publish = class Publish extends SubPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_item_card_container_html(items, title, subtitle='', search_html='') {
|
function get_item_card_container_html(items, title='') {
|
||||||
const items_html = (items || []).map(item => get_item_card_html(item)).join('');
|
const items_html = (items || []).map(item => get_item_card_html(item)).join('');
|
||||||
|
|
||||||
const html = `<div class="row hub-card-container">
|
const html = `<div class="row hub-card-container">
|
||||||
<div class="col-md-12 margin-bottom">
|
<div class="col-sm-12 margin-bottom">
|
||||||
<b>${title}</b>
|
<b>${title}</b>
|
||||||
|
|
||||||
<p class="text-muted">${subtitle}</p>
|
|
||||||
|
|
||||||
${search_html}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${items_html}
|
${items_html}
|
||||||
|
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
@ -31,6 +31,11 @@ body[data-route^="marketplace/"] {
|
|||||||
border-color: #59b81c;
|
border-color: #59b81c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subpage-title.flex {
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.hub-card {
|
.hub-card {
|
||||||
border: 1px solid @border-color;
|
border: 1px solid @border-color;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user