2015-01-29 12:39:11 +00:00
|
|
|
frappe.pages['pos'].on_page_load = function(wrapper) {
|
2015-01-01 10:29:34 +00:00
|
|
|
var page = frappe.ui.make_app_page({
|
2014-08-08 10:00:49 +00:00
|
|
|
parent: wrapper,
|
2014-09-10 07:36:53 +00:00
|
|
|
title: __('Start POS'),
|
2014-08-08 10:00:49 +00:00
|
|
|
single_column: true
|
|
|
|
});
|
|
|
|
|
2015-01-01 10:29:34 +00:00
|
|
|
page.main.html('<div class="text-center" style="padding: 40px">\
|
2014-08-08 10:00:49 +00:00
|
|
|
<p>' + __("Select type of transaction") + '</p>\
|
|
|
|
<p class="select-type" style="margin: auto; max-width: 300px; margin-bottom: 15px;"></p>\
|
2015-01-01 10:29:34 +00:00
|
|
|
<p class="pos-setting-message hide">'
|
|
|
|
+ '<br><a class="btn btn-default btn-sm" onclick="newdoc(\'POS Setting\')">'
|
|
|
|
+ __("Make new POS Setting") + '</a><br><br></p>\
|
|
|
|
<p><button class="btn btn-primary btn-sm">' + __("Start") + '</button></p>\
|
2014-08-08 10:00:49 +00:00
|
|
|
</div>');
|
|
|
|
|
|
|
|
var pos_type = frappe.ui.form.make_control({
|
2015-01-01 10:29:34 +00:00
|
|
|
parent: page.main.find(".select-type"),
|
2014-08-08 10:00:49 +00:00
|
|
|
df: {
|
|
|
|
fieldtype: "Select",
|
|
|
|
options: [
|
|
|
|
{label: __("Billing (Sales Invoice)"), value:"Sales Invoice"},
|
|
|
|
{value:"Sales Order"},
|
|
|
|
{value:"Delivery Note"},
|
|
|
|
{value:"Quotation"},
|
|
|
|
{value:"Purchase Order"},
|
|
|
|
{value:"Purchase Receipt"},
|
|
|
|
{value:"Purchase Invoice"},
|
|
|
|
],
|
|
|
|
fieldname: "pos_type"
|
|
|
|
},
|
|
|
|
only_input: true
|
|
|
|
});
|
|
|
|
|
|
|
|
pos_type.refresh();
|
|
|
|
|
2015-01-01 10:29:34 +00:00
|
|
|
page.main.find(".btn-primary").on("click", function() {
|
2014-08-08 10:00:49 +00:00
|
|
|
erpnext.open_as_pos = true;
|
|
|
|
new_doc(pos_type.get_value());
|
|
|
|
});
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: "/api/resource/POS Setting",
|
|
|
|
success: function(data) {
|
|
|
|
if(!data.data.length) {
|
2015-01-01 10:29:34 +00:00
|
|
|
page.main.find(".pos-setting-message").removeClass('hide');
|
2014-08-08 10:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|