|
@ -56,66 +56,6 @@ frappe.ui.form.on('Kilometer Mapping', { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
validate: function (frm) { |
|
|
validate: function (frm) { |
|
|
// //custom button
|
|
|
|
|
|
// frm.add_custom_button(__("Duplicate Data"), function () {
|
|
|
|
|
|
// let d = new frappe.ui.Dialog({
|
|
|
|
|
|
// title: 'Choose the variant',
|
|
|
|
|
|
// fields: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// label: 'Variant',
|
|
|
|
|
|
// fieldname: 'variant',
|
|
|
|
|
|
// fieldtype: 'Link',
|
|
|
|
|
|
// options: "Kilometer Mapping"
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// label: '',
|
|
|
|
|
|
// fieldname: 'content_html',
|
|
|
|
|
|
// fieldtype: 'HTML',
|
|
|
|
|
|
// },
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// size: 'small',
|
|
|
|
|
|
// secondary_action_label: "No",
|
|
|
|
|
|
// primary_action_label: 'Yes',
|
|
|
|
|
|
// primary_action(values) {
|
|
|
|
|
|
// console.log(values);
|
|
|
|
|
|
// if (values) {
|
|
|
|
|
|
|
|
|
|
|
|
// if (frm.doc.config_kilometer && frm.doc.config_kilometer.length > 0) {
|
|
|
|
|
|
// cur_frm.clear_table("config_kilometer");
|
|
|
|
|
|
// cur_frm.refresh_fields('config_kilometer');
|
|
|
|
|
|
// }
|
|
|
|
|
|
// cur_frm.refresh_fields("config_kilometer");
|
|
|
|
|
|
// frappe.call({
|
|
|
|
|
|
// "method": "smart_service.transactions.doctype.kilometer_mapping.kilometer_mapping.get_config_kilometer",
|
|
|
|
|
|
// "args": {
|
|
|
|
|
|
// "doc": values.variant,
|
|
|
|
|
|
// "docname": frm.doc.name
|
|
|
|
|
|
// },
|
|
|
|
|
|
// callback: function (r) {
|
|
|
|
|
|
// if (r.message && r.message.length > 0) {
|
|
|
|
|
|
// cur_frm.refresh_fields("config_kilometer");
|
|
|
|
|
|
// frm.save()
|
|
|
|
|
|
// frm.refresh()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// d.hide();
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
// secondary_action(values) {
|
|
|
|
|
|
// d.hide();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
// d.show();
|
|
|
|
|
|
// var res = $(d.fields_dict.content_html.wrapper).empty();
|
|
|
|
|
|
// var ret = "<p>Upload the Kilometer</p>"
|
|
|
|
|
|
// res.append(ret)
|
|
|
|
|
|
// }).css({ "color": "#fff", "background-color": "red" });;
|
|
|
|
|
|
// //end
|
|
|
|
|
|
|
|
|
|
|
|
frm.doc.kilometer_filter = "All"; |
|
|
frm.doc.kilometer_filter = "All"; |
|
|
if (frm.doc.kilometer_filter == "All") { |
|
|
if (frm.doc.kilometer_filter == "All") { |
|
@ -146,9 +86,7 @@ frappe.ui.form.on('Kilometer Mapping', { |
|
|
secondary_action_label: "No", |
|
|
secondary_action_label: "No", |
|
|
primary_action_label: 'Yes', |
|
|
primary_action_label: 'Yes', |
|
|
primary_action(values) { |
|
|
primary_action(values) { |
|
|
console.log(values.variant); |
|
|
|
|
|
if (values.variant) { |
|
|
if (values.variant) { |
|
|
console.log("calling") |
|
|
|
|
|
cur_frm.refresh_fields("config_kilometer"); |
|
|
cur_frm.refresh_fields("config_kilometer"); |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
"method": "smart_service.transactions.doctype.kilometer_mapping.kilometer_mapping.get_config_kilometer", |
|
|
"method": "smart_service.transactions.doctype.kilometer_mapping.kilometer_mapping.get_config_kilometer", |
|
@ -157,10 +95,17 @@ frappe.ui.form.on('Kilometer Mapping', { |
|
|
"docname": frm.doc.name |
|
|
"docname": frm.doc.name |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
if (r.message && r.message.length > 0) { |
|
|
if (r.message && r.message['status'] == "success") { |
|
|
cur_frm.refresh_fields("config_kilometer"); |
|
|
cur_frm.refresh_fields("config_kilometer"); |
|
|
frm.save() |
|
|
frm.save() |
|
|
|
|
|
|
|
|
|
|
|
frappe.show_alert({ |
|
|
|
|
|
message: __('Saved'), |
|
|
|
|
|
indicator: 'green' |
|
|
|
|
|
}, 5); |
|
|
frm.refresh() |
|
|
frm.refresh() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -181,10 +126,6 @@ frappe.ui.form.on('Kilometer Mapping', { |
|
|
$('.modal-dialog').find('.custom-actions').html('<p>Are you sure to update the <b>kilometer mapping</b>?</p>') |
|
|
$('.modal-dialog').find('.custom-actions').html('<p>Are you sure to update the <b>kilometer mapping</b>?</p>') |
|
|
} |
|
|
} |
|
|
, 300); |
|
|
, 300); |
|
|
|
|
|
|
|
|
// var res = $(d.fields_dict.content_html.wrapper).empty();
|
|
|
|
|
|
// var ret="<p>Are you sure to update the kilometer mapping ?</p>"
|
|
|
|
|
|
// res.append(ret)
|
|
|
|
|
|
}).css({ "color": "#fff", "background-color": "red" });; |
|
|
}).css({ "color": "#fff", "background-color": "red" });; |
|
|
//end
|
|
|
//end
|
|
|
|
|
|
|
|
|