From a56372428b3ef854b1ce51462245c13aeb0b13e6 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 23 Mar 2022 12:12:14 +0000 Subject: [PATCH] update kilometer mapping and login logo --- smart_service/apis/addon_api.py | 5 +-- smart_service/apis/transaction_api.py | 4 +-- smart_service/apis/update_validation.py | 3 +- smart_service/fixtures/client_script.json | 10 +++--- smart_service/hooks.py | 32 ++++++++++-------- smart_service/public/images/Logo Fav Icon.png | Bin 0 -> 821 bytes .../public/images/Mahindra and SS.png | Bin 0 -> 13094 bytes smart_service/public/images/SS Alone.png | Bin 0 -> 8383 bytes .../public/images/SS and Mahindra.png | Bin 0 -> 13150 bytes .../templates/includes/login/_login.js | 12 +++++-- .../kilometer_mapping/kilometer_mapping.py | 20 ++++++++++- .../transactions/doctype/publish/publish.py | 10 +++--- 12 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 smart_service/public/images/Logo Fav Icon.png create mode 100644 smart_service/public/images/Mahindra and SS.png create mode 100644 smart_service/public/images/SS Alone.png create mode 100644 smart_service/public/images/SS and Mahindra.png diff --git a/smart_service/apis/addon_api.py b/smart_service/apis/addon_api.py index 2127649..5a94a64 100644 --- a/smart_service/apis/addon_api.py +++ b/smart_service/apis/addon_api.py @@ -57,7 +57,7 @@ def addon(args): except: api = {"isSuccessful": False} - + return api @@ -165,7 +165,8 @@ def feedback(args, request): except: return {"isSuccessful": False} - + + @frappe.whitelist() def model_hit(args, request): try: diff --git a/smart_service/apis/transaction_api.py b/smart_service/apis/transaction_api.py index 8a96f16..9e2e755 100644 --- a/smart_service/apis/transaction_api.py +++ b/smart_service/apis/transaction_api.py @@ -13,8 +13,8 @@ base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public" @frappe.whitelist() def get_technical_manual(args): try: - manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {1}.`tabVariant Mapping_Assets` where parent='{0}' and category='Technical Manual' - and parentfield = 'assets';'''.format(args,current_db_name), as_dict=True) + manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {0}.`tabVariant Mapping_Assets` where parent='{1}' and category='Technical Manual' + and parentfield = 'assets';'''.format(current_db_name,args), as_dict=True) for i in manual_out: try: diff --git a/smart_service/apis/update_validation.py b/smart_service/apis/update_validation.py index ec7d494..724920b 100644 --- a/smart_service/apis/update_validation.py +++ b/smart_service/apis/update_validation.py @@ -285,12 +285,13 @@ def check_vehicle_update(vehicle_list): @frappe.whitelist() def update_completed(FileName): try: - os.remove(base_url+ FileName) + os.remove(base_url+FileName) return {'isSuccessful':True} except: return {'isSuccessful':False} + @frappe.whitelist() def delete_complete(doc=None,method=None): diff --git a/smart_service/fixtures/client_script.json b/smart_service/fixtures/client_script.json index 022ea52..8e2f42a 100644 --- a/smart_service/fixtures/client_script.json +++ b/smart_service/fixtures/client_script.json @@ -69,12 +69,12 @@ "doctype": "Client Script", "dt": "System Mapping", "enabled": 1, - "modified": "2022-03-16 12:59:16.640573", + "modified": "2022-03-22 19:50:50.489229", "name": "System Mapping-Form", "parent": null, "parentfield": null, "parenttype": null, - "script": "var dusted = false;\n\nvar sub_system_idx = [];\nvar mat_array = [];\n\ncur_frm.fields_dict['variant_mapping'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.transactions.doctype.procedure.procedure.variant\",};\n};\n\ncur_frm.fields_dict['system_sub_systems'].grid.get_field('systems').get_query = function(doc, cdt, cdn){ \n return {query:\"smart_service.transactions.doctype.system_mapping.system_mapping.systems\",};\n};\n\ncur_frm.fields_dict['system_sub_systems'].grid.get_field('procedure').get_query = function(doc, cdt, cdn){ \n return {query:\"smart_service.transactions.doctype.system_mapping.system_mapping.procedure\",};\n};\n\nfrappe.ui.form.on('System Mapping', {\n onload: function(frm) {\n frm.set_query(\"systems\", \"system_sub_systems\", function(doc , cdt, cdn) {\n return {\n \"query\": \"smart_service.transactions.doctype.system_mapping.system_mapping.system_filter\",\n filters:{\n \"system_filter\": frm.doc.system_filter\n }\n };\n });\n frm.set_query(\"systems\", \"systems_assets\", function(doc , cdt, cdn) {\n var system = [];\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n let value = row.doc.systems;\n system.push(value);\n });\n return {\n filters: {'system_name': ['in',system],\n }\n };\n });\n \n frm.trigger('fnLoadmat_initial_values');\n if (frm.doc.kilometer_mapping !== undefined){\n frappe.db.get_doc('Kilometer Mapping', frm.doc.kilometer_mapping)\n .then(doc => {\n frm.set_value(\"km_active_status\",doc.active_status);\n refresh_field(\"km_active_status\");\n });\n \n }\n },\n refresh: function(frm) {\n cur_frm.doc.system_filter = \"All\";\n if(frm.doc.system_filter == \"All\"){\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n }\n\n frm.disable_save(); //*** Check Refresh for Save Function\n\n frm.add_custom_button(__('Save'), function(){\n frm.trigger('fnSave');\n }).addClass(\"btn-warning\").css({'background-color':'#e31a37', 'color':'white'});\n\n frm.fields_dict.system_sub_systems.grid.get_field('procedure').get_query = function(doc, cdt, cdn) {\n \treturn {\n \t\tfilters:[\n \t\t\t['language', '=', frm.doc.language]\n \t\t]\n \t};\n };\n frm.trigger('fnsetsystemsfilter');\n // Make a Copy of Rows Data for Move Function\n sub_system_idx.length = 0;\n frm.fields_dict.system_sub_systems.grid.data.forEach((row) => {\n sub_system_idx.push(row);\n });\n },\n onload_post_render: function(frm) {\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Published\";\n }\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n });\n refresh_field(\"system_sub_systems\");\n },\n variant_mapping: function(frm) {\n frm.trigger('fnSet_SM_KM_4_VM');\n },\n language: function(frm) {\n frm.trigger('fnSet_SM_KM_4_VM');\n },\n system_filter: function(frm) {\n if (frm.doc.system_filter == \"All\"){\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n \n frm.get_field('systems_assets').grid.static_rows = false;\n frm.fields_dict.systems_assets.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n \n } else {\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.systems != frm.doc.system_filter){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n \n frm.get_field('systems_assets').grid.static_rows = false;\n frm.fields_dict.systems_assets.grid.grid_rows.forEach((row) => {\n if (row.doc.systems != frm.doc.system_filter){\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n },\n fnsetsystemsfilter: function(frm){\n var filtered_systems = frm.doc.system_filter;\n $(\"select[data-fieldname='system_filter']\").empty();\n $(\"select[data-fieldname='system_filter']\").append(new Option(\"All\", \"All\"));\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n let value = row.doc.systems;\n if (value)\n if ($(\"select[data-fieldname='system_filter'] option[value='\" + value + \"']\").length === 0){\n $(\"select[data-fieldname='system_filter']\").append(new Option(value, value));\n }\n \n });\n frm.doc.system_filter = filtered_systems;\n //refresh_field(\"system_sub_systems\");\n },\n fnLoadmat_initial_values: function(frm){\n if (frm.doc.system_sub_systems !== undefined){\n mat_array.length = 0;\n frm.doc.system_sub_systems.forEach(row => {\n // ***Update the Current Procedure Status\n if (row.procedure){\n frappe.db.get_doc('Procedure', row.procedure)\n .then(doc => {\n row.procedure_status = doc.workflow_state;\n refresh_field(\"system_sub_systems\");\n });\n }\n // ***Store the Initial MAT values\n var valueToPush = {};\n valueToPush.name = row.name;\n valueToPush.type = (frm.is_new() ? \"New\":\"Initial\");\n valueToPush.mat_initial = (row.mat === undefined ? null:row.mat);\n valueToPush.mat_update = (frm.is_new() ? row.mat:null);\n valueToPush.sub_systems = row.sub_systems;\n valueToPush.procedure_status = row.procedure_status;\n valueToPush.procedure_is_published = row.procedure_is_published;\n mat_array.push(valueToPush);\n });\n }\n },\n fnSave: function(frm){\n //*** Check the respective Kilometer Mapping Document exisits\n if (frm.is_new()) {\n var km_doc_name = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\";\n frappe.db.exists('System Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\")\n .then(smexists => {\n if (smexists){\n frappe.throw(__('System Mapping already Exists!!!'));\n } else {\n console.log(\"Step 2: Checking Kilometer Mapping Doc Exisits\");\n frappe.db.exists('Kilometer Mapping', km_doc_name)\n .then(exists => {\n if (exists) {\n frm.trigger('fnSave_caller');\n } else {\n frappe.db.insert({\n doctype: 'Kilometer Mapping',\n variant_mapping: frm.doc.variant_mapping,\n language:frm.doc.language\n }).then(doc => {\n frm.set_value(\"kilometer_mapping\",doc.name);\n refresh_field(\"kilometer_mapping\");\n frm.trigger('fnSave_caller');\n });\n //frappe.throw(__('Corresponding Kilometer Mapping is Created! Please contact Admin.'));\n }\n });\n }\n });\n } else {\n frm.trigger('fnSave_caller');\n }\n },\n fnSave_caller: function(frm){\n //*** Construct the change point as HTML\n \n var html = \"\";\n $.each(mat_array, function(index, row){\n if (row.type !== \"Initial\"){\n html = html + \"\" ;\n dusted = true;\n }\n });\n html = html + \"
\" + row.sub_systems + \" MAT \" + row.type + \": \" + row.mat_update + \"
\";\n console.log(\"Step 3: HTML Tag Created\");\n \n if (dusted){\n frappe.confirm('Changes will impact KM Mapping - '+ frm.doc.kilometer_mapping + '
This Document status will be set to: Draft

Following are the changes updated:
' + html,\n () => {\n //*** Change the State to Draft for KM\n //console.log(\"Dusted:\" + dusted);\n //console.log(\"Is Dirty:\" + frm.is_dirty());\n frappe.db.set_value('Kilometer Mapping', frm.doc.kilometer_mapping, 'workflow_state', 'Draft')\n .then(r => {\n dusted = false;frm.save();\n // MOVE THIS CODE TO PY FILE ********* START\n console.log(\"Step 4: Array Looing Starts\");\n mat_array.forEach((array_row) => {\n \n //*** Add Edit Delete the respective Kiolmeter with Updated/Deleted MAT\n console.log(\"Calling Function: \" + array_row.type);\n console.log(\"Calling Function: \" + array_row.sub_systems);\n \n if (array_row.type !== \"Initial\"){\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.system_mapping.system_mapping.update_mat\",\n \"args\": {\n \"doc\": cur_frm.doc.name,\n \"km\": frm.doc.kilometer_mapping,\n \"vehicle\": frm.doc.vehicle,\n \"type\": array_row.type,\n \"sub_systems\": array_row.sub_systems,\n \"mat_initial\": array_row.mat_initial, //*** for Deleted\n \"mat_update\": array_row.mat_update, //*** for New, Added & Edited\n \"km_applicable\": 0\n \t},\n \t//freeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n }\n });\n // MOVE THIS CODE TO PY FILE ********* END\n console.log(\"Step 5: Array Looing Ends\");\n frappe.show_alert({\n message:__('Inserted Rows in KM Doc: ' + frm.doc.kilometer_mapping),\n indicator:'green'\n }, 5);\n frm.trigger('fnLoadmat_initial_values');\n });\n }, () => {\n // action to perform if No is selected\n });\n } else if(frm.is_dirty()){\n dusted = false;frm.save();\n frm.trigger('fnLoadmat_initial_values');\n } else {\n frappe.show_alert({\n message:__('No updates for Kilometer Mapping... '),\n indicator:'green'\n }, 5);\n }\n },\n fnSet_SM_KM_4_VM: function (frm) {\n if (frm.doc.variant_mapping === undefined) return;\n frappe.db.exists('System Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\")\n .then(smexists => {\n if (smexists){\n frappe.throw(__('System Mapping already Exists!!!'));\n //frm.set_value(\"variant_mapping\",null);\n //refresh_field(\"variant_mapping\");\n } else {\n frappe.db.exists('Kilometer Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\")\n .then(exists => {\n if (exists){\n frm.set_value(\"kilometer_mapping\",frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\");\n } else {\n frm.set_value(\"kilometer_mapping\",null);\n frm.set_value(\"km_active_status\",\"Not Configured!\");\n }\n });\n }\n });\n }\n});\n\nfrappe.ui.form.on('System Mapping_Sub System', {\n before_system_sub_systems_remove: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n let index = mat_array.findIndex(o => o.name === row.doc.name);\n if (index >= 0){\n \n if (row.doc.mat !== \"\"){\n mat_array[index].type = \"Deleted\";\n mat_array[index].mat_update = row.doc.mat === '' ? null : row.doc.mat;\n }\n }\n },\n system_sub_systems_move: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n\n \tvar id = d.idx;\n \tvar from = id;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n\n let index = sub_system_idx.findIndex(o => o.name === d.name);\n var to = index + 1;\n\n if(from > to) {to = [from, from = to][0];}\n\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n if (row.doc.idx >= from && row.doc.idx <= to) {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }\n }\n });\n refresh_field(\"system_sub_systems\");\n },\n system_sub_systems_add: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var prevrow = frm.fields_dict.system_sub_systems.grid.grid_rows[id-1];\n if (frm.doc.system_filter == \"All\"){\n if (prevrow !== undefined) row.doc.systems = prevrow.doc.systems;\n }else{\n row.doc.systems = frm.doc.system_filter;\n }\n \n },\n systems: function (frm,cdt,cdn) {\n frm.trigger('fnsetsystemsfilter');\n },\n system_sub_systems_remove: function(frm,cdt,cdn) {\n let index = sub_system_idx.findIndex(o => o.name === cdn);\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n if (row.doc.idx >= index) {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }\n }\n });\n frm.refresh();\n frm.doc.system_filter = \"All\";\n },\n systems: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n sub_systems: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n procedure: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n active_status: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n symptom: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n component: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n estimated_time: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n rts: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n cover_image: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n mat: function(frm,cdt,cdn) {\n var res_mat = [];\n var child = locals[cdt,cdn];\n for (var i = 0; i < cur_frm.doc.system_sub_systems.length; i++) {\n for (var j = 0; j < res_mat.length; j++) {\n if (res_mat[j] == cur_frm.doc.system_sub_systems[i].mat) {\n cur_frm.doc.system_sub_systems[i].mat = '';\n cur_frm.refresh_field('mat')\n cur_frm.refresh_fields();\n frappe.throw('You Cannot Select Same MAT ' + cur_frm.doc.system_sub_systems[i].mat + ' Multiple Times');\n }\n }\n if (cur_frm.doc.system_sub_systems[i].mat) {\n res_mat.push(frm.doc.system_sub_systems[i].mat)\n }\n }\n cur_frm.refresh_fields();\n frm.refresh_field(\"system_sub_systems\")\n fn_mat_updated(frm,cdt,cdn)\n },\n sub_systems: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n \tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var procedurename = frm.doc.variant_mapping+\"-\"+d.sub_systems+\"-\"+frm.doc.language;\n frappe.db.exists('Procedure', procedurename)\n .then(exists => {\n if (exists){\n frappe.db.get_doc('Procedure', procedurename)\n .then(doc => {\n row.doc.procedure = doc.name;\n row.doc.procedure_status = doc.workflow_state;\n if (row.doc.estimated_time === undefined) row.doc.estimated_time = doc.estimated_time;\n if (row.doc.rts === undefined) row.doc.rts = doc.rts;\n if (row.doc.mat === undefined) {row.doc.mat = doc.mat; fn_mat_updated(frm,cdt,cdn)}\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure\"]').css({'background-color': '#ffc3c3'});\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n });\n }else{\n row.doc.procedure = \"\";\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n frappe.throw(__('Procedure to be created or sub-system renamed'));\n }\n });\n },\n procedure: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n \tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var procedurename = frm.doc.variant_mapping+\"-\"+d.sub_systems+\"-\"+frm.doc.language;\n if (d.procedure){\n frappe.db.exists('Procedure', d.procedure)\n .then(exists => {\n if (exists){\n frappe.db.get_doc('Procedure', d.procedure)\n .then(doc => {\n row.doc.procedure = doc.name;\n row.doc.procedure_status = doc.workflow_state;\n row.doc.procedure_is_published = 0;\n //if (row.doc.estimated_time === undefined) row.doc.estimated_time = doc.estimated_time;\n //if (row.doc.rts === undefined) row.doc.rts = doc.rts;\n //if (row.doc.mat === undefined) row.doc.mat = doc.mat;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure\"]').css({'background-color': '#ffc3c3'});\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n });\n }else{\n row.doc.procedure = \"\";\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n frappe.throw(__('Procedure to be created or sub-system renamed'));\n }\n });\n } else {\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n }\n },\n});\n\nfunction fn_updateProceduteStatus(frm,cdt,cdn){\n var d = locals[cdt][cdn];\n\tvar id = d.idx;\n\tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n }\n refresh_field(\"system_sub_systems\"); \n\n}\nfunction fn_mat_updated(frm,cdt,cdn){\n fn_updateProceduteStatus(frm,cdt,cdn);\n var d = locals[cdt][cdn];\n\tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n let index = mat_array.findIndex(o => o.name === row.doc.name);\n if (index >= 0){\n mat_array[index].mat_update = row.doc.mat === '' ? null : row.doc.mat;\n if (row.doc.mat === \"\"){\n if (mat_array[index].mat_initial === null){\n mat_array[index].type = \"Initial\";\n if (mat_array[index].procedure_is_published){\n row.doc.procedure_status = \"Published\";\n row.doc.procedure_is_published = 1;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n row.toggle_editable_row(false);\n }\n } else {mat_array[index].type = \"Deleted\";}\n } else {\n if (mat_array[index].mat_initial === null){\n mat_array[index].type = \"Added\";\n } else {\n if (mat_array[index].mat_initial == row.doc.mat){\n mat_array[index].type = \"Initial\";\n if (mat_array[index].procedure_is_published){\n row.doc.procedure_status = \"Published\";\n row.doc.procedure_is_published = 1;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n row.toggle_editable_row(false);\n }\n } else {mat_array[index].type = \"Edited\";}\n }\n }\n } else {\n var valueToPush = {};\n valueToPush.name = row.doc.name;\n valueToPush.type = \"New\";\n valueToPush.mat_initial = null;\n valueToPush.mat_update = row.doc.mat;\n valueToPush.sub_systems = row.doc.sub_systems;\n valueToPush.procedure_status = row.doc.procedure_status;\n valueToPush.procedure_is_published = row.doc.procedure_is_published;\n mat_array.push(valueToPush);\n }\n\n}\n\nfrappe.ui.form.on('System Mapping_System Assets', {\n remarks: function(frm,cdt,cdn){\n\t\tvar child = locals[cdt][cdn];\n\t\tif(child.active_status == \"Active\"){\n\t\tchild.remarks = '';\n\t\tcur_frm.refresh_fields();\n\t\tfrappe.throw(\"Remarks should not allow for Active status\")\n\t\t}\n\t},\n\tactive_status: function(frm,cdt,cdn){\n\t\tvar child = locals[cdt][cdn];\n\t\tchild.remarks = '';\n\t\tcur_frm.refresh_fields();\n\n\t},\n systems_assets_add: function(frm,cdt,cdn){\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.systems_assets.grid.grid_rows[id];\n var prevrow = frm.fields_dict.systems_assets.grid.grid_rows[id-1];\n if (frm.doc.system_filter == \"All\"){\n if (prevrow !== undefined) row.doc.systems = prevrow.doc.systems;\n }else{\n row.doc.systems = frm.doc.system_filter;\n }\n row.doc.language = frm.doc.language;\n cur_frm.refresh_fields();\n }\n});", + "script": "var dusted = false;\n\nvar sub_system_idx = [];\nvar mat_array = [];\n\ncur_frm.fields_dict['variant_mapping'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.transactions.doctype.procedure.procedure.variant\",};\n};\n\ncur_frm.fields_dict['system_sub_systems'].grid.get_field('systems').get_query = function(doc, cdt, cdn){ \n return {query:\"smart_service.transactions.doctype.system_mapping.system_mapping.systems\",};\n};\n\ncur_frm.fields_dict['system_sub_systems'].grid.get_field('procedure').get_query = function(doc, cdt, cdn){ \n return {query:\"smart_service.transactions.doctype.system_mapping.system_mapping.procedure\",};\n};\n\nfrappe.ui.form.on('System Mapping', {\n onload: function(frm) {\n frm.set_query(\"systems\", \"system_sub_systems\", function(doc , cdt, cdn) {\n return {\n \"query\": \"smart_service.transactions.doctype.system_mapping.system_mapping.system_filter\",\n filters:{\n \"system_filter\": frm.doc.system_filter\n }\n };\n });\n frm.set_query(\"systems\", \"systems_assets\", function(doc , cdt, cdn) {\n var system = [];\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n let value = row.doc.systems;\n system.push(value);\n });\n return {\n filters: {'system_name': ['in',system],\n }\n };\n });\n \n frm.trigger('fnLoadmat_initial_values');\n if (frm.doc.kilometer_mapping !== undefined){\n frappe.db.get_doc('Kilometer Mapping', frm.doc.kilometer_mapping)\n .then(doc => {\n frm.set_value(\"km_active_status\",doc.active_status);\n refresh_field(\"km_active_status\");\n });\n \n }\n },\n refresh: function(frm) {\n cur_frm.doc.system_filter = \"All\";\n if(frm.doc.system_filter == \"All\"){\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n }\n\n frm.disable_save(); //*** Check Refresh for Save Function\n\n frm.add_custom_button(__('Save'), function(){\n frm.trigger('fnSave');\n }).addClass(\"btn-warning\").css({'background-color':'#e31a37', 'color':'white'});\n\n frm.fields_dict.system_sub_systems.grid.get_field('procedure').get_query = function(doc, cdt, cdn) {\n \treturn {\n \t\tfilters:[\n \t\t\t['language', '=', frm.doc.language]\n \t\t]\n \t};\n };\n frm.trigger('fnsetsystemsfilter');\n // Make a Copy of Rows Data for Move Function\n sub_system_idx.length = 0;\n frm.fields_dict.system_sub_systems.grid.data.forEach((row) => {\n sub_system_idx.push(row);\n });\n },\n onload_post_render: function(frm) {\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Published\";\n }\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n });\n refresh_field(\"system_sub_systems\");\n },\n variant_mapping: function(frm) {\n frm.trigger('fnSet_SM_KM_4_VM');\n },\n language: function(frm) {\n frm.trigger('fnSet_SM_KM_4_VM');\n },\n system_filter: function(frm) {\n if (frm.doc.system_filter == \"All\"){\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n \n frm.get_field('systems_assets').grid.static_rows = false;\n frm.fields_dict.systems_assets.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n \n } else {\n frm.get_field('system_sub_systems').grid.static_rows = false;\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.systems != frm.doc.system_filter){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n \n frm.get_field('systems_assets').grid.static_rows = false;\n frm.fields_dict.systems_assets.grid.grid_rows.forEach((row) => {\n if (row.doc.systems != frm.doc.system_filter){\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=systems_assets]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n },\n fnsetsystemsfilter: function(frm){\n var filtered_systems = frm.doc.system_filter;\n $(\"select[data-fieldname='system_filter']\").empty();\n $(\"select[data-fieldname='system_filter']\").append(new Option(\"All\", \"All\"));\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n let value = row.doc.systems;\n if (value)\n if ($(\"select[data-fieldname='system_filter'] option[value='\" + value + \"']\").length === 0){\n $(\"select[data-fieldname='system_filter']\").append(new Option(value, value));\n }\n \n });\n frm.doc.system_filter = filtered_systems;\n //refresh_field(\"system_sub_systems\");\n },\n fnLoadmat_initial_values: function(frm){\n if (frm.doc.system_sub_systems !== undefined){\n mat_array.length = 0;\n frm.doc.system_sub_systems.forEach(row => {\n // ***Update the Current Procedure Status\n if (row.procedure){\n frappe.db.get_doc('Procedure', row.procedure)\n .then(doc => {\n row.procedure_status = doc.workflow_state;\n refresh_field(\"system_sub_systems\");\n });\n }\n // ***Store the Initial MAT values\n var valueToPush = {};\n valueToPush.name = row.name;\n valueToPush.type = (frm.is_new() ? \"New\":\"Initial\");\n valueToPush.mat_initial = (row.mat === undefined ? null:row.mat);\n valueToPush.mat_update = (frm.is_new() ? row.mat:null);\n valueToPush.sub_systems = row.sub_systems;\n valueToPush.procedure_status = row.procedure_status;\n valueToPush.procedure_is_published = row.procedure_is_published;\n mat_array.push(valueToPush);\n });\n }\n },\n fnSave: function(frm){\n console.log(\"MAT \" + mat_array.length)\n //*** Check the respective Kilometer Mapping Document exisits\n if (frm.is_new()) {\n var km_doc_name = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\";\n frappe.db.exists('System Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\")\n .then(smexists => {\n if (smexists){\n frappe.throw(__('System Mapping already Exists!!!'));\n } else {\n console.log(\"Step 2: Checking Kilometer Mapping Doc Exisits\");\n frappe.db.exists('Kilometer Mapping', km_doc_name)\n .then(exists => {\n if (exists) {\n frm.trigger('fnSave_caller');\n } else {\n frappe.db.insert({\n doctype: 'Kilometer Mapping',\n variant_mapping: frm.doc.variant_mapping,\n language:frm.doc.language\n }).then(doc => {\n frm.set_value(\"kilometer_mapping\",doc.name);\n refresh_field(\"kilometer_mapping\");\n frm.trigger('fnSave_caller');\n });\n //frappe.throw(__('Corresponding Kilometer Mapping is Created! Please contact Admin.'));\n }\n });\n }\n });\n } else {\n frm.trigger('fnSave_caller');\n }\n },\n fnSave_caller: function(frm){\n //*** Construct the change point as HTML\n \n var html = \"\";\n $.each(mat_array, function(index, row){\n if (row.type !== \"Initial\"){\n html = html + \"\" ;\n dusted = true;\n }\n });\n html = html + \"
\" + row.sub_systems + \" MAT \" + row.type + \": \" + row.mat_update + \"
\";\n console.log(\"Step 3: HTML Tag Created\");\n \n if (dusted){\n \n frappe.confirm('Changes will impact KM Mapping - '+ frm.doc.kilometer_mapping + '
This Document status will be set to: Draft

Following are the changes updated:
' + html,\n () => {\n //*** Change the State to Draft for KM\n //console.log(\"Dusted:\" + dusted);\n //console.log(\"Is Dirty:\" + frm.is_dirty());\n frappe.db.set_value('Kilometer Mapping', frm.doc.kilometer_mapping, 'workflow_state', 'Draft')\n .then(r => {\n dusted = false;frm.save();\n // MOVE THIS CODE TO PY FILE ********* START\n console.log(\"Step 4: Array Looing Starts\");\n mat_array.forEach((array_row) => {\n \n //*** Add Edit Delete the respective Kiolmeter with Updated/Deleted MAT\n console.log(\"Calling Function: \" + array_row.type);\n console.log(\"Calling Function: \" + array_row.sub_systems);\n \n if (array_row.type !== \"Initial\"){\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.system_mapping.system_mapping.update_mat\",\n \"args\": {\n \"doc\": cur_frm.doc.name,\n \"km\": frm.doc.kilometer_mapping,\n \"vehicle\": frm.doc.vehicle,\n \"type\": array_row.type,\n \"sub_systems\": array_row.sub_systems,\n \"mat_initial\": array_row.mat_initial, //*** for Deleted\n \"mat_update\": array_row.mat_update, //*** for New, Added & Edited\n \"km_applicable\": 0\n \t},\n \t//freeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n }\n });\n // MOVE THIS CODE TO PY FILE ********* END\n console.log(\"Step 5: Array Looing Ends\");\n frappe.show_alert({\n message:__('Inserted Rows in KM Doc: ' + frm.doc.kilometer_mapping),\n indicator:'green'\n }, 5);\n frm.trigger('fnLoadmat_initial_values');\n });\n }, () => {\n // action to perform if No is selected\n });\n } else if(frm.is_dirty()){\n dusted = false;frm.save();\n frm.trigger('fnLoadmat_initial_values');\n } else {\n frappe.show_alert({\n message:__('No updates for Kilometer Mapping... '),\n indicator:'green'\n }, 5);\n }\n },\n fnSet_SM_KM_4_VM: function (frm) {\n if (frm.doc.variant_mapping === undefined) return;\n frappe.db.exists('System Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\")\n .then(smexists => {\n if (smexists){\n frappe.throw(__('System Mapping already Exists!!!'));\n //frm.set_value(\"variant_mapping\",null);\n //refresh_field(\"variant_mapping\");\n } else {\n frappe.db.exists('Kilometer Mapping', frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\")\n .then(exists => {\n if (exists){\n frm.set_value(\"kilometer_mapping\",frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\");\n } else {\n frm.set_value(\"kilometer_mapping\",null);\n frm.set_value(\"km_active_status\",\"Not Configured!\");\n }\n });\n }\n });\n }\n});\n\nfrappe.ui.form.on('System Mapping_Sub System', {\n before_system_sub_systems_remove: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n let index = mat_array.findIndex(o => o.name === row.doc.name);\n if (index >= 0){\n \n if (row.doc.mat !== \"\"){\n mat_array[index].type = \"Deleted\";\n mat_array[index].mat_update = row.doc.mat === '' ? null : row.doc.mat;\n }\n }\n },\n system_sub_systems_move: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n\n \tvar id = d.idx;\n \tvar from = id;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n\n let index = sub_system_idx.findIndex(o => o.name === d.name);\n var to = index + 1;\n\n if(from > to) {to = [from, from = to][0];}\n\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n if (row.doc.idx >= from && row.doc.idx <= to) {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }\n }\n });\n refresh_field(\"system_sub_systems\");\n },\n system_sub_systems_add: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var prevrow = frm.fields_dict.system_sub_systems.grid.grid_rows[id-1];\n if (frm.doc.system_filter == \"All\"){\n if (prevrow !== undefined) row.doc.systems = prevrow.doc.systems;\n }else{\n row.doc.systems = frm.doc.system_filter;\n }\n \n },\n systems: function (frm,cdt,cdn) {\n frm.trigger('fnsetsystemsfilter');\n },\n system_sub_systems_remove: function(frm,cdt,cdn) {\n let index = sub_system_idx.findIndex(o => o.name === cdn);\n frm.fields_dict.system_sub_systems.grid.grid_rows.forEach((row) => {\n if (row.doc.procedure_status == \"Publish Ready\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }else if (row.doc.procedure_status == \"Published\"){\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n } else {\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffffff'});\n }\n if (row.doc.idx >= index) {\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n }\n }\n });\n frm.refresh();\n frm.doc.system_filter = \"All\";\n },\n systems: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n sub_systems: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n procedure: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n active_status: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n symptom: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n component: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n estimated_time: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n rts: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n cover_image: function(frm,cdt,cdn) {fn_updateProceduteStatus(frm,cdt,cdn)},\n mat: function(frm,cdt,cdn) {\n var res_mat = [];\n var child = locals[cdt,cdn];\n for (var i = 0; i < cur_frm.doc.system_sub_systems.length; i++) {\n for (var j = 0; j < res_mat.length; j++) {\n if (res_mat[j] == cur_frm.doc.system_sub_systems[i].mat) {\n cur_frm.doc.system_sub_systems[i].mat = '';\n cur_frm.refresh_field('mat')\n cur_frm.refresh_fields();\n frappe.throw('You Cannot Select Same MAT ' + cur_frm.doc.system_sub_systems[i].mat + ' Multiple Times');\n }\n }\n if (cur_frm.doc.system_sub_systems[i].mat) {\n res_mat.push(frm.doc.system_sub_systems[i].mat)\n }\n }\n cur_frm.refresh_fields();\n frm.refresh_field(\"system_sub_systems\")\n fn_mat_updated(frm,cdt,cdn)\n },\n sub_systems: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n \tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var procedurename = frm.doc.variant_mapping+\"-\"+d.sub_systems+\"-\"+frm.doc.language;\n frappe.db.exists('Procedure', procedurename)\n .then(exists => {\n if (exists){\n frappe.db.get_doc('Procedure', procedurename)\n .then(doc => {\n row.doc.procedure = doc.name;\n row.doc.procedure_status = doc.workflow_state;\n if (row.doc.estimated_time === undefined) row.doc.estimated_time = doc.estimated_time;\n if (row.doc.rts === undefined) row.doc.rts = doc.rts;\n if (row.doc.mat === undefined) {row.doc.mat = doc.mat; fn_mat_updated(frm,cdt,cdn)}\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure\"]').css({'background-color': '#ffc3c3'});\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n });\n }else{\n row.doc.procedure = \"\";\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n frappe.throw(__('Procedure to be created or sub-system renamed'));\n }\n });\n },\n procedure: function(frm,cdt,cdn) {\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n \tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n var procedurename = frm.doc.variant_mapping+\"-\"+d.sub_systems+\"-\"+frm.doc.language;\n if (d.procedure){\n frappe.db.exists('Procedure', d.procedure)\n .then(exists => {\n if (exists){\n frappe.db.get_doc('Procedure', d.procedure)\n .then(doc => {\n row.doc.procedure = doc.name;\n row.doc.procedure_status = doc.workflow_state;\n row.doc.procedure_is_published = 0;\n //if (row.doc.estimated_time === undefined) row.doc.estimated_time = doc.estimated_time;\n //if (row.doc.rts === undefined) row.doc.rts = doc.rts;\n //if (row.doc.mat === undefined) row.doc.mat = doc.mat;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure\"]').css({'background-color': '#ffc3c3'});\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n });\n }else{\n row.doc.procedure = \"\";\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n frappe.throw(__('Procedure to be created or sub-system renamed'));\n }\n });\n } else {\n row.doc.procedure_status = \"\";\n row.toggle_editable_row(false);\n refresh_field(\"system_sub_systems\");\n }\n },\n});\n\nfunction fn_updateProceduteStatus(frm,cdt,cdn){\n var d = locals[cdt][cdn];\n\tvar id = d.idx;\n\tid = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n if (row.doc.procedure_is_published == 1){\n // row.doc.procedure_status = \"Publish Ready\";\n row.doc.procedure_is_published = 0;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffc3c3'});\n row.toggle_editable_row(false);\n }\n refresh_field(\"system_sub_systems\"); \n\n}\nfunction fn_mat_updated(frm,cdt,cdn){\n fn_updateProceduteStatus(frm,cdt,cdn);\n var d = locals[cdt][cdn];\n\tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.system_sub_systems.grid.grid_rows[id];\n let index = mat_array.findIndex(o => o.name === row.doc.name);\n if (index >= 0){\n mat_array[index].mat_update = row.doc.mat === '' ? null : row.doc.mat;\n if (row.doc.mat === \"\"){\n if (mat_array[index].mat_initial === null){\n mat_array[index].type = \"Initial\";\n if (mat_array[index].procedure_is_published){\n row.doc.procedure_status = \"Published\";\n row.doc.procedure_is_published = 1;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n row.toggle_editable_row(false);\n }\n } else {mat_array[index].type = \"Deleted\";}\n } else {\n if (mat_array[index].mat_initial === null){\n mat_array[index].type = \"Added\";\n } else {\n if (mat_array[index].mat_initial == row.doc.mat){\n mat_array[index].type = \"Initial\";\n if (mat_array[index].procedure_is_published){\n row.doc.procedure_status = \"Published\";\n row.doc.procedure_is_published = 1;\n $(\"div[data-fieldname=system_sub_systems]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#93f163'});\n row.toggle_editable_row(false);\n }\n } else {mat_array[index].type = \"Edited\";}\n }\n }\n } else {\n var valueToPush = {};\n valueToPush.name = row.doc.name;\n valueToPush.type = \"New\";\n valueToPush.mat_initial = null;\n valueToPush.mat_update = row.doc.mat;\n valueToPush.sub_systems = row.doc.sub_systems;\n valueToPush.procedure_status = row.doc.procedure_status;\n valueToPush.procedure_is_published = row.doc.procedure_is_published;\n mat_array.push(valueToPush);\n }\n\n}\n\nfrappe.ui.form.on('System Mapping_System Assets', {\n remarks: function(frm,cdt,cdn){\n\t\tvar child = locals[cdt][cdn];\n\t\tif(child.active_status == \"Active\"){\n\t\tchild.remarks = '';\n\t\tcur_frm.refresh_fields();\n\t\tfrappe.throw(\"Remarks should not allow for Active status\")\n\t\t}\n\t},\n\tactive_status: function(frm,cdt,cdn){\n\t\tvar child = locals[cdt][cdn];\n\t\tchild.remarks = '';\n\t\tcur_frm.refresh_fields();\n\n\t},\n systems_assets_add: function(frm,cdt,cdn){\n \tvar d = locals[cdt][cdn];\n \tvar id = d.idx;\n id = id-1;\n var row = frm.fields_dict.systems_assets.grid.grid_rows[id];\n var prevrow = frm.fields_dict.systems_assets.grid.grid_rows[id-1];\n if (frm.doc.system_filter == \"All\"){\n if (prevrow !== undefined) row.doc.systems = prevrow.doc.systems;\n }else{\n row.doc.systems = frm.doc.system_filter;\n }\n row.doc.language = frm.doc.language;\n cur_frm.refresh_fields();\n }\n});", "view": "Form" }, { @@ -82,7 +82,7 @@ "doctype": "Client Script", "dt": "Publish", "enabled": 1, - "modified": "2022-03-21 14:39:16.544555", + "modified": "2022-03-22 17:30:13.019123", "name": "Publish-Form", "parent": null, "parentfield": null, @@ -95,12 +95,12 @@ "doctype": "Client Script", "dt": "Kilometer Mapping", "enabled": 1, - "modified": "2022-03-18 13:47:59.029016", + "modified": "2022-03-23 12:51:48.480786", "name": "Kilometer Mapping-Form", "parent": null, "parentfield": null, "parenttype": null, - "script": "cur_frm.fields_dict['variant_mapping'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.transactions.doctype.procedure.procedure.variant\",};\n};\n\nvar trigger = true;\nfrappe.ui.form.on('Kilometer Mapping', {\n before_load: function (frm){\n frm.get_field('config_kilometer').grid.cannot_add_rows = true;\n frm.get_field(\"config_kilometer\").grid.df.cannot_delete_rows = true;\n },\n onload: function(frm) {\n frm.get_field('config_kilometer').grid.cannot_add_rows = true;\n frm.get_field(\"config_kilometer\").grid.df.cannot_delete_rows = true;\n\n //*** allign idx while deleting rows\n //if(cur_frm.doc.config_kilometer){\n //for (var i =0;i {\n smrecords.sort(sortsm);\n $.each(smrecords, function(index, smrow){\n sub_system_set.push(smrow.sub_systems);\n });\n frm.set_df_property('sub_system_filter', 'options', sub_system_set);\n });\n frappe.db.get_list('Vehicle_SK', {\n fields: ['service_kilometers'],\n //filters: { parent: frm.doc.variant_mapping }\n filters: { parent: frm.doc.vehicle }\n }).then(kmrecord => {\n kmrecord.sort(sortkm);\n $.each(kmrecord, function(index, kmsrow){\n kilometer_set.push(kmsrow.service_kilometers);\n });\n frm.set_df_property('kilometer_filter', 'options', kilometer_set);\n });\n }\n },\n refresh: function(frm) {\n\t\tvar previous_kilometer = \"\";\n\t\t//console.log(frm.doc.sub_system_filter,frm.doc.kilometer_filter);\n\t\tif (frm.doc.sub_system_filter ==\"All\" && frm.doc.kilometer_filter ==\"All\"){\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.kilometer == previous_kilometer){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#EDEDED'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#FFFFFF'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #ebeef0'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n }else{\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#000000'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#EDEDED'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #7b7c7c'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n }\n previous_kilometer = row.doc.kilometer;\n let id = row.doc.idx;\n });\n\t\t} else {\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#000000'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#FFFFFF'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #ebeef0'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n });\n\t\t}\n\t},\n\t\n variant_mapping: function(frm) {\n if(frm.doc.variant_mapping === undefined) {return;}\n var filter = frm.doc.variant_mapping + \"-en-SM\";\n var sub_system_set = ['All'];\n var kilometer_set = ['All'];\n frappe.db.get_list('System Mapping_Sub System', {\n fields: ['sub_systems', 'mat','idx'],\n filters: { \n parent: filter,\n \"mat\": [\"!=\",'']\n }\n }).then(smrecords => {\n smrecords.sort(sortsm);\n $.each(smrecords, function(index, smrow){\n sub_system_set.push(smrow.sub_systems);\n });\n frm.set_df_property('sub_system_filter', 'options', sub_system_set);\n \n frappe.db.get_list('Vehicle_SK', {\n fields: ['service_kilometers'],\n filters: { parent: frm.doc.vehicle }\n }).then(kmrecord => {\n kmrecord.sort(sortkm);\n $.each(kmrecord, function(index, kmsrow){\n kilometer_set.push(kmsrow.service_kilometers);\n });\n frm.set_df_property('kilometer_filter', 'options', kilometer_set);\n $.each(kmrecord, function(index, kmrow){\n $.each(smrecords, function(index, smrow){\n if (smrow.mat !== null){\n var child = cur_frm.add_child(\"config_kilometer\");\n child.sub_systems = smrow.sub_systems;\n child.mat = smrow.mat;\n child.kilometer = kmrow.service_kilometers;\n }\n });\n frm.refresh();\n }); \n });\n });\n },\n kilometer_filter: function(frm) {\n if (!trigger){ trigger = true; return;}\n if (frm.doc.sub_system_filter !=\"All\"){trigger=false;frm.set_value(\"sub_system_filter\",\"All\");}\n if (frm.doc.kilometer_filter ==\"All\"){\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n } else {\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.kilometer != frm.doc.kilometer_filter){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n frm.refresh();\n },\n sub_system_filter: function(frm) {\n if (!trigger){ trigger = true; return;}\n if (frm.doc.kilometer_filter !=\"All\"){trigger=false;frm.set_value(\"kilometer_filter\",\"All\");}\n \n if (frm.doc.sub_system_filter ==\"All\"){\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n } else {\n frm.get_field('config_kilometer').grid.static_rows = true;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.sub_systems != frm.doc.sub_system_filter){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n frm.refresh();\n },\n sort_by_kilometer: function(frm) {\n var idx = 1;\n frm.doc.config_kilometer.sort(function(a,b){\n if (parseInt(a.kilometer) < parseInt(b.kilometer)){ return -1 }\n else if ( parseInt(a.kilometer) > parseInt(b.kilometer)){ return 1 }\n return 1;\n });\n \n frm.doc.config_kilometer.map(function(item){\n item.idx = idx++;\n });\n if (frm.doc.temp_field == \"Set\") {frm.set_value(\"temp_field\",\"Not Set\");} else {frm.set_value(\"temp_field\",\"Set\");}\n refresh_field(\"config_kilometer\");\n }\n});\n\nfrappe.ui.form.on('Kilometer Mapping_Items', {\n config_kilometer_move: function(frm) {\n frm.refresh();\n }\n});\n\nfunction sortkm(a, b) {\n if (parseInt(a.service_kilometers) < parseInt(b.service_kilometers)){return -1;}\n if (parseInt(a.service_kilometers) > parseInt(b.service_kilometers)){return 1;}\n return 0;\n}\n\nfunction sortsm(a, b) {\n if (a.sub_systems < b.sub_systems){return -1;}\n if (a.sub_systems > b.sub_systems){return 1;}\n return 0;\n}", + "script": "cur_frm.fields_dict['variant_mapping'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.transactions.doctype.procedure.procedure.variant\",};\n};\n\nvar trigger = true;\nfrappe.ui.form.on('Kilometer Mapping', {\n before_load: function (frm){\n frm.get_field('config_kilometer').grid.cannot_add_rows = true;\n frm.get_field(\"config_kilometer\").grid.df.cannot_delete_rows = true;\n },\n onload: function(frm) {\n frm.get_field('config_kilometer').grid.cannot_add_rows = true;\n frm.get_field(\"config_kilometer\").grid.df.cannot_delete_rows = true;\n\n //*** allign idx while deleting rows\n //if(cur_frm.doc.config_kilometer){\n //for (var i =0;i {\n smrecords.sort(sortsm);\n $.each(smrecords, function(index, smrow){\n sub_system_set.push(smrow.sub_systems);\n });\n frm.set_df_property('sub_system_filter', 'options', sub_system_set);\n });\n frappe.db.get_list('Vehicle_SK', {\n fields: ['service_kilometers'],\n //filters: { parent: frm.doc.variant_mapping }\n filters: { parent: frm.doc.vehicle }\n }).then(kmrecord => {\n kmrecord.sort(sortkm);\n $.each(kmrecord, function(index, kmsrow){\n kilometer_set.push(kmsrow.service_kilometers);\n });\n frm.set_df_property('kilometer_filter', 'options', kilometer_set);\n });\n }\n },\n refresh: function(frm) {\n // frm.get_field('config_kilometer').grid.cannot_add_rows = true;\n // frm.get_field(\"config_kilometer\").grid.df.cannot_delete_rows = true;\n\t\tvar previous_kilometer = \"\";\n\t\t//console.log(frm.doc.sub_system_filter,frm.doc.kilometer_filter);\n\t\tif (frm.doc.sub_system_filter ==\"All\" && frm.doc.kilometer_filter ==\"All\"){\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.kilometer == previous_kilometer){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#EDEDED'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#FFFFFF'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #ebeef0'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n }else{\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#000000'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#EDEDED'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #7b7c7c'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n }\n previous_kilometer = row.doc.kilometer;\n let id = row.doc.idx;\n });\n\t\t} else {\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'color': '#000000'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'background-color': '#FFFFFF'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').css({'border-bottom': '1px Solid #ebeef0'});\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').find('div.col[data-fieldname=\"kilometer\"]').css({'text-align': 'right'});\n });\n\t\t}\n\t},\n\t\tvariant_mapping: function(frm,cdt,cdn) {\n\t\tif(frm.doc.variant_mapping === undefined) {return;}\n\t\t\t var filter = frm.doc.variant_mapping + \"-en-SM\";\n\t\t\t var sub_system_set = ['All'];\n\t\t\t var kilometer_set = ['All'];\n\t\t\t frappe.call({\n\t\t\t\t\"method\": \"smart_service.transactions.doctype.kilometer_mapping.kilometer_mapping.get_subsystem\",\n\t\t\t\t\"args\": {\n\t\t\t\t\t\"doc\": frm.doc.variant_mapping,\n\t\t\t\t},\n\t\t\t\tcallback: function(r) {\n\t\t\t\t\t$.each(r.message, function(index, smrow){\n\t\t\t\t\t\tr.message.sort(sortsm);\n\t\t\t\t\t\tsub_system_set.push(smrow.sub_systems);\n\t\t\t\t\t});\n\t\t\t\t\tfrm.set_df_property('sub_system_filter', 'options', [...new Set(sub_system_set)]);\n\t\t\t \n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tfrappe.db.get_list('Vehicle_SK', {\n\t\t\t\t\t fields: ['service_kilometers'],\n\t\t\t\t\t filters: { parent: frm.doc.vehicle }\n\t\t\t\t }).then(kmrecord => {\n\t\t\t\t\t kmrecord.sort(sortkm);\n\t\t\t\t\t $.each(kmrecord, function(index, kmsrow){\n\t\t\t\t\t\t kilometer_set.push(kmsrow.service_kilometers);\n\t\t\t\t\t });\n\t\t\t\t\t frm.set_df_property('kilometer_filter', 'options', kilometer_set);\n\t \n\t\t\t\t\t $.each(kmrecord, function(index, kmrow){\n\t \n\t\t\t frappe.call({\n\t\t\t\t\t \"method\": \"smart_service.transactions.doctype.kilometer_mapping.kilometer_mapping.get_system\",\n\t\t\t\t\t \"args\": {\n\t\t\t\t\t\t \"doc\": frm.doc.variant_mapping,\n\t\t\t\t\t },\n\t\t\t\t\t callback: function(r) {\n\t\t\t\t\t\t\t $.each(r.message, function(index, smrow){\n\t\t\t\t\t\t\t var child;\n\t\t\t\t\t\t\t if (smrow.mat !== null){\n\t\t\t\t\t\t\t\t var child = cur_frm.add_child(\"config_kilometer\");\n\t\t\t\t\t\t\t\t child.sub_systems = smrow.sub_systems;\n\t\t\t\t\t\t\t\t child.mat = smrow.mat;\n\t\t\t\t\t\t\t\t child.kilometer = kmrow.service_kilometers;\n\t\t\t\t\t\t\t\t cur_frm.refresh_field('config_kilometer');\n \t\t cur_frm.refresh_fields();\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t });\n\t \t\t\t\t\t}\n\t \t\t\t\t\t})\n\t\t\t\t\t }); \n\t\t\t\t });\n\t\t },\n\n /*variant_mapping: function(frm) {\n if(frm.doc.variant_mapping === undefined) {return;}\n var filter = frm.doc.variant_mapping + \"-en-SM\";\n var sub_system_set = ['All'];\n var kilometer_set = ['All'];\n frappe.db.get_list('System Mapping_Sub System', {\n fields: ['sub_systems', 'mat','idx'],\n filters: { \n parent: filter,\n \"mat\": [\"!=\",'']\n }\n }).then(smrecords => {\n smrecords.sort(sortsm);\n $.each(smrecords, function(index, smrow){\n sub_system_set.push(smrow.sub_systems);\n });\n frm.set_df_property('sub_system_filter', 'options', sub_system_set);\n \n frappe.db.get_list('Vehicle_SK', {\n fields: ['service_kilometers'],\n filters: { parent: frm.doc.vehicle }\n }).then(kmrecord => {\n kmrecord.sort(sortkm);\n $.each(kmrecord, function(index, kmsrow){\n kilometer_set.push(kmsrow.service_kilometers);\n });\n frm.set_df_property('kilometer_filter', 'options', kilometer_set);\n $.each(kmrecord, function(index, kmrow){\n $.each(smrecords, function(index, smrow){\n if (smrow.mat !== null){\n var child = cur_frm.add_child(\"config_kilometer\");\n child.sub_systems = smrow.sub_systems;\n child.mat = smrow.mat;\n child.kilometer = kmrow.service_kilometers;\n }\n });\n frm.refresh();\n }); \n });\n });\n },*/\n kilometer_filter: function(frm) {\n if (!trigger){ trigger = true; return;}\n if (frm.doc.sub_system_filter !=\"All\"){trigger=false;frm.set_value(\"sub_system_filter\",\"All\");}\n if (frm.doc.kilometer_filter ==\"All\"){\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n } else {\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.kilometer != frm.doc.kilometer_filter){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n frm.refresh();\n },\n sub_system_filter: function(frm) {\n if (!trigger){ trigger = true; return;}\n if (frm.doc.kilometer_filter !=\"All\"){trigger=false;frm.set_value(\"kilometer_filter\",\"All\");}\n \n if (frm.doc.sub_system_filter ==\"All\"){\n frm.get_field('config_kilometer').grid.static_rows = false;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n });\n } else {\n frm.get_field('config_kilometer').grid.static_rows = true;\n frm.fields_dict.config_kilometer.grid.grid_rows.forEach((row) => {\n if (row.doc.sub_systems != frm.doc.sub_system_filter){\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').hide();\n } else {\n $(\"div[data-fieldname=config_kilometer]\").find('div.grid-row[data-idx=\"'+ row.doc.idx + '\"]').show();\n }\n });\n }\n frm.refresh();\n },\n sort_by_kilometer: function(frm) {\n var idx = 1;\n frm.doc.config_kilometer.sort(function(a,b){\n if (parseInt(a.kilometer) < parseInt(b.kilometer)){ return -1 }\n else if ( parseInt(a.kilometer) > parseInt(b.kilometer)){ return 1 }\n return 1;\n });\n \n frm.doc.config_kilometer.map(function(item){\n item.idx = idx++;\n });\n if (frm.doc.temp_field == \"Set\") {frm.set_value(\"temp_field\",\"Not Set\");} else {frm.set_value(\"temp_field\",\"Set\");}\n refresh_field(\"config_kilometer\");\n }\n});\n\nfrappe.ui.form.on('Kilometer Mapping_Items', {\n config_kilometer_move: function(frm) {\n frm.refresh();\n }\n});\n\nfunction sortkm(a, b) {\n if (parseInt(a.service_kilometers) < parseInt(b.service_kilometers)){return -1;}\n if (parseInt(a.service_kilometers) > parseInt(b.service_kilometers)){return 1;}\n return 0;\n}\n\nfunction sortsm(a, b) {\n if (a.sub_systems < b.sub_systems){return -1;}\n if (a.sub_systems > b.sub_systems){return 1;}\n return 0;\n}", "view": "Form" }, { diff --git a/smart_service/hooks.py b/smart_service/hooks.py index 7a0e4a7..3ea35cc 100644 --- a/smart_service/hooks.py +++ b/smart_service/hooks.py @@ -8,7 +8,8 @@ app_icon = "" app_color = "#E31A37" app_email = "siva@hnsonline.com" app_license = "MIT" -app_logo_url = "/assets/smart_service/images/Mahindra_NewSplash.png" +# app_logo_url = "/assets/smart_service/images/SS Alone.png" +app_logo_url = "/assets/smart_service/images/SS and Mahindra.png" # app_logo_url = "/assets/smart_service/images/ic_app_icon1.png" # ic_app_icon.png @@ -19,7 +20,7 @@ web_include_css = ["/assets/css/smart_service.min.css"] # Icons website_context = { -"favicon": "/assets/smart_service/images/Smart_service_logo.png", +"favicon": "/assets/smart_service/images/Logo Fav Icon.png", "splash_image": "/assets/smart_service/images/Mahindra_NewSplash.png", # "splash_image": "/assets/smart_service/images/ic_app_icon1.png", "app_name" : "smart service" @@ -192,18 +193,21 @@ user_data_fields = [ # "smart_service.auth.validate" # ] fixtures = [ - #"doctype": "Notification", - #"filters": [{"is_standard":0}] - "Custom Field", - "Property Setter", - "Client Script", - "Server Script", - "Workflow", - "Workflow Action Master", - "Workflow State", - "Role", - "Workspace", - "Custom DocPerm" +# { +# "doctype": "Notification", +# "filters": [{"is_standard":0}] +# } + #"Custom Field", + #"Property Setter", + #"Client Script", + #"Server Script", + #"Workflow", + #"Workflow Action Master", + #"Workflow State", + #"Role", + #"Workspace", + #"Custom DocPerm" + #"Dashboard Chart" ] diff --git a/smart_service/public/images/Logo Fav Icon.png b/smart_service/public/images/Logo Fav Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..25830a3d11c48aa068499ebfd41715b8b395c573 GIT binary patch literal 821 zcmV-51Iqk~P)HCVsG3EXnvz z;4TM$h31Tw5@i0wJzOdOckj#Zv?z-LXR|C#kiIIq5QPGc%<9Q!=lj$;ue6+BzFuqQrMx(iuH8wMn|7LU*08 zI))^(K#@;R&zGhk_za|>rKKgP02CJ&^JcTTL?zN*y*F^Lsi$)WW@Ur$V;)nU+DH*y zZ{be$pBG_d94{WL^}@s%R`P#ioFfNE-Lcr1ubt^|^vSOLyHfL+Dt z?#JzNdm8}O*4lvJT4b%momY5}qyTJAWWNRC0*S!?0jzGuh0EP)h;{r{ht-P^kZlzK>&-mHj#VnYNeD*Ce*da*`q(Wp@) zCK~<6L{ws<7kiD8h$09!L}_Y7>0qdON0WnVyF35)ciG*{&d%)29(QnoeO@ekJM+xb zX6E~OzFpf?zpJ4Rb}@`~3}R-uH2lQTyB4oG*u#XVJceOB&?JB1 z!xcTw&3Rqs8k%;tUAy7pV4J4DE?HgCeID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bx{fnQo-8yPPMI9Aja}@H-b7p#1$AaWJvQul+l1gff0=! z;{*<3q!h2JdR}}yc%NR=W3gY98%8;fgef020OWl!^<|sesD% z4#!{M-TeS3#Yr4rFfpMpA2W1lH+)OR(e6d;>hC6uiRl49YQ%^e(2+=>#tO`I$D>W3 zoVZ2@BwF(O7}^t&nWB#ynw6Gnc*vWkzlm!G)CfSNVUe*lZru2O1}8E-3BG5Bf8V%q z<3)e}``>r}5FdtMPQeNUD-f(eE-N4rJs`+y0FaWnuJ?3HoQJ5Z7xmswx=H{fi{TDZ zfk=}vvXXrRB$Z{Al|_+Aq*VwV3Ix3o=bYRu%IW(lyvfrdbfZ(5MtxD z6;cKwU#r)#+L8c`aR~#DX|70R4ojHin$6PZ=g{N@TeojtY>%8S{(WV;clS!TW*pD8 z5}iV1=j-_Xl { + args.pwd = getPass; + args.device = "desktop"; + login.call(args); + isSubmit = 0; + $("button").css("cursor", "pointer"); + $("body").css("cursor", "default"); + $('.login-captcha-refresh').css('z-index', '2'); + $('.toggle-password').css('z-index', '2'); + /*(async () => { const rawResponse = await fetch("http://www.mahindramile.com/WindowAuth/Service.asmx/ValidateCredential?LoginID=" + args.usr + "&Password=" + btoa(getPass)); const resStr = await rawResponse.text(); login.set_status('{{ _("Verifying...") }}', 'blue'); @@ -138,7 +146,7 @@ login.bind_events = function () { return false; - })(); + })();*/ diff --git a/smart_service/transactions/doctype/kilometer_mapping/kilometer_mapping.py b/smart_service/transactions/doctype/kilometer_mapping/kilometer_mapping.py index cd8699d..ce6ded8 100644 --- a/smart_service/transactions/doctype/kilometer_mapping/kilometer_mapping.py +++ b/smart_service/transactions/doctype/kilometer_mapping/kilometer_mapping.py @@ -6,4 +6,22 @@ from frappe.model.document import Document class KilometerMapping(Document): def validate(self): - pass \ No newline at end of file + pass +@frappe.whitelist() +def get_system(doc): + current_db_name = frappe.conf.get("db_name") + system_map = frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True) + if system_map: + for s in system_map: + doc = frappe.get_doc("System Mapping",s.name) + system = frappe.db.sql("""select sub_systems,mat from {0}.`tabSystem Mapping_Sub System` where parent = '{1}' and procedure_is_published = '0'""".format(current_db_name,s.name),as_dict=True) + return system +@frappe.whitelist() +def get_subsystem(doc): + current_db_name = frappe.conf.get("db_name") + system_map = frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True) + if system_map: + for s in system_map: + doc = frappe.get_doc("System Mapping",s.name) + sub_system = frappe.db.sql("""select sub_systems,mat,idx from {0}.`tabSystem Mapping_Sub System` where parent = '{1}' and procedure_is_published = '0'""".format(current_db_name,s.name),as_dict=True) + return sub_system diff --git a/smart_service/transactions/doctype/publish/publish.py b/smart_service/transactions/doctype/publish/publish.py index afde8de..f24ed71 100644 --- a/smart_service/transactions/doctype/publish/publish.py +++ b/smart_service/transactions/doctype/publish/publish.py @@ -172,22 +172,22 @@ def update_mapping(variant_mapping,doc): @frappe.whitelist() def get_vm_asset(doc): doc = frappe.get_doc("Variant Mapping",doc) - vm_assets = frappe.db.sql("""select category,language,attach_file,active_status from `tabVariant Mapping_Assets` where parent = %s and published = '0'""",doc.name,as_dict=True) + vm_assets = frappe.db.sql("""select category,language,attach_file,active_status from {0}.`tabVariant Mapping_Assets` where parent = '{1}' and published = '0'""".format(current_db_name,doc.name),as_dict=True) return vm_assets @frappe.whitelist() def get_sm_asset(doc): - system_map = frappe.db.sql("""select name from `tabSystem Mapping` where variant_mapping=%s""",doc,as_dict=True) + system_map = frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True) if system_map: for s in system_map: doc = frappe.get_doc("System Mapping",s.name) - system_asset = frappe.db.sql("""select systems,language,active_status,system_asset from `tabSystem Mapping_System Assets` where parent = %s and published = '0'""",s.name,as_dict=True) + system_asset = frappe.db.sql("""select systems,language,active_status,system_asset from {0}.`tabSystem Mapping_System Assets` where parent = '{1}' and published = '0'""".format(current_db_name,s.name),as_dict=True) return system_asset @frappe.whitelist() def get_system(doc): - system_map = frappe.db.sql("""select name from `tabSystem Mapping` where variant_mapping=%s""",doc,as_dict=True) + system_map = frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True) if system_map: for s in system_map: doc = frappe.get_doc("System Mapping",s.name) - system = frappe.db.sql("""select systems,sub_systems,active_status,symptom,component,estimated_time,rts,component,mat,procedure_status,`procedure` from `tabSystem Mapping_Sub System` where parent = %s and procedure_is_published = '0'""",s.name,as_dict=True) + system = frappe.db.sql("""select systems,sub_systems,active_status,symptom,component,estimated_time,rts,component,mat,procedure_status,`procedure` from {0}.`tabSystem Mapping_Sub System` where parent = '{1}' and procedure_is_published = '0'""".format(current_db_name,s.name),as_dict=True) return system