-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
// Copyright (c) 2025, Kalutu and contributors | ||
// For license information, please see license.txt | ||
|
||
// frappe.ui.form.on("Ride Booking", { | ||
// refresh(frm) { | ||
frappe.ui.form.on("Ride Booking", { | ||
refresh(frm) {}, | ||
|
||
// }, | ||
// }); | ||
rate(frm) { | ||
frm.trigger("update_total_amount"); | ||
}, | ||
|
||
update_total_amount(frm) { | ||
let total_distance = 0; | ||
for (let item of frm.doc.items) { | ||
total_distance += item.distance; | ||
} | ||
|
||
const amount = frm.doc.rate * total_distance; | ||
frm.set_value("total_amount", amount); | ||
}, | ||
}); | ||
|
||
frappe.ui.form.on("Ride Booking Item", { | ||
refresh(frm) {}, | ||
distance(frm, cdt, cdn) { | ||
frm.trigger("update_total_amount"); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,29 @@ | ||
// Copyright (c) 2025, Kalutu and contributors | ||
// For license information, please see license.txt | ||
|
||
// frappe.ui.form.on("Ride Order", { | ||
// refresh(frm) { | ||
|
||
// }, | ||
// }); | ||
frappe.ui.form.on("Ride Order", { | ||
refresh(frm) { | ||
if (frm.doc.status == "New") { | ||
frm.add_custom_button( | ||
"Accept", | ||
() => { | ||
// change status to accepted | ||
frm.set_value("status", "Accepted"); | ||
// Save form | ||
frm.save(); | ||
}, | ||
"Actions" | ||
); | ||
frm.add_custom_button( | ||
"Reject", | ||
() => { | ||
// change status to accepted | ||
frm.set_value("status", "Rejected"); | ||
// Save form | ||
frm.save(); | ||
}, | ||
"Actions" | ||
); | ||
} | ||
}, | ||
}); |