blob: 7dceb641cddf1b5339afae60822b12d0256a33d1 [file] [log] [blame]
Rushabh Mehta72e17192014-08-08 15:30:49 +05301frappe.pages['pos'].onload = 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,
81552433qqcom4bab0a22014-09-10 15:36:53 +08004 title: __('Start POS'),
Rushabh Mehta72e17192014-08-08 15:30:49 +05305 single_column: true
6 });
7
Rushabh Mehta4c36d732015-01-01 15:59:34 +05308 page.main.html('<div class="text-center" style="padding: 40px">\
Rushabh Mehta72e17192014-08-08 15:30:49 +05309 <p>' + __("Select type of transaction") + '</p>\
10 <p class="select-type" style="margin: auto; max-width: 300px; margin-bottom: 15px;"></p>\
Rushabh Mehta4c36d732015-01-01 15:59:34 +053011 <p class="pos-setting-message hide">'
12 + '<br><a class="btn btn-default btn-sm" onclick="newdoc(\'POS Setting\')">'
13 + __("Make new POS Setting") + '</a><br><br></p>\
14 <p><button class="btn btn-primary btn-sm">' + __("Start") + '</button></p>\
Rushabh Mehta72e17192014-08-08 15:30:49 +053015 </div>');
16
17 var pos_type = frappe.ui.form.make_control({
Rushabh Mehta4c36d732015-01-01 15:59:34 +053018 parent: page.main.find(".select-type"),
Rushabh Mehta72e17192014-08-08 15:30:49 +053019 df: {
20 fieldtype: "Select",
21 options: [
22 {label: __("Billing (Sales Invoice)"), value:"Sales Invoice"},
23 {value:"Sales Order"},
24 {value:"Delivery Note"},
25 {value:"Quotation"},
26 {value:"Purchase Order"},
27 {value:"Purchase Receipt"},
28 {value:"Purchase Invoice"},
29 ],
30 fieldname: "pos_type"
31 },
32 only_input: true
33 });
34
35 pos_type.refresh();
36
Rushabh Mehta4c36d732015-01-01 15:59:34 +053037 page.main.find(".btn-primary").on("click", function() {
Rushabh Mehta72e17192014-08-08 15:30:49 +053038 erpnext.open_as_pos = true;
39 new_doc(pos_type.get_value());
40 });
41
42 $.ajax({
43 url: "/api/resource/POS Setting",
44 success: function(data) {
45 if(!data.data.length) {
Rushabh Mehta4c36d732015-01-01 15:59:34 +053046 page.main.find(".pos-setting-message").removeClass('hide');
Rushabh Mehta72e17192014-08-08 15:30:49 +053047 }
48 }
49 })
50
51}