|
|
@ -16,12 +16,14 @@ frappe.ui.form.on('Qwik Service', { |
|
|
|
custom_tab_html(frm) |
|
|
|
} |
|
|
|
set_display_order(frm) |
|
|
|
variant(frm) |
|
|
|
}, |
|
|
|
onload:function(frm){ |
|
|
|
if (!frm.is_new()) { |
|
|
|
custom_tab_html(frm) |
|
|
|
} |
|
|
|
set_display_order(frm) |
|
|
|
variant(frm) |
|
|
|
}, |
|
|
|
validate:function(frm){ |
|
|
|
cur_frm.refresh_fields("display_order") |
|
|
@ -56,6 +58,7 @@ frappe.ui.form.on('Qwik Service', { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
check_field_character(frm.doc.service_time) |
|
|
|
}, |
|
|
|
after_save: function (frm) { |
|
|
|
cur_frm.refresh_fields("display_order") |
|
|
@ -77,7 +80,6 @@ frappe.ui.form.on('Qwik Service', { |
|
|
|
frm.refresh_field('kilometers') |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
@ -417,3 +419,29 @@ frappe.ui.form.on('Qwik Service Content',{ |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
function check_field_character(field_name) { |
|
|
|
if (field_name) { |
|
|
|
if (field_name.length > 1) { |
|
|
|
if (field_name.length > 3) { |
|
|
|
frappe.throw("<b>Service Time:</b> Only <b> 3 </b> characters are allowed") |
|
|
|
frappe.validated = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function variant(frm){ |
|
|
|
frappe.call({ |
|
|
|
method: "smart_service.phase_2.doctype.qwik_service.qwik_service.get_kilometer", |
|
|
|
args: { |
|
|
|
vehicle: frm.doc.vehicle, |
|
|
|
service_kilometers: frm.doc.service_kilometers |
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message) |
|
|
|
frm.set_df_property('kilometers', 'options', r.message); |
|
|
|
frm.refresh_field('kilometers') |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|