|
@ -83,78 +83,78 @@ frappe.ui.form.on('Procedure', { |
|
|
cur_frm.refresh_fields('procedure_details'); |
|
|
cur_frm.refresh_fields('procedure_details'); |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
select_row(frm); |
|
|
// select_row(frm);
|
|
|
if (frm.doc.procedure_filter == "All") { |
|
|
// if (frm.doc.procedure_filter == "All") {
|
|
|
frm.get_field('procedure_details').grid.static_rows = false; |
|
|
// frm.get_field('procedure_details').grid.static_rows = false;
|
|
|
frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => { |
|
|
// frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => {
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').show(); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').show();
|
|
|
}); |
|
|
// });
|
|
|
} |
|
|
// }
|
|
|
var previous_procedure_name = ""; |
|
|
// var previous_procedure_name = "";
|
|
|
var previous_step_name = ""; |
|
|
// var previous_step_name = "";
|
|
|
$("select[data-fieldname='procedure_filter']").empty(); |
|
|
// $("select[data-fieldname='procedure_filter']").empty();
|
|
|
$("select[data-fieldname='procedure_filter']").append(new Option("All", "All")); |
|
|
// $("select[data-fieldname='procedure_filter']").append(new Option("All", "All"));
|
|
|
$("select[data-fieldname='step_filter']").empty(); |
|
|
// $("select[data-fieldname='step_filter']").empty();
|
|
|
$("select[data-fieldname='step_filter']").append(new Option("All", "All")); |
|
|
// $("select[data-fieldname='step_filter']").append(new Option("All", "All"));
|
|
|
cur_frm.doc.procedure_filter = "All"; |
|
|
// cur_frm.doc.procedure_filter = "All";
|
|
|
cur_frm.doc.step_filter = "All"; |
|
|
// cur_frm.doc.step_filter = "All";
|
|
|
frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => { |
|
|
// frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => {
|
|
|
if (row.doc.step_name) { |
|
|
// if (row.doc.step_name) {
|
|
|
fn_addSteptolist(row.doc.step_name); |
|
|
// fn_addSteptolist(row.doc.step_name);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (row.doc.procedure_name) { |
|
|
// if (row.doc.procedure_name) {
|
|
|
fn_addProceduretolist(row.doc.procedure_name); |
|
|
// fn_addProceduretolist(row.doc.procedure_name);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
if (row.doc.procedure_name == previous_procedure_name) { |
|
|
// if (row.doc.procedure_name == previous_procedure_name) {
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="procedure_name"]').find('a[data-doctype="Procedure Name"]').css({ 'color': '#EDEDED' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="procedure_name"]').find('a[data-doctype="Procedure Name"]').css({ 'color': '#EDEDED' });
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'background-color': '#FFFFFF' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'background-color': '#FFFFFF' });
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #ebeef0' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #ebeef0' });
|
|
|
} else { |
|
|
// } else {
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="procedure_name"]').find('a[data-doctype="Procedure Name"]').css({ 'color': '#000000' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="procedure_name"]').find('a[data-doctype="Procedure Name"]').css({ 'color': '#000000' });
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'background-color': '#EDEDED' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'background-color': '#EDEDED' });
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #7b7c7c' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #7b7c7c' });
|
|
|
} |
|
|
// }
|
|
|
previous_procedure_name = row.doc.procedure_name; |
|
|
// previous_procedure_name = row.doc.procedure_name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (row.doc.step_name == previous_step_name) { |
|
|
// if (row.doc.step_name == previous_step_name) {
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="step_name"]').find('a[data-doctype="Procedure Step Name"]').css({ 'color': '#DFDFDF' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="step_name"]').find('a[data-doctype="Procedure Step Name"]').css({ 'color': '#DFDFDF' });
|
|
|
} else { |
|
|
// } else {
|
|
|
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="step_name"]').find('a[data-doctype="Procedure Step Name"]').css({ 'color': '#000000' }); |
|
|
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').find('div.col[data-fieldname="step_name"]').find('a[data-doctype="Procedure Step Name"]').css({ 'color': '#000000' });
|
|
|
} |
|
|
// }
|
|
|
previous_step_name = row.doc.step_name; |
|
|
// previous_step_name = row.doc.step_name;
|
|
|
let id = row.doc.idx; |
|
|
// let id = row.doc.idx;
|
|
|
|
|
|
|
|
|
}); |
|
|
// });
|
|
|
|
|
|
|
|
|
if (frm.doc.workflow_state == "Publish Ready" && frappe.user_roles.indexOf("_Admin") > 0) { |
|
|
// if (frm.doc.workflow_state == "Publish Ready" && frappe.user_roles.indexOf("_Admin") > 0) {
|
|
|
frm.add_custom_button(__('Revoke Publish'), function () { |
|
|
// frm.add_custom_button(__('Revoke Publish'), function () {
|
|
|
//get all system mapping with the procedure linked
|
|
|
// //get all system mapping with the procedure linked
|
|
|
frappe.db.get_list('System Mapping_Sub System', { |
|
|
// frappe.db.get_list('System Mapping_Sub System', {
|
|
|
fields: ['parent', 'procedure', 'procedure_status'], |
|
|
// fields: ['parent', 'procedure', 'procedure_status'],
|
|
|
filters: { |
|
|
// filters: {
|
|
|
procedure: frm.doc.name |
|
|
// procedure: frm.doc.name
|
|
|
} |
|
|
// }
|
|
|
}).then(records => { |
|
|
// }).then(records => {
|
|
|
var html = "<br><br><html><head><style>table, th, td {border: 1px solid #DFDFDF; border-collapse: collapse;}table {border-radius: 10px;}th, td {text-align:center;padding: 5px;}</style></head><body><table>"; |
|
|
// var html = "<br><br><html><head><style>table, th, td {border: 1px solid #DFDFDF; border-collapse: collapse;}table {border-radius: 10px;}th, td {text-align:center;padding: 5px;}</style></head><body><table>";
|
|
|
$.each(records, function (index, row) { |
|
|
// $.each(records, function (index, row) {
|
|
|
html = html + "<tr><td>" + row.parent + "</td>" + "<td>" + row.procedure + "</td></tr>"; |
|
|
// html = html + "<tr><td>" + row.parent + "</td>" + "<td>" + row.procedure + "</td></tr>";
|
|
|
}); |
|
|
// });
|
|
|
html = html + "</table></body>"; |
|
|
// html = html + "</table></body>";
|
|
|
frappe.warn('Are you sure you want to Revoke?', |
|
|
// frappe.warn('Are you sure you want to Revoke?',
|
|
|
'Since there are System Mappings attached to it!!! ' + html, |
|
|
// 'Since there are System Mappings attached to it!!! ' + html,
|
|
|
() => { |
|
|
// () => {
|
|
|
frm.set_value("workflow_state", "Draft"); |
|
|
// frm.set_value("workflow_state", "Draft");
|
|
|
frm.save(); |
|
|
// frm.save();
|
|
|
// action to perform if Continue is selected
|
|
|
// // action to perform if Continue is selected
|
|
|
}, |
|
|
// },
|
|
|
'Continue', false // Sets dialog as minimizable
|
|
|
// 'Continue', false // Sets dialog as minimizable
|
|
|
); |
|
|
// );
|
|
|
}); |
|
|
// });
|
|
|
}); |
|
|
// });
|
|
|
} |
|
|
// }
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
procedure_filter: function (frm) { |
|
|
procedure_filter: function (frm) { |
|
@ -225,7 +225,7 @@ frappe.ui.form.on('Procedure', { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
before_workflow_action1: (frm) => { |
|
|
before_workflow_action: (frm) => { |
|
|
if ((frm.doc.workflow_state == 'Review Pending' || frm.doc.workflow_state == 'Publish Ready') && (frm.selected_workflow_action == 'Revoke')) { |
|
|
if ((frm.doc.workflow_state == 'Review Pending' || frm.doc.workflow_state == 'Publish Ready') && (frm.selected_workflow_action == 'Revoke')) { |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
"method": "smart_service.transactions.doctype.procedure.procedure.get_publish_details", |
|
|
"method": "smart_service.transactions.doctype.procedure.procedure.get_publish_details", |
|
|