fix: Warn users if "Repeat Header and Footer" is disabled

- and if the user still sets Letterhead

Also, add label to the print options
This commit is contained in:
Suraj Shetty 2023-05-31 08:55:59 +05:30
parent ca85524f91
commit a13592a66a
2 changed files with 19 additions and 7 deletions

View file

@ -91,7 +91,7 @@ frappe.ui.form.PrintView = class {
fieldtype: "Link",
fieldname: "print_format",
options: "Print Format",
placeholder: __("Print Format"),
label: __("Print Format"),
get_query: () => {
return { filters: { doc_type: this.frm.doctype } };
},
@ -101,7 +101,7 @@ frappe.ui.form.PrintView = class {
this.language_selector = this.add_sidebar_item({
fieldtype: "Link",
fieldname: "language",
placeholder: __("Language"),
label: __("Language"),
options: "Language",
change: () => {
this.set_user_lang();
@ -109,12 +109,27 @@ frappe.ui.form.PrintView = class {
},
}).$input;
let description = "";
if (!cint(this.print_settings.repeat_header_footer)) {
description =
"<div class='form-message yellow p-3 mt-3'>" +
__("Footer might not be visible as {0} option is disabled</div>", [
`<a href="/app/print-settings/Print Settings#repeat_header_footer">${__(
"Repeat Header and Footer"
)}</a>`,
]);
}
const print_view = this;
this.letterhead_selector = this.add_sidebar_item({
fieldtype: "Link",
fieldname: "letterhead",
options: "Letter Head",
placeholder: __("Letter Head"),
change: () => this.preview(),
label: __("Letter Head"),
description: description,
change: function () {
this.set_description(this.get_value() ? description : "");
print_view.preview();
},
}).$input;
this.sidebar_dynamic_section = $(`<div class="dynamic-settings"></div>`).appendTo(
this.sidebar

View file

@ -45,9 +45,6 @@
.layout-side-section.print-preview-sidebar {
padding-right: var(--padding-md);
.clearfix {
display: none;
}
.label-area {
white-space: nowrap;