mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 10:45:29 +00:00
feat: full screen on pos (#45404)
* feat: full screen on pos
* refactor: variables for label
* fix: refactor and handled button label change
* refactor: rename enable fullscreen label
(cherry picked from commit 78c7c1c631)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -165,6 +165,7 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
this.prepare_dom();
|
this.prepare_dom();
|
||||||
this.prepare_components();
|
this.prepare_components();
|
||||||
this.prepare_menu();
|
this.prepare_menu();
|
||||||
|
this.prepare_fullscreen_btn();
|
||||||
this.make_new_invoice();
|
this.make_new_invoice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +201,39 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
this.page.add_menu_item(__("Close the POS"), this.close_pos.bind(this), false, "Shift+Ctrl+C");
|
this.page.add_menu_item(__("Close the POS"), this.close_pos.bind(this), false, "Shift+Ctrl+C");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_fullscreen_btn() {
|
||||||
|
this.page.page_actions.find(".custom-actions").empty();
|
||||||
|
|
||||||
|
this.page.add_button(__("Full Screen"), null, { btn_class: "btn-default fullscreen-btn" });
|
||||||
|
|
||||||
|
this.bind_fullscreen_events();
|
||||||
|
}
|
||||||
|
|
||||||
|
bind_fullscreen_events() {
|
||||||
|
this.$fullscreen_btn = this.page.page_actions.find(".fullscreen-btn");
|
||||||
|
|
||||||
|
this.$fullscreen_btn.on("click", function () {
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
document.documentElement.requestFullscreen();
|
||||||
|
} else if (document.exitFullscreen) {
|
||||||
|
document.exitFullscreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("fullscreenchange", this.handle_fullscreen_change_event.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_fullscreen_change_event() {
|
||||||
|
let enable_fullscreen_label = __("Full Screen");
|
||||||
|
let exit_fullscreen_label = __("Exit Full Screen");
|
||||||
|
|
||||||
|
if (document.fullscreenElement) {
|
||||||
|
this.$fullscreen_btn[0].innerText = exit_fullscreen_label;
|
||||||
|
} else {
|
||||||
|
this.$fullscreen_btn[0].innerText = enable_fullscreen_label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open_form_view() {
|
open_form_view() {
|
||||||
frappe.model.sync(this.frm.doc);
|
frappe.model.sync(this.frm.doc);
|
||||||
frappe.set_route("Form", this.frm.doc.doctype, this.frm.doc.name);
|
frappe.set_route("Form", this.frm.doc.doctype, this.frm.doc.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user