From 22069d28240608a62b5b651ef32ab3334917a710 Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Fri, 15 Sep 2023 16:45:38 +0530 Subject: [PATCH] modules fix --- smart_service/apis/v2/master.py | 28 +- .../masters/doctype/app_labels/app_labels.js | 8 +- .../doctype/feature_finder/feature_finder.js | 39 +- .../feature_finder/feature_finder.json | 17 +- .../doctype/feature_finder/feature_finder.py | 1 + .../feature_finder_category_master.json | 4 +- .../feature_finder_master.json | 4 +- .../feature_finder_specification_master.json | 4 +- .../module_publish_mapping.json | 4 +- .../repair_service_mapping.json | 8 +- .../repair_service_master.json | 4 +- .../repair_service_master_mapping.json | 4 +- .../special_tool_information.js | 2 +- .../special_tool_information.json | 10 +- .../training_information.js | 2 +- .../training_information.json | 4 +- .../training_information_master.json | 4 +- .../transactions/doctype/publish/publish.js | 1803 ++++++++++------- .../transactions/doctype/publish/publish.json | 4 +- .../transactions/doctype/publish/publish.py | 255 +-- 20 files changed, 1300 insertions(+), 909 deletions(-) diff --git a/smart_service/apis/v2/master.py b/smart_service/apis/v2/master.py index f573eaa..407b7f1 100644 --- a/smart_service/apis/v2/master.py +++ b/smart_service/apis/v2/master.py @@ -55,15 +55,15 @@ def get_repair_service_mapping(vehicle, language): try: repair_service_details = [] if language == 'en': - repair_service_details = frappe.db.sql(f""" select vehicle,vehicle_id,name,language,check_list_name,active_status,display_order,my_id from + repair_service_details = frappe.db.sql(f""" select vehicle,vehicle_id,name,language,check_list_name,active_status,display_order,my_id,keywords from `tabRepair Service Mapping` where vehicle = '{vehicle}' and language = '{language}'; """, as_dict=1) else: - repair_service_details = frappe.db.sql(f""" select vehicle,vehicle_id,name,language,translated_check_list_name as check_list_name,active_status, + repair_service_details = frappe.db.sql(f""" select vehicle,vehicle_id,name,language,translated_check_list_name as check_list_name,active_status,keywords, display_order,my_id from `tabRepair Service Mapping` where vehicle = '{vehicle}' and language = '{language}'; """, as_dict=1) for d in repair_service_details: - d['complaint'] = frappe.db.sql(f""" select complaint,remedial_action_ok,remedial_action_not_ok,idx as display_order,active_status from + d['complaint'] = frappe.db.sql(f""" select complaint,remedial_action_ok,remedial_action_not_ok,idx as display_order from `tabRepair Service Child` where parent = '{d['name']}' order by display_order ;""", as_dict=1) return True, repair_service_details @@ -77,6 +77,7 @@ def get_feature_finder(vehicle, variant, language): feature_finder_details = [] if language == 'en': feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.vehicle_id,ff.variant,ff.variant_id,ff.language, + ff.keywords,ff.sop_name, ff.features_names as feature_name,ff.feature_category,ff.display_order,ff.active_status, ffm.feature_pdf as pdf from `tabFeature Finder` ff left join `tabFeature Finder Master` ffm on ff.features_names = ffm.feature_name @@ -85,6 +86,7 @@ def get_feature_finder(vehicle, variant, language): """, as_dict=1) else: feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.vehicle_id,ff.variant,ff.variant_id,ff.language, + ff.keywords,ff.sop_name, ff.translated_feature_name as feature_name,ff.feature_category, ff.display_order,ff.active_status,ffm.feature_pdf as pdf from `tabFeature Finder` ff left join `tabFeature Finder Master` ffm on ff.features_names = ffm.feature_name @@ -93,32 +95,32 @@ def get_feature_finder(vehicle, variant, language): for f in feature_finder_details: f['disclaimer'] = frappe.db.sql(f''' - SELECT name,content,active_status,idx as display_order FROM `tabFeature Finder Disclaimer` + SELECT name,content,idx as display_order FROM `tabFeature Finder Disclaimer` where parent = '{str(f['vehicle'])+ str('-')+ str(f['feature_name']) +str('-')+str(f['language'])}'; ''', as_dict=1) - sop_images = frappe.db.sql(f""" select image,idx as display_order,active_status from `tabFeature Finder Images` where + sop_images = frappe.db.sql(f""" select image,idx as display_order from `tabFeature Finder Images` where parent = '{f['name']}' and feature_type ='SOP';""", as_dict=1) - sop_content = frappe.db.sql(f"""select content,idx as display_order, active_status from `tabFeature Finder Content` + sop_content = frappe.db.sql(f"""select content,idx as display_order from `tabFeature Finder Content` where parent = '{f['name']}' and feature_type ='SOP';""", as_dict=1) - sop_specification = frappe.db.sql(f"""select specification,value,idx as display_order,active_status from `tabFeature Finder Specification` + sop_specification = frappe.db.sql(f"""select specification,value,idx as display_order from `tabFeature Finder Specification` where parent = '{f['name']}' and feature_type ='SOP';""", as_dict=1) f['sop'] = {'content': sop_content, 'images': sop_images, - 'specificaton': sop_specification} + 'specificaton': sop_specification,'sop_name':f['sop_name']} post_vin_data = frappe.db.sql(f'''select name,idx as display_order,post_vin_cutoff_name,post_vin_cutoff_id from `tabPost Vin Cutoff ID` where parent = '{f['name']}';''', as_dict=1) for p in post_vin_data: - vin_content = frappe.db.sql(f"""select content,idx as display_order, active_status from `tabFeature Finder Content` + vin_content = frappe.db.sql(f"""select content,idx as display_order from `tabFeature Finder Content` where parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}';""", as_dict=1) - vin_images = frappe.db.sql(f""" select image,idx as display_order,active_status from `tabFeature Finder Images` where + vin_images = frappe.db.sql(f""" select image,idx as display_order from `tabFeature Finder Images` where parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}';""", as_dict=1) - vin_specification = frappe.db.sql(f"""select specification,value,idx as display_order,active_status from `tabFeature Finder Specification` + vin_specification = frappe.db.sql(f"""select specification,value,idx as display_order from `tabFeature Finder Specification` where parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}';""", as_dict=1) p['content'] = vin_content p['images'] = vin_images @@ -133,7 +135,7 @@ def get_feature_finder(vehicle, variant, language): @frappe.whitelist(methods=["POST"], allow_guest=1) def get_training_information(vehicle, language): try: - training_information = frappe.db.sql(f"""select name,vehicle,category,topic,language,active_status from`tabTraining Information` + training_information = frappe.db.sql(f"""select name,vehicle,category,topic,language,active_status,keywords from`tabTraining Information` where vehicle = "{vehicle}" and language = "{language}"; """, as_dict=1) for t in training_information: @@ -224,7 +226,7 @@ def new_publish1(): @frappe.whitelist(methods=['POST'], allow_guest=1) def get_special_tool_information(vehicle): try: - special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, my_id from `tabSpecial Tool Information` + special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, my_id,keywords from `tabSpecial Tool Information` where vehicle="{vehicle}";''', as_dict=1) for s in special_tool_details: s['tool_usage_content'] = frappe.db.sql(f'''select idx as 'display_order',image,content,video,asset_type,active_status from `tabMST Information Assets` diff --git a/smart_service/masters/doctype/app_labels/app_labels.js b/smart_service/masters/doctype/app_labels/app_labels.js index 81564fe..9f56530 100644 --- a/smart_service/masters/doctype/app_labels/app_labels.js +++ b/smart_service/masters/doctype/app_labels/app_labels.js @@ -1,6 +1,6 @@ // Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors // For license information, please see license.txt - +var regex = /[!@#$%^&*()]+/; frappe.ui.form.on('App Labels', { is_group: function (frm) { @@ -39,7 +39,7 @@ frappe.ui.form.on('App Labels', { frappe.throw(__("Just a . is not prescribed!")); frappe.validated = false; } - var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/]+/; + // var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/]+/; if (frm.doc.english_label) { if (regex.test(frm.doc.english_label) === true) { frappe.throw(__("English Label : Only letters, numbers and - , are allowed.")); @@ -66,7 +66,7 @@ frappe.ui.form.on('App Labels', { frappe.throw(__("Just a . is not prescribed!")); frappe.validated = false; } - var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/?]+/; + // var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/?]+/; if (frm.doc.page_name) { if (regex.test(frm.doc.page_name) === true) { frappe.throw(__("Page Name : Only letters, numbers and -, are allowed.")); @@ -93,7 +93,7 @@ frappe.ui.form.on('App Labels', { frappe.throw(__("Just a . is not prescribed!")); frappe.validated = false; } - var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/]+/; + // var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/]+/; if (frm.doc.label) { if (regex.test(frm.doc.label) === true) { frappe.throw(__("Translated Label : Only letters, numbers and -, are allowed.")); diff --git a/smart_service/phase_2/doctype/feature_finder/feature_finder.js b/smart_service/phase_2/doctype/feature_finder/feature_finder.js index b8b14b2..c329ce1 100644 --- a/smart_service/phase_2/doctype/feature_finder/feature_finder.js +++ b/smart_service/phase_2/doctype/feature_finder/feature_finder.js @@ -16,21 +16,21 @@ frappe.ui.form.on('Feature Finder', { set_display_order(frm) show_images(frm) - var is_sop =1 - if(frm.doc.post_vin_cutoff_id_tab && frm.doc.post_vin_cutoff_id_tab.length>0){ - frm.doc.post_vin_cutoff_id_tab.map(v=>{ - if(v.post_vin_cutoff_name=="SOP"){ - is_sop=0 - } - }) + // var is_sop =1 + // if(frm.doc.post_vin_cutoff_id_tab && frm.doc.post_vin_cutoff_id_tab.length>0){ + // frm.doc.post_vin_cutoff_id_tab.map(v=>{ + // if(v.post_vin_cutoff_name=="SOP"){ + // is_sop=0 + // } + // }) - } - if(is_sop==1){ - var childTable = cur_frm.add_child("post_vin_cutoff_id_tab"); - childTable.post_vin_cutoff_name="SOP" + // } + // if(is_sop==1){ + // var childTable = cur_frm.add_child("post_vin_cutoff_id_tab"); + // childTable.post_vin_cutoff_name="SOP" - cur_frm.refresh_fields("post_vin_cutoff_id_tab"); - } + // cur_frm.refresh_fields("post_vin_cutoff_id_tab"); + // } }, @@ -170,6 +170,7 @@ frappe.ui.form.on('Feature Finder', { language: frm.doc.language, } }).then(records => { + console.log(records,"records") if (records.length) { frappe.db.set_value('Feature Finder', records[0].name, { display_order: original_display_order @@ -221,7 +222,9 @@ function set_display_order_child(doctype_name, values) { } function show_images(frm) { var res = $(cur_frm.fields_dict.image_html.wrapper).empty(); - if (cur_frm.doc.feature_finder_images && cur_frm.doc.feature_finder_images.length > 0) { + var feature_finder_images_ = frm.doc.feature_finder_images.filter(o => o.feature_type == frm.doc.tab_ref) + if (cur_frm.doc.feature_finder_images && cur_frm.doc.feature_finder_images.length > 0 && feature_finder_images_.length>0) { + var img_html = "" img_html += "
" cur_frm.doc.feature_finder_images.map(val =>{ @@ -242,7 +245,12 @@ function custom_tab_html(frm) { var res = $(cur_frm.fields_dict.test_html.wrapper).empty(); var ret = '