Browse Source

mst prework hmtl content

version2
venkata akhil 11 months ago
parent
commit
adb7bb7eae
  1. 24
      smart_service/apis/v2/master.py
  2. 2
      smart_service/phase_2/doctype/instructions/instructions.json
  3. 16
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

24
smart_service/apis/v2/master.py

@ -196,17 +196,33 @@ def new_publish():
flag, data = get_qwik_service(variant, language)
CLEANR = re.compile('<.*?>')
CLEANR_back_slash = re.compile("\"")
ul_html='<ul style="list-style-type: none; padding-left: 0px;"> <span style="width: 0;height: 0;border-top: 9px solid transparent;border-left: 12px solid red;border-bottom: 9px solid transparent;position: absolute;"></span>'
li_html='<li style="margin-left: 25px;padding: 0px 1px 5px 0px;"data-list=\"bullet\">'
cling_li='</li><span style="width: 0;height: 0;border-top: 9px solid transparent;border-left: 12px solid red;border-bottom: 9px solid transparent;position: absolute;"></span>'
ul_html='<ul style="list-style-type: none; padding-left: 0px;"><span style="width: 0;height: 0;border-top: 6px solid transparent;border-left: 8px solid red;border-bottom: 6px solid transparent;position: absolute;margin-top: 3px;"></span>'
li_html='<li style="margin-left: 15px;padding: 0px 1px 5px 0px;"data-list=\"bullet\">'
cling_li='</li><span style="width: 0;height: 0;border-top: 6px solid transparent;border-left: 8px solid red;border-bottom: 6px solid transparent;position: absolute;margin-top: 3px;"></span>'
cling_last='</ul>'
find_last_ul='<span style="width: 0;height: 0;border-top: 9px solid transparent;border-left: 12px solid red;border-bottom: 9px solid transparent;position: absolute;"></span></ul>'
find_last_ul='<span style="width: 0;height: 0;border-top: 6px solid transparent;border-left: 8px solid red;border-bottom: 6px solid transparent;position: absolute;margin-top: 3px;"></span></ul>'
for dt in data:
if len(dt['consumables'])>0:
for con in dt['consumables']:
if con['content']:
con['content'] = re.sub(CLEANR, '', con['content'])
if len(dt['pre_work'])>0:
for pw in dt['pre_work']:
reg_str = "<p>"
res = re.findall(reg_str, pw['content'])
if res:
pw['content'] = re.sub('<p>','<p style="color: #fff">',pw['content'] )
else:
pw['content'] = '<p style="color: #fff">'+pw['content']+'</p>'
# VALID_TAGS = ['div', 'p']
# soup = BeautifulSoup(pw['content'])
# for tag in soup.findAll('p'):
# if tag.name in VALID_TAGS:
# pw['content'] = re.sub('<p>','<p style="color: #fff">',pw['content'] )
# else:
# pw['content'] = '<p style="color: #fff">'+pw['content']+'</p>'
if dt['qwik_procedure']:
for qp in dt['qwik_procedure']['LHS']:
if qp['content']:

2
smart_service/phase_2/doctype/instructions/instructions.json

@ -50,7 +50,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-19 16:33:47.404474",
"modified": "2023-10-19 17:11:44.433031",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Instructions",

16
smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

@ -204,16 +204,17 @@ frappe.ui.form.on('Special Tool Information', {
},
});
function teb_validation(frm){
if(frm.is_new()){
cur_frm.clear_table("instructions");
cur_frm.refresh_fields('instructions');
cur_frm.refresh_fields()
}
// frm.reload_doc()
if(frm.doc.category == "TEB"){
if(frm.is_new()){
cur_frm.clear_table("instructions");
cur_frm.refresh_fields('instructions');
cur_frm.refresh_fields()
}
//to set df property to child readonly based on main doc
cur_frm.refresh_fields("instructions");
var df = frappe.meta.get_docfield("Instructions", "content", cur_frm.doc.name);
@ -269,7 +270,7 @@ function set_display_order(frm){
frappe.ui.form.on('Instructions', {
// child table depends_on based on main doctype
instructions_add: function (frm, cdt, cdn) {
refresh_field("instructions")
// refresh_field("instructions")
var child = locals[cdt][cdn];
var x = child.idx - 1;
if(frm.doc.category == "TEB"){
@ -305,7 +306,6 @@ frappe.ui.form.on('Instructions', {
cur_frm.get_field("instructions").grid.grid_rows[x].columns.title.df.read_only = 0;
cur_frm.refresh_field("content_type")
}
// frm.reload_doc()
cur_frm.refresh_fields("content_type")
refresh_field("instructions");
cur_frm.refresh_fields();

Loading…
Cancel
Save