From 7787252bb1d1206b7688b92362e49af02f9107ea Mon Sep 17 00:00:00 2001 From: administrator Date: Mon, 12 Jun 2023 10:06:24 +0000 Subject: [PATCH] code comment --- .../doctype/procedure/procedure.js | 144 +++++++++--------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/smart_service/transactions/doctype/procedure/procedure.js b/smart_service/transactions/doctype/procedure/procedure.js index bc83553..3aa3386 100644 --- a/smart_service/transactions/doctype/procedure/procedure.js +++ b/smart_service/transactions/doctype/procedure/procedure.js @@ -82,78 +82,78 @@ 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); - } - - 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.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 = "

"; - $.each(records, function (index, row) { - html = html + "" + ""; - }); - html = html + "
" + row.parent + "" + row.procedure + "
"; - 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 - ); - }); - }); - } + // 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 == 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 = "

"; + // $.each(records, function (index, row) { + // html = html + "" + ""; + // }); + // html = html + "
" + row.parent + "" + row.procedure + "
"; + // 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) {