Browse Source

procedure code comment

master
venkataakhil 1 year ago
parent
commit
b666add82d
  1. 156
      smart_service/transactions/doctype/procedure/procedure.js

156
smart_service/transactions/doctype/procedure/procedure.js

@ -60,15 +60,15 @@ frappe.ui.form.on('Procedure', {
// frm.refresh();
},
refresh: function (frm) {
// if (frm.doc.procedure_details) {
// frappe.call({
// "method": "smart_service.transactions.doctype.procedure.procedure.update_system_id",
// "args": {
// "name": frm.doc.name,
// },
// callback: function (r) {
// }
// })
if (frm.doc.procedure_details) {
frappe.call({
"method": "smart_service.transactions.doctype.procedure.procedure.update_system_id",
"args": {
"name": frm.doc.name,
},
callback: function (r) {
}
})
// var url = window.location.host;
@ -82,79 +82,79 @@ frappe.ui.form.on('Procedure', {
// }
// cur_frm.refresh_fields('procedure_details');
// })
// }
// select_row(frm);
// if (frm.doc.procedure_filter == "All") {
// frm.get_field('procedure_details').grid.static_rows = false;
// 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();
// });
// }
// var previous_procedure_name = "";
// var previous_step_name = "";
// $("select[data-fieldname='procedure_filter']").empty();
// $("select[data-fieldname='procedure_filter']").append(new Option("All", "All"));
// $("select[data-fieldname='step_filter']").empty();
// $("select[data-fieldname='step_filter']").append(new Option("All", "All"));
// cur_frm.doc.procedure_filter = "All";
// cur_frm.doc.step_filter = "All";
// frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => {
// if (row.doc.step_name) {
// fn_addSteptolist(row.doc.step_name);
// }
}
select_row(frm);
if (frm.doc.procedure_filter == "All") {
frm.get_field('procedure_details').grid.static_rows = false;
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();
});
}
var previous_procedure_name = "";
var previous_step_name = "";
$("select[data-fieldname='procedure_filter']").empty();
$("select[data-fieldname='procedure_filter']").append(new Option("All", "All"));
$("select[data-fieldname='step_filter']").empty();
$("select[data-fieldname='step_filter']").append(new Option("All", "All"));
cur_frm.doc.procedure_filter = "All";
cur_frm.doc.step_filter = "All";
frm.fields_dict.procedure_details.grid.grid_rows.forEach((row) => {
if (row.doc.step_name) {
fn_addSteptolist(row.doc.step_name);
}
// if (row.doc.procedure_name) {
// fn_addProceduretolist(row.doc.procedure_name);
// }
if (row.doc.procedure_name) {
fn_addProceduretolist(row.doc.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 + '"]').css({ 'background-color': '#FFFFFF' });
// $("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #ebeef0' });
// } 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 + '"]').css({ 'background-color': '#EDEDED' });
// $("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;
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 + '"]').css({ 'background-color': '#FFFFFF' });
$("div[data-fieldname=procedure_details]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').css({ 'border-bottom': '1px Solid #ebeef0' });
} 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 + '"]').css({ 'background-color': '#EDEDED' });
$("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;
// 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' });
// } 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' });
// }
// previous_step_name = row.doc.step_name;
// let id = row.doc.idx;
// });
// if (frm.doc.workflow_state == "Publish Ready" && frappe.user_roles.indexOf("_Admin") > 0) {
// frm.add_custom_button(__('Revoke Publish'), function () {
// //get all system mapping with the procedure linked
// frappe.db.get_list('System Mapping_Sub System', {
// fields: ['parent', 'procedure', 'procedure_status'],
// filters: {
// procedure: frm.doc.name
// }
// }).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>";
// $.each(records, function (index, row) {
// html = html + "<tr><td>" + row.parent + "</td>" + "<td>" + row.procedure + "</td></tr>";
// });
// html = html + "</table></body>";
// frappe.warn('Are you sure you want to Revoke?',
// 'Since there are System Mappings attached to it!!! ' + html,
// () => {
// frm.set_value("workflow_state", "Draft");
// frm.save();
// // action to perform if Continue is selected
// },
// 'Continue', false // Sets dialog as minimizable
// );
// });
// });
// }
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' });
} 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' });
}
previous_step_name = row.doc.step_name;
let id = row.doc.idx;
});
if (frm.doc.workflow_state == "Publish Ready" && frappe.user_roles.indexOf("_Admin") > 0) {
frm.add_custom_button(__('Revoke Publish'), function () {
//get all system mapping with the procedure linked
frappe.db.get_list('System Mapping_Sub System', {
fields: ['parent', 'procedure', 'procedure_status'],
filters: {
procedure: frm.doc.name
}
}).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>";
$.each(records, function (index, row) {
html = html + "<tr><td>" + row.parent + "</td>" + "<td>" + row.procedure + "</td></tr>";
});
html = html + "</table></body>";
frappe.warn('Are you sure you want to Revoke?',
'Since there are System Mappings attached to it!!! ' + html,
() => {
frm.set_value("workflow_state", "Draft");
frm.save();
// action to perform if Continue is selected
},
'Continue', false // Sets dialog as minimizable
);
});
});
}
},
procedure_filter: function (frm) {

Loading…
Cancel
Save