blob: df7757b8426f24f6f11bb19020d4ab96d988644d [file] [log] [blame]
Rushabh Mehta06fa46f2015-01-29 18:09:11 +05301frappe.pages['pos'].on_page_load = function(wrapper) {
Rushabh Mehta4c36d732015-01-01 15:59:34 +05302 var page = frappe.ui.make_app_page({
Rushabh Mehta72e17192014-08-08 15:30:49 +05303 parent: wrapper,
Rushabh Mehtac4dce992015-03-05 15:09:04 +05304 title: __('Start Point-of-Sale (POS)'),
Rushabh Mehta72e17192014-08-08 15:30:49 +05305 single_column: true
6 });
7
Rushabh Mehtac4dce992015-03-05 15:09:04 +05308 page.main.html(frappe.render_template("pos_page", {}));
Rushabh Mehta72e17192014-08-08 15:30:49 +05309
10 var pos_type = frappe.ui.form.make_control({
Rushabh Mehta4c36d732015-01-01 15:59:34 +053011 parent: page.main.find(".select-type"),
Rushabh Mehta72e17192014-08-08 15:30:49 +053012 df: {
13 fieldtype: "Select",
14 options: [
15 {label: __("Billing (Sales Invoice)"), value:"Sales Invoice"},
16 {value:"Sales Order"},
17 {value:"Delivery Note"},
18 {value:"Quotation"},
19 {value:"Purchase Order"},
20 {value:"Purchase Receipt"},
21 {value:"Purchase Invoice"},
22 ],
23 fieldname: "pos_type"
24 },
25 only_input: true
26 });
27
28 pos_type.refresh();
29
Rushabh Mehtac4dce992015-03-05 15:09:04 +053030 pos_type.set_input("Sales Invoice");
31
Rushabh Mehta4c36d732015-01-01 15:59:34 +053032 page.main.find(".btn-primary").on("click", function() {
Rushabh Mehta72e17192014-08-08 15:30:49 +053033 erpnext.open_as_pos = true;
34 new_doc(pos_type.get_value());
35 });
36
37 $.ajax({
Rushabh Mehtaa27cca92015-05-20 15:43:17 +053038 url: "/api/resource/POS Profile",
Rushabh Mehta72e17192014-08-08 15:30:49 +053039 success: function(data) {
40 if(!data.data.length) {
Rushabh Mehta4c36d732015-01-01 15:59:34 +053041 page.main.find(".pos-setting-message").removeClass('hide');
Rushabh Mehta72e17192014-08-08 15:30:49 +053042 }
43 }
44 })
45
46}