diff --git a/smart_service/apis/v2/master.py b/smart_service/apis/v2/master.py index c7d4bc4..f59ef90 100644 --- a/smart_service/apis/v2/master.py +++ b/smart_service/apis/v2/master.py @@ -224,22 +224,22 @@ def new_publish1(): with open(BASE_PATH + str(vehicle) + '-feature_finder.json') as outfile: data = json.load(outfile) data = data['data'] - filter_json = filter_publish_json(data,variant) - data = filter_json - + filter_json = filter_publish_json(data, variant) + data = filter_json + elif module == 'Repair/Service Check Sheet': with open(BASE_PATH + str(vehicle) + '-repair_check_sheet.json') as outfile: data = json.load(outfile) data = data['data'] - filter_json = filter_publish_json(data,variant) - data = filter_json + filter_json = filter_publish_json(data, variant) + data = filter_json elif module == 'QWIK Service': with open(BASE_PATH + str(vehicle) + '-qwik_service.json') as outfile: data = json.load(outfile) data = data['data'] - filter_json = filter_publish_json(data,variant) - data = filter_json + filter_json = filter_publish_json(data, variant) + data = filter_json elif module == 'Training Information': pass @@ -266,17 +266,10 @@ 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,keywords from `tabSpecial Tool Information` - # where vehicle="{vehicle}";''', as_dict=1) - - special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,tool_name,aggregate_name, aggregate_image as 'tool_image', + special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,aggregate_name, aggregate_image as 'tool_image', pdf,image,video,keywords,display_order,my_id,active_status from `tabSpecial Tool Information` where vehicle= '%s' ;''' % (vehicle), as_dict=1) for s in special_tool_information: - # s['tool_usage_content'] = frappe.db.sql(f'''select idx as 'display_order',image,content,video,asset_type,active_status - # from `tabMST Information Assets` where parent = '{s['name']}' order by display_order;''', as_dict=1) - s['instructions'] = frappe.db.sql('''select idx as 'display_order',step_name,content_type,content,attach_file,title from `tabInstructions` where parent = '%s' order by display_order;''' % (s['name']), as_dict=1) return True, special_tool_information @@ -344,10 +337,11 @@ def update_publish_mapping(vehicle, variant, language, module): doc.save() return 1 -def filter_publish_json(src_json,filter_cond): + +def filter_publish_json(src_json, filter_cond): try: filtered_json = [src_json.get(filter_cond, None) for d in src_json] - + return filtered_json[0] except Exception as e: - frappe.throw(str(e)) \ No newline at end of file + frappe.throw(str(e)) 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 07d5869..d786754 100644 --- a/smart_service/phase_2/doctype/feature_finder/feature_finder.js +++ b/smart_service/phase_2/doctype/feature_finder/feature_finder.js @@ -1046,7 +1046,7 @@ function custom_tab_html(frm) { console.log(values.image,"values.image") frappe.call({ method: "smart_service.phase_2.doctype.feature_finder.feature_finder.file_validation", - args: { + args: { image: values.image, }, callback: function (r) { diff --git a/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json b/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json index f8e9d8d..3853960 100644 --- a/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json +++ b/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json @@ -10,23 +10,21 @@ "published", "column_break_cyo0a", "vehicle", - "active_status", - "display_order", + "tool_type", + "keywords", + "image", + "aggregate_image", "column_break_m3p9i", "category", "aggregate_name", - "column_break_whk88", - "tool_type", - "tool_name", + "pdf", + "column_break_wvkn2", + "active_status", + "display_order", + "video", "my_id", "section_break_e91wx", - "instructions", - "teb_instructions", - "keywords", - "pdf", - "image", - "aggregate_image", - "video" + "instructions" ], "fields": [ { @@ -67,10 +65,6 @@ "fieldname": "section_break_e91wx", "fieldtype": "Section Break" }, - { - "fieldname": "column_break_whk88", - "fieldtype": "Column Break" - }, { "fieldname": "active_status", "fieldtype": "Select", @@ -123,24 +117,12 @@ "label": "Instructions", "options": "Instructions" }, - { - "depends_on": "eval:doc.category !='TEB';", - "fieldname": "tool_name", - "fieldtype": "Data", - "label": "Tool Name" - }, { "fieldname": "tool_type", "fieldtype": "Select", "label": "Tool Type", - "options": "New Tool\nCarry Over" - }, - { - "fieldname": "teb_instructions", - "fieldtype": "Table", - "hidden": 1, - "label": "TEB Instructions", - "options": "TEB Instructions" + "options": "New Tool\nCarry Over", + "set_only_once": 1 }, { "fieldname": "image", @@ -155,11 +137,15 @@ "fieldname": "video", "fieldtype": "Attach", "label": "Video" + }, + { + "fieldname": "column_break_wvkn2", + "fieldtype": "Column Break" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-10-03 12:24:34.313498", + "modified": "2023-10-04 10:51:51.926504", "modified_by": "Administrator", "module": "Phase-2", "name": "Special Tool Information",