fix: add new batch form enhancements (#43) invite request doctype and flow (#42)

This commit is contained in:
pateljannat
2021-05-01 14:37:57 +05:30
parent 4bc05bfda8
commit 52f16131af
17 changed files with 323 additions and 40 deletions

View File

@@ -5,27 +5,35 @@ frappe.ready(function () {
"method": "community.lms.doctype.lms_batch_membership.lms_batch_membership.create_membership",
"args": {
"batch": data.title,
"member_type": "Mentor"
"member_type": "Mentor",
"course": data.course
},
"callback": (data) => {
if (data.message == "OK") {
window.location.href = "/courses"
if (data.message) {
window.location.href = `courses/${data.message}`
}
}
})
}
frappe.web_form.validate = () => {
let sysdefaults = frappe.boot.sysdefaults;
let time_format = sysdefaults && sysdefaults.time_format ? sysdefaults.time_format : 'HH:mm:ss';
let data = frappe.web_form.get_values();
data.start_time = moment(data.start_time,time_format).format(time_format)
data.end_time = moment(data.end_time,time_format).format(time_format)
if (!frappe.datetime.validate(data.start_time) || !frappe.datetime.validate(data.end_time)) {
frappe.msgprint(__('Invalid Start or End Time.'));
return false;
}
if (data.start_time > data.end_time) {
frappe.msgprint(__('Start Time should be less than End Time.'));
return false;
}
console.log(data.start_date, date.nowdate())
if (data.start_date < date.nowdate()) {
frappe.msgprint(__('Start date cannot be a past date.'))
return false;

View File

@@ -11,6 +11,7 @@
"apply_document_permissions": 0,
"button_label": "Save",
"creation": "2021-04-20 11:37:49.135114",
"custom_css": ".datepicker.active {\n background-color: white;\n}",
"doc_type": "LMS Batch",
"docstatus": 0,
"doctype": "Web Form",
@@ -18,7 +19,7 @@
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2021-04-26 11:08:00.026388",
"modified": "2021-04-30 11:22:18.188712",
"modified_by": "Administrator",
"module": "LMS",
"name": "add-a-new-batch",
@@ -37,13 +38,13 @@
{
"allow_read_on_all_link_options": 0,
"fieldname": "course",
"fieldtype": "Link",
"fieldtype": "Data",
"hidden": 0,
"label": "Course",
"max_length": 0,
"max_value": 0,
"options": "LMS Course",
"read_only": 0,
"options": "",
"read_only": 1,
"reqd": 0,
"show_in_filter": 0
},
@@ -90,7 +91,7 @@
"fieldname": "start_time",
"fieldtype": "Data",
"hidden": 0,
"label": "Start Time (HH:MM:SS)",
"label": "Start Time",
"max_length": 0,
"max_value": 0,
"read_only": 0,
@@ -102,7 +103,7 @@
"fieldname": "end_time",
"fieldtype": "Data",
"hidden": 0,
"label": "End Time (HH:MM:SS)",
"label": "End Time",
"max_length": 0,
"max_value": 0,
"read_only": 0,