Browse Source

Publish phase2

version2
venkataakhil 1 year ago
parent
commit
500a4c4cfb
  1. 7
      smart_service/apis/master_api.py
  2. 45
      smart_service/apis/v2/master.py
  3. 231
      smart_service/phase_2/doctype/feature_finder/feature_finder.js
  4. 29
      smart_service/phase_2/doctype/feature_finder/feature_finder.json
  5. 54
      smart_service/phase_2/doctype/feature_finder/feature_finder.py
  6. 28
      smart_service/phase_2/doctype/feature_finder_category_master/feature_finder_category_master.js
  7. 11
      smart_service/phase_2/doctype/feature_finder_content/feature_finder_content.json
  8. 11
      smart_service/phase_2/doctype/feature_finder_images/feature_finder_images.json
  9. 10
      smart_service/phase_2/doctype/feature_finder_master/feature_finder_master.json
  10. 3
      smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json
  11. 7
      smart_service/phase_2/doctype/mst_information_assets/mst_information_assets.py
  12. 192
      smart_service/phase_2/doctype/publish_test/publish_test.js
  13. 13
      smart_service/phase_2/doctype/publish_test/publish_test.json
  14. 141
      smart_service/phase_2/doctype/publish_test/publish_test.py
  15. 110
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.js
  16. 8
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json
  17. 11
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.py
  18. 23
      smart_service/phase_2/doctype/repair_service_master/repair_service_master.js
  19. 13
      smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json
  20. 23
      smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json
  21. 60
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.js
  22. 14
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.json
  23. 22
      smart_service/phase_2/doctype/training_information/training_information.js
  24. 15
      smart_service/phase_2/doctype/training_information/training_information.json
  25. 6
      smart_service/phase_2/doctype/training_information/training_information.py
  26. 4
      smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.py
  27. 9
      smart_service/phase_2/doctype/training_information_master/training_information_master.js
  28. 3
      smart_service/phase_2/doctype/training_information_master/training_information_master.py
  29. 75
      smart_service/public/js/common_fun.js
  30. 6
      smart_service/transactions/doctype/publish/publish.js

7
smart_service/apis/master_api.py

@ -357,12 +357,13 @@ def variant(LSD, language):
mahindra_special_tool_information as 'Mahindra Special Tool Information',training_information as 'Training Information',
qwik_service as 'QWIK Service',pdi_inspection as 'PDI Inspection',
torque_information_nm as 'Torque Information NM'
FROM grmtest.`tabModule Publish Mapping` where vehicle='Thar' and variant='ZLX';''', as_dict=1)
FROM `tabModule Publish Mapping`where variant="{d['variant_name']}" ;''', as_dict=1)
if modules:
d['modules'] = [{'title': k, 'active_status': v, 'app_menu_id':
frappe.db.sql(f'''select app_menu_id from `tabModule Master` where module_name = '{k}' ;''', as_dict=1)[0]['app_menu_id']}
for k, v in modules[0].items()]
else:
d['modules'] = []
return {"status": 1, "error": None, 'data': data}
except Exception as e:

45
smart_service/apis/v2/master.py

@ -49,11 +49,18 @@ def get_role_mapping():
@frappe.whitelist(methods=["POST"], allow_guest=1)
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
`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,
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 `tabRepair Service Child`
where parent = '{d['name']}' order by display_order ;""", as_dict=1)
d['complaint'] = frappe.db.sql(f""" select complaint,remedial_action_ok,remedial_action_not_ok,idx as display_order,active_status from
`tabRepair Service Child` where parent = '{d['name']}' order by display_order ;""", as_dict=1)
return True, repair_service_details
except Exception as e:
@ -90,11 +97,23 @@ def old_get_feature_finder(vehicle, variant, language):
@frappe.whitelist(methods=["POST"], allow_guest=1)
def get_feature_finder(vehicle, variant, language):
try:
feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.vehicle_id,ff.variant,ff.variant_id,ff.language,ff.features_names as feature_name,
ff.feature_category,ff.display_order,ff.active_status,ffm.feature_pdf as pdf from `tabFeature Finder` ff
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.features_names as feature_name,ff.feature_category,ff.display_order,ff.active_status,
ffm.feature_pdf as pdf from grmtest.`tabFeature Finder` ff left join grmtest.`tabFeature Finder Master` ffm on
ff.features_names = ffm.feature_name
where ff.vehicle = "{vehicle}" and ffm.vehicle = "{vehicle}" and ff.variant = "{variant}"
and ff.language = "{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.translated_feature_name as feature_name,ff.feature_category,
ff.display_order,ff.active_status,ffm.feature_pdf as pdf from grmtest.`tabFeature Finder` ff
left join grmtest.`tabFeature Finder Master` ffm on ff.features_names = ffm.feature_name
where ff.vehicle = "{vehicle}" and ffm.vehicle = "{vehicle}" and ff.variant = "{variant}"
and ff.language = "{language}"; """, as_dict=1)
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`
@ -112,8 +131,7 @@ def get_feature_finder(vehicle, variant, language):
f['sop'] = {'content': sop_content, 'images': sop_images,
'specificaton': sop_specification}
post_vin_data = frappe.db.sql(f'''
select name,idx as display_order,post_vin_cutoff_name,post_vin_cutoff_id
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:
@ -130,7 +148,6 @@ def get_feature_finder(vehicle, variant, language):
p['specificaton'] = vin_specification
f['post_vin'] = post_vin_data
return True, feature_finder_details
except Exception as e:
return False, e
@ -171,6 +188,9 @@ def new_publish():
elif module == 'Training Information':
flag, data = get_training_information(vehicle, language)
elif module == "Mahindra Special Tool Information":
flag, data = get_special_tool_information(vehicle)
if flag:
return {'status': 1, 'error': None, 'data': data}
else:
@ -184,10 +204,11 @@ def new_publish():
@frappe.whitelist(methods=['POST'], allow_guest=1)
def get_special_tool_information(vehicle):
try:
special_tool_details=frappe.db.sql(''' select vehicle,category,sub_category,display_order, my_id from grmtest.`tabSpecial Tool Information` ;''',as_dict=1)
for d in special_tool_details:
d['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 = '{d['name']}' order by display_order;''',as_dict=1)
return True, special_tool_details,d['tool_usage_content']
special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, my_id from grmtest.`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`
where parent = '{s['name']}' order by display_order;''', as_dict=1)
return True, special_tool_details
except Exception as e:
return False, e

231
smart_service/phase_2/doctype/feature_finder/feature_finder.js

@ -9,39 +9,76 @@ frappe.ui.form.on('Feature Finder', {
refresh: function (frm) {
// filter_value = "SOP"
// set_default_tab(frm,filter_value)
setTimeout(function mysam(){
if (!frm.doc.feature_finder_images){
console.log("calling 1")
$(cur_frm.fields_dict.image_html.wrapper).empty();
}
if (!frm.is_new()) {
custom_tab_html(frm)
}
},2000)
set_display_order(frm)
show_images(frm)
// show_images(frm)
},
onload: function (frm) {
// filter_value = "SOP"
// set_default_tab(frm,filter_value)
setTimeout(function mysam(){
if (!frm.doc.feature_finder_images){
console.log("calling 1")
$(cur_frm.fields_dict.image_html.wrapper).empty();
}
if (!frm.is_new()) {
custom_tab_html(frm)
}
},2000)
set_display_order(frm)
show_images(frm)
// show_images(frm)
},
variant: function (frm) {
frm.doc.features_names = ""
frm.doc.feature_name = ""
cur_frm.refresh_fields("features_names")
cur_frm.refresh_fields("feature_name")
if (frm.doc.variant) {
frm.toggle_display('feature_name', true)
frm.toggle_display('features_names', true)
} else
{
frm.toggle_display('features_names', false)
frm.toggle_display('feature_name', false)
}
set_display_order(frm)
},
features_names: function (frm) {
if(frm.doc.features_names){
frappe.db.get_list('Feature Finder Master', {
fields: ['name'],
filters: {
feature_name: frm.doc.feature_name,
feature_name: frm.doc.features_names,
vehicle: frm.doc.vehicle
}
}).then(records => {
console.log(records)
if(records.length>0){
frm.doc.feature_name = records[0].name
cur_frm.refresh_fields("feature_name")
}else{
frm.doc.feature_name = ""
cur_frm.refresh_fields("feature_name")
}
})
}
},
create_feature_finder_images: function (frm) {
if (click_count == 0) {
@ -54,12 +91,27 @@ frappe.ui.form.on('Feature Finder', {
}
},
language: function (frm) {
console.log('Language trigger');
if (frm.doc.language == "en") {
frm.toggle_display('translated_feature_name', false)
frm.doc.translated_feature_name = ""
cur_frm.refresh_fields("translated_feature_name")
} else {
frm.toggle_display('translated_feature_name', true)
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.get_feature_list",
args: {
vehicle: frm.doc.vehicle,
language: frm.doc.language
},
callback: function (r) {
console.log(r.message)
frm.set_df_property('features_names', 'options', r.message);
frm.refresh_field('features_names')
}
})
}
},
// feature_type: function (frm) {
@ -113,18 +165,20 @@ frappe.ui.form.on('Feature Finder', {
frm.reload_doc()
}
});
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 img_html = ""
img_html += "<div style='height: 300px;overflow-y: auto;overflow-x: hidden;border:1px solid var(--table-border-color);margin: 5px 0px 10px 0px;'><div style='padding: 5px;' class='row'>"
cur_frm.doc.feature_finder_images.forEach((val) =>
img_html += "<div class='col-3' style='padding-top:13px;'><img src=" + "'" + val.image + "'" + "></div>"
);
img_html += "</div></div>"
$(res).append(img_html)
}
}
// 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 img_html = ""
// img_html += "<div style='height: 300px;overflow-y: auto;overflow-x: hidden;border:1px solid var(--table-border-color);margin: 5px 0px 10px 0px;'><div style='padding: 5px;' class='row'>"
// cur_frm.doc.feature_finder_images.forEach((val) =>
// img_html += "<div class='col-3' style='padding-top:13px;'><img src=" + "'" + val.image + "'" + "></div>"
// );
// img_html += "</div></div>"
// $(res).append(img_html)
// }
// }
function custom_tab_html(frm) {
// $('[data-fieldname="specification"]').show()
@ -155,10 +209,11 @@ function custom_tab_html(frm){
var res = $(cur_frm.fields_dict.test_html.wrapper).empty();
var ret = '<div class="main"><div class="custom_tab style="border:1px solid var(--table-border-color);"><ul class="nav nav-tabs" role="tablist">'
if(frm.doc.post_vin_cutoff_id_tab.length>0){
ret += '<li class="nav-item">'
ret += '<a class="nav-link active" id="SOP" data-toggle="tab" role="tab" value="SOP">SOP</a>'
ret += '</li>'
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(val => {
ret += '<li class="nav-item">'
ret += '<a class="nav-link" id="' + val.post_vin_cutoff_name + '" value=' + val.post_vin_cutoff_name + ' data-toggle="tab" role="tab">PV-' + val.post_vin_cutoff_name + '</a>'
@ -181,16 +236,25 @@ function custom_tab_html(frm){
var specification = ""
var feature_finder_images = ""
var feature_finder_content = ""
if (frm.doc.specification && frm.doc.feature_finder_images && frm.doc.feature_finder_content){
specification = frm.doc.specification.filter(o => o.feature_type == "SOP")
feature_finder_images = frm.doc.feature_finder_images.filter(o => o.feature_type == "SOP")
feature_finder_content = frm.doc.feature_finder_content.filter(o => o.feature_type == "SOP")
specification.sort((a, b) => a.display_order - b.display_order);
feature_finder_images.sort((a, b) => a.display_order - b.display_order);
feature_finder_content.sort((a, b) => a.display_order - b.display_order);
}
var spec_dialog_value = ""
var image_dialog_value = ""
var content_dialog_value = ""
var nav_spec = {}
nav_spec.feature_type = "SOP"
all_tabs()
show_images()
$('.main').find('.nav-link').click(function (event) {
console.log($(this)[0].id)
@ -200,6 +264,11 @@ function custom_tab_html(frm){
specification = frm.doc.specification.filter(o => o.feature_type == $(this)[0].id)
feature_finder_images = frm.doc.feature_finder_images.filter(o => o.feature_type == $(this)[0].id)
feature_finder_content = frm.doc.feature_finder_content.filter(o => o.feature_type == $(this)[0].id)
specification.sort((a, b) => a.display_order - b.display_order);
feature_finder_images.sort((a, b) => a.display_order - b.display_order);
feature_finder_content.sort((a, b) => a.display_order - b.display_order);
}
else {
nav_spec.feature_type = "Post Vin CutOff"
@ -208,13 +277,32 @@ function custom_tab_html(frm){
feature_finder_images = frm.doc.feature_finder_images.filter(o => o.post_vin_cutoff_name == $(this)[0].id)
console.log(feature_finder_images, "---feature_finder_images")
feature_finder_content = frm.doc.feature_finder_content.filter(o => o.post_vin_cutoff_name == $(this)[0].id)
specification.sort((a, b) => a.display_order - b.display_order);
feature_finder_images.sort((a, b) => a.display_order - b.display_order);
feature_finder_content.sort((a, b) => a.display_order - b.display_order);
}
all_tabs()
show_images()
})
function show_images(frm) {
var res = $(cur_frm.fields_dict.image_html.wrapper).empty();
if (feature_finder_images.length > 0) {
var img_html = ""
img_html += "<div style='height: 300px;overflow-y: auto;overflow-x: hidden;border:1px solid var(--table-border-color);margin: 5px 0px 10px 0px;'><div style='padding: 5px;' class='row'>"
feature_finder_images.forEach((val) =>
img_html += "<div class='col-3' style='padding-top:13px;'><img src=" + "'" + val.image + "'" + "></div>"
);
img_html += "</div></div>"
$(res).append(img_html)
}
}
function all_tabs() {
@ -278,9 +366,9 @@ function custom_tab_html(frm){
if (specification.length > 0) {
specification.map(val => {
specification_count += 1
// spec_custom_dt += '<tr draggable="true" ondragstart="dragstartFunction(event)" ondragover="dragovertFunction(event)">'
spec_custom_dt += '<tr>'
spec_custom_dt += '<td style="width: 7%;" id="count"><input id='+val.name+' type="checkbox" class="speccheck grid-row-check pull-left"><span class="spec_check">'+specification_count+'</span></td>'
spec_custom_dt += '<tr id=' + val.name + ' draggable="true" ondragstart="dragstartFunction(event)" ondragover="dragovertFunction(event)">'
// spec_custom_dt += '<tr>'
spec_custom_dt += '<td style="width: 7%;" id="spec_count"><input id=' + val.name + ' type="checkbox" class="speccheck grid-row-check pull-left"><span class="spec_check">' + specification_count + '</span></td>'
spec_custom_dt += '<td>' + val.specification + '</td>'
spec_custom_dt += '<td>' + val.value + '</td>'
spec_custom_dt += '<td>' + val.active_status + '</td>'
@ -305,9 +393,9 @@ function custom_tab_html(frm){
if (feature_finder_images.length) {
feature_finder_images.map(val => {
image_count += 1
// spec_custom_dt += '<tr draggable="true" ondragstart="dragstartFunction(event)" ondragover="dragovertFunction(event)">'
image_custom_dt += '<tr>'
image_custom_dt += '<td style="width: 7%;" id="count"><input id='+val.name+' type="checkbox" class="imagecheck grid-row-check pull-left"><span class="image_check">'+image_count+'</span></td>'
image_custom_dt += '<tr id=' + val.name + ' draggable="true" ondragstart="dragstartFunction_1(event)" ondragover="dragovertFunction_1(event)">'
// image_custom_dt += '<tr>'
image_custom_dt += '<td style="width: 7%;" id="image_count"><input id=' + val.name + ' type="checkbox" class="imagecheck grid-row-check pull-left"><span class="image_check">' + image_count + '</span></td>'
image_custom_dt += '<td>' + val.image + '</td>'
image_custom_dt += '<td>' + val.active_status + '</td>'
image_custom_dt += '<td>' + val.feature_type + '</td>'
@ -331,9 +419,9 @@ function custom_tab_html(frm){
if (feature_finder_content.length) {
feature_finder_content.map(val => {
content_count += 1
// spec_custom_dt += '<tr draggable="true" ondragstart="dragstartFunction(event)" ondragover="dragovertFunction(event)">'
content_custom_dt += '<tr>'
content_custom_dt += '<td style="width: 7%;" id="count"><input id='+val.name+' type="checkbox" class="contentcheck grid-row-check pull-left"><span class="content_check">'+content_count+'</span></td>'
content_custom_dt += '<tr id=' + val.name + ' draggable="true" ondragstart="dragstartFunction_2(event)" ondragover="dragovertFunction_2(event)">'
// content_custom_dt += '<tr>'
content_custom_dt += '<td style="width: 7%;" id="cont_count"><input id=' + val.name + ' type="checkbox" class="contentcheck grid-row-check pull-left"><span class="content_check">' + content_count + '</span></td>'
content_custom_dt += '<td>' + val.content + '</td>'
content_custom_dt += '<td>' + val.active_status + '</td>'
content_custom_dt += '<td>' + val.feature_type + '</td>'
@ -392,28 +480,29 @@ function custom_tab_html(frm){
$(res).find('.feature_contbl').empty()
$(res).find('.feature_contbl').append(content_custom_dt)
$(res).append(`<style>.spec_check{padding:0px 5px 0px 5px !important}.spec_custom_save{display:none}.spec_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}</style>`)
$(res).append(`<style>.spec_check{padding:0px 5px 0px 5px !important}.spec_custom_save{display:none;margin:10px 0px 0px 10px;background-color:red !important;color:#fff !important;}.spec_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}</style>`)
$(res).append(`<style>.image_check{padding:0px 5px 0px 5px !important}.image_custom_save{display:none}.image_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}
$(res).append(`<style>.image_check{padding:0px 5px 0px 5px !important}.image_custom_save{display:none;margin:10px 0px 0px 10px;background-color:red !important;color:#fff !important;}.image_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}
.image_custom_add{margin:10px 0px 0px 0px</style>`)
$(res).append(`<style>.content_check{padding:0px 5px 0px 5px !important}.content_custom_save{display:none}.content_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}
$(res).append(`<style>.content_check{padding:0px 5px 0px 5px !important}.content_custom_save{display:none;margin:10px 0px 0px 10px;background-color:red !important;color:#fff !important;}.content_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}
.content_custom_add{margin:10px 0px 0px 0px</style>`)
//append end
//add button
$(res).find('.feature_imgbl').find('.image_custom_add').click(function(event){
image_dialog_value = ""
image_dialog_value = nav_spec
image_dialog_view()
})
$(res).find('.specification_bl').find('.spec_custom_add').click(function (event) {
spec_dialog_value = ""
spec_dialog_value = nav_spec
spec_dialog_view()
})
$(res).find('.feature_imgbl').find('.image_custom_add').click(function (event) {
image_dialog_value = ""
image_dialog_value = nav_spec
image_dialog_view()
})
$(res).find('.feature_contbl').find('.content_custom_add').click(function (event) {
content_dialog_value = ""
content_dialog_value = nav_spec
@ -422,6 +511,58 @@ function custom_tab_html(frm){
//end add button
//save function
$(res).find('.specification_bl').find('.spec_custom_save').click(function (event) {
var spec_id_dis = []
$(document).ready(function () {
$('.specification_bl').find('table > tbody > tr').each(function (index, tr) {
spec_id_dis.push(this.id);
});
set_display_order_child("Feature Finder Specification", spec_id_dis)
})
})
$(res).find('.feature_imgbl').find('.image_custom_save').click(function (event) {
var image_id_dis = []
$(document).ready(function () {
$('.feature_imgbl').find('table > tbody > tr').each(function (index, tr) {
image_id_dis.push(this.id);
});
set_display_order_child("Feature Finder Images", image_id_dis)
})
})
$(res).find('.feature_contbl').find('.content_custom_save').click(function (event) {
var cont_id_dis = []
$(document).ready(function () {
$('.feature_contbl').find('table > tbody > tr').each(function (index, tr) {
cont_id_dis.push(this.id);
});
set_display_order_child("Feature Finder Content", cont_id_dis)
})
})
function set_display_order_child(doctype_name, values) {
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.set_display_order",
args: {
doctype_name: doctype_name,
values: values
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
}
}
})
}
//end save function
//edit button
$(res).find('.feature_imgbl').find('.image_edit_row').click(function (event) {
image_dialog_value = frm.doc.feature_finder_images.filter(o => o.name == $(this)[0].id)[0]
@ -713,7 +854,7 @@ function custom_tab_html(frm){
primary_action_label: 'Submit',
primary_action(values) {
console.log(values, "values");
if (values){
if (values && values.image) {
console.log(values, "---values")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.insert_image_data",
@ -724,7 +865,8 @@ function custom_tab_html(frm){
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
cur_frm.refresh()
// cur_frm.reload_doc()
}
}
})
@ -873,13 +1015,7 @@ function custom_tab_html(frm){
// }
function set_display_order(frm) {
if(frm.doc.variant){
frm.toggle_display('feature_name', true)
frm.toggle_display('features_names', true)
}else{
frm.toggle_display('feature_name', false)
frm.toggle_display('features_names', false)
}
// if (frm.doc.feature_type == "Post VIN Cutoff") {
// frm.toggle_display('post_vin_cutoff_id', true)
// }
@ -887,11 +1023,12 @@ function set_display_order(frm) {
// frm.toggle_display('post_vin_cutoff_id', false)
// }
if(frm.doc.variant && frm.doc.vehicle){
if (frm.doc.variant && frm.doc.vehicle && frm.doc.language) {
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.get_feature_list",
args: {
vehicle:frm.doc.vehicle
vehicle: frm.doc.vehicle,
language: frm.doc.language
},
callback: function (r) {
frm.set_df_property('features_names', 'options', r.message);

29
smart_service/phase_2/doctype/feature_finder/feature_finder.json

@ -17,6 +17,7 @@
"vehicle",
"feature_name",
"features_names",
"translated_feature_name",
"feature_category",
"section_break_u9bx1",
"image_html",
@ -61,17 +62,17 @@
"in_standard_filter": 1,
"label": "Variant",
"options": "Variant Mapping",
"reqd": 1
"reqd": 1,
"set_only_once": 1
},
{
"depends_on": "eval:doc.variant!=\"\"",
"fieldname": "feature_name",
"fieldtype": "Link",
"hidden": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Feature Name",
"label": "Feature Name1",
"options": "Feature Finder Master",
"read_only": 1,
"set_only_once": 1
},
{
@ -134,7 +135,8 @@
"fieldname": "features_names",
"fieldtype": "Select",
"label": "Feature Name",
"reqd": 1
"reqd": 1,
"set_only_once": 1
},
{
"fieldname": "test_html",
@ -148,21 +150,30 @@
"options": "Post Vin Cutoff ID"
},
{
"fetch_from": "variant_mapping.vehicle_id",
"fetch_from": "variant.vehicle_id",
"fieldname": "vehicle_id",
"fieldtype": "Int",
"hidden": 1,
"label": "Vehicle Id"
},
{
"fetch_from": "variant_mapping.variant_id",
"fetch_from": "variant.name",
"fieldname": "variant_id",
"fieldtype": "Int",
"fieldtype": "Data",
"hidden": 1,
"label": "Variant Id"
},
{
"fieldname": "translated_feature_name",
"fieldtype": "Data",
"label": "Translated Feature Name",
"mandatory_depends_on": "eval:doc.language!=\"en\"",
"read_only_depends_on": "eval:doc.language==\"en\""
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 18:05:41.690172",
"modified": "2023-08-09 12:50:40.680301",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder",

54
smart_service/phase_2/doctype/feature_finder/feature_finder.py

@ -5,6 +5,7 @@ import frappe
from frappe.model.document import Document
import json
class FeatureFinder(Document):
# def validate(self):
# if self.feature_name and self.feature_type=="SOP":
@ -25,11 +26,14 @@ class FeatureFinder(Document):
try:
if self.is_new():
if self.variant and self.language and self.feature_name:
check_exe = frappe.db.get_list("Feature Finder",
filters={"variant": self.variant, "language": "en",
"feature_name": self.feature_name,
"name": ["!=", self.name]},
fields={"name", "language", "display_order", "active_status"})
# check_exe = frappe.db.get_list("Feature Finder",
# filters={"variant": self.variant, "language": "en",
# "features_names": self.features_names,
# "name": ["!=", self.name]},
# fields={"name", "language", "display_order", "active_status"})
check_exe = frappe.db.sql(f''' select * from `tabFeature Finder` where variant='{self.variant}' and features_names='{self.features_names}'
and language='en' and name != '{self.name}' ;
''', as_dict=1)
if check_exe:
if self.language != "en":
for d in check_exe:
@ -48,6 +52,7 @@ class FeatureFinder(Document):
# for k in specification:
# set_idx +=1
# k['']
except Exception as e:
raise e
@ -71,20 +76,23 @@ class FeatureFinder(Document):
@frappe.whitelist()
def get_feature_list(vehicle):
features_list = frappe.db.sql(f"""select feature_name from `tabFeature Finder Master` where vehicle='{vehicle}'""",as_list=1)
def get_feature_list(vehicle, language):
features_list = frappe.db.sql(
f"""select feature_name from `tabFeature Finder Master` where vehicle='{vehicle}' and language = '{language}';""", as_list=1)
return features_list
@frappe.whitelist()
def get_list_data(name, val):
specification = frappe.db.sql(f"""select *,'Feature Finder Specification' as doctype from `tabFeature Finder Specification` where parent = '{name}' and post_vin_cutoff_name='{val}'""",as_dict=1)
feature_finder_images = frappe.db.sql(f"""select * from `tabFeature Finder Images` where parent = '{name}' and post_vin_cutoff_name='{val}'""",as_dict=1)
feature_finder_content = frappe.db.sql(f"""select * from `tabFeature Finder Content` where parent = '{name}' and post_vin_cutoff_name='{val}'""",as_dict=1)
specification = frappe.db.sql(
f"""select *,'Feature Finder Specification' as doctype from `tabFeature Finder Specification` where parent = '{name}' and post_vin_cutoff_name='{val}'""", as_dict=1)
feature_finder_images = frappe.db.sql(
f"""select * from `tabFeature Finder Images` where parent = '{name}' and post_vin_cutoff_name='{val}'""", as_dict=1)
feature_finder_content = frappe.db.sql(
f"""select * from `tabFeature Finder Content` where parent = '{name}' and post_vin_cutoff_name='{val}'""", as_dict=1)
return specification, feature_finder_images, feature_finder_content
@frappe.whitelist()
def insert_spec_data(doc_name, values):
try:
@ -122,8 +130,6 @@ def delete_spec_data(values):
frappe.log_error("delete_spec_data", str(e))
@frappe.whitelist()
def insert_image_data(doc_name, values):
try:
@ -148,7 +154,6 @@ def insert_image_data(doc_name,values):
return {"status": "failure"}
@frappe.whitelist()
def delete_image_data(values):
try:
@ -162,7 +167,6 @@ def delete_image_data(values):
frappe.log_error("delete_image_data", str(e))
@frappe.whitelist()
def insert_content_data(doc_name, values):
try:
@ -187,8 +191,6 @@ def insert_content_data(doc_name,values):
return {"status": "failure"}
@frappe.whitelist()
def delete_content_data(values):
try:
@ -208,3 +210,21 @@ def delete_content_data(values):
# "active_status":val.get('active_status'),
# "feature_type":val.get('feature_type')
# })
@frappe.whitelist()
def set_display_order(doctype_name, values):
try:
val = json.loads(values)
if len(val) > 0:
count_val = 0
for k in val:
count_val += 1
res = frappe.get_doc(doctype_name, k)
# frappe.msgprint(str(k)+"-"+str(count_val))
res.display_order = count_val
res.save()
frappe.db.commit()
return {"status": "success"}
except Exception as e:
frappe.log_error("set_display_order", str(e))

28
smart_service/phase_2/doctype/feature_finder_category_master/feature_finder_category_master.js

@ -2,7 +2,29 @@
// For license information, please see license.txt
frappe.ui.form.on('Feature Finder Category Master', {
// refresh: function(frm) {
// }
validate: function (frm) {
check_field_character(frm.doc.feature_category)
check_field_character(frm.doc.feature_name)
}
});
function check_field_character(field_name) {
if (field_name) {
var alphanum = /^[a-zA-Z]+/;
if (field_name.length > 1) {
if (field_name.length > 50) {
frappe.throw("<b>Feature Finder Category Master:</b> Only <b> 50 </b> characters are allowed")
frappe.validated = false;
} else {
if (alphanum.test(field_name) === true) {
frappe.validated = true;
} else if (field_name) {
frappe.throw(__("<b>Feature Finder Category Master:</b> Enter letter or alpha numeric characters only."));
frappe.validated = false;
}
}
} else {
frappe.throw("<b>Feature Finder Category Master:</b> Single character not allowed")
frappe.validated = false;
}
}
}

11
smart_service/phase_2/doctype/feature_finder_content/feature_finder_content.json

@ -9,7 +9,8 @@
"content",
"active_status",
"feature_type",
"post_vin_cutoff_name"
"post_vin_cutoff_name",
"display_order"
],
"fields": [
{
@ -35,12 +36,18 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Post Vin Cutoff Name"
},
{
"fieldname": "display_order",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Display Order"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-04 17:42:23.562696",
"modified": "2023-08-08 10:42:40.213885",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Content",

11
smart_service/phase_2/doctype/feature_finder_images/feature_finder_images.json

@ -9,7 +9,8 @@
"image",
"active_status",
"feature_type",
"post_vin_cutoff_name"
"post_vin_cutoff_name",
"display_order"
],
"fields": [
{
@ -35,12 +36,18 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Post Vin Cutoff Name"
},
{
"fieldname": "display_order",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Display Order"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-04 17:42:08.111627",
"modified": "2023-08-08 10:43:06.101130",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Images",

10
smart_service/phase_2/doctype/feature_finder_master/feature_finder_master.json

@ -51,14 +51,18 @@
{
"fieldname": "vehicle",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Vehicle",
"options": "Vehicle"
"options": "Vehicle",
"reqd": 1
},
{
"fieldname": "language",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Language",
"options": "Custom Languages"
"options": "Custom Languages",
"reqd": 1
},
{
"fetch_from": "feature_name.feature_category",
@ -69,7 +73,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-04 17:45:51.699581",
"modified": "2023-08-09 12:10:38.658905",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Master",

3
smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json

@ -47,13 +47,14 @@
{
"fieldname": "display_order",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Display Order"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-07 15:35:30.309157",
"modified": "2023-08-08 10:42:51.401310",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Specification",

7
smart_service/phase_2/doctype/mst_information_assets/mst_information_assets.py

@ -1,8 +1,11 @@
# Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
class MSTInformationAssets(Document):
pass
def validate(self):
if self.content:
self.content = self.content.strip()

192
smart_service/phase_2/doctype/publish_test/publish_test.js

@ -10,25 +10,34 @@ cur_frm.fields_dict['variant_mapping'].get_query = function (doc, cdt, cdn) {
}
};
};
var selected_module=0
var selected_module=''
cur_frm.fields_dict['vehicle'].get_query = function (doc, cdt, cdn) {
return { query: "smart_service.masters.doctype.vehicle.vehicle.vehicle_filter", };
};
let lang_set_first_time = true;
frappe.ui.form.on('Publish Test', {
publish_module:function(frm){
if(frm.doc.publish_module=='Automotive'){4
selected_module=1
// publish_module:function(frm){
// if(frm.doc.publish_module=='Automotive'){
// selected_module=1
}
else{
selected_module=0
// }
// else{
// selected_module=0
}
// }
},
// },
onload: function (frm) {
// $('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Internal Publish")
if (frm.doc.docstatus == 0 && !frm.is_new() && frm.doc.publish_type != "Global" && frm.doc.publish_module=='Others') {
$('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Internal Publish")
}
if (frm.doc.docstatus == 0 && frm.doc.publish_type == "Global"&& frm.doc.publish_module=='Others') {
$('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Global Publish")
}
$(document).on('mouseover', function (events) {
$("a:contains(Copy to Clipboard)").css({ 'pointer-events': 'none' }),
$("a:contains(Duplicate)").css({ 'pointer-events': 'none' });
@ -49,7 +58,30 @@ frappe.ui.form.on('Publish Test', {
},
refresh: function (frm) {
if(selected_module==1){
// if (frm.doc.docstatus == 1 && !frm.is_new() && frm.doc.publish_type != "Global" && frm.doc.publish_module=='Others') {
// frm.add_custom_button(__('Global Publish'), function () {
// // frappe.call({
// // method: "tsmcvcms.transactions.doctype.publish_details.publish_details.generate_global_publish",
// // args: {
// // name: frm.doc.name
// // },
// // callback: function (r) {
// // if (r.message.status == "success") {
// // window.location.href = r.message.url + "/app/publish-details" + "/" + r.message.message
// // }
// // }
// // })
// }).addClass("btn-primary");
// }
// $('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Internal Publish")
if (frm.doc.docstatus == 0 && !frm.is_new() && frm.doc.publish_type != "Global") {
$('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Internal Publish")
}
if (frm.doc.docstatus == 0 && frm.doc.publish_type == "Global") {
$('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Global Publish")
}
if(frm.doc.publish_module=='Automotive'){
cur_frm.set_df_property('system_mapping', "read_only", 1);
cur_frm.fields_dict['system_mapping'].grid.wrapper.find('.grid-add-row').hide();
cur_frm.fields_dict['system_mapping'].grid.wrapper.find('.grid-upload').hide();
@ -212,6 +244,8 @@ frappe.ui.form.on('Publish Test', {
frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);
}
if (frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish') {
frm.get_field('system_mapping').grid.add_custom_button(__('Add to Publish'), function () {
let added = 0;
@ -290,9 +324,76 @@ frappe.ui.form.on('Publish Test', {
}
if (frm.doc.docstatus == 1 && !frm.is_new() && frm.doc.publish_type != "Global" && frm.doc.publish_module=='Others') {
frm.add_custom_button(__('Global Publish'), function () {
frappe.call({
method: "smart_service.phase_2.doctype.publish_test.publish_test.generate_global_publish",
args: {
name: frm.doc.name
},
callback: function (r) {
debugger
if (r.message.status == "success") {
frm.set_df_property('repair_checksheet_publish','hidden',0)
frm.refresh_field('repair_checksheet_publish')
window.location.href = r.message.url + "/app/publish-test" + "/" + r.message.message
}
}
})
}).addClass("btn-primary");
}
// if (frm.doc.docstatus === 1 && frm.doc.publish_status == 'To Publish' && frappe.user.has_role('_Publisher') && frm.doc.publish_module=='Others') {
// frm.add_custom_button(__('Global Publish'), function () {
// frappe.confirm('Are you sure you want to Publish?',
// () => {
// // action to perform if Yes is selected
// if (frm.doc.vehicle && frm.doc.language && frm.doc.publish_type) {
// frappe.call({
// method: 'smart_service.phase_2.doctype.publish_test.publish_test.repair_checksheet_publish',
// args: {
// vehicle: frm.doc.vehicle,
// language: frm.doc.language,
// publish_type: frm.doc.publish_type,
// release_description:frm.doc.release_description,
// vehicle_id:frm.doc.vehicle_id,
// variant:frm.doc.variant_mapping
// },
// callback: (r) => {
// if(r.message[0]==1){
// frappe.msgprint({
// title: __('Notification'),
// message: __('<b>Successfully Published:</b> ' + r.message[1]),
// primary_action: {
// action(values) {
// frm.save('Update');
// }
// }
// });
// }
// },
// })
// }
// }, () => {
// // action to perform if No is selected
// });
// }).addClass("btn-warning").css({ 'background-color': '#f5b0cd', 'color': 'black' });
// } else if (frm.doc.publish_status == 'Published') {
// frm.set_read_only();
// // frm.set_df_property('add_variant_mapping_to_publish', 'hidden', 1);
// }
},
validate: function (frm) {
if(selected_module==1){
if(frm.doc.publish_module=='Automotive'){
let regex = /[!@#$%^*_+\=\[\]{};'`~\\|.<>\?]+/;
if (regex.test(frm.doc.release_description) === true) {
frm.doc.release_description = '';
@ -310,7 +411,14 @@ frappe.ui.form.on('Publish Test', {
}
}
//check for atleast one data to publish
if(frm.doc.publish_module=='Others' && !frm.doc.hasOwnProperty('repair_checksheet_publish')){
debugger
frappe.throw('No Data Found To Publish')
}
},
variant_mapping: function (frm) {
frappe.db.get_value('Variant Mapping', { name: frm.doc.variant_mapping }, ['fuel', 'transmission', 'drive'], (r) => {
@ -350,7 +458,7 @@ frappe.ui.form.on('Publish Test', {
},
km_active_status: function (frm) {
if (frm.doc.variant_mapping && selected_module==1) {
if (frm.doc.variant_mapping && frm.doc.publish_module=='Automotive') {
frappe.show_alert({
message: __('Please wait until variant mapping details are loaded.'),
indicator: 'yellow'
@ -358,7 +466,7 @@ frappe.ui.form.on('Publish Test', {
}
if (frm.doc.km_active_status === "" || frm.doc.km_active_status === null) { return; }
let filter = frm.doc.variant_mapping + "-" + frm.doc.language + "-SM";
if (frm.doc.variant_mapping_status == "Active" && frm.doc.km_active_status == "Active" && selected_module==1) {
if (frm.doc.variant_mapping_status == "Active" && frm.doc.km_active_status == "Active" && frm.doc.publish_module=='Automotive') {
frappe.call({
"method": "smart_service.transactions.doctype.publish.publish.get_system",
"args": {
@ -431,7 +539,7 @@ frappe.ui.form.on('Publish Test', {
})
} else {
if (frm.doc.variant_mapping_status && selected_module==1) {
if (frm.doc.variant_mapping_status && frm.doc.publish_module=='Automotive') {
frappe.msgprint({
title: __('Notification'),
indicator: 'red',
@ -442,7 +550,7 @@ frappe.ui.form.on('Publish Test', {
},
add_variant_mapping_to_publish: function (frm) {
let dulicate = false;
if (frm.doc.publish_documents && selected_module==1) {
if (frm.doc.publish_documents && frm.doc.publish_module=='Automotive') {
frm.doc.publish_documents.forEach(publishrow => {
if (frm.doc.variant_mapping == publishrow.variant_mapping && publishrow.systems === undefined && publishrow.sub_systems === undefined && publishrow.procedure === undefined) {
dulicate = true;
@ -450,7 +558,7 @@ frappe.ui.form.on('Publish Test', {
});
frappe.msgprint("Variant Mapping already added");
}
if (dulicate === false && selected_module==1) {
if (dulicate === false && frm.doc.publish_module=='Automotive') {
let child = cur_frm.add_child("publish_documents");
child.variant_mapping = frm.doc.variant_mapping;
child.item_category = "Variant Mapping";
@ -482,13 +590,30 @@ frappe.ui.form.on('Publish Test', {
}
});
if (frm.doc.vehicle === undefined || frm.doc.vehicle === null && selected_module==1) { return; }
if (frm.doc.vehicle === undefined || frm.doc.vehicle === null && frm.doc.publish_module=='Automotive') { return; }
$("[data-fieldname=variant_mapping]").focus();
if (frm.doc.vehicle) {
frm.set_df_property('vehicle', 'read_only', 1);
}
//other modules-Repair Checksheet
if(frm.doc.publish_module=='Others'){
if (frm.doc.repair_checksheet_publish && frm.doc.repair_checksheet_publish.length > 0) {
content_flag = 1
cur_frm.clear_table("repair_checksheet_publish");
cur_frm.refresh_fields('repair_checksheet_publish');
}
add_to_publish(frm)
}
},
language: function (frm) {
if(frm.doc.publish_module=='Others'){
add_to_publish(frm)
}
if (!lang_set_first_time) {
frappe.confirm('This will clear all the data, are you sure you want to proceed?',
() => {
@ -502,6 +627,7 @@ frappe.ui.form.on('Publish Test', {
}, () => {
// action to perform if No is selected
});
} else { lang_set_first_time = false; }
},
auto_version_update: function (frm) {
@ -536,3 +662,35 @@ frappe.ui.form.on('Publish_Temp Doc', {
frm.fields_dict.system_mapping.grid.wrapper.find('.grid-insert-row').hide();
},
})
function add_to_publish(frm){
frappe.call({
method: "smart_service.phase_2.doctype.publish_test.publish_test.get_service_repair",
args: { vehicle: frm.doc.vehicle, language_label: frm.doc.language, publish_type: frm.doc.publish_type },
callback: function (r) {
if (r.message) {
cur_frm.set_df_property('repair_checksheet_publish','hidden',0)
var records = r.message
debugger
records.map(v => {
var childTable = cur_frm.add_child("repair_checksheet_publish");
childTable.parent_name = v['name'];
childTable.vehicle = v['vehicle'];
childTable.language = v['language'];
childTable.lang_myid = v['lang_myid'];
childTable.display_order = v['display_order'];
childTable.check_list_name = v['check_list_name'];
childTable.active_status = v['active_status'];
childTable.my_id = v['my_id'];
childTable.lang_myid = v['lang_myid'];
})
cur_frm.refresh_fields("repair_checksheet_publish");
}
}
})
}

13
smart_service/phase_2/doctype/publish_test/publish_test.json

@ -43,6 +43,7 @@
"variant_mapping_assets",
"section_break_5",
"publish_documents",
"repair_checksheet_publish",
"amended_from"
],
"fields": [
@ -303,7 +304,15 @@
"fieldname": "publish_module",
"fieldtype": "Select",
"label": "Publish Module",
"options": "Automotive\nOthers"
"options": "\nAutomotive\nOthers",
"reqd": 1
},
{
"fieldname": "repair_checksheet_publish",
"fieldtype": "Table",
"hidden": 1,
"label": "Repair Checksheet Publish",
"options": "Repair Service Publish Data"
},
{
"fieldname": "amended_from",
@ -318,7 +327,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-08-07 17:55:10.923830",
"modified": "2023-08-08 10:29:25.863957",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Publish Test",

141
smart_service/phase_2/doctype/publish_test/publish_test.py

@ -4,14 +4,28 @@
import sys
from html import unescape
import frappe
import os
from frappe.model.document import Document
import json
from datetime import date
from frappe.utils import cstr
from frappe.utils import logger
current_db_name = frappe.conf.get("db_name")
sys.tracebacklimit = 0
site_name = cstr(frappe.local.site)
base_url = os.path.expanduser(
"~") + "/frappe-bench/sites/" + site_name + "/public"+"/json_files"+"/Other_Module"
frappe.utils.logger.set_log_level("DEBUG")
success_reponse={"status":1,"data":"","message":""}
failure_reponse={"status":0,"data":"","error":""}
class PublishTest(Document):
def validate(self):
self.published_date = str(date.today())
self.published_by = frappe.session.user
# Selected variant and kilometer mapping details list
variant = []
for vm in self.get('publish_documents'):
@ -32,6 +46,15 @@ class PublishTest(Document):
for km_mapping in km_mapping_record:
self.kilometer_mapping_details = self.kilometer_mapping_details + \
str(km_mapping.name) + '\n'
def on_submit(self):
if self.docstatus==1 and self.publish_status == 'To Publish' and self.publish_module=='Others' and self.publish_type=='Internal':
repair_checksheet_publish(self.vehicle,self.vehicle_id,self.language,self.publish_type,self.release_description,self.variant)
update_publish_status=frappe.db.sql("""update `tabPublish Test` set publish_status='Published' where name='{0}'""".format(self.name))
if self.docstatus==1 and self.publish_module=='Others' and self.publish_type=='Global':
update_published_docs(self)
repair_checksheet_publish(self.vehicle,self.vehicle_id,self.language,self.publish_type,self.release_description,self.variant)
def onload1(self):
current_db_name = frappe.conf.get("db_name")
@ -218,8 +241,23 @@ def global_publish(doc):
doc.global_publish = publish_record.name
doc.save()
frappe.msgprint('Global Publish Created for ' + publish_record.name)
@frappe.whitelist()
def generate_global_publish(name):
try:
res = frappe.get_doc("Publish Test", name)
ret = frappe.get_doc({
"doctype": "Publish Test",
"vehicle": res.vehicle,
"publish_type": "Global",
"language":res.language,
"release_description":res.release_description,
"publish_module":res.publish_module,
"repair_checksheet_publish":res.repair_checksheet_publish
})
ret.insert()
return {"status": "success", "message": ret.name, "url": frappe.utils.get_url()}
except Exception as e:
frappe.throw(str(e))
@frappe.whitelist()
def old_publish(vehicle, language):
current_db_name = frappe.conf.get("db_name")
@ -386,6 +424,103 @@ def update_procedure_value(name, file_path):
@ frappe.whitelist()
def get_service_repair(vehicle, language_label, publish_type):
data = frappe.db.sql(f'''
select * from `tabRepair Service Master Mapping` where vehicle = '{vehicle}' and language_label = '{language_label}' and is_published = 0;
select * from `tabRepair Service Mapping` where vehicle = '{vehicle}' and language='{language_label}' and published = 0;
''', as_dict=1)
return data
def repair_checksheet_publish(vehicle,vehicle_id,language,publish_type,release_description,variant):
try:
logger_file=f'{vehicle}-{language}-{publish_type}'
logger = frappe.logger(logger_file, allow_site=True, file_count=100)
logger.info(f'Repair Checksheet Started-{vehicle}-{language}-{publish_type}')
folder_url=base_url+"/"+vehicle.replace(' ', '-') + "/"+language
logger.info(f'Created Folder-{vehicle}-{language}-{publish_type}')
'''Publish Ready Flags'''
publish_repair_checksheet=0
'''Create Folder For Publish'''
create_publish_folders(folder_url)
file_path = folder_url + "/" + publish_type + "/" + vehicle.replace(' ',
'-') +'.json'
try:
'''Append Published Data to Json'''
logger.info(f'Repair Checksheet Data Append Start::{vehicle}-{language}-{publish_type}')
vehicle_data = {
'vehicle': vehicle,
'vehicle_myid': vehicle_id,
'publish_type': publish_type,
'publish_description': release_description,
'publish_language': language,
'data':''
}
repair_checksheet=repair_checksheet_data(vehicle,language,publish_type)
if repair_checksheet['status']==1:
publish_repair_checksheet=1
if publish_repair_checksheet==1:
""" Save publish file """
vehicle_data['data']={'repair_checksheet':repair_checksheet['data']}
with open(file_path, 'w') as outfile:
outfile.write(json.dumps(vehicle_data,indent=4,default=str))
else:
logger.error(f'{vehicle}-{language}-{publish_type} error in json creation')
return 1,file_path
except Exception as e:
logger.info(f'{vehicle}-{language}-{publish_type} error in json creation'+str(e))
return e
except Exception as e:
return e
def update_published_docs(self):
try:
if self.repair_checksheet_publish:
try:
for d in self.repair_checksheet_publish:
frappe.db.sql(
"""UPDATE `tabRepair Service Mapping` set published=1 where name='{0}'""".format(d.parent_name))
frappe.db.commit()
except Exception as e:
frappe.throw(str(e))
except:
frappe.throw(str(e))
def create_publish_folders(folder_url):
try:
if not os.path.isdir(folder_url + "/" + "Global"):
os.makedirs(folder_url + "/" + "Global")
if not os.path.isdir(folder_url + "/" + "Internal"):
os.makedirs(folder_url + "/" + "Internal")
return True
except Exception as e:
frappe.throw(str(e))
return False
def repair_checksheet_data(vehicle=None,language=None,publish_type=None):
try:
logger_file=f'{vehicle}-{language}-{publish_type}'
logger = frappe.logger(logger_file, allow_site=True, file_count=100)
logger.info(f"start of fetching repair checksheet data-{vehicle}-{language}")
repair_service_details = frappe.db.sql(f""" select vehicle,vehicle_id,name,language,check_list_name,active_status,display_order,my_id from
`tabRepair Service Mapping` where vehicle = '{vehicle}' and language = '{language}' and active_status='Active'""", 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 `tabRepair Service Child`
where parent = '{d['name']}' order by display_order ;""", as_dict=1)
logger.info(f"end of fetching repair checksheet data {vehicle}-{language}")
success_reponse['data']=repair_service_details
success_reponse['message']=f'Repair Checksheet Fecthed Succesfully for {vehicle}-{language}'
return success_reponse
except Exception as e:
failure_reponse['error']=f"{vehicle}-{language} has following error-" +str(e)
logger.error('error in repair checksheet'+str(e))
return failure_reponse

110
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.js

@ -3,39 +3,67 @@
var original_display_order = 0;
var vehicle_count = 0;
frappe.require('assets/smart_service/js/utils.js', () => { })
// frappe.require('assets/smart_service/js/utils.js', () => { })
frappe.ui.form.on('Repair Service Mapping', {
onload: function (frm) {
// Set Display Order
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Repair Service Mapping', {
set_display_order(frm)
},
refresh: function (frm) {
// Set Display Order
set_display_order(frm)
},
validate: function (frm) {
//For Display Order
// cur_frm.refresh_fields("display_order")
if (frm.doc.display_order && frm.doc.name && !frm.is_new()) {
//***check if there is same display_order
frappe.db.get_list('Repair Service Mapping', {
fields: ['display_order', 'name'],
filters: {
"vehicle": cur_frm.doc.vehicle,
"language": frm.doc.language
display_order: frm.doc.display_order,
name: ["!=", frm.doc.name],
vehicle: frm.doc.vehicle,
language: frm.doc.language,
}
}).then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
}).then(records => {
if (records.length) {
frappe.db.set_value('Repair Service Mapping', records[0].name, {
display_order: original_display_order
}).then(r => {
let doc = r.message;
frappe.show_alert({
message: __('Swapped display order with: ' + records[0].name),
indicator: 'green'
}, 5);
});
} else {
original_display_order = frm.doc.display_order;
if (frm.doc.display_order >= vehicle_count) {
let display_vehicle_count = vehicle_count - 1;
msgprint('There are only ' + display_vehicle_count + " " + frm.doc.doctype);
frappe.validated = false;
}
}
});
}
},
refresh: function (frm) {
// Set Display Order
after_save: function (frm) {
cur_frm.refresh_fields("display_order")
},
});
function set_display_order(frm){
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Repair Service Mapping', {
filters: {
"vehicle": cur_frm.doc.vehicle,
@ -49,53 +77,7 @@ frappe.ui.form.on('Repair Service Mapping', {
original_display_order = frm.doc.display_order;
}
});
},
validate: function (frm) {
//For Display Order
cur_frm.refresh_fields("display_order")
// console.log(module_name_count,"----",original_display_order)
// if (frm.doc.display_order && frm.doc.name && !frm.is_new()) {
// //***check if there is same display_order
// frappe.db.get_list('Repair Service Mapping', {
// fields: ['display_order', 'name'],
// filters: {
// display_order: frm.doc.display_order,
// name: ["!=", frm.doc.name],
// vehicle: frm.doc.vehicle,
// language:frm.doc.language
// }
// }).then(records => {
// if (records.length) {
// frappe.db.set_value('Repair Service Mapping', records[0].name,{
// display_order: original_display_order
// }).then(r => {
// // console.log(records)
// let doc = r.message;
// frappe.show_alert({
// message: __('Swapped display order with: ' + records[0].name),
// indicator: 'green'
// }, 5);
// });
// } else {
// if (frm.doc.display_order >= vehicle_count) {
// let display_name_count = vehicle_count - 1;
// msgprint('There are only ' + display_name_count +" "+frm.doc.doctype);
// frappe.validated = false;
// }
// }
// });
// }
display_order_validation(frm, vehicle_count, original_display_order, frm.doc.vehicle)
},
after_save: function (frm) {
cur_frm.refresh_fields("display_order")
},
});
}

8
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json

@ -51,7 +51,9 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Language",
"options": "Custom Languages"
"options": "Custom Languages",
"reqd": 1,
"set_only_once": 1
},
{
"fieldname": "column_break_sjvew",
@ -64,6 +66,7 @@
"in_standard_filter": 1,
"label": "Check List Name",
"options": "Repair Service Master",
"reqd": 1,
"set_only_once": 1
},
{
@ -117,12 +120,13 @@
"fetch_from": "vehicle.myid",
"fieldname": "vehicle_id",
"fieldtype": "Int",
"hidden": 1,
"label": "Vehicle Id"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 16:28:34.938285",
"modified": "2023-08-09 14:28:17.586504",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Mapping",

11
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.py

@ -18,6 +18,9 @@ class RepairServiceMapping(Document):
if self.vehicle:
self.vehicle = self.vehicle.strip()
if self.translated_check_list_name:
self.translated_check_list_name=self.translated_check_list_name.strip()
try:
if self.is_new():
@ -40,14 +43,6 @@ class RepairServiceMapping(Document):
except Exception as e:
raise e
# def autoname(self):
# if self.is_new():
# count = frappe.db.sql('''select max(my_id) as max_count from `tabRepair Service Mapping`;''')
# if count[0][0] is not None:
# self.my_id = count[0][0] + 1
# else:
# self.my_id = 1
def on_update(self):
if self.language == "en":
try:

23
smart_service/phase_2/doctype/repair_service_master/repair_service_master.js

@ -48,8 +48,27 @@ frappe.ui.form.on('Repair Service Master', {
validate: function (frm){
//For Display Order
cur_frm.refresh_fields("display_order")
// console.log(module_name_count,"----",original_display_order)
// display_order_validation(frm, repair_service_count, original_display_order,frm.doc.vehicle)
if(frm.doc.repairservicename) {
let alphanum = /^[a-zA-Z]+/;
if (frm.doc.repairservicename.length > 1) {
if (frm.doc.repairservicename.length > 140) {
frappe.throw(__("<b>Repair/ServiceName:</b> Only <b> 140 </b> characters are allowed"))
frappe.validate=false;
} else {
if (alphanum.test(frm.doc.repairservicename) === true) {
frappe.validated = false;
} else if (frm.doc.repairservicename) {
frappe.throw(__("<b>Repair/ServiceName:</b> Enter letter or alpha numeric characters only."));
frappe.validate=false;
}
}
} else {
frappe.throw(__("<b>Repair/ServiceName:</b> Single character not allowed"))
frappe.validate=true;
}
}
}
});

13
smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json

@ -20,7 +20,8 @@
"display_order",
"section_break_ecyyc",
"description",
"my_id"
"my_id",
"lang_myid"
],
"fields": [
{
@ -72,7 +73,8 @@
"default": "0",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published"
"label": "Published",
"read_only": 1
},
{
"fieldname": "section_break_ci53z",
@ -97,11 +99,16 @@
{
"fieldname": "column_break_azh0p",
"fieldtype": "Column Break"
},
{
"fieldname": "lang_myid",
"fieldtype": "Int",
"label": "Lang MyId"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 16:27:20.861818",
"modified": "2023-08-08 12:11:28.469998",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Master Mapping",

23
smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json

@ -12,8 +12,8 @@
"check_list_name",
"active_status",
"display_order",
"description",
"my_id"
"my_id",
"lang_myid"
],
"fields": [
{
@ -25,24 +25,28 @@
{
"fieldname": "parent_name",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Parent Name",
"options": "Repair Service Master Mapping"
"options": "Repair Service Mapping"
},
{
"fieldname": "language",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Language",
"options": "Custom Languages"
},
{
"fieldname": "check_list_name",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Check List Name",
"options": "Repair Service Master"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
@ -51,22 +55,21 @@
"fieldtype": "Int",
"label": "Display Order"
},
{
"fieldname": "description",
"fieldtype": "Table",
"label": "Description",
"options": "Repair Service Child"
},
{
"fieldname": "my_id",
"fieldtype": "Int",
"label": "My Id"
},
{
"fieldname": "lang_myid",
"fieldtype": "Int",
"label": "Lang MyId"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-07 18:47:20.666082",
"modified": "2023-08-09 12:35:45.411733",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Publish Data",

60
smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

@ -2,52 +2,19 @@
// For license information, please see license.txt
var original_display_order = 0;
var vehicle_count = 0;
// var counter = 0;
// frappe.require('assets/smart_service/js/utils.js', () => {})
frappe.ui.form.on('Special Tool Information', {
onload: function (frm) {
// Set Display Order
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else{
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Special Tool Information')
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
set_display_order(frm)
},
refresh: function (frm) {
// Set Display Order
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Special Tool Information')
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
set_display_order(frm)
},
// after_save:function(frm){
// cur_frm.refresh_fields("display_order")
// },
validate:function(frm){
//For Display Order
cur_frm.refresh_fields("display_order")
@ -89,3 +56,26 @@ frappe.ui.form.on('Special Tool Information', {
});
function set_display_order(frm){
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Special Tool Information',{
filters:{
"vehicle":frm.doc.vehicle,
}
})
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
}

14
smart_service/phase_2/doctype/special_tool_information/special_tool_information.json

@ -9,6 +9,8 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"published",
"column_break_cyo0a",
"vehicle",
"category",
"sub_category",
@ -60,11 +62,21 @@
"fieldtype": "Table",
"label": "Tool Usage Content",
"options": "MST Information Assets"
},
{
"default": "0",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published"
},
{
"fieldname": "column_break_cyo0a",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 10:38:16.791578",
"modified": "2023-08-08 12:12:55.927631",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Special Tool Information",

22
smart_service/phase_2/doctype/training_information/training_information.js

@ -26,5 +26,27 @@ frappe.ui.form.on('Training Information', {
}
});
},
validate:function(frm){
if(frm.doc.topic) {
let alphanum = /^[a-zA-Z]+/;
if (frm.doc.topic.length > 1) {
if (frm.doc.topic.length > 140) {
frappe.throw(__("<b>Topic:</b> Only <b> 140 </b> characters are allowed"))
frappe.validate=false;
} else {
if (alphanum.test(frm.doc.topic) === true) {
frappe.validated = false;
} else if (frm.doc.topic) {
frappe.throw(__("<b>Topic:</b> Enter letter or alpha numeric characters only."));
frappe.validate=false;
}
}
} else {
frappe.throw(__("<b>Topic:</b> Single character not allowed"))
frappe.validate=true;
}
}
},
});

15
smart_service/phase_2/doctype/training_information/training_information.json

@ -7,6 +7,8 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"published",
"section_break_jqjts",
"vehicle",
"category",
"topic",
@ -33,6 +35,7 @@
"options": "Training Information Master"
},
{
"fetch_from": "category.topic",
"fieldname": "topic",
"fieldtype": "Data",
"label": "Topic"
@ -79,11 +82,21 @@
"fieldname": "display_order",
"fieldtype": "Int",
"label": "Display Order"
},
{
"default": "0",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published"
},
{
"fieldname": "section_break_jqjts",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 10:25:28.869989",
"modified": "2023-08-08 18:17:00.667481",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Training Information",

6
smart_service/phase_2/doctype/training_information/training_information.py

@ -5,10 +5,14 @@ import frappe
from frappe.model.document import Document
class TrainingInformation(Document):
def validate(self):
def autoname(self):
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabTraining Information`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
def validate(self):
if self.topic:
self.topic=self.topic.strip()

4
smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.py

@ -5,4 +5,6 @@
from frappe.model.document import Document
class TrainingInformationContentReference(Document):
pass
def validate(self):
if self.content:
self.content=self.content.strip()

9
smart_service/phase_2/doctype/training_information_master/training_information_master.js

@ -13,24 +13,21 @@ frappe.ui.form.on('Training Information Master', {
function check_field_character(field_name) {
if (field_name) {
var alphanum = /^[a-zA-Z]+/;
if (field_name.length > 1) {
if (field_name.length > 50) {
frappe.msgprint("<b>Training Information Master:</b> Only <b> 50 </b> characters are allowed")
frappe.throw("<b>Training Information Master:</b> Only <b> 50 </b> characters are allowed")
frappe.validated = false;
} else {
if (alphanum.test(field_name) === true) {
frappe.validated = true;
} else if (field_name) {
frappe.msgprint(__("<b>Training Information Master:</b> Enter letter or alpha numeric characters only."));
frappe.throw(__("<b>Training Information Master:</b> Enter letter or alpha numeric characters only."));
frappe.validated = false;
}
}
} else {
frappe.msgprint("<b>Training Information Master:</b> Single character not allowed")
frappe.throw("<b>Training Information Master:</b> Single character not allowed")
frappe.validated = false;
}
}
}

3
smart_service/phase_2/doctype/training_information_master/training_information_master.py

@ -1,7 +1,7 @@
# Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
class TrainingInformationMaster(Document):
@ -11,6 +11,7 @@ class TrainingInformationMaster(Document):
if self.topic:
self.topic = self.topic.strip()
def autoname(self):
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabTraining Informations`;''')
if count[0][0] is not None:

75
smart_service/public/js/common_fun.js

@ -1,4 +1,6 @@
var row;
var row1;
var row2;
function dragstartFunction(evt){
row = evt.target;
}
@ -12,12 +14,12 @@ function dragovertFunction(evt){
var count = 1
var unchecked_value = 0
children.map(h => {
console.log($(h),"------------------h----------")
console.log($(h).find('#count'),"---------$(h).find('#count')------")
console.log($(h).find('#count').val(),"---------$(h).find('#count').val(count)------")
var html = '<input id='+count+' type="checkbox" class="speccheck grid-row-check pull-left"><span class="spec_check">'+count+'</span>'
$(h).find('#count').html(html)
$(h).find('.spec_custom_save').css("display","inline-block")
$(h).find('#spec_count').html(html)
$( document ).ready(function() {
$('.specification_bl').find('.spec_custom_save').css("display","inline-block")
})
count +=1
})
//end
@ -28,3 +30,66 @@ function dragovertFunction(evt){
e.target.parentNode.before(row);
}
}
function dragstartFunction_1(evt){
row1= evt.target;
}
function dragovertFunction_1(evt){
var global_name = 1
var e = evt;
e.preventDefault();
let children= Array.from(e.target.parentNode.parentNode.children);
//change count value
var count = 1
var unchecked_value = 0
children.map(h => {
var html = '<input id='+count+' type="checkbox" class="imagecheck grid-row-check pull-left"><span class="image_check">'+count+'</span>'
$(h).find('#image_count').html(html)
$( document ).ready(function() {
$('.feature_imgbl').find('.image_custom_save').css("display","inline-block")
})
count +=1
})
//end
if(children.indexOf(e.target.parentNode)>children.indexOf(row1)){
e.target.parentNode.after(row1);
}
else{
e.target.parentNode.before(row1);
}
}
function dragstartFunction_2(evt){
row2 = evt.target;
}
function dragovertFunction_2(evt){
var global_name = 1
var e = evt;
e.preventDefault();
let children= Array.from(e.target.parentNode.parentNode.children);
//change count value
var count = 1
var unchecked_value = 0
children.map(h => {
var html = '<input id='+count+' type="checkbox" class="contentcheck grid-row-check pull-left"><span class="content_check">'+count+'</span>'
$(h).find('#cont_count').html(html)
$( document ).ready(function() {
$('.feature_contbl').find('.content_custom_save').css("display","inline-block")
})
count +=1
})
//end
if(children.indexOf(e.target.parentNode)>children.indexOf(row2)){
e.target.parentNode.after(row2);
}
else{
e.target.parentNode.before(row2);
}
}

6
smart_service/transactions/doctype/publish/publish.js

@ -434,7 +434,7 @@ frappe.ui.form.on('Publish', {
},
add_variant_mapping_to_publish: function (frm) {
let dulicate = false;
if (frm.doc.publish_documents && selected_module==1) {
if (frm.doc.publish_documents) {
frm.doc.publish_documents.forEach(publishrow => {
if (frm.doc.variant_mapping == publishrow.variant_mapping && publishrow.systems === undefined && publishrow.sub_systems === undefined && publishrow.procedure === undefined) {
dulicate = true;
@ -481,7 +481,7 @@ frappe.ui.form.on('Publish', {
}
},
language: function (frm) {
if (!lang_set_first_time && selected_module==1) {
if (!lang_set_first_time) {
frappe.confirm('This will clear all the data, are you sure you want to proceed?',
() => {
// action to perform if Yes is selected
@ -497,7 +497,7 @@ frappe.ui.form.on('Publish', {
} else { lang_set_first_time = false; }
},
auto_version_update: function (frm) {
if (frm.doc.vehicle && frm.doc.language && frm.doc.publish_type && selected_module==1) {
if (frm.doc.vehicle && frm.doc.language && frm.doc.publish_type) {
frappe.call({
method: 'smart_service.transactions.doctype.publish.publish.cal_ver',
args: {

Loading…
Cancel
Save