fix: formatting issues

This commit is contained in:
prssanna 2021-02-01 20:12:47 +05:30
parent 53225f5cbb
commit 526ea46ae2
6 changed files with 28 additions and 24 deletions

View File

@ -19,8 +19,8 @@ frappe.ui.form.on('Course Scheduling Tool', {
}
const { course_schedules } = r.message;
if (course_schedules) {
const html = `
<table class="table table-bordered">
/* eslint-disable indent */
const html = `<table class="table table-bordered">
<caption>${__('Following course schedules were created')}</caption>
<thead><tr><th>${__("Course")}</th><th>${__("Date")}</th></tr></thead>
<tbody>
@ -29,7 +29,8 @@ frappe.ui.form.on('Course Scheduling Tool', {
<td>${c.schedule_date}</td></tr>`
).join('')}
</tbody>
</table>`
</table>`;
/* eslint-disable indent */
frappe.msgprint(html);
}

View File

@ -182,7 +182,7 @@ erpnext.PointOfSale.Controller = class {
if (this.frm.doc.items.length == 0) {
frappe.show_alert({
message:__("You must add atleast one item to save it as draft."),
message: __("You must add atleast one item to save it as draft."),
indicator:'red'
});
frappe.utils.play_sound("error");

View File

@ -155,11 +155,11 @@ erpnext.PointOfSale.ItemCart = class {
bind_events() {
const me = this;
this.$customer_section.on('click', '.reset-customer-btn', function (e) {
this.$customer_section.on('click', '.reset-customer-btn', function () {
me.reset_customer_selector();
});
this.$customer_section.on('click', '.close-details-btn', function (e) {
this.$customer_section.on('click', '.close-details-btn', function () {
me.toggle_customer_info(false);
});
@ -365,7 +365,7 @@ erpnext.PointOfSale.ItemCart = class {
}
show_discount_control() {
this.$add_discount_elem.css({ 'padding': '0px', 'border': 'none' })
this.$add_discount_elem.css({ 'padding': '0px', 'border': 'none' });
this.$add_discount_elem.html(
`<div class="add-discount-field"></div>`
);
@ -447,13 +447,13 @@ erpnext.PointOfSale.ItemCart = class {
function get_customer_description() {
if (!email_id && !mobile_no) {
return `<div class="customer-desc">Click to add email / phone</div>`
return `<div class="customer-desc">Click to add email / phone</div>`;
} else if (email_id && !mobile_no) {
return `<div class="customer-desc">${email_id}</div>`
return `<div class="customer-desc">${email_id}</div>`;
} else if (mobile_no && !email_id) {
return `<div class="customer-desc">${mobile_no}</div>`
return `<div class="customer-desc">${mobile_no}</div>`;
} else {
return `<div class="customer-desc">${email_id} - ${mobile_no}</div>`
return `<div class="customer-desc">${email_id} - ${mobile_no}</div>`;
}
}
@ -462,9 +462,9 @@ erpnext.PointOfSale.ItemCart = class {
get_customer_image() {
const { customer, image } = this.customer_info || {};
if (image) {
return `<div class="customer-image"><img src="${image}" alt="${image}""></div>`
return `<div class="customer-image"><img src="${image}" alt="${image}""></div>`;
} else {
return `<div class="customer-image customer-abbr">${frappe.get_abbr(customer)}</div>`
return `<div class="customer-image customer-abbr">${frappe.get_abbr(customer)}</div>`;
}
}
@ -501,7 +501,7 @@ erpnext.PointOfSale.ItemCart = class {
this.$numpad_section.find('.numpad-grand-total').html(
`<div>Grand Total: <span>${format_currency(value, currency)}</span></div>`
)
);
}
render_taxes(value, taxes) {
@ -509,6 +509,7 @@ erpnext.PointOfSale.ItemCart = class {
const currency = this.events.get_frm().doc.currency;
this.$totals_section.find('.taxes-container').css('display', 'flex').html(
`${
// eslint-disable-next-line no-unused-vars
taxes.map((t, i) => {
const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`;
return `<div class="tax-row">
@ -519,7 +520,7 @@ erpnext.PointOfSale.ItemCart = class {
</div>`
}).join('')
}`
)
);
} else {
this.$totals_section.find('.taxes-container').css('display', 'none').html('');
}
@ -633,7 +634,7 @@ erpnext.PointOfSale.ItemCart = class {
}
}
item_data.description = frappe.ellipsis(item_data.description, 45);
return `<div class="item-desc">${item_data.description}</div>`
return `<div class="item-desc">${item_data.description}</div>`;
}
return ``;
}
@ -641,9 +642,9 @@ erpnext.PointOfSale.ItemCart = class {
function get_item_image_html() {
const { image, item_name } = item_data;
if (image) {
return `<div class="item-image"><img src="${image}" alt="${image}""></div>`
return `<div class="item-image"><img src="${image}" alt="${image}""></div>`;
} else {
return `<div class="item-image item-abbr">${frappe.get_abbr(item_name)}</div>`
return `<div class="item-image item-abbr">${frappe.get_abbr(item_name)}</div>`;
}
}
}
@ -980,7 +981,7 @@ erpnext.PointOfSale.ItemCart = class {
this.fetch_customer_details(frm.doc.customer).then(() => {
this.events.customer_details_updated(this.customer_info);
this.update_customer_section();
})
});
this.$cart_items_wrapper.html('');
if (frm.doc.items.length) {

View File

@ -183,11 +183,11 @@ erpnext.PointOfSale.ItemDetails = class {
if (!item.has_batch_no) {
this.$form_container.append(
`<div class="grid-filler no-select"></div>`
)
);
}
this.$form_container.append(
`<div class="btn btn-sm btn-secondary auto-fetch-btn">Auto Fetch Serial Numbers</div>`
)
);
this.$form_container.find('.serial_no-control').find('textarea').css('height', '6rem');
}
}

View File

@ -22,11 +22,11 @@ erpnext.PointOfSale.NumberPad = class {
return keys.reduce((a, row, i) => {
return a + row.reduce((a2, number, j) => {
const class_to_append = css_classes && css_classes[i] ? css_classes[i][j] : '';
const fieldname = fieldnames && fieldnames[number] ?
const fieldname = fieldnames && fieldnames[number] ?
fieldnames[number] : typeof number === 'string' ? frappe.scrub(number) : number;
return a2 + `<div class="numpad-btn ${class_to_append}" data-button-value="${fieldname}">${number}</div>`
}, '')
return a2 + `<div class="numpad-btn ${class_to_append}" data-button-value="${fieldname}">${number}</div>`;
}, '');
}, '');
}

View File

@ -209,6 +209,7 @@ class ItemConfigure {
__('{0} item found.', [filtered_items_count]) :
__('{0} items found.', [filtered_items_count]);
/* eslint-disable indent */
const item_found_status = exact_match.length === 1
? `<div class="alert alert-success d-flex justify-content-between align-items-center" role="alert">
<div><div>
@ -230,6 +231,7 @@ class ItemConfigure {
${__('Clear values')}
</a>
</div>`;
/* eslint-disable indent */
return `
${item_found_status}