diff --git a/smart_service/fixtures/client_script.json b/smart_service/fixtures/client_script.json index 5a79399..e31a268 100644 --- a/smart_service/fixtures/client_script.json +++ b/smart_service/fixtures/client_script.json @@ -173,12 +173,12 @@ "doctype": "Client Script", "dt": "Publish", "enabled": 1, - "modified": "2022-04-09 15:46:18.201387", + "modified": "2022-04-11 16:07:59.738034", "name": "Publish-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\ncur_frm.fields_dict['vehicle'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.masters.doctype.vehicle.vehicle.vehicle_filter\",};\n};\n\nvar lang_set_first_time = true;\n\nfrappe.ui.form.on('Publish', {\n onload: function(frm) {\n lang_set_first_time = true;\n frm.get_field('publish_documents').grid.cannot_add_rows = true;\n },\n planned_publish_date: function(frm){\n var date = (frappe.datetime.nowdate())\n if (frm.doc.planned_publish_date < date){\n frm.doc.planned_publish_date = '';\n cur_frm.refresh_fields();\n frappe.msgprint(\"Planned Publish Date: You can not select past date\");\n frappe.validated = false;\n }\n\n },\n refresh: function(frm) {\n if (frm.doc.docstatus === 1 && frm.doc.publish_type == \"Internal\" && frm.doc.publish_status == 'Published' && !frm.doc.global_publish) {\n frm.add_custom_button(__('Global Publish'), function() {\n frappe.call({\n method: \"smart_service.transactions.doctype.publish.publish.global_publish\",\n args: {\n \"doc\": frm.doc.name,\n },\n callback: function(r) {\n cur_frm.reload_doc();\n }\n });\n }).addClass(\"btn-warning\").css({ 'background-color': '#f5b0cd', 'color': 'black' });\n }\n\n\n if(frm.doc.docstatus === 1 && frm.doc.publish_status == 'To Publish'){\n frm.add_custom_button(__('Publish'), function(){\n // frm.trigger(\"auto_version_update\");\n frappe.confirm('Are you sure you want to Internal Publish?',\n () => {\n // action to perform if Yes is selected\n if(frm.doc.vehicle && frm.doc.language && frm.doc.publish_type){\n \t\t frappe.call({\n method: 'smart_service.transactions.doctype.publish.publish.cal_ver',\n args: {\n vehicle: frm.doc.vehicle,\n lang:frm.doc.language,\n publish_type:frm.doc.publish_type,\n doc:frm.doc.name\n },\n callback: (r) => {\n frm.set_value('version',r.message);\n cur_frm.refresh_field('version')\n // },\n \n // });\n //\t}\n if(frm.doc.docstatus === 1 && frm.doc.publish_status == 'To Publish'){\n frappe.call({\n method: \"smart_service.apis.publish_api.api_procedure\",\n // async:false,\n args: {\n \"args\":frm.doc.name,\n \"vehicle\": frm.doc.vehicle,\n \"language\":frm.doc.language,\n \"version\":frm.doc.version\n },\n callback: function(r) {\n frm.set_value('publish_status','Published');\n frm.set_value('actual_published_date',frappe.datetime.nowdate());\n // frm.set_value('published_link',r.message)\n frappe.msgprint(__());\n frappe.msgprint({\n title: __('Notification'),\n message: __('Successfully Published' + r.message),\n primary_action:{\n action(values) {\n frm.save('Update');\n }\n }\n });\n \n }\n \n });\n }\n \n },\n })\n }\n \n }, () => {\n // action to perform if No is selected\n }); \n }).addClass(\"btn-warning\").css({'background-color':'#f5b0cd', 'color':'black'});\n } else if(frm.doc.publish_status == 'Published'){\n frm.set_read_only();\n frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);\n }\n \n if(frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish'){\n frm.get_field('system_mapping').grid.add_custom_button(__('Add to Publish'), function() {\n\t var added = 0;\n\t var topublish = [];\n if (frm.doc.publish_type =='Global'){topublish = ['Publish Ready'];}else{topublish = ['Review Pending','Publish Ready','Approval Pending'];}\n frm.doc.system_mapping.forEach(row => {\n if (topublish.indexOf(row.procedure_status) > -1){\n var dulicate = false;\n if (frm.doc.publish_documents){\n frm.doc.publish_documents.forEach(publishrow => {\n if (frm.doc.variant_mapping == publishrow.variant_mapping && \n row.systems == publishrow.system && \n row.sub_systems == publishrow.sub_system && row.procedure == publishrow.procedure_link){\n dulicate = true;\n }\n });\n }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.system = row.systems;\n child.sub_system = row.sub_systems;\n child.procedure_link = row.procedure;\n child.procedure_status = row.procedure_status;\n child.item_category = \"System Mapping\";\n child.variant = frm.doc.variant;\n refresh_field(\"publish_documents\");\n added += 1;\n }\n }\n });\n if (added){frappe.msgprint(__(added + \" Doc(s) Added\"));}\n else{frappe.msgprint(__(\"No Doc Added\"));}\n });\n }\n frm.fields_dict.system_mapping.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary');\n\n\t frm.get_field('variant_mapping_assets').grid.add_custom_button(__('Add to Publish'), function() {\n\t var added = 0;\n\t var topublish = [];\n frm.doc.variant_mapping_assets.forEach(row => {\n if (row.active_status == \"Active\" || row.active_status == \"Inactive\"){\n var dulicate = false;\n if (frm.doc.publish_documents){\n frm.doc.publish_documents.forEach(publishrow => {\n if (frm.doc.variant_mapping == publishrow.variant_mapping && \n row.category == publishrow.asset_category){\n dulicate = true;\n }\n });\n }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.asset_category = row.category;\n child.item_category = \"Variant Mapping Assets\";\n child.variant = frm.doc.variant;\n refresh_field(\"publish_documents\");\n added += 1;\n }\n }\n });\n if (added){frappe.msgprint(__(added + \" Doc(s) Added\"));}\n else{frappe.msgprint(__(\"No Doc Added\"));}\n });\n \n frm.fields_dict.variant_mapping_assets.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary');\n\t},\n\tvalidate: function(frm) {\n\t \n\t if (frm.fields_dict.publish_documents.grid.grid_rows.length === 0){\n\t frappe.msgprint(__(\"No item selected to Publish\"));\n\t frappe.validated = false;\n\t }\n if (frm.doc.planned_publish_date < frappe.datetime.get_today()) {\n frappe.msgprint(__(\"Planned Publish Date: You can not select past date\"));\n frappe.validated = false;\n }\n },\n before_save: function(frm) {\n //frm.set_value('variant_mapping',null);\n // frm.set_value('system_mapping', null);\n // frm.set_value('variant_mapping_assets', null);\n },\n before_cancel: function(frm) {\n if (frm.doc.publish_status == 'Published'){\n //frappe.throw(__('You can not cancel a Published Document!'));\n //frappe.validated = false;\n }\n },\n\tvariant_mapping:function(frm){\n\t frappe.db.get_value('Variant Mapping', { name: frm.doc.variant_mapping }, ['fuel', 'transmission', 'drive'], (r) => {\n frm.doc.variant = r.fuel + ',' + r.transmission + ',' + r.drive;\n cur_frm.refresh_field('variant');\n })\n\n\t var km_name = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\";\n\t frappe.db.get_value('Kilometer Mapping', {name: km_name}, 'workflow_state' , (r) =>{\n\t if(r.workflow_state == \"Draft\"){\n\t frm.doc.kilometer_mapping = '';\n\t frm.refresh_field('kilometer_mapping')\n\t frappe.msgprint(\"Kilometer Mapping Draft record not loaded\")\n\t }\n\t \n\t else{\n if (frm.doc.variant_mapping === undefined) {return;}\n frm.set_value('system_mapping', null);\n frm.set_value('variant_mapping_assets', null);\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 frm.refresh_field('kilometer_mapping')\n } else {\n // frm.set_value(\"kilometer_mapping\",null);\n frm.set_value(\"km_active_status\",\"Not Configured!\");\n }\n });\n\t }\n\t })\n\t},\n\tkm_active_status:function(frm){\n \tif(frm.doc.km_active_status === \"\" || frm.doc.km_active_status === null) {return;}\n var filter = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\";\n if (frm.doc.variant_mapping_status == \"Active\" && frm.doc.km_active_status == \"Active\") {\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_system\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child;\n child = cur_frm.add_child(\"system_mapping\");\n child.systems = row.systems;\n child.sub_systems = row.sub_systems;\n child.active_status = row.active_status;\n child.symptom = row.symptom;\n child.component = row.component;\n child.estimate_time = row.estimate_time;\n child.rts = row.rts;\n child.mat = row.mat;\n //child.cover_image = row.cover_image;\n child.procedure = row.procedure;\n child.procedure_status = row.procedure_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n \n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_vm_asset\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child;\n child = cur_frm.add_child(\"variant_mapping_assets\");\n child.category = row.category;\n child.language = row.language;\n child.attach_file = row.attach_file;\n child.active_status = row.active_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n \n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_sm_asset\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child_row;\n child_row = cur_frm.add_child(\"variant_mapping_assets\");\n child_row.category = row.systems;\n child_row.language = row.language;\n child_row.attach_file = row.system_asset;\n child_row.active_status = row.active_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n /* frappe.db.get_list('System Mapping_Sub System', {\n fields: ['systems', 'sub_systems','active_status','symptom','component','estimated_time','rts','mat','procedure','procedure_status'],\n filters: { parent: filter,\n procedure_is_published: [\"=\",'0'], }\n }).then(records => {\n //frm.set_value('system_mapping', null);\n var child;\n $.each(records, function(index, row){\n child = cur_frm.add_child(\"system_mapping\");\n child.systems = row.systems;\n child.sub_systems = row.sub_systems;\n child.active_status = row.active_status;\n child.symptom = row.symptom;\n child.component = row.component;\n child.estimated_time = row.estimated_time;\n child.rts = row.rts;\n child.mat = row.mat;\n //child.cover_image = row.cover_image;\n child.procedure = row.procedure;\n child.procedure_status = row.procedure_status;\n if (row.procedure) {\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.procedure.procedure.get_doc_status\",\n \"args\": {\n \"docname\": row.procedure,\n \t},\n \tasync:false,\n \tcallback:function(r){\n child.procedure_status = r.message; //doc.workflow_state;\n if (r.message == 'Review Pending'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffa243'});}\n else if (r.message == 'Publish Ready'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#cfffcf'});}\n //refresh_field(\"system_mapping\");\n \t}\n });\n //frappe.db.get_doc('Procedure', row.procedure)\n // .then(doc => {\n \n // child.procedure_status = doc.workflow_state;\n // if (doc.workflow_state == 'Review Pending'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffa243'});}\n // else if (doc.workflow_state == 'Publish Ready'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#cfffcf'});}\n // frm.refresh_field(\"system_mapping\");\n // });\n }\n });\n frm.refresh_field('system_mapping');\n });\n \n frappe.db.get_list('Variant Mapping_Assets', {\n fields: ['category', 'language','active_status','attach_file'],\n filters: {\n parent: frm.doc.variant_mapping, \n language: frm.doc.language,\n published: [\"=\",'0'],\n \n }\n }).then(assets => {\n var child;\n $.each(assets, function(index, row){\n //child = cur_frm.add_child(\"variant_mapping_assets\");\n // console.log(row.category)\n // child.category = row.category;\n // child.language = row.language;\n //child.attach_file = row.attach_file;\n // child.active_status = row.active_status;\n });\n \n frappe.db.get_list('System Mapping_System Assets', {\n fields: ['systems', 'language','active_status','system_asset'],\n filters: {\n parent: filter,\n published: [\"=\",'0'],\n \n }\n }).then(asset => {\n var child_row;\n $.each(asset, function(index, row){\n child_row = cur_frm.add_child(\"variant_mapping_assets\");\n child_row.category = row.systems;\n child_row.language = row.language;\n child_row.attach_file = row.system_asset;\n child_row.active_status = row.active_status;\n });\n cur_frm.refresh_field('variant_mapping_assets');\n })\n \n });*/\n \n } else {\n if (frm.doc.variant_mapping_status != null){\n frappe.msgprint({\n title: __('Notification'),\n indicator: 'red',\n message: __('System Mapping & Assets not loaded as the selected Variant/Kilometer Mapping is Inactive or not configured')\n });\n }\n }\t\n\t},\n\tadd_variant_mapping_to_publish:function(frm){\n var dulicate = false;\n if (frm.doc.publish_documents){\n frm.doc.publish_documents.forEach(publishrow => {\n if (frm.doc.variant_mapping == publishrow.variant_mapping && publishrow.systems === undefined && publishrow.sub_systems === undefined && publishrow.procedure === undefined){\n dulicate = true;\n }\n });\n }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.item_category = \"Variant Mapping\";\n refresh_field(\"publish_documents\");\n frappe.msgprint(__(frm.doc.variant_mapping + \" Added\"));\n }\n\t},\n\tkm_report: function(frm, cdt, cdn) {\n frappe.set_route(\"query-report\", 'Kilometer Mapping', { 'kilometer_mapping': frm.doc.kilometer_mapping });\n },\n\n\tvehicle:function(frm){\n\t frappe.call({\n method: \"smart_service.transactions.doctype.publish.publish.old_publish\",\n async:false,\n args: {\n \"vehicle\": frm.doc.vehicle,\n \"language\": frm.doc.language\n },\n callback: function(r) {\n if (r.message) {\n var vehicle = frm.doc.vehicle;\n cur_frm.doc.vehicle = '';\n cur_frm.doc.vehicle_status = '';\n cur_frm.refresh_field('vehicle');\n cur_frm.refresh_field('vehicle_status');\n frappe.throw(\"Already publish record \" + r.message + \" created for \" + vehicle + \" vehicle. Please edit already available internal publish!\")\n }\n }\n });\n\n\n\t \n\t if (frm.doc.vehicle === undefined || frm.doc.vehicle === null) {return;}\n\t //frm.trigger(\"auto_version_update\");\n var filter = frm.doc.vehicle;\n filter = \"%\"+filter+\"%\";\n frm.set_query(\"variant_mapping\", function() {\n return {\n \"filters\": {\n // \"name\": [\"like\",filter]\n \"vehicle\":frm.doc.vehicle\n }\n };\n });\n $(\"[data-fieldname=variant_mapping]\").focus();\n if(frm.doc.vehicle){\n frm.set_df_property('vehicle', 'read_only', 1);\n }\n\t},\n\tlanguage:function(frm){\n if (!lang_set_first_time){\n frappe.confirm('This will clear all the data, are you sure you want to proceed?',\n () => {\n // action to perform if Yes is selected\n frm.set_value('variant_mapping',null);\n frm.set_value('variant_mapping_status',null);\n frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);\n frm.set_value('system_mapping', null);\n frm.set_value('variant_mapping_assets', null);\n frm.set_value('publish_documents', null);\n lang_set_first_time = false;\n }, () => {\n // action to perform if No is selected\n });\n } else {lang_set_first_time = false;}\n\t},\n\tauto_version_update:function(frm){\n \tif(frm.doc.vehicle && frm.doc.language && frm.doc.publish_type){\n \t console.log(\"called ver\")\n \t\tfrappe.call({\n method: 'smart_service.transactions.doctype.publish.publish.cal_ver',\n args: {\n vehicle: frm.doc.vehicle,\n lang:frm.doc.language,\n publish_type:frm.doc.publish_type,\n doc:frm.doc.name\n },\n callback: (r) => {\n //frm.set_value('version',r.message);\n cur_frm.refresh_field('version')\n console.log(frm.doc.version);\n },\n error: (r) => {\n // on error\n }\n });\n \t}\n\t},\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\ncur_frm.fields_dict['vehicle'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.masters.doctype.vehicle.vehicle.vehicle_filter\",};\n};\n\nvar lang_set_first_time = true;\n\nfrappe.ui.form.on('Publish', {\n onload: function(frm) {\n lang_set_first_time = true;\n frm.get_field('publish_documents').grid.cannot_add_rows = true;\n },\n planned_publish_date: function(frm){\n var date = (frappe.datetime.nowdate())\n if (frm.doc.planned_publish_date < date){\n frm.doc.planned_publish_date = '';\n cur_frm.refresh_fields();\n frappe.msgprint(\"Planned Publish Date: You can not select past date\");\n frappe.validated = false;\n }\n\n },\n refresh: function(frm) {\n if (frm.doc.docstatus === 1 && frm.doc.publish_type == \"Internal\" && frm.doc.publish_status == 'Published' && !frm.doc.global_publish) {\n frm.add_custom_button(__('Global Publish'), function() {\n frappe.call({\n method: \"smart_service.transactions.doctype.publish.publish.global_publish\",\n args: {\n \"doc\": frm.doc.name,\n },\n callback: function(r) {\n cur_frm.reload_doc();\n }\n });\n }).addClass(\"btn-warning\").css({ 'background-color': '#f5b0cd', 'color': 'black' });\n }\n\n\n if(frm.doc.docstatus === 1 && frm.doc.publish_status == 'To Publish'){\n frm.add_custom_button(__('Publish'), function(){\n // frm.trigger(\"auto_version_update\");\n frappe.confirm('Are you sure you want to Internal Publish?',\n () => {\n // action to perform if Yes is selected\n if(frm.doc.vehicle && frm.doc.language && frm.doc.publish_type){\n \t\t frappe.call({\n method: 'smart_service.transactions.doctype.publish.publish.cal_ver',\n args: {\n vehicle: frm.doc.vehicle,\n lang:frm.doc.language,\n publish_type:frm.doc.publish_type,\n doc:frm.doc.name\n },\n callback: (r) => {\n frm.set_value('version',r.message);\n cur_frm.refresh_field('version')\n // },\n \n // });\n //\t}\n if(frm.doc.docstatus === 1 && frm.doc.publish_status == 'To Publish'){\n frappe.call({\n method: \"smart_service.apis.publish_api.api_procedure\",\n // async:false,\n args: {\n \"args\":frm.doc.name,\n \"vehicle\": frm.doc.vehicle,\n \"language\":frm.doc.language,\n \"version\":frm.doc.version\n },\n callback: function(r) {\n frm.set_value('publish_status','Published');\n frm.set_value('actual_published_date',frappe.datetime.nowdate());\n // frm.set_value('published_link',r.message)\n frappe.msgprint(__());\n frappe.msgprint({\n title: __('Notification'),\n message: __('Successfully Published' + r.message),\n primary_action:{\n action(values) {\n frm.save('Update');\n }\n }\n });\n \n }\n \n });\n }\n \n },\n })\n }\n \n }, () => {\n // action to perform if No is selected\n }); \n }).addClass(\"btn-warning\").css({'background-color':'#f5b0cd', 'color':'black'});\n } else if(frm.doc.publish_status == 'Published'){\n frm.set_read_only();\n frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);\n }\n \n if(frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish'){\n frm.get_field('system_mapping').grid.add_custom_button(__('Add to Publish'), function() {\n\t var added = 0;\n\t var topublish = [];\n if (frm.doc.publish_type =='Global'){topublish = ['Publish Ready'];}else{topublish = ['Review Pending','Publish Ready','Approval Pending'];}\n frm.doc.system_mapping.forEach(row => {\n if (topublish.indexOf(row.procedure_status) > -1){\n var dulicate = false;\n if (frm.doc.publish_documents){\n frm.doc.publish_documents.forEach(publishrow => {\n if (frm.doc.variant_mapping == publishrow.variant_mapping && \n row.systems == publishrow.system && \n row.sub_systems == publishrow.sub_system && row.procedure == publishrow.procedure_link){\n // dulicate = true;\n }\n });\n }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.system = row.systems;\n child.sub_system = row.sub_systems;\n child.procedure_link = row.procedure;\n child.procedure_status = row.procedure_status;\n child.item_category = \"System Mapping\";\n child.variant = frm.doc.variant;\n refresh_field(\"publish_documents\");\n added += 1;\n }\n }\n });\n if (added){frappe.msgprint(__(added + \" Doc(s) Added\"));}\n else{frappe.msgprint(__(\"No Doc Added\"));}\n });\n // }\n frm.fields_dict.system_mapping.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary');\n }\n if(frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish'){\n\t frm.get_field('variant_mapping_assets').grid.add_custom_button(__('Add to Publish'), function() {\n\t var added = 0;\n\t var topublish = [];\n frm.doc.variant_mapping_assets.forEach(row => {\n if (row.active_status == \"Active\" || row.active_status == \"Inactive\"){\n var dulicate = false;\n // if (frm.doc.publish_documents){\n // frm.doc.publish_documents.forEach(publishrow => {\n // if (frm.doc.variant_mapping == publishrow.variant_mapping && \n // row.category == publishrow.asset_category){\n // dulicate = true;\n // }\n // });\n // }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.asset_category = row.category;\n child.item_category = \"Variant Mapping Assets\";\n child.variant = frm.doc.variant;\n refresh_field(\"publish_documents\");\n added += 1;\n }\n }\n });\n if (added){frappe.msgprint(__(added + \" Doc(s) Added\"));}\n else{frappe.msgprint(__(\"No Doc Added\"));}\n });\n \n frm.fields_dict.variant_mapping_assets.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary');\n }\n },\n\tvalidate: function(frm) {\n\t \n\t if (frm.fields_dict.publish_documents.grid.grid_rows.length === 0){\n\t frappe.msgprint(__(\"No item selected to Publish\"));\n\t frappe.validated = false;\n\t }\n if (frm.doc.planned_publish_date < frappe.datetime.get_today()) {\n frappe.msgprint(__(\"Planned Publish Date: You can not select past date\"));\n frappe.validated = false;\n }\n },\n before_save: function(frm) {\n //frm.set_value('variant_mapping',null);\n // frm.set_value('system_mapping', null);\n // frm.set_value('variant_mapping_assets', null);\n },\n before_cancel: function(frm) {\n if (frm.doc.publish_status == 'Published'){\n //frappe.throw(__('You can not cancel a Published Document!'));\n //frappe.validated = false;\n }\n },\n\tvariant_mapping:function(frm){\n\t frappe.db.get_value('Variant Mapping', { name: frm.doc.variant_mapping }, ['fuel', 'transmission', 'drive'], (r) => {\n frm.doc.variant = r.fuel + ',' + r.transmission + ',' + r.drive;\n cur_frm.refresh_field('variant');\n })\n\n\t var km_name = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-KM\";\n\t frappe.db.get_value('Kilometer Mapping', {name: km_name}, 'workflow_state' , (r) =>{\n\t if(r.workflow_state == \"Draft\"){\n\t frm.doc.kilometer_mapping = '';\n\t frm.refresh_field('kilometer_mapping')\n\t frappe.msgprint(\"Kilometer Mapping Draft record not loaded\")\n\t }\n\t \n\t else{\n if (frm.doc.variant_mapping === undefined) {return;}\n frm.set_value('system_mapping', null);\n frm.set_value('variant_mapping_assets', null);\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 frm.refresh_field('kilometer_mapping')\n } else {\n // frm.set_value(\"kilometer_mapping\",null);\n frm.set_value(\"km_active_status\",\"Not Configured!\");\n }\n });\n\t }\n\t })\n\t},\n\tkm_active_status:function(frm){\n \tif(frm.doc.km_active_status === \"\" || frm.doc.km_active_status === null) {return;}\n var filter = frm.doc.variant_mapping + \"-\" + frm.doc.language + \"-SM\";\n if (frm.doc.variant_mapping_status == \"Active\" && frm.doc.km_active_status == \"Active\") {\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_system\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child;\n child = cur_frm.add_child(\"system_mapping\");\n child.systems = row.systems;\n child.sub_systems = row.sub_systems;\n child.active_status = row.active_status;\n child.symptom = row.symptom;\n child.component = row.component;\n child.estimate_time = row.estimate_time;\n child.rts = row.rts;\n child.mat = row.mat;\n //child.cover_image = row.cover_image;\n child.procedure = row.procedure;\n child.procedure_status = row.procedure_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n \n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_vm_asset\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child;\n child = cur_frm.add_child(\"variant_mapping_assets\");\n child.category = row.category;\n child.language = row.language;\n child.attach_file = row.attach_file;\n child.active_status = row.active_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n \n frappe.call({\n \"method\": \"smart_service.transactions.doctype.publish.publish.get_sm_asset\",\n \"args\": {\n \"doc\": frm.doc.variant_mapping,\n },\n callback: function(r) {\n $.each(r.message, function(index, row) {\n var child_row;\n child_row = cur_frm.add_child(\"variant_mapping_assets\");\n child_row.category = row.systems;\n child_row.language = row.language;\n child_row.attach_file = row.system_asset;\n child_row.active_status = row.active_status;\n cur_frm.refresh_field('variant_mapping_assets');\n cur_frm.refresh_fields();\n })\n }\n\n })\n /* frappe.db.get_list('System Mapping_Sub System', {\n fields: ['systems', 'sub_systems','active_status','symptom','component','estimated_time','rts','mat','procedure','procedure_status'],\n filters: { parent: filter,\n procedure_is_published: [\"=\",'0'], }\n }).then(records => {\n //frm.set_value('system_mapping', null);\n var child;\n $.each(records, function(index, row){\n child = cur_frm.add_child(\"system_mapping\");\n child.systems = row.systems;\n child.sub_systems = row.sub_systems;\n child.active_status = row.active_status;\n child.symptom = row.symptom;\n child.component = row.component;\n child.estimated_time = row.estimated_time;\n child.rts = row.rts;\n child.mat = row.mat;\n //child.cover_image = row.cover_image;\n child.procedure = row.procedure;\n child.procedure_status = row.procedure_status;\n if (row.procedure) {\n frappe.call({\n \"method\": \"smart_service.transactions.doctype.procedure.procedure.get_doc_status\",\n \"args\": {\n \"docname\": row.procedure,\n \t},\n \tasync:false,\n \tcallback:function(r){\n child.procedure_status = r.message; //doc.workflow_state;\n if (r.message == 'Review Pending'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffa243'});}\n else if (r.message == 'Publish Ready'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#cfffcf'});}\n //refresh_field(\"system_mapping\");\n \t}\n });\n //frappe.db.get_doc('Procedure', row.procedure)\n // .then(doc => {\n \n // child.procedure_status = doc.workflow_state;\n // if (doc.workflow_state == 'Review Pending'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#ffa243'});}\n // else if (doc.workflow_state == 'Publish Ready'){$(\"div[data-fieldname=system_mapping]\").find('div.grid-row[data-idx=\"'+ child.idx + '\"]').find('div.col[data-fieldname=\"procedure_status\"]').css({'background-color': '#cfffcf'});}\n // frm.refresh_field(\"system_mapping\");\n // });\n }\n });\n frm.refresh_field('system_mapping');\n });\n \n frappe.db.get_list('Variant Mapping_Assets', {\n fields: ['category', 'language','active_status','attach_file'],\n filters: {\n parent: frm.doc.variant_mapping, \n language: frm.doc.language,\n published: [\"=\",'0'],\n \n }\n }).then(assets => {\n var child;\n $.each(assets, function(index, row){\n //child = cur_frm.add_child(\"variant_mapping_assets\");\n // console.log(row.category)\n // child.category = row.category;\n // child.language = row.language;\n //child.attach_file = row.attach_file;\n // child.active_status = row.active_status;\n });\n \n frappe.db.get_list('System Mapping_System Assets', {\n fields: ['systems', 'language','active_status','system_asset'],\n filters: {\n parent: filter,\n published: [\"=\",'0'],\n \n }\n }).then(asset => {\n var child_row;\n $.each(asset, function(index, row){\n child_row = cur_frm.add_child(\"variant_mapping_assets\");\n child_row.category = row.systems;\n child_row.language = row.language;\n child_row.attach_file = row.system_asset;\n child_row.active_status = row.active_status;\n });\n cur_frm.refresh_field('variant_mapping_assets');\n })\n \n });*/\n \n } else {\n if (frm.doc.variant_mapping_status != null){\n frappe.msgprint({\n title: __('Notification'),\n indicator: 'red',\n message: __('System Mapping & Assets not loaded as the selected Variant/Kilometer Mapping is Inactive or not configured')\n });\n }\n }\t\n\t},\n\tadd_variant_mapping_to_publish:function(frm){\n var dulicate = false;\n // if (frm.doc.publish_documents){\n // frm.doc.publish_documents.forEach(publishrow => {\n // if (frm.doc.variant_mapping == publishrow.variant_mapping && publishrow.systems === undefined && publishrow.sub_systems === undefined && publishrow.procedure === undefined){\n // dulicate = true;\n // }\n // });\n // }\n if (dulicate === false){\n var child = cur_frm.add_child(\"publish_documents\");\n child.variant_mapping = frm.doc.variant_mapping;\n child.item_category = \"Variant Mapping\";\n refresh_field(\"publish_documents\");\n frappe.msgprint(__(frm.doc.variant_mapping + \" Added\"));\n }\n\t},\n\tkm_report: function(frm, cdt, cdn) {\n frappe.set_route(\"query-report\", 'Kilometer Mapping', { 'kilometer_mapping': frm.doc.kilometer_mapping });\n },\n\n\tvehicle:function(frm){\n\t frappe.call({\n method: \"smart_service.transactions.doctype.publish.publish.old_publish\",\n async:false,\n args: {\n \"vehicle\": frm.doc.vehicle,\n \"language\": frm.doc.language\n },\n callback: function(r) {\n if (r.message) {\n var vehicle = frm.doc.vehicle;\n cur_frm.doc.vehicle = '';\n cur_frm.doc.vehicle_status = '';\n cur_frm.refresh_field('vehicle');\n cur_frm.refresh_field('vehicle_status');\n frappe.throw(\"Already publish record \" + r.message + \" created for \" + vehicle + \" vehicle. Please edit already available internal publish!\")\n }\n }\n });\n\n\n\t \n\t if (frm.doc.vehicle === undefined || frm.doc.vehicle === null) {return;}\n\t //frm.trigger(\"auto_version_update\");\n var filter = frm.doc.vehicle;\n filter = \"%\"+filter+\"%\";\n frm.set_query(\"variant_mapping\", function() {\n return {\n \"filters\": {\n // \"name\": [\"like\",filter]\n \"vehicle\":frm.doc.vehicle\n }\n };\n });\n $(\"[data-fieldname=variant_mapping]\").focus();\n if(frm.doc.vehicle){\n frm.set_df_property('vehicle', 'read_only', 1);\n }\n\t},\n\tlanguage:function(frm){\n if (!lang_set_first_time){\n frappe.confirm('This will clear all the data, are you sure you want to proceed?',\n () => {\n // action to perform if Yes is selected\n frm.set_value('variant_mapping',null);\n frm.set_value('variant_mapping_status',null);\n frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);\n frm.set_value('system_mapping', null);\n frm.set_value('variant_mapping_assets', null);\n frm.set_value('publish_documents', null);\n lang_set_first_time = false;\n }, () => {\n // action to perform if No is selected\n });\n } else {lang_set_first_time = false;}\n\t},\n\tauto_version_update:function(frm){\n \tif(frm.doc.vehicle && frm.doc.language && frm.doc.publish_type){\n \t console.log(\"called ver\")\n \t\tfrappe.call({\n method: 'smart_service.transactions.doctype.publish.publish.cal_ver',\n args: {\n vehicle: frm.doc.vehicle,\n lang:frm.doc.language,\n publish_type:frm.doc.publish_type,\n doc:frm.doc.name\n },\n callback: (r) => {\n //frm.set_value('version',r.message);\n cur_frm.refresh_field('version')\n console.log(frm.doc.version);\n },\n error: (r) => {\n // on error\n }\n });\n \t}\n\t},\n});", "view": "Form" }, { @@ -199,12 +199,12 @@ "doctype": "Client Script", "dt": "System Mapping", "enabled": 1, - "modified": "2022-04-09 15:51:14.888143", + "modified": "2022-04-11 15:33:50.398294", "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 if(frm.doc.variant_mapping)\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 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\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\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 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 estimate_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.estimate_time === undefined) row.doc.estimate_time = doc.estimate_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 //*** Check the respective Kilometer Mapping Document exisits\n if (frm.is_new()) {\n if(frm.doc.variant_mapping)\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 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\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\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 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:'yellow'\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 estimate_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.estimate_time === undefined) row.doc.estimate_time = doc.estimate_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 || mat_array[index].mat_initial == ''){\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 {\n 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" }, { @@ -212,12 +212,12 @@ "doctype": "Client Script", "dt": "Vehicle", "enabled": 1, - "modified": "2022-04-04 13:30:34.748552", + "modified": "2022-04-11 15:32:59.943509", "name": "Vehicle-Form", "parent": null, "parentfield": null, "parenttype": null, - "script": "cur_frm.fields_dict['vehicle_segment'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.masters.doctype.vehicle.vehicle.vehicle_segment\",\n };\n };\n\nvar original_display_order = 0;\nvar vehicle_count = 0;\nvar skm_array = [];\nvar dusted = false;\n\nfrappe.ui.form.on('Vehicle', {\n\tonload: function(frm) {\n if (!frm.is_new()) fnLoad_skm_initial_values(frm);\n\t},\n image: function (frm) {\n\t\tvar file = frm.doc.image;\n\t\tif (frm.doc.image) {\n\t\t\tfrappe.call({\n\t\t\t\tmethod: \"smart_service.masters.doctype.vehicle.vehicle.image_size\",\n\t\t\t\targs: {\n\t\t\t\t\t\"image\": frm.doc.image,\n\t\t\t\t\t\"doc\": frm.doc.name\n\t\t\t\t},\n\t\t\t\tcallback: function (r) {\n\t\t\t\tif(r.message){\n\t\t\t\t\tif(r.message == frm.doc.image){\n\t\t\t\t\t\tfrm.doc.image = '';\n\t\t\t\t\t\tcur_frm.refresh_field('image');\n\t\t\t\t\t\tfrappe.show_alert({\n\t\t\t\t\t\t\tmessage: __('Max Dimesions are 2048*1080.'),\n\t\t\t\t\t\t\tindicator: 'yellow'\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tfrm.doc.image = '';\n\t\t\t\t\t\tcur_frm.refresh_field('image');\n\t\t\t\t\t\tfrappe.show_alert({\n\t\t\t\t\t\t\tmessage: __('Max Image Size is 10MB.'),\n\t\t\t\t\t\t\tindicator: 'yellow'\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\trefresh: function(frm) {\n if (frm.is_new()){\n frm.set_df_property('display_order', 'read_only', 1);\n } else {\n frm.set_df_property('display_order', 'read_only', 0);\n }\n if (!frm.is_new()) {\n frm.disable_save(); //*** Check Refresh for Save Function\n \n frm.add_custom_button(__('Save'), function(){\n fnSave(frm);\n }).addClass(\"btn-warning\").css({'background-color':'#e31a37', 'color':'white'});\n }\n\n\t\tfrappe.db.count('Vehicle')\n .then(count => {\n vehicle_count = count + 1;\n if (frm.is_new()){ \n frm.set_value(\"display_order\",vehicle_count); \n } else {\n original_display_order = frm.doc.display_order;\n }\n });\n\t},\n\t\n\tvalidate: function(frm) {\n\t if(frm.doc.vehicle){\n\t if (frm.doc.vehicle.length>50){\n\t\t\tfrappe.msgprint(\"Vehicle: Only 50 characters are allowed\")\n\n\t\t\tvalidated = false;\n\t\t}\n\t\tif (frm.doc.vehicle.length == 1){\n\t\t frappe.msgprint(\"Vehicle: Single character not allowed\")\n\t\t\tvalidated = false;\n\t\t}\n\t }\n\t if (frm.doc.vehicle == \".\"){\n\t frappe.throw(__(\"Just a . is not prescribed!\"));\n\t frappe.validated = false;\n\t }\n //var regex = /^[A-Za-z0-9&-()@/,.<>_ ]*$/;\n var regex = /[!@#$%^&*()_+\\=\\[\\]{};'`~:\"\\\\|.<>\\/?]+/;\n if(frm.doc.vehicle){\n if (regex.test(frm.doc.vehicle) === true){\n frappe.throw(__(\"Vehicle: Only letters, numbers and -, are allowed.\"));\n frappe.validated = false;\n } else if(frm.doc.vehicle) {\n if(frm.doc.vehicle.includes(\"'\")) {\n frappe.throw(__(\"Vehicle: Only letters, numbers and -, are allowed.\"));\n frappe.validated = false;\n }\n }\n }\n \n if (frm.doc.display_order && frm.doc.vehicle && frm.doc.vehicle_segment){\n //*** check if there is same display_order\n frappe.db.get_list('Vehicle', {\n fields: ['display_order', 'name'],\n filters: {\n display_order: frm.doc.display_order,\n vehicle:[\"!=\",frm.doc.vehicle]\n }\n }).then(records => {\n if (records.length){\n frappe.db.set_value('Vehicle', records[0].name, {\n display_order: original_display_order\n }).then(r => {\n let doc = r.message;\n frappe.show_alert({\n message:__('Swapped display order with: ' + records[0].name),\n indicator:'green'\n }, 5);\n });\n } else {\n if (frm.doc.display_order > vehicle_count){\n let display_vehicle_count = vehicle_count - 1;\n msgprint('There are only ' + display_vehicle_count + ' vehicle(s)');\n frappe.validated = false;\n }\n }\n });\n }\n\t},\n\n\tservice_kilometers: function(frm) {\n //*** Check & add any KM got added in Service Kilometers\n\n dusted = true;\n frm.doc.service_kilometers.forEach(row => {\n let index = skm_array.findIndex(o => o.name === row.name);\n if (index < 0){\n let index1 = skm_array.findIndex(o => o.skm_initial === row.service_kilometers);\n if (index1 >= 0){\n skm_array[index1].type = \"Initial\";\n } else {\n var valueToPush = {};\n valueToPush.type = \"New\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n skm_array.push(valueToPush);\n }\n }\n });\n var current_skm_array = [];\n frm.doc.service_kilometers.forEach(row => {\n var valueToPush = {};\n valueToPush.type = \"Initial\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n current_skm_array.push(valueToPush);\n });\n\n //*** Check & remove any KM got Removed in Service Kilometers\n var idx=0;\n skm_array.forEach(row => {\n idx++;\n let index = current_skm_array.findIndex(o => o.skm_initial === row.skm_initial);\n if (index < 0){\n //row.type = row.type === \"New\" ? \"No Action\": \"Deleted\";\n if (row.type == \"New\"){\n skm_array.splice(idx-1, 1);\n }else{\n row.type = \"Deleted\";\n }\n }\n });\n }\n});\n\nfrappe.ui.form.on('Vehicle', {\n\tafter_save1: function(frm) {\n\t frappe.call({\n \"method\": \"smart_service.masters.doctype.vehicle.vehicle.update_km_mapping\",\n \"args\": {\n \"doc\":frm.doc.name,\n \"skm_array\": skm_array,\n \"skm\": frm.doc.service_kilometers\n \t},\n \tfreeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n \n\t}\n\t\n});\n\nfunction fnLoad_skm_initial_values(frm){\n // ***Store the Initial Service Kilometer values\n skm_array.length = 0;\n frm.doc.service_kilometers.forEach(row => {\n var valueToPush = {};\n valueToPush.type = \"Initial\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n skm_array.push(valueToPush);\n });\n}\n\nfunction fnSave(frm){\n //console.log(\"Dusted\");\n if (dusted){\n frappe.confirm('Changes will impact KM Mapping associated with this vehicle: ' + frm.doc.vehicle + '',\n () => {\n //*** Change the State to Draft for KM\n frm.save();\n skm_array.forEach((array_row) => {\n \n //*** Add Edit Delete the respective Kiolmeter with Updated/Deleted SKM\n if (array_row.type !== \"Initial\"){\n frappe.call({\n \"method\": \"smart_service.masters.doctype.vehicle.vehicle.update_km_mapping\",\n \"args\": {\n \"doc\": frm.doc.name,\n \"vehicle\":frm.doc.vehicle,\n \"type\":array_row.type,\n \"skm_initial\":array_row.skm_initial\n \t},\n \tfreeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n }\n });\n frappe.show_alert({\n message:__('Inserted Rows in Respective KM Doc & made as Draft Mode!'),\n indicator:'green'\n }, 5);\n fnLoad_skm_initial_values(frm);\n }, () => {\n // action to perform if No is selected\n });\n } else if(frm.is_dirty()){\n frm.save();\n fnLoad_skm_initial_values(frm);\n } else {\n frappe.show_alert({\n message:__('No updates for Kilometer Mapping... '),\n indicator:'green'\n }, 5);\n }\n}", + "script": "cur_frm.fields_dict['vehicle_segment'].get_query = function(doc, cdt, cdn) {\n return {query:\"smart_service.masters.doctype.vehicle.vehicle.vehicle_segment\",\n };\n };\n\nvar original_display_order = 0;\nvar vehicle_count = 0;\nvar skm_array = [];\nvar dusted = false;\n\nfrappe.ui.form.on('Vehicle', {\n\tonload: function(frm) {\n if (!frm.is_new()) fnLoad_skm_initial_values(frm);\n\t},\n image: function (frm) {\n\t\tvar file = frm.doc.image;\n\t\tif (frm.doc.image) {\n\t\t\tfrappe.call({\n\t\t\t\tmethod: \"smart_service.masters.doctype.vehicle.vehicle.image_size\",\n\t\t\t\targs: {\n\t\t\t\t\t\"image\": frm.doc.image,\n\t\t\t\t\t\"doc\": frm.doc.name\n\t\t\t\t},\n\t\t\t\tcallback: function (r) {\n\t\t\t\tif(r.message){\n\t\t\t\t\tif(r.message == frm.doc.image){\n\t\t\t\t\t\tfrm.doc.image = '';\n\t\t\t\t\t\tcur_frm.refresh_field('image');\n\t\t\t\t\t\tfrappe.show_alert({\n\t\t\t\t\t\t\tmessage: __('Max Dimesions are 2048*1080.'),\n\t\t\t\t\t\t\tindicator: 'yellow'\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tfrm.doc.image = '';\n\t\t\t\t\t\tcur_frm.refresh_field('image');\n\t\t\t\t\t\tfrappe.show_alert({\n\t\t\t\t\t\t\tmessage: __('Max Image Size is 10MB.'),\n\t\t\t\t\t\t\tindicator: 'yellow'\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\trefresh: function(frm) {\n if (frm.is_new()){\n frm.set_df_property('display_order', 'read_only', 1);\n } else {\n frm.set_df_property('display_order', 'read_only', 0);\n }\n if (!frm.is_new()) {\n frm.disable_save(); //*** Check Refresh for Save Function\n \n frm.add_custom_button(__('Save'), function(){\n fnSave(frm);\n }).addClass(\"btn-warning\").css({'background-color':'#e31a37', 'color':'white'});\n }\n\n\t\tfrappe.db.count('Vehicle')\n .then(count => {\n vehicle_count = count + 1;\n if (frm.is_new()){ \n frm.set_value(\"display_order\",vehicle_count); \n } else {\n original_display_order = frm.doc.display_order;\n }\n });\n\t},\n\t\n\tvalidate: function(frm) {\n\t if(frm.doc.vehicle){\n\t if (frm.doc.vehicle.length>50){\n\t\t\tfrappe.msgprint(\"Vehicle: Only 50 characters are allowed\")\n\n\t\t\tvalidated = false;\n\t\t}\n\t\tif (frm.doc.vehicle.length == 1){\n\t\t frappe.msgprint(\"Vehicle: Single character not allowed\")\n\t\t\tvalidated = false;\n\t\t}\n\t }\n\t if (frm.doc.vehicle == \".\"){\n\t frappe.throw(__(\"Just a . is not prescribed!\"));\n\t frappe.validated = false;\n\t }\n //var regex = /^[A-Za-z0-9&-()@/,.<>_ ]*$/;\n var regex = /[!@#$%^&*()_+\\=\\[\\]{};'`~:\"\\\\|.<>\\/?]+/;\n if(frm.doc.vehicle){\n if (regex.test(frm.doc.vehicle) === true){\n frappe.throw(__(\"Vehicle: Only letters, numbers and -, are allowed.\"));\n frappe.validated = false;\n } else if(frm.doc.vehicle) {\n if(frm.doc.vehicle.includes(\"'\")) {\n frappe.throw(__(\"Vehicle: Only letters, numbers and -, are allowed.\"));\n frappe.validated = false;\n }\n }\n }\n \n if (frm.doc.display_order && frm.doc.vehicle && frm.doc.vehicle_segment){\n //*** check if there is same display_order\n frappe.db.get_list('Vehicle', {\n fields: ['display_order', 'name'],\n filters: {\n display_order: frm.doc.display_order,\n vehicle:[\"!=\",frm.doc.vehicle]\n }\n }).then(records => {\n if (records.length){\n frappe.db.set_value('Vehicle', records[0].name, {\n display_order: original_display_order\n }).then(r => {\n let doc = r.message;\n frappe.show_alert({\n message:__('Swapped display order with: ' + records[0].name),\n indicator:'green'\n }, 5);\n });\n } else {\n if (frm.doc.display_order > vehicle_count){\n let display_vehicle_count = vehicle_count - 1;\n msgprint('There are only ' + display_vehicle_count + ' vehicle(s)');\n frappe.validated = false;\n }\n }\n });\n }\n\t},\n\n\tservice_kilometers: function(frm) {\n //*** Check & add any KM got added in Service Kilometers\n\n dusted = true;\n frm.doc.service_kilometers.forEach(row => {\n let index = skm_array.findIndex(o => o.name === row.name);\n if (index < 0){\n let index1 = skm_array.findIndex(o => o.skm_initial === row.service_kilometers);\n if (index1 >= 0){\n skm_array[index1].type = \"Initial\";\n } else {\n var valueToPush = {};\n valueToPush.type = \"New\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n skm_array.push(valueToPush);\n }\n }\n });\n var current_skm_array = [];\n frm.doc.service_kilometers.forEach(row => {\n var valueToPush = {};\n valueToPush.type = \"Initial\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n current_skm_array.push(valueToPush);\n });\n\n //*** Check & remove any KM got Removed in Service Kilometers\n var idx=0;\n skm_array.forEach(row => {\n idx++;\n let index = current_skm_array.findIndex(o => o.skm_initial === row.skm_initial);\n if (index < 0){\n //row.type = row.type === \"New\" ? \"No Action\": \"Deleted\";\n if (row.type == \"New\"){\n skm_array.splice(idx-1, 1);\n }else{\n row.type = \"Deleted\";\n }\n }\n });\n }\n});\n\nfrappe.ui.form.on('Vehicle', {\n\tafter_save1: function(frm) {\n\t frappe.call({\n \"method\": \"smart_service.masters.doctype.vehicle.vehicle.update_km_mapping\",\n \"args\": {\n \"doc\":frm.doc.name,\n \"skm_array\": skm_array,\n \"skm\": frm.doc.service_kilometers\n \t},\n \tfreeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n \n\t}\n\t\n});\n\nfunction fnLoad_skm_initial_values(frm){\n // ***Store the Initial Service Kilometer values\n skm_array.length = 0;\n frm.doc.service_kilometers.forEach(row => {\n var valueToPush = {};\n valueToPush.type = \"Initial\";\n valueToPush.name = row.name;\n valueToPush.skm_initial = (row.service_kilometers === undefined ? null:row.service_kilometers);\n skm_array.push(valueToPush);\n });\n}\n\nfunction fnSave(frm){\n //console.log(\"Dusted\");\n if (dusted){\n frappe.confirm('Changes will impact KM Mapping associated with this vehicle: ' + frm.doc.vehicle + '',\n () => {\n //*** Change the State to Draft for KM\n frm.save();\n skm_array.forEach((array_row) => {\n \n //*** Add Edit Delete the respective Kiolmeter with Updated/Deleted SKM\n if (array_row.type !== \"Initial\"){\n frappe.call({\n \"method\": \"smart_service.masters.doctype.vehicle.vehicle.update_km_mapping\",\n \"args\": {\n \"doc\": frm.doc.name,\n \"vehicle\":frm.doc.vehicle,\n \"type\":array_row.type,\n \"skm_initial\":array_row.skm_initial\n \t},\n \tfreeze: true,\n \tasync:false,\n \tcallback:function(r){}\n });\n }\n });\n frappe.show_alert({\n message:__('Inserted Rows in Respective KM Doc & made as Draft Mode!'),\n indicator:'green'\n }, 5);\n fnLoad_skm_initial_values(frm);\n }, () => {\n // action to perform if No is selected\n });\n } else if(frm.is_dirty()){\n frm.save();\n fnLoad_skm_initial_values(frm);\n } else {\n frappe.show_alert({\n message:__('No updates for Kilometer Mapping... '),\n indicator:'yellow'\n }, 5);\n }\n}", "view": "Form" }, { diff --git a/smart_service/fixtures/workspace.json b/smart_service/fixtures/workspace.json index ce68c41..acbcfe6 100644 --- a/smart_service/fixtures/workspace.json +++ b/smart_service/fixtures/workspace.json @@ -2688,7 +2688,7 @@ "shortcuts_label": null }, { - "cards_label": "Masters", + "cards_label": null, "category": "Places", "charts": [], "charts_label": null, @@ -2700,22 +2700,22 @@ "extends_another_page": 0, "for_user": null, "hide_custom": 0, - "icon": "list", + "icon": "integration", "is_default": 0, "is_standard": 0, - "label": "Masters", + "label": "Transaction", "links": [ { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Masters #1", + "label": "Transactions", "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Card Break" @@ -2725,12 +2725,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Vehicle Segment", - "link_to": "Vehicle Segment", + "label": "Variant Mapping", + "link_to": "Variant Mapping", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2740,12 +2740,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Service Kilometers", - "link_to": "Service Kilometers", + "label": "Procedure", + "link_to": "Procedure", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2755,12 +2755,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Vehicle", - "link_to": "Vehicle", + "label": "System Mapping", + "link_to": "System Mapping", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2770,12 +2770,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Variant", - "link_to": "Variant", + "label": "Kilometer Mapping", + "link_to": "Kilometer Mapping", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2785,12 +2785,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Translation", - "link_to": "Translation", + "label": "Publish", + "link_to": "Publish", "link_type": "DocType", "onboard": 0, - "only_for": "", - "parent": "Masters", + "only_for": null, + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2800,42 +2800,74 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Masters #2", + "label": "Translation Reports", "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Transaction", "parentfield": "links", "parenttype": "Workspace", "type": "Card Break" - }, + } + ], + "modified": "2021-11-29 10:26:07.339507", + "module": "Transactions", + "name": "Transaction", + "onboarding": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "pin_to_bottom": 0, + "pin_to_top": 0, + "restrict_to_domain": null, + "shortcuts": [], + "shortcuts_label": null + }, + { + "cards_label": null, + "category": "Places", + "charts": [], + "charts_label": null, + "developer_mode_only": 0, + "disable_user_customization": 1, + "docstatus": 0, + "doctype": "Workspace", + "extends": null, + "extends_another_page": 0, + "for_user": null, + "hide_custom": 0, + "icon": "attachment", + "is_default": 0, + "is_standard": 0, + "label": "Add Ons", + "links": [ { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Fuel", - "link_to": "Fuel", + "label": "Masters", + "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Link" + "type": "Card Break" }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Transmission", - "link_to": "Transmission", + "label": "User Feedback Types", + "link_to": "User Feedback_Types", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2845,12 +2877,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Drive", - "link_to": "Drive", + "label": "Application Menu", + "link_to": "Application Menu", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2860,12 +2892,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Systems", - "link_to": "Systems", + "label": "App Preference", + "link_to": "App Preference", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2875,12 +2907,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Sub Systems", - "link_to": "Sub Systems", + "label": "App Dealer", + "link_to": "App Dealer", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2890,42 +2922,42 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Masters #3", - "link_to": null, + "label": "App Device", + "link_to": "App Device", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Card Break" + "type": "Link" }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "App Labels", - "link_to": "App Labels", + "label": "Add Ons", + "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Link" + "type": "Card Break" }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Custom Languages", - "link_to": "Custom Languages", + "label": "App Users", + "link_to": "App Users", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2935,12 +2967,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Procedure Name", - "link_to": "Procedure Name", + "label": "Bookmark", + "link_to": "Bookmark", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2950,12 +2982,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Procedure Step Name", - "link_to": "Procedure Step Name", + "label": "Circular", + "link_to": "Circular", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2965,27 +2997,27 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Translation Reports", - "link_to": null, + "label": "Teknet Module", + "link_to": "Teknet Module", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Card Break" + "type": "Link" }, { "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Vehicle Segment Translation", - "link_to": "_Vehicle Segment Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "Teknet Group", + "link_to": "Teknet Group", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -2994,13 +3026,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Vehicle Translation", - "link_to": "_Vehicle Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "User Manual", + "link_to": "User Manual", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3009,13 +3041,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Variant Translation", - "link_to": "_Variant Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "User Feedback", + "link_to": "User Feedback", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3024,13 +3056,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Fuel Translation", - "link_to": "_Fuel Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "GSS User Manual", + "link_to": "GSS User Manual", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3039,43 +3071,43 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Drive Translation", - "link_to": "_Drive Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "For Reports", + "link_to": null, + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Link" + "type": "Card Break" }, { "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Transmission Translation", - "link_to": "_Transmission Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "Tools", + "link_to": null, + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", - "type": "Link" + "type": "Card Break" }, { "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Systems Translation", - "link_to": "_Systems Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "File Manager", + "link_to": "File", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3084,21 +3116,21 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 1, - "label": "Sub Systems Translation", - "link_to": "_Sub Systems Translation", - "link_type": "Report", + "is_query_report": 0, + "label": "Data Import", + "link_to": "Data Import", + "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Masters", + "parent": "Add Ons", "parentfield": "links", "parenttype": "Workspace", "type": "Link" } ], - "modified": "2022-03-17 18:59:51.605303", - "module": "Masters", - "name": "Masters", + "modified": "2022-02-26 12:30:34.844158", + "module": "Add Ons", + "name": "Add Ons", "onboarding": null, "parent": null, "parentfield": null, @@ -3110,306 +3142,229 @@ "shortcuts_label": null }, { - "cards_label": "", + "cards_label": null, "category": "Places", - "charts": [ - { - "chart_name": "Procedure", - "label": null, - "parent": "Dashboard", - "parentfield": "charts", - "parenttype": "Workspace" - }, - { - "chart_name": "KM Mapping", - "label": null, - "parent": "Dashboard", - "parentfield": "charts", - "parenttype": "Workspace" - }, - { - "chart_name": "Publish", - "label": "Publish Type", - "parent": "Dashboard", - "parentfield": "charts", - "parenttype": "Workspace" - }, - { - "chart_name": "Publish Status", - "label": null, - "parent": "Dashboard", - "parentfield": "charts", - "parenttype": "Workspace" - } - ], + "charts": [], "charts_label": null, "developer_mode_only": 0, - "disable_user_customization": 0, + "disable_user_customization": 1, "docstatus": 0, "doctype": "Workspace", "extends": null, "extends_another_page": 0, "for_user": null, "hide_custom": 0, - "icon": "dashboard", + "icon": "sell", "is_default": 0, "is_standard": 0, - "label": "Dashboard", - "links": [], - "modified": "2022-03-17 19:03:24.863290", - "module": "Core", - "name": "Dashboard", - "onboarding": null, - "parent": null, - "parentfield": null, - "parenttype": null, - "pin_to_bottom": 0, - "pin_to_top": 1, - "restrict_to_domain": null, - "shortcuts": [ + "label": "Reports", + "links": [ { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Vehicle Segment", - "link_to": "Vehicle Segment", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 0, + "label": "Tools", + "link_to": null, + "link_type": "DocType", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Card Break" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Service Kilometer", - "link_to": "Service Kilometers", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 1, + "label": "Audit Report", + "link_to": "Audit Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": "#47a1f5", - "doc_view": "List", - "format": null, - "icon": "setting-gear", - "label": "Vehicle", - "link_to": "Vehicle", - "parent": "Dashboard", - "parentfield": "shortcuts", + "dependencies": null, + "hidden": 0, + "icon": null, + "is_query_report": 1, + "label": "File Structure", + "link_to": "_File Structure", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Variant", - "link_to": "Variant", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 1, + "label": "Model Download Report", + "link_to": "Model Download Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Fuel", - "link_to": "Fuel", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 1, + "label": "Kilometer Mapping", + "link_to": "Kilometer Mapping", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Transmission", - "link_to": "Transmission", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 0, + "label": "Add Ons", + "link_to": null, + "link_type": "DocType", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Card Break" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Drive", - "link_to": "Drive", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 1, + "label": "Login Report", + "link_to": "Login Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": "#ECAD4B", - "doc_view": "List", - "format": null, - "icon": "list", - "label": "Systems", - "link_to": "Systems", - "parent": "Dashboard", - "parentfield": "shortcuts", + "dependencies": null, + "hidden": 0, + "icon": null, + "is_query_report": 1, + "label": "Installation Report", + "link_to": "Installation Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": "#29CD42", - "doc_view": "List", - "format": null, - "icon": "gantt", - "label": "Sub Systems", - "link_to": "Sub Systems", - "parent": "Dashboard", - "parentfield": "shortcuts", + "dependencies": null, + "hidden": 0, + "icon": null, + "is_query_report": 1, + "label": "Feedback Report", + "link_to": "Feedback Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": "#761ACB", - "doc_view": "List", - "format": null, - "icon": "solid-info", - "label": "Variant Mapping", - "link_to": "Variant Mapping", - "parent": "Dashboard", - "parentfield": "shortcuts", + "dependencies": null, + "hidden": 0, + "icon": null, + "is_query_report": 1, + "label": "Model Hit", + "link_to": "Model Hit Report", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" - }, - { - "color": "#CB2929", - "doc_view": "List", - "format": null, - "icon": "file", - "label": "Procedure", - "link_to": "Procedure", - "parent": "Dashboard", - "parentfield": "shortcuts", - "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" - }, - { - "color": "#ED6396", - "doc_view": "List", - "format": null, - "icon": "branch", - "label": "System Mapping", - "link_to": "System Mapping", - "parent": "Dashboard", - "parentfield": "shortcuts", - "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Link" }, { - "color": null, - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "Kilometer Mapping", - "link_to": "Kilometer Mapping", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 0, + "label": "Translation", + "link_to": null, + "link_type": "DocType", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" + "type": "Card Break" }, { - "color": "#761ACB", - "doc_view": "List", - "format": null, + "dependencies": null, + "hidden": 0, "icon": null, - "label": "App User Feedback", - "link_to": "User Feedback", - "parent": "Dashboard", - "parentfield": "shortcuts", + "is_query_report": 1, + "label": "Vehicle Segment Translation", + "link_to": "_Vehicle Segment Translation", + "link_type": "Report", + "onboard": 0, + "only_for": null, + "parent": "Reports", + "parentfield": "links", "parenttype": "Workspace", - "restrict_to_domain": "", - "stats_filter": "{\"name\":[\"is\",\"set\"]}", - "type": "DocType" - } - ], - "shortcuts_label": null - }, - { - "cards_label": null, - "category": "Places", - "charts": [], - "charts_label": null, - "developer_mode_only": 0, - "disable_user_customization": 1, - "docstatus": 0, - "doctype": "Workspace", - "extends": null, - "extends_another_page": 0, - "for_user": null, - "hide_custom": 0, - "icon": "integration", - "is_default": 0, - "is_standard": 0, - "label": "Transaction", - "links": [ + "type": "Link" + }, { "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Transactions", - "link_to": null, - "link_type": "DocType", + "is_query_report": 1, + "label": "Vehicle Translation", + "link_to": "_Vehicle Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", - "type": "Card Break" + "type": "Link" }, { "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Variant Mapping", - "link_to": "Variant Mapping", - "link_type": "DocType", + "is_query_report": 1, + "label": "Variant Translation", + "link_to": "_Variant Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3418,13 +3373,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Procedure", - "link_to": "Procedure", - "link_type": "DocType", + "is_query_report": 1, + "label": "Fuel Translation", + "link_to": "_Fuel Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3433,13 +3388,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "System Mapping", - "link_to": "System Mapping", - "link_type": "DocType", + "is_query_report": 1, + "label": "Transmission Translation", + "link_to": "_Transmission Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3448,13 +3403,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Kilometer Mapping", - "link_to": "Kilometer Mapping", - "link_type": "DocType", + "is_query_report": 1, + "label": "Drive Translation", + "link_to": "_Drive Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3463,13 +3418,13 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Publish", - "link_to": "Publish", - "link_type": "DocType", + "is_query_report": 1, + "label": "Systems Translation", + "link_to": "_Systems Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3478,33 +3433,33 @@ "dependencies": null, "hidden": 0, "icon": null, - "is_query_report": 0, - "label": "Translation Reports", - "link_to": null, - "link_type": "DocType", + "is_query_report": 1, + "label": "Sub Systems Translation", + "link_to": "_Sub Systems Translation", + "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Transaction", + "parent": "Reports", "parentfield": "links", "parenttype": "Workspace", - "type": "Card Break" + "type": "Link" } ], - "modified": "2021-11-29 10:26:07.339507", - "module": "Transactions", - "name": "Transaction", + "modified": "2022-04-11 17:57:02.783824", + "module": "Core", + "name": "Reports", "onboarding": null, "parent": null, "parentfield": null, "parenttype": null, - "pin_to_bottom": 0, + "pin_to_bottom": 1, "pin_to_top": 0, "restrict_to_domain": null, "shortcuts": [], "shortcuts_label": null }, { - "cards_label": null, + "cards_label": "Masters", "category": "Places", "charts": [], "charts_label": null, @@ -3516,22 +3471,22 @@ "extends_another_page": 0, "for_user": null, "hide_custom": 0, - "icon": "attachment", + "icon": "list", "is_default": 0, "is_standard": 0, - "label": "Add Ons", + "label": "Masters", "links": [ { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Masters", + "label": "Masters #1", "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Card Break" @@ -3541,12 +3496,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "User Feedback Types", - "link_to": "User Feedback_Types", + "label": "Vehicle Segment", + "link_to": "Vehicle Segment", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3556,12 +3511,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Application Menu", - "link_to": "Application Menu", + "label": "Service Kilometers", + "link_to": "Service Kilometers", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3571,12 +3526,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "App Preference", - "link_to": "App Preference", + "label": "Vehicle", + "link_to": "Vehicle", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3586,12 +3541,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "App Dealer", - "link_to": "App Dealer", + "label": "Variant", + "link_to": "Variant", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3601,12 +3556,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "App Device", - "link_to": "App Device", + "label": "Translation", + "link_to": "Translation", "link_type": "DocType", "onboard": 0, - "only_for": null, - "parent": "Add Ons", + "only_for": "", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3616,12 +3571,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Add Ons", + "label": "Masters #2", "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Card Break" @@ -3631,12 +3586,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "App Users", - "link_to": "App Users", + "label": "Fuel", + "link_to": "Fuel", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3646,12 +3601,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Bookmark", - "link_to": "Bookmark", + "label": "Transmission", + "link_to": "Transmission", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3661,12 +3616,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Circular", - "link_to": "Circular", + "label": "Drive", + "link_to": "Drive", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3676,12 +3631,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Teknet Module", - "link_to": "Teknet Module", + "label": "Systems", + "link_to": "Systems", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3691,12 +3646,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Teknet Group", - "link_to": "Teknet Group", + "label": "Sub Systems", + "link_to": "Sub Systems", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3706,27 +3661,27 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "User Manual", - "link_to": "User Manual", + "label": "Masters #3", + "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", - "type": "Link" + "type": "Card Break" }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "User Feedback", - "link_to": "User Feedback", + "label": "App Labels", + "link_to": "App Labels", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3736,12 +3691,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "GSS User Manual", - "link_to": "GSS User Manual", + "label": "Custom Languages", + "link_to": "Custom Languages", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3751,42 +3706,12 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "For Reports", - "link_to": null, - "link_type": "DocType", - "onboard": 0, - "only_for": null, - "parent": "Add Ons", - "parentfield": "links", - "parenttype": "Workspace", - "type": "Card Break" - }, - { - "dependencies": null, - "hidden": 0, - "icon": null, - "is_query_report": 0, - "label": "Tools", - "link_to": null, - "link_type": "DocType", - "onboard": 0, - "only_for": null, - "parent": "Add Ons", - "parentfield": "links", - "parenttype": "Workspace", - "type": "Card Break" - }, - { - "dependencies": null, - "hidden": 0, - "icon": null, - "is_query_report": 0, - "label": "File Manager", - "link_to": "File", + "label": "Procedure Name", + "link_to": "Procedure Name", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3796,59 +3721,27 @@ "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Data Import", - "link_to": "Data Import", + "label": "Procedure Step Name", + "link_to": "Procedure Step Name", "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Add Ons", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" - } - ], - "modified": "2022-02-26 12:30:34.844158", - "module": "Add Ons", - "name": "Add Ons", - "onboarding": null, - "parent": null, - "parentfield": null, - "parenttype": null, - "pin_to_bottom": 0, - "pin_to_top": 0, - "restrict_to_domain": null, - "shortcuts": [], - "shortcuts_label": null - }, - { - "cards_label": null, - "category": "Places", - "charts": [], - "charts_label": null, - "developer_mode_only": 0, - "disable_user_customization": 1, - "docstatus": 0, - "doctype": "Workspace", - "extends": null, - "extends_another_page": 0, - "for_user": null, - "hide_custom": 0, - "icon": "sell", - "is_default": 0, - "is_standard": 0, - "label": "Reports", - "links": [ + }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 0, - "label": "Tools", + "label": "Translation Reports", "link_to": null, "link_type": "DocType", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Card Break" @@ -3858,12 +3751,12 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Audit Report", - "link_to": "Audit Report", + "label": "Vehicle Segment Translation", + "link_to": "_Vehicle Segment Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3873,12 +3766,12 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "File Structure", - "link_to": "_File Structure", + "label": "Vehicle Translation", + "link_to": "_Vehicle Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3888,12 +3781,12 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Model Download Report", - "link_to": "Model Download Report", + "label": "Variant Translation", + "link_to": "_Variant Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3903,42 +3796,27 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Kilometer Mapping", - "link_to": "Kilometer Mapping", + "label": "Fuel Translation", + "link_to": "_Fuel Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" }, - { - "dependencies": null, - "hidden": 0, - "icon": null, - "is_query_report": 0, - "label": "Add Ons", - "link_to": null, - "link_type": "DocType", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", - "parenttype": "Workspace", - "type": "Card Break" - }, { "dependencies": null, "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Login Report", - "link_to": "Login Report", + "label": "Drive Translation", + "link_to": "_Drive Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3948,12 +3826,12 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Installation Report", - "link_to": "Installation Report", + "label": "Transmission Translation", + "link_to": "_Transmission Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3963,12 +3841,12 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Feedback Report", - "link_to": "Feedback Report", + "label": "Systems Translation", + "link_to": "_Systems Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" @@ -3978,163 +3856,285 @@ "hidden": 0, "icon": null, "is_query_report": 1, - "label": "Model Usage", - "link_to": "Model Hit Report", + "label": "Sub Systems Translation", + "link_to": "_Sub Systems Translation", "link_type": "Report", "onboard": 0, "only_for": null, - "parent": "Reports", + "parent": "Masters", "parentfield": "links", "parenttype": "Workspace", "type": "Link" + } + ], + "modified": "2022-03-17 18:59:51.605303", + "module": "Masters", + "name": "Masters", + "onboarding": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "pin_to_bottom": 0, + "pin_to_top": 0, + "restrict_to_domain": null, + "shortcuts": [], + "shortcuts_label": null + }, + { + "cards_label": "", + "category": "Places", + "charts": [ + { + "chart_name": "Procedure", + "label": null, + "parent": "Dashboard", + "parentfield": "charts", + "parenttype": "Workspace" }, { - "dependencies": null, - "hidden": 0, + "chart_name": "KM Mapping", + "label": null, + "parent": "Dashboard", + "parentfield": "charts", + "parenttype": "Workspace" + }, + { + "chart_name": "Publish", + "label": "Publish Type", + "parent": "Dashboard", + "parentfield": "charts", + "parenttype": "Workspace" + }, + { + "chart_name": "Publish Status", + "label": null, + "parent": "Dashboard", + "parentfield": "charts", + "parenttype": "Workspace" + } + ], + "charts_label": null, + "developer_mode_only": 0, + "disable_user_customization": 0, + "docstatus": 0, + "doctype": "Workspace", + "extends": null, + "extends_another_page": 0, + "for_user": null, + "hide_custom": 0, + "icon": "dashboard", + "is_default": 0, + "is_standard": 0, + "label": "Dashboard", + "links": [], + "modified": "2022-03-17 19:03:24.863290", + "module": "Core", + "name": "Dashboard", + "onboarding": null, + "parent": null, + "parentfield": null, + "parenttype": null, + "pin_to_bottom": 0, + "pin_to_top": 1, + "restrict_to_domain": null, + "shortcuts": [ + { + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 0, - "label": "Translation", - "link_to": null, - "link_type": "DocType", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Vehicle Segment", + "link_to": "Vehicle Segment", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Card Break" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Vehicle Segment Translation", - "link_to": "_Vehicle Segment Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Service Kilometer", + "link_to": "Service Kilometers", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, - "icon": null, - "is_query_report": 1, - "label": "Vehicle Translation", - "link_to": "_Vehicle Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "color": "#47a1f5", + "doc_view": "List", + "format": null, + "icon": "setting-gear", + "label": "Vehicle", + "link_to": "Vehicle", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Variant Translation", - "link_to": "_Variant Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Variant", + "link_to": "Variant", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Fuel Translation", - "link_to": "_Fuel Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Fuel", + "link_to": "Fuel", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Transmission Translation", - "link_to": "_Transmission Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Transmission", + "link_to": "Transmission", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Drive Translation", - "link_to": "_Drive Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Drive", + "link_to": "Drive", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": "#ECAD4B", + "doc_view": "List", + "format": null, + "icon": "list", + "label": "Systems", + "link_to": "Systems", + "parent": "Dashboard", + "parentfield": "shortcuts", + "parenttype": "Workspace", + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, + { + "color": "#29CD42", + "doc_view": "List", + "format": null, + "icon": "gantt", + "label": "Sub Systems", + "link_to": "Sub Systems", + "parent": "Dashboard", + "parentfield": "shortcuts", + "parenttype": "Workspace", + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, + { + "color": "#761ACB", + "doc_view": "List", + "format": null, + "icon": "solid-info", + "label": "Variant Mapping", + "link_to": "Variant Mapping", + "parent": "Dashboard", + "parentfield": "shortcuts", + "parenttype": "Workspace", + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, + { + "color": "#CB2929", + "doc_view": "List", + "format": null, + "icon": "file", + "label": "Procedure", + "link_to": "Procedure", + "parent": "Dashboard", + "parentfield": "shortcuts", + "parenttype": "Workspace", + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, + { + "color": "#ED6396", + "doc_view": "List", + "format": null, + "icon": "branch", + "label": "System Mapping", + "link_to": "System Mapping", + "parent": "Dashboard", + "parentfield": "shortcuts", + "parenttype": "Workspace", + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, + { + "color": null, + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Systems Translation", - "link_to": "_Systems Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "Kilometer Mapping", + "link_to": "Kilometer Mapping", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" }, { - "dependencies": null, - "hidden": 0, + "color": "#761ACB", + "doc_view": "List", + "format": null, "icon": null, - "is_query_report": 1, - "label": "Sub Systems Translation", - "link_to": "_Sub Systems Translation", - "link_type": "Report", - "onboard": 0, - "only_for": null, - "parent": "Reports", - "parentfield": "links", + "label": "App User Feedback", + "link_to": "User Feedback", + "parent": "Dashboard", + "parentfield": "shortcuts", "parenttype": "Workspace", - "type": "Link" + "restrict_to_domain": "", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" } ], - "modified": "2022-02-09 19:31:28.986418", - "module": "Core", - "name": "Reports", - "onboarding": null, - "parent": null, - "parentfield": null, - "parenttype": null, - "pin_to_bottom": 1, - "pin_to_top": 0, - "restrict_to_domain": null, - "shortcuts": [], "shortcuts_label": null }, {