Browse Source

Feature finder custom tab and MST

version2
venkataakhil 1 year ago
parent
commit
014f15ea39
  1. 38
      smart_service/apis/master_api.py
  2. 43
      smart_service/apis/v2/master.py
  3. 2
      smart_service/hooks.py
  4. 7
      smart_service/masters/doctype/role_master/role_master.py
  5. 485
      smart_service/phase_2/doctype/feature_finder/feature_finder.js
  6. 19
      smart_service/phase_2/doctype/feature_finder/feature_finder.json
  7. 79
      smart_service/phase_2/doctype/feature_finder/feature_finder.py
  8. 10
      smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json
  9. 0
      smart_service/phase_2/doctype/publish_test/__init__.py
  10. 262
      smart_service/phase_2/doctype/publish_test/publish_test.js
  11. 6
      smart_service/phase_2/doctype/publish_test/publish_test.json
  12. 8
      smart_service/phase_2/doctype/publish_test/publish_test.py
  13. 0
      smart_service/phase_2/doctype/publish_test/test_publish_test.py
  14. 11
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json
  15. 4
      smart_service/phase_2/doctype/repair_service_master/repair_service_master.json
  16. 2
      smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json
  17. 30
      smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.py
  18. 0
      smart_service/phase_2/doctype/repair_service_publish_data/__init__.py
  19. 77
      smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json
  20. 8
      smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.py
  21. 2
      smart_service/phase_2/doctype/training_information/training_information.py
  22. 12
      smart_service/phase_2/doctype/training_information_master/training_information_master.py
  23. 30
      smart_service/public/js/common_fun.js
  24. 19
      smart_service/transactions/doctype/publish/publish.js

38
smart_service/apis/master_api.py

@ -305,7 +305,7 @@ def check_pub_type(iid):
@frappe.whitelist(methods=['POST'])
def variant(LSD, language):
def old_variant(LSD, language):
date_format = "%Y-%m-%d %H:%M:%S.%f"
if LSD != "":
try:
@ -339,7 +339,7 @@ def variant(LSD, language):
@frappe.whitelist(methods=['POST'])
def variant1(LSD, language):
def variant(LSD, language):
date_format = "%Y-%m-%d %H:%M:%S.%f"
if LSD != "":
try:
@ -347,33 +347,29 @@ def variant1(LSD, language):
except:
return {"status": 0, "error": " 'LSD' format error"}
try:
data = frappe.db.sql('''
select name,vehicle,vehicle_id,variant_name,variant,variant_id,fuel,fuel_id,transmission,transmission_id,drive,drive_id,family_code,
data = frappe.db.sql(f'''
select name,vehicle,vehicle_id,name as variant_name,variant,variant_id,fuel,fuel_id,transmission,transmission_id,drive,drive_id,family_code,
case when active_status= 'Active' Then true else false end as active_status
FROM `tabVariant Mapping` where modified >='';''', as_dict=1)
FROM `tabVariant Mapping` where modified >='{LSD}';''', as_dict=1)
for d in data:
d['modules'] = frappe.db.sql(''' select 'automotive_system' as 'Automotive System', automotive_system as 'Active Status','tsb' as 'TSB',tsb as
'Active Status','fsa' as 'FSA', fsa as 'Active Status','tekalert' as 'TEKalert',tekalert as 'Active Status',
'feature_finder' as 'Feature Finder',feature_finder as 'Active Status','repairservice_check_sheet' as 'Repair/Service Check Sheet',
repairservice_check_sheet as 'Active Status','mahindra_special_tool_information' as 'Mahindra Special Tool Information',
mahindra_special_tool_information as 'Active Status','training_information' as 'Training Information',training_information as
'Active Status','qwik_service' as 'QWIK Service',qwik_service as 'Active Status','pdi_inspection' as 'PDI Inspection',
pdi_inspection as 'Active Status','torque_information_nm' as 'Torque Information NM',torque_information_nm as
'Active Status' FROM grmtest.`tabModule Publish Mapping`;''')
module_list = []
for k, v in d.items():
module_list.append([{'title': k}, {'active_status': v}])
return {"status":1,"error":None,'data':module_list}
# return {"status": 1, "error": None, 'data': data}
modules = frappe.db.sql(f''' select automotive_system as 'Automotive System',tsb as 'TSB',fsa as 'FSA',tekalert as 'TEKalert',
feature_finder as 'Feature Finder',repairservice_check_sheet as 'Repair/Service Check Sheet',
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)
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()]
return {"status": 1, "error": None, 'data': data}
except Exception as e:
frappe.local.response['http_status_code'] = 400
return {"status": 0, "error": e, 'data': None}
@frappe.whitelist(methods=['POST'])
def app_modules(LSD):
date_format = "%Y-%m-%d %H:%M:%S.%f"

43
smart_service/apis/v2/master.py

@ -49,7 +49,7 @@ def get_role_mapping():
@frappe.whitelist(methods=["POST"], allow_guest=1)
def get_repair_service_mapping(vehicle, language):
try:
repair_service_details = frappe.db.sql(f""" select vehicle,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 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`
@ -61,7 +61,7 @@ def get_repair_service_mapping(vehicle, language):
@frappe.whitelist(methods=["POST"], allow_guest=1)
def get_feature_finder(vehicle, variant, language):
def old_get_feature_finder(vehicle, variant, language):
try:
feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.variant,ff.language,ff.feature_name,ff.translated_feature_name,
ff.feature_category,ff.feature_type,ff.display_order,ff.active_status,ffm.feature_pdf from `tabFeature Finder` ff
@ -88,9 +88,9 @@ def get_feature_finder(vehicle, variant, language):
@frappe.whitelist(methods=["POST"], allow_guest=1)
def get_feature_finder1(vehicle, variant, language):
def get_feature_finder(vehicle, variant, language):
try:
feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.variant,ff.language,ff.features_names as feature_name,
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
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}"
@ -102,13 +102,13 @@ def get_feature_finder1(vehicle, variant, language):
''', as_dict=1)
sop_images = frappe.db.sql(f""" select image,idx as display_order,active_status from `tabFeature Finder Images` where
parent = '{f['name']}' and feature_type ='sop';""", as_dict=1)
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`
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`
where parent = '{f['name']}' and post_vin_cutoff_name ='SOP';""", as_dict=1)
where parent = '{f['name']}' and feature_type ='SOP';""", as_dict=1)
f['sop'] = {'content': sop_content, 'images': sop_images,
'specificaton': sop_specification}
@ -136,6 +136,20 @@ def get_feature_finder1(vehicle, variant, language):
return False, e
@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`
where vehicle = "{vehicle}" and language = "{language}"; """,as_dict=1)
for t in training_information:
t['content'] = frappe.db.sql(f''' select content_type,content,image_video,idx as display_order,active_status from
`tabTraining Information Content Reference` where parent = '{t['name']}';''',as_dict=1)
return True, training_information
except Exception as e:
return False, e
@frappe.whitelist(methods=['POST'])
def new_publish():
req = json.loads(frappe.request.data)
@ -149,11 +163,14 @@ def new_publish():
data = []
if module == 'Feature Finder':
flag, data = get_feature_finder1(vehicle, variant, language)
flag, data = get_feature_finder(vehicle, variant, language)
elif module == 'Repair/Service Check Sheet':
flag, data = get_repair_service_mapping(vehicle, language)
elif module == 'Training Information':
flag, data = get_training_information(vehicle, language)
if flag:
return {'status': 1, 'error': None, 'data': data}
else:
@ -162,3 +179,15 @@ def new_publish():
except Exception as e:
frappe.local.response['http_status_code'] = 400
return {'status': 0, 'error': "Parameter's missing: " + str(e), 'data': None}
@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']
except Exception as e:
return False, e

2
smart_service/hooks.py

@ -17,7 +17,7 @@ app_logo_url = "/assets/smart_service/images/Mahindra Rise2.png"
app_include_css = ["/assets/css/smart_service.min.css"]
# for web css
web_include_css = ["/assets/css/smart_service.min.css"]
app_include_js = "/assets/smart_service/js/common_fun.js"
# Icons
website_context = {
"favicon": "/assets/smart_service/images/Logo Fav Icon.png",

7
smart_service/masters/doctype/role_master/role_master.py

@ -6,10 +6,6 @@ from frappe.model.document import Document
class RoleMaster(Document):
def validate(self):
if self.role:
self.role = self.role.strip()
def autoname(self):
if self.is_new():
count = frappe.db.sql(
'''select max(my_id) as max_count from `tabRole Master`;''')
@ -18,6 +14,9 @@ class RoleMaster(Document):
else:
self.my_id = 1
if self.role:
self.role = self.role.strip()
@ frappe.whitelist()
def get_module_names():
data = frappe.db.sql(f'''

485
smart_service/phase_2/doctype/feature_finder/feature_finder.js

@ -170,14 +170,24 @@ function custom_tab_html(frm){
ret += '</div>'
res.append(ret)
res.append(`<style>.custom_tab{border:1px solid var(--table-border-color);}.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {background-color:lavender !important;}.nav-tabs {
border-bottom:none !important;}.specification_bl{margin:10px;}.main{border: 1px solid var(--table-border-color);margin:15px 0px 15px 0px}.spec_custom_add{margin:10px 0px 0px 0px}</style>`)
$(res).find('.main').append(`<div class="specification_bl"></div>`)
$(res).find('.main').append(`<div class="feature_imgbl"></div>`)
$(res).find('.main').append(`<div class="feature_contbl"></div>`)
res.append(`<style>.custom_tab{border:1px solid var(--table-border-color);}.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {background-color:lavender !important;}.nav-tabs {
border-bottom:none !important;}.feature_contbl{margin:10px;}.specification_bl{margin:10px;}.feature_imgbl{margin:10px;}.main{border: 1px solid var(--table-border-color);margin:15px 0px 15px 0px}.spec_custom_add{margin:10px 0px 0px 0px}</style>`)
var specification =""
var feature_finder_images = ""
var 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")
var spec_dialog_value = ""
var image_dialog_value =""
var content_dialog_value =""
var nav_spec = {}
nav_spec.feature_type = "SOP"
all_tabs()
@ -188,11 +198,16 @@ function custom_tab_html(frm){
nav_spec.feature_type= "SOP"
nav_spec.post_vin_cutoff_name = ""
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)
}
else{
nav_spec.feature_type= "Post Vin CutOff"
nav_spec.post_vin_cutoff_name = $(this)[0].id
specification = frm.doc.specification.filter(o => o.post_vin_cutoff_name == $(this)[0].id)
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)
}
all_tabs()
@ -201,6 +216,9 @@ function custom_tab_html(frm){
function all_tabs(){
//heading
var spec_custom_dt = ""
spec_custom_dt += `<label class="control-label">Specification</label><table class="table table-bordered table-editable" style='margin:0px !important'>
<thead>
@ -219,57 +237,275 @@ function custom_tab_html(frm){
spec_custom_dt += "<tbody>"
var image_custom_dt = ""
image_custom_dt += `<label class="control-label">Feature Finder Images</label><table class="table table-bordered table-editable" style='margin:0px !important'>
<thead>
<tr>
<th style="width: 7%;" class="feature_image"><input type="checkbox" id="imgcheckAll"' class="grid-row-check pull-left"><span class='image_check'>No</span></th>
<th>Image</th>
<th>Active Status</th>
<th>Feature Type</th>
<th>Post Vin CutOff Name</th>
<th><a><svg class="icon icon-sm" style="filter: opacity(0.5)">
<use class="" href="#icon-setting-gear"></use>
</svg></a></th>
</tr>
</thead>`
image_custom_dt += "<tbody>"
var content_custom_dt = ""
content_custom_dt += `<label class="control-label">Feature Finder Content</label><table class="table table-bordered table-editable" style='margin:0px !important'>
<thead>
<tr>
<th style="width: 7%;" class="feature_content"><input type="checkbox" id="contentcheckAll"' class="grid-row-check pull-left"><span class='content_check'>No</span></th>
<th>Content</th>
<th>Active Status</th>
<th>Feature Type</th>
<th>Post Vin CutOff Name</th>
<th><a><svg class="icon icon-sm" style="filter: opacity(0.5)">
<use class="" href="#icon-setting-gear"></use>
</svg></a></th>
</tr>
</thead>`
content_custom_dt += "<tbody>"
//end heading
//list
var specification_count = 0
specification.map(val => {
specification_count += 1
spec_custom_dt += '<tr>'
spec_custom_dt += '<td style="width: 7%;"><input id='+val.name+' type="checkbox" class="check 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>'
spec_custom_dt += '<td>'+val.feature_type+'</td>'
if(val.post_vin_cutoff_name){
spec_custom_dt += '<td>'+val.post_vin_cutoff_name+'</td>'
}
else{
spec_custom_dt += '<td> </td>'
}
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 += '<td>'+val.specification+'</td>'
spec_custom_dt += '<td>'+val.value+'</td>'
spec_custom_dt += '<td>'+val.active_status+'</td>'
spec_custom_dt += '<td>'+val.feature_type+'</td>'
if(val.post_vin_cutoff_name){
spec_custom_dt += '<td>'+val.post_vin_cutoff_name+'</td>'
}
else{
spec_custom_dt += '<td> </td>'
}
spec_custom_dt += '<td id='+ val.name+' class="spec_edit_row"><a><svg class="icon icon-xs" style=""><use class="" href="#icon-edit"></use></svg>Edit</a></td>'
spec_custom_dt += '</tr>'
spec_custom_dt += '<td id='+ val.name+' class="spec_edit_row"><a><svg class="icon icon-xs" style=""><use class="" href="#icon-edit"></use></svg>Edit</a></td>'
spec_custom_dt += '</tr>'
})
})
}else{
spec_custom_dt += '<tr><td></td><td style="text-align:center">No Records Found</td></tr>'
}
var image_count = 0
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 += '<td>'+val.image+'</td>'
image_custom_dt += '<td>'+val.active_status+'</td>'
image_custom_dt += '<td>'+val.feature_type+'</td>'
if(val.post_vin_cutoff_name){
image_custom_dt += '<td>'+val.post_vin_cutoff_name+'</td>'
}
else{
image_custom_dt += '<td> </td>'
}
image_custom_dt += '<td id='+ val.name+' class="image_edit_row"><a><svg class="icon icon-xs" style=""><use class="" href="#icon-edit"></use></svg>Edit</a></td>'
image_custom_dt += '</tr>'
})
}else{
image_custom_dt += '<tr><td></td><td style="text-align:center">No Records Found</td></tr>'
}
var content_count = 0
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 += '<td>'+val.content+'</td>'
content_custom_dt += '<td>'+val.active_status+'</td>'
content_custom_dt += '<td>'+val.feature_type+'</td>'
if(val.post_vin_cutoff_name){
content_custom_dt += '<td>'+val.post_vin_cutoff_name+'</td>'
}
else{
content_custom_dt += '<td> </td>'
}
content_custom_dt += '<td id='+ val.name+' class="content_edit_row"><a><svg class="icon icon-xs" style=""><use class="" href="#icon-edit"></use></svg>Edit</a></td>'
content_custom_dt += '</tr>'
})
}else{
content_custom_dt += '<tr><td></td><td style="text-align:center">No Records Found</td></tr>'
}
//list end
//buttons
spec_custom_dt += '</tbody>'
spec_custom_dt += '</table>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_delete">Delete</button>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_add">Add Row</button>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_save">Save</button>'
image_custom_dt += '</tbody>'
image_custom_dt += '</table>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_delete">Delete</button>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_add">Add Row</button>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_save">Save</button>'
content_custom_dt += '</tbody>'
content_custom_dt += '</table>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_delete">Delete</button>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_add">Add Row</button>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_save">Save</button>'
//button end
//append
spec_custom_dt += '</div>'
image_custom_dt += '</div>'
content_custom_dt += '</div>'
$(res).find('.specification_bl').empty()
$(res).find('.specification_bl').append(spec_custom_dt)
$(res).append(`<style>.spec_check{padding:0px 5px 0px 5px !important}.spec_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}</style>`)
// $(res).append(spec_custom_dt)
$(res).find('.feature_imgbl').empty()
$(res).find('.feature_imgbl').append(image_custom_dt)
$(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>.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}
.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}
.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_contbl').find('.content_custom_add').click(function(event){
content_dialog_value = ""
content_dialog_value = nav_spec
content_dialog_view()
})
//end add button
//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]
image_dialog_view()
})
$(res).find('.specification_bl').find('.spec_edit_row').click(function(event){
spec_dialog_value = frm.doc.specification.filter(o => o.name == $(this)[0].id)[0]
spec_dialog_view()
})
$(res).find('.feature_contbl').find('.content_edit_row').click(function(event){
content_dialog_value = frm.doc.feature_finder_content.filter(o => o.name == $(this)[0].id)[0]
content_dialog_view()
})
//end edit button
//delete all button
$(res).find('.feature_imgbl').find('.feature_image').find('input[type=checkbox]').change(function() {
$(".imagecheck").prop('checked', $(this).prop('checked'));
if(this.checked) {
$(res).find('.feature_imgbl').find('.image_custom_delete').css("display","inline-block")
}else{
$(res).find('.feature_imgbl').find('.image_custom_delete').css("display","None")
}
})
$(res).find('.specification_bl').find('.specifiction').find('input[type=checkbox]').change(function() {
$(".check").prop('checked', $(this).prop('checked'));
$(".speccheck").prop('checked', $(this).prop('checked'));
if(this.checked) {
$(res).find('.specification_bl').find('.spec_custom_delete').css("display","inline-block")
}else{
$(res).find('.specification_bl').find('.spec_custom_delete').css("display","None")
}
})
$(res).find('.feature_contbl').find('.feature_content').find('input[type=checkbox]').change(function() {
$(".contentcheck").prop('checked', $(this).prop('checked'));
if(this.checked) {
$(res).find('.feature_contbl').find('.content_custom_delete').css("display","inline-block")
}else{
$(res).find('.feature_contbl').find('.content_custom_delete').css("display","None")
}
})
//end delete all button
//individual delete button
$(res).find('.feature_imgbl').find('.imagecheck').change(function() {
if(this.checked) {
$(res).find('.feature_imgbl').find('.image_custom_delete').css("display","inline-block")
}else{
$(res).find('.feature_imgbl').find('.image_custom_delete').css("display","None")
}
})
$(res).find('.specification_bl').find('.speccheck').change(function() {
if(this.checked) {
$(res).find('.specification_bl').find('.spec_custom_delete').css("display","inline-block")
}else{
$(res).find('.specification_bl').find('.spec_custom_delete').css("display","None")
}
})
$(res).find('.feature_contbl').find('.contentcheck').change(function() {
if(this.checked) {
$(res).find('.feature_contbl').find('.content_custom_delete').css("display","inline-block")
}else{
$(res).find('.feature_contbl').find('.content_custom_delete').css("display","None")
}
})
//end individual delete button
//delete function
$(res).find('.specification_bl').find('.spec_custom_delete').click(function(event){
var arr = []
$(res).find('.specification_bl').find("input[type=checkbox]").each(function () {
@ -279,7 +515,10 @@ function custom_tab_html(frm){
arr.push(self.attr("id"));
}
});
arr = arr.slice(1)
if(arr[0]=="checkAll"){
arr = arr.slice(1)
}
console.log(arr,"-------------------")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.delete_spec_data",
@ -295,6 +534,63 @@ function custom_tab_html(frm){
})
})
$(res).find('.feature_imgbl').find('.image_custom_delete').click(function(event){
var arr = []
$(res).find('.feature_imgbl').find("input[type=checkbox]").each(function () {
var self = $(this);
if (self.is(':checked')) {
console.log(self.attr("id"),"sdcdcd")
arr.push(self.attr("id"));
}
});
if(arr[0]=="checkAll"){
arr = arr.slice(1)
}
console.log(arr,"-------------------")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.delete_image_data",
args: {
values:arr
},
callback:function(r){
console.log(r.message.status,'-rmessage')
if(r.message.status=="success"){
cur_frm.reload_doc()
}
}
})
})
$(res).find('.feature_contbl').find('.content_custom_delete').click(function(event){
var arr = []
$(res).find('.feature_contbl').find("input[type=checkbox]").each(function () {
var self = $(this);
if (self.is(':checked')) {
console.log(self.attr("id"),"sdcdcd")
arr.push(self.attr("id"));
}
});
if(arr[0]=="checkAll"){
arr = arr.slice(1)
}
console.log(arr,"-------------------")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.delete_content_data",
args: {
values:arr
},
callback:function(r){
console.log(r.message.status,'-rmessage')
if(r.message.status=="success"){
cur_frm.reload_doc()
}
}
})
})
//delete function end
}
function spec_dialog_view(){
@ -317,7 +613,7 @@ function custom_tab_html(frm){
default:spec_dialog_value.specification
},
{
label: 'Valuee',
label: 'Value',
fieldname: 'value',
fieldtype: 'Data',
default:spec_dialog_value.value
@ -342,6 +638,7 @@ function custom_tab_html(frm){
fieldtype: 'Data',
default:spec_dialog_value.post_vin_cutoff_name,
depends_on:"eval:doc.feature_type=='Post Vin CutOff'",
},
],
// size: 'small', // small, large, extra-large
@ -371,6 +668,146 @@ function custom_tab_html(frm){
}
function image_dialog_view(){
let spec_dia = new frappe.ui.Dialog({
title: 'Enter details',
fields: [
{
label: 'Name',
fieldname: 'name',
fieldtype: 'Data',
default:image_dialog_value.name,
hidden:1
},
{
label: 'Image',
fieldname: 'image',
fieldtype: 'Attach',
},
{
label: 'Active Status',
fieldname: 'active_status',
fieldtype: 'Select',
options:"Active\nInactive",
default:image_dialog_value.active_status
},
{
label: 'Feature Type',
fieldname: 'feature_type',
fieldtype: 'Data',
default:image_dialog_value.feature_type,
read_only:1
},
{
label: 'Post Vin Cutoff Name',
fieldname: 'post_vin_cutoff_name',
fieldtype: 'Data',
default:image_dialog_value.post_vin_cutoff_name,
depends_on:"eval:doc.feature_type=='Post Vin CutOff'",
read_only:1
},
],
// size: 'small', // small, large, extra-large
primary_action_label: 'Submit',
primary_action(values) {
console.log(values,"values");
if (values){
console.log(values,"---values")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.insert_image_data",
args: {
doc_name:frm.doc.name,
values:values
},
callback:function(r){
console.log(r.message.status,'-rmessage')
if(r.message.status=="success"){
cur_frm.reload_doc()
}
}
})
}
spec_dia.hide();
}
});
console.log(spec_dia,"spec_dia")
spec_dia.show();
}
function content_dialog_view(){
let spec_dia = new frappe.ui.Dialog({
title: 'Enter details',
fields: [
{
label: 'Name',
fieldname: 'name',
fieldtype: 'Data',
default:content_dialog_value.name,
hidden:1
},
{
label: 'Content',
fieldname: 'content',
fieldtype: 'Data',
default:content_dialog_value.content,
},
{
label: 'Active Status',
fieldname: 'active_status',
fieldtype: 'Select',
options:"Active\nInactive",
default:content_dialog_value.active_status
},
{
label: 'Feature Type',
fieldname: 'feature_type',
fieldtype: 'Data',
default:content_dialog_value.feature_type,
read_only:1
},
{
label: 'Post Vin Cutoff Name',
fieldname: 'post_vin_cutoff_name',
fieldtype: 'Data',
default:content_dialog_value.post_vin_cutoff_name,
depends_on:"eval:doc.feature_type=='Post Vin CutOff'",
read_only:1
},
],
// size: 'small', // small, large, extra-large
primary_action_label: 'Submit',
primary_action(values) {
console.log(values,"values");
if (values){
console.log(values,"---values")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.insert_content_data",
args: {
doc_name:frm.doc.name,
values:values
},
callback:function(r){
console.log(r.message.status,'-rmessage')
if(r.message.status=="success"){
cur_frm.reload_doc()
}
}
})
}
spec_dia.hide();
}
});
console.log(spec_dia,"spec_dia")
spec_dia.show();
}
// $("#specification").click(function(){

19
smart_service/phase_2/doctype/feature_finder/feature_finder.json

@ -25,7 +25,9 @@
"test_html",
"specification",
"feature_finder_images",
"feature_finder_content"
"feature_finder_content",
"vehicle_id",
"variant_id"
],
"fields": [
{
@ -98,6 +100,7 @@
{
"fieldname": "create_feature_finder_images",
"fieldtype": "Button",
"hidden": 1,
"label": "Add Feature Finder Images"
},
{
@ -143,11 +146,23 @@
"fieldtype": "Table",
"label": "Post Vin Cutoff ID",
"options": "Post Vin Cutoff ID"
},
{
"fetch_from": "variant_mapping.vehicle_id",
"fieldname": "vehicle_id",
"fieldtype": "Int",
"label": "Vehicle Id"
},
{
"fetch_from": "variant_mapping.variant_id",
"fieldname": "variant_id",
"fieldtype": "Int",
"label": "Variant Id"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-07 13:10:48.720447",
"modified": "2023-08-07 18:05:41.690172",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder",

79
smart_service/phase_2/doctype/feature_finder/feature_finder.py

@ -123,6 +123,85 @@ def delete_spec_data(values):
@frappe.whitelist()
def insert_image_data(doc_name,values):
try:
val = json.loads(values)
if val.get('name')!=None:
doc = frappe.get_doc("Feature Finder Images",val['name'])
doc.image = val.get('image')
doc.active_status = val.get('active_status')
doc.feature_type = val.get('feature_type')
doc.save()
frappe.db.commit()
else:
res = frappe.get_doc("Feature Finder",doc_name)
res.append("feature_finder_images",val)
res.save()
frappe.db.commit()
return {"status":"success"}
except Exception as e:
frappe.log_error("insert_image_data",str(e))
return {"status":"failure"}
@frappe.whitelist()
def delete_image_data(values):
try:
val = json.loads(values)
if len(val)>0:
for d in val:
frappe.delete_doc("Feature Finder Images",d)
frappe.db.commit()
return {"status":"success"}
except Exception as e:
frappe.log_error("delete_image_data",str(e))
@frappe.whitelist()
def insert_content_data(doc_name,values):
try:
val = json.loads(values)
if val.get('name')!=None:
doc = frappe.get_doc("Feature Finder Content",val['name'])
doc.content = val.get('content')
doc.active_status = val.get('active_status')
doc.feature_type = val.get('feature_type')
doc.save()
frappe.db.commit()
else:
res = frappe.get_doc("Feature Finder",doc_name)
res.append("feature_finder_content",val)
res.save()
frappe.db.commit()
return {"status":"success"}
except Exception as e:
frappe.log_error("insert_content_data",str(e))
return {"status":"failure"}
@frappe.whitelist()
def delete_content_data(values):
try:
val = json.loads(values)
if len(val)>0:
for d in val:
frappe.delete_doc("Feature Finder Content",d)
frappe.db.commit()
return {"status":"success"}
except Exception as e:
frappe.log_error("delete_image_data",str(e))
# res.append("specification",{
# "specification":val.get('specification'),
# "value":val.get('value'),

10
smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json

@ -10,7 +10,8 @@
"value",
"active_status",
"feature_type",
"post_vin_cutoff_name"
"post_vin_cutoff_name",
"display_order"
],
"fields": [
{
@ -42,12 +43,17 @@
"fieldname": "post_vin_cutoff_name",
"fieldtype": "Data",
"label": "Post Vin Cutoff Name"
},
{
"fieldname": "display_order",
"fieldtype": "Data",
"label": "Display Order"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-04 13:05:42.300134",
"modified": "2023-08-07 15:35:30.309157",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Specification",

0
smart_service/transactions/doctype/publish_test/__init__.py → smart_service/phase_2/doctype/publish_test/__init__.py

262
smart_service/transactions/doctype/publish_test/publish_test.js → smart_service/phase_2/doctype/publish_test/publish_test.js

@ -17,6 +17,17 @@ cur_frm.fields_dict['vehicle'].get_query = function (doc, cdt, cdn) {
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
}
else{
selected_module=0
}
},
onload: function (frm) {
$(document).on('mouseover', function (events) {
$("a:contains(Copy to Clipboard)").css({ 'pointer-events': 'none' }),
@ -27,19 +38,6 @@ frappe.ui.form.on('Publish Test', {
frm.get_field('publish_documents').grid.cannot_add_rows = true;
},
publish_module_type:function(frm){
if(cur_frm.doc.publish_module_type=='Automative'){
selected_module=1
}
else{
selected_module=0
}
},
planned_publish_date: function (frm) {
let date = (frappe.datetime.nowdate())
if (frm.doc.planned_publish_date < date) {
@ -51,7 +49,8 @@ frappe.ui.form.on('Publish Test', {
},
refresh: function (frm) {
cur_frm.set_df_property('system_mapping', "read_only", 1);
if(selected_module==1){
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();
cur_frm.fields_dict['system_mapping'].grid.wrapper.find('.grid-remove-rows').hide();
@ -288,12 +287,243 @@ frappe.ui.form.on('Publish Test', {
$(".grid-buttons").hide();
}
}
},
validate: function (frm) {
if(selected_module==1){
if(selected_module==1){
let regex = /[!@#$%^*_+\=\[\]{};'`~\\|.<>\?]+/;
if (regex.test(frm.doc.release_description) === true) {
frm.doc.release_description = '';
frm.refresh_fields();
frappe.msgprint(__("<b>Publish Description:</b> Only letters, numbers and <b> / - () & , ' : </b> are allowed."));
}
}
if (frm.doc.vehicle && frm.doc.release_description && frm.fields_dict.publish_documents.grid.grid_rows.length === 0) {
frappe.msgprint(__("No item selected to Publish"));
frappe.validated = false;
}
if (frm.doc.planned_publish_date < frappe.datetime.get_today()) {
frappe.msgprint(__("<b>Planned Publish Date:</b> You can not select past date"));
frappe.validated = false;
}
}
},
variant_mapping: function (frm) {
frappe.db.get_value('Variant Mapping', { name: frm.doc.variant_mapping }, ['fuel', 'transmission', 'drive'], (r) => {
frm.doc.variant = r.fuel + ',' + r.transmission + ',' + r.drive;
cur_frm.refresh_field('variant');
})
let km_name = frm.doc.variant_mapping + "-" + frm.doc.language + "-KM";
frappe.db.get_value('Kilometer Mapping', { name: km_name }, 'workflow_state', (r) => {
if (r.workflow_state == "Draft") {
frm.doc.kilometer_mapping = '';
frm.doc.variant_mapping = '';
frm.doc.system_mapping = '';
frm.doc.variant_mapping_status = '';
frm.refresh_field('kilometer_mapping');
frm.refresh_field('variant_mapping');
frm.refresh_field('system_mapping');
frappe.msgprint("System Mapping details cannot be loaded due to kilometer mapping in draft state");
frappe.validated = false;
}
else {
if (frm.doc.variant_mapping === undefined) { return; }
frm.set_value('system_mapping', null);
frm.set_value('variant_mapping_assets', null);
frappe.db.exists('Kilometer Mapping', frm.doc.variant_mapping + "-" + frm.doc.language + "-KM")
.then(exists => {
if (exists) {
frm.set_value("kilometer_mapping", frm.doc.variant_mapping + "-" + frm.doc.language + "-KM");
frm.refresh_field('kilometer_mapping')
} else {
frm.set_value("km_active_status", "Not Configured!");
}
});
}
})
},
km_active_status: function (frm) {
if (frm.doc.variant_mapping && selected_module==1) {
frappe.show_alert({
message: __('Please wait until variant mapping details are loaded.'),
indicator: 'yellow'
}, 5);
}
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) {
frappe.call({
"method": "smart_service.transactions.doctype.publish.publish.get_system",
"args": {
"doc": frm.doc.variant_mapping,
"name": filter,
"lang": frm.doc.language
},
callback: function (r) {
$.each(r.message, function (index, row) {
let child;
child = cur_frm.add_child("system_mapping");
child.systems = row.systems;
child.sub_systems = row.sub_systems;
child.active_status = row.active_status;
child.symptom = row.symptom;
child.component = row.component;
child.estimate_time = row.estimate_time;
child.rts = row.rts;
child.mat = row.mat;
child.procedure = row.procedure;
child.procedure_status = row.procedure_status;
cur_frm.refresh_field('system_mapping');
cur_frm.refresh_fields();
})
}
})
frappe.call({
"method": "smart_service.transactions.doctype.publish.publish.get_vm_asset",
"args": {
"doc": frm.doc.variant_mapping,
"lang": frm.doc.language
},
callback: function (r) {
$.each(r.message, function (index, row) {
let child;
child = cur_frm.add_child("variant_mapping_assets");
child.category = row.category;
child.language = row.language;
child.attach_file = row.attach_file;
child.active_status = row.active_status;
cur_frm.refresh_field('variant_mapping_assets');
cur_frm.refresh_fields();
})
}
})
frappe.call({
"method": "smart_service.transactions.doctype.publish.publish.get_sm_asset",
"args": {
"doc": frm.doc.variant_mapping,
"name": filter,
"lang": frm.doc.language
},
callback: function (r) {
$.each(r.message, function (index, row) {
let child_row;
child_row = cur_frm.add_child("variant_mapping_assets");
child_row.category = row.systems;
child_row.language = row.language;
child_row.attach_file = row.system_asset;
child_row.active_status = row.active_status;
cur_frm.refresh_field('variant_mapping_assets');
cur_frm.refresh_fields();
})
}
})
} else {
if (frm.doc.variant_mapping_status && selected_module==1) {
frappe.msgprint({
title: __('Notification'),
indicator: 'red',
message: __('System Mapping & Assets not loaded as the selected Variant/Kilometer Mapping is <b>Inactive or not configured</b>')
});
}
}
},
add_variant_mapping_to_publish: function (frm) {
let dulicate = false;
if (frm.doc.publish_documents && selected_module==1) {
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;
}
});
frappe.msgprint("Variant Mapping already added");
}
if (dulicate === false && selected_module==1) {
let child = cur_frm.add_child("publish_documents");
child.variant_mapping = frm.doc.variant_mapping;
child.item_category = "Variant Mapping";
refresh_field("publish_documents");
frappe.msgprint(__(frm.doc.variant_mapping + " Added"));
}
},
km_report: function (frm, cdt, cdn) {
frappe.set_route("query-report", 'Kilometer Mapping', { 'kilometer_mapping': frm.doc.kilometer_mapping });
},
vehicle: function (frm) {
frappe.call({
method: "smart_service.transactions.doctype.publish.publish.old_publish",
async: false,
args: {
"vehicle": frm.doc.vehicle,
"language": frm.doc.language
},
callback: function (r) {
if (r.message) {
let vehicle = frm.doc.vehicle;
cur_frm.doc.vehicle = '';
cur_frm.doc.vehicle_status = '';
cur_frm.refresh_field('vehicle');
cur_frm.refresh_field('vehicle_status');
frappe.msgprint("Already publish record " + r.message[0]['name'] + " created for " + vehicle + " vehicle. Please edit already available " + r.message[0]['publish_type'] + " publish!")
}
}
});
if (frm.doc.vehicle === undefined || frm.doc.vehicle === null && selected_module==1) { return; }
$("[data-fieldname=variant_mapping]").focus();
if (frm.doc.vehicle) {
frm.set_df_property('vehicle', 'read_only', 1);
}
},
language: function (frm) {
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
frm.set_value('variant_mapping', null);
frm.set_value('variant_mapping_status', null);
frm.set_value('system_mapping', null);
frm.set_value('variant_mapping_assets', null);
frm.set_value('publish_documents', null);
lang_set_first_time = false;
}, () => {
// action to perform if No is selected
});
} else { lang_set_first_time = false; }
},
auto_version_update: function (frm) {
if (frm.doc.vehicle && frm.doc.language && frm.doc.publish_type) {
frappe.call({
method: 'smart_service.transactions.doctype.publish.publish.cal_ver',
args: {
vehicle: frm.doc.vehicle,
lang: frm.doc.language,
publish_type: frm.doc.publish_type,
doc: frm.doc.name
},
callback: (r) => {
frm.doc.version = r
cur_frm.refresh_field('version')
},
error: (r) => {
// on error
}
});
}
},
});
frappe.ui.form.on('Publish_Temp Doc', {

6
smart_service/transactions/doctype/publish_test/publish_test.json → smart_service/phase_2/doctype/publish_test/publish_test.json

@ -1,7 +1,7 @@
{
"actions": [],
"autoname": "format: {vehicle}-{language} -{creation}",
"creation": "2023-08-07 14:56:06.369284",
"creation": "2023-08-07 16:21:22.055887",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
@ -318,9 +318,9 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-08-07 15:10:40.972425",
"modified": "2023-08-07 17:55:10.923830",
"modified_by": "Administrator",
"module": "Transactions",
"module": "Phase-2",
"name": "Publish Test",
"owner": "Administrator",
"permissions": [

8
smart_service/transactions/doctype/publish_test/publish_test.py → smart_service/phase_2/doctype/publish_test/publish_test.py

@ -381,3 +381,11 @@ def update_procedure_value(name, file_path):
frappe.db.set_value(
"Publish", self.name, "published_by", str(name))
frappe.db.commit()
@ 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;
''', as_dict=1)
return data

0
smart_service/transactions/doctype/publish_test/test_publish_test.py → smart_service/phase_2/doctype/publish_test/test_publish_test.py

11
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json

@ -21,7 +21,8 @@
"display_order",
"section_break_ecyyc",
"description",
"my_id"
"my_id",
"vehicle_id"
],
"fields": [
{
@ -111,11 +112,17 @@
"in_list_view": 1,
"label": "My Id",
"set_only_once": 1
},
{
"fetch_from": "vehicle.myid",
"fieldname": "vehicle_id",
"fieldtype": "Int",
"label": "Vehicle Id"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-04 09:54:00.221736",
"modified": "2023-08-07 16:28:34.938285",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Mapping",

4
smart_service/phase_2/doctype/repair_service_master/repair_service_master.json

@ -1,7 +1,7 @@
{
"_comments": "[]",
"_liked_by": "[\"Administrator\"]",
"actions": [],
"allow_rename": 1,
"autoname": "format:{repairservicename}",
"creation": "2023-07-20 17:52:46.159091",
"doctype": "DocType",
@ -51,7 +51,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-04 16:23:33.967758",
"modified": "2023-08-07 15:55:31.517282",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Master",

2
smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json

@ -101,7 +101,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-04 10:54:59.348477",
"modified": "2023-08-07 16:27:20.861818",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Master Mapping",

30
smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.py

@ -5,17 +5,25 @@ import frappe
from frappe.model.document import Document
class RepairServiceMasterMapping(Document):
def validate(self):
if self.vehicle:
self.vehicle = self.vehicle.strip()
def autoname(self):
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabRepair Service Master Mapping`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
def validate(self):
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabRepair Service Master Mapping`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
if self.vehicle:
self.vehicle = self.vehicle.strip()
# def autoname(self):
# if self.is_new():
# count = frappe.db.sql('''select max(my_id) as max_count from `tabRepair Service Master Mapping`;''')
# if count[0][0] is not None:
# self.my_id = count[0][0] + 1
# else:
# self.my_id = 1

0
smart_service/phase_2/doctype/repair_service_publish_data/__init__.py

77
smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json

@ -0,0 +1,77 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-08-07 18:24:41.059420",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"vehicle",
"parent_name",
"language",
"check_list_name",
"active_status",
"display_order",
"description",
"my_id"
],
"fields": [
{
"fieldname": "vehicle",
"fieldtype": "Link",
"label": "Vehicle",
"options": "Vehicle"
},
{
"fieldname": "parent_name",
"fieldtype": "Link",
"label": "Parent Name",
"options": "Repair Service Master Mapping"
},
{
"fieldname": "language",
"fieldtype": "Link",
"label": "Language",
"options": "Custom Languages"
},
{
"fieldname": "check_list_name",
"fieldtype": "Link",
"label": "Check List Name",
"options": "Repair Service Master"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "display_order",
"fieldtype": "Int",
"label": "Display Order"
},
{
"fieldname": "description",
"fieldtype": "Table",
"label": "Description",
"options": "Repair Service Child"
},
{
"fieldname": "my_id",
"fieldtype": "Int",
"label": "My Id"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-07 18:47:20.666082",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Publish Data",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC"
}

8
smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.py

@ -0,0 +1,8 @@
# Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class RepairServicePublishData(Document):
pass

2
smart_service/phase_2/doctype/training_information/training_information.py

@ -5,7 +5,7 @@ import frappe
from frappe.model.document import Document
class TrainingInformation(Document):
def autoname(self):
def validate(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:

12
smart_service/phase_2/doctype/training_information_master/training_information_master.py

@ -5,17 +5,17 @@
from frappe.model.document import Document
class TrainingInformationMaster(Document):
def autoname(self):
def validate(self):
if self.category:
self.category = self.category.strip()
if self.topic:
self.topic = self.topic.strip()
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:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
def validate(self):
if self.category:
self.category = self.category.strip()
if self.topic:
self.topic = self.topic.strip()

30
smart_service/public/js/common_fun.js

@ -0,0 +1,30 @@
var row;
function dragstartFunction(evt){
row = evt.target;
}
function dragovertFunction(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 => {
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")
count +=1
})
//end
if(children.indexOf(e.target.parentNode)>children.indexOf(row)){
e.target.parentNode.after(row);
}
else{
e.target.parentNode.before(row);
}
}

19
smart_service/transactions/doctype/publish/publish.js

@ -1,6 +1,6 @@
// Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
// For license information, please see license.txt
var selected_module=0
cur_frm.fields_dict['variant_mapping'].get_query = function (doc, cdt, cdn) {
return {
@ -17,6 +17,17 @@ cur_frm.fields_dict['vehicle'].get_query = function (doc, cdt, cdn) {
let lang_set_first_time = true;
frappe.ui.form.on('Publish', {
publish_module:function(frm){
if(cur_frm.doc.publish_module=='Automotive'){
selected_module=1
}
else{
selected_module=0
}
},
onload: function (frm) {
$(document).on('mouseover', function (events) {
$("a:contains(Copy to Clipboard)").css({ 'pointer-events': 'none' }),
@ -423,7 +434,7 @@ frappe.ui.form.on('Publish', {
},
add_variant_mapping_to_publish: function (frm) {
let dulicate = false;
if (frm.doc.publish_documents) {
if (frm.doc.publish_documents && selected_module==1) {
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;
@ -470,7 +481,7 @@ frappe.ui.form.on('Publish', {
}
},
language: function (frm) {
if (!lang_set_first_time) {
if (!lang_set_first_time && selected_module==1) {
frappe.confirm('This will clear all the data, are you sure you want to proceed?',
() => {
// action to perform if Yes is selected
@ -486,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) {
if (frm.doc.vehicle && frm.doc.language && frm.doc.publish_type && selected_module==1) {
frappe.call({
method: 'smart_service.transactions.doctype.publish.publish.cal_ver',
args: {

Loading…
Cancel
Save