|
|
@ -76,9 +76,9 @@ frappe.ui.form.on('Special Tool Information', { |
|
|
|
value: "image" |
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message, "r.message") |
|
|
|
// console.log(r.message, "r.message")
|
|
|
|
if (r.message && r.message[0] == false) { |
|
|
|
frm.doc.upload_file = "" |
|
|
|
frm.doc.image = "" |
|
|
|
frm.refresh_fields("image") |
|
|
|
if (r.message[1] == 1) { |
|
|
|
frappe.validated = false; |
|
|
@ -101,9 +101,9 @@ frappe.ui.form.on('Special Tool Information', { |
|
|
|
value: "aggregate_image" |
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message, "r.message") |
|
|
|
// console.log(r.message, "r.message")
|
|
|
|
if (r.message && r.message[0] == false) { |
|
|
|
frm.doc.upload_file = "" |
|
|
|
frm.doc.aggregate_image = "" |
|
|
|
frm.refresh_fields("aggregate_image") |
|
|
|
if (r.message[1] == 1) { |
|
|
|
frappe.validated = false; |
|
|
@ -125,13 +125,19 @@ frappe.ui.form.on('Special Tool Information', { |
|
|
|
// name:frm.doc.name
|
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message, "r.message") |
|
|
|
// console.log(r.message, "r.message")
|
|
|
|
if (r.message && r.message[0] == false) { |
|
|
|
frm.doc.pdf = "" |
|
|
|
frm.refresh_fields("pdf") |
|
|
|
if (r.message[1] == 1) { |
|
|
|
frappe.validated = false; |
|
|
|
frappe.msgprint("Invalid file type") |
|
|
|
frm.reload_doc() |
|
|
|
} |
|
|
|
if (r.message[1] == 2) { |
|
|
|
frappe.validated = false; |
|
|
|
frappe.msgprint("Invalid file size") |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -146,11 +152,18 @@ frappe.ui.form.on('Special Tool Information', { |
|
|
|
name:frm.doc.name |
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message, "r.message") |
|
|
|
// console.log(r.message, "r.message")
|
|
|
|
if (r.message && r.message[0] == false) { |
|
|
|
frm.doc.video = "" |
|
|
|
frm.refresh_fields("video") |
|
|
|
if (r.message[1] == 1) { |
|
|
|
frappe.validated = false; |
|
|
|
frappe.msgprint("Invalid file type") |
|
|
|
frm.reload_doc() |
|
|
|
} |
|
|
|
if (r.message[1] == 2) { |
|
|
|
frappe.validated = false; |
|
|
|
frappe.msgprint("Invalid file size") |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -168,25 +181,25 @@ frappe.ui.form.on('Special Tool Information', { |
|
|
|
if (!frm.is_new()){ |
|
|
|
teb_validation(frm) |
|
|
|
} |
|
|
|
if (frm.doc.instructions) { |
|
|
|
frappe.call({ |
|
|
|
method: "smart_service.phase_2.doctype.special_tool_information.special_tool_information.file_validation_child", |
|
|
|
args: { |
|
|
|
name: frm.doc.name, |
|
|
|
value:"instructions" |
|
|
|
}, |
|
|
|
callback: function (r) { |
|
|
|
console.log(r.message, "----file validation size-------") |
|
|
|
if (r.message && r.message[0] == false) { |
|
|
|
if (r.message[1]) { |
|
|
|
frappe.validated = false; |
|
|
|
frm.reload_doc() |
|
|
|
frappe.throw("In Special Tool information content " + r.message[1] + " row was invalid file type") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// if (frm.doc.instructions) {
|
|
|
|
// frappe.call({
|
|
|
|
// method: "smart_service.phase_2.doctype.special_tool_information.special_tool_information.file_validation_child",
|
|
|
|
// args: {
|
|
|
|
// name: frm.doc.name,
|
|
|
|
// value:"instructions"
|
|
|
|
// },
|
|
|
|
// callback: function (r) {
|
|
|
|
// console.log(r.message, "----file validation size-------")
|
|
|
|
// if (r.message && r.message[0] == false) {
|
|
|
|
// if (r.message[1]) {
|
|
|
|
// frappe.validated = false;
|
|
|
|
// frm.reload_doc()
|
|
|
|
// frappe.throw("In Special Tool information content " + r.message[1] + " row was invalid file type")
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
}, |
|
|
|
}); |
|
|
|
function teb_validation(frm){ |
|
|
@ -200,13 +213,6 @@ function teb_validation(frm){ |
|
|
|
// frm.reload_doc()
|
|
|
|
|
|
|
|
if(frm.doc.category == "TEB"){ |
|
|
|
//to nullify the table
|
|
|
|
if (frm.doc.instructions && frm.doc.instructions.length > 0) { |
|
|
|
|
|
|
|
cur_frm.clear_table("instructions"); |
|
|
|
cur_frm.refresh_fields('instructions'); |
|
|
|
cur_frm.refresh_fields(); |
|
|
|
} |
|
|
|
//to set df property to child readonly based on main doc
|
|
|
|
cur_frm.refresh_fields("instructions"); |
|
|
|
var df = frappe.meta.get_docfield("Instructions", "content", cur_frm.doc.name); |
|
|
@ -282,6 +288,7 @@ frappe.ui.form.on('Instructions', { |
|
|
|
refresh_field("instructions"); |
|
|
|
}, |
|
|
|
content_type: function (frm, cdt, cdn) { |
|
|
|
cur_frm.refresh_field("content_type") |
|
|
|
var select_value = locals[cdt][cdn]; |
|
|
|
var x = select_value.idx - 1; |
|
|
|
if (select_value.content_type == 'Image' || select_value.content_type == 'Video' || select_value.content_type == 'PDF'){ |
|
|
@ -296,11 +303,12 @@ frappe.ui.form.on('Instructions', { |
|
|
|
cur_frm.get_field("instructions").grid.grid_rows[x].columns.content.df.read_only = 0; |
|
|
|
cur_frm.get_field("instructions").grid.grid_rows[x].columns.step_name.df.read_only = 0; |
|
|
|
cur_frm.get_field("instructions").grid.grid_rows[x].columns.title.df.read_only = 0; |
|
|
|
cur_frm.refresh_fields("content_type") |
|
|
|
cur_frm.refresh_field("content_type") |
|
|
|
} |
|
|
|
frm.reload_doc() |
|
|
|
// frm.reload_doc()
|
|
|
|
cur_frm.refresh_fields("content_type") |
|
|
|
refresh_field("instructions"); |
|
|
|
cur_frm.refresh_fields(); |
|
|
|
}, |
|
|
|
}) |
|
|
|
function check_field_character(field_name) { |
|
|
|