diff --git a/smart_service/apis/master_api.py b/smart_service/apis/master_api.py
index e0a62b2..ec43ef0 100644
--- a/smart_service/apis/master_api.py
+++ b/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`;''')
+ 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)
- module_list = []
- for k, v in d.items():
- module_list.append([{'title': k}, {'active_status': v}])
- return {"status":1,"error":None,'data':module_list}
+ 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}
+ 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"
diff --git a/smart_service/apis/v2/master.py b/smart_service/apis/v2/master.py
index 15e1814..afaf730 100644
--- a/smart_service/apis/v2/master.py
+++ b/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
\ No newline at end of file
diff --git a/smart_service/hooks.py b/smart_service/hooks.py
index 05fecae..fb2a9fa 100644
--- a/smart_service/hooks.py
+++ b/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",
diff --git a/smart_service/masters/doctype/role_master/role_master.py b/smart_service/masters/doctype/role_master/role_master.py
index aafb194..33183b5 100644
--- a/smart_service/masters/doctype/role_master/role_master.py
+++ b/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`;''')
@@ -17,6 +13,9 @@ class RoleMaster(Document):
self.my_id = count[0][0] + 1
else:
self.my_id = 1
+
+ if self.role:
+ self.role = self.role.strip()
@ frappe.whitelist()
def get_module_names():
diff --git a/smart_service/phase_2/doctype/feature_finder/feature_finder.js b/smart_service/phase_2/doctype/feature_finder/feature_finder.js
index 1e0ac2d..0f0feb5 100644
--- a/smart_service/phase_2/doctype/feature_finder/feature_finder.js
+++ b/smart_service/phase_2/doctype/feature_finder/feature_finder.js
@@ -170,14 +170,24 @@ function custom_tab_html(frm){
ret += ''
res.append(ret)
- res.append(``)
$(res).find('.main').append(`
`)
+ $(res).find('.main').append(``)
+ $(res).find('.main').append(``)
+
+ res.append(``)
+
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 += `
@@ -218,58 +236,276 @@ function custom_tab_html(frm){
`
spec_custom_dt += ""
-
+
+ var image_custom_dt = ""
+ image_custom_dt += `'
+ image_custom_dt += ''
+ image_custom_dt += ''
+ image_custom_dt += ''
+
+
+ content_custom_dt += ''
+ content_custom_dt += '
'
+ content_custom_dt += ''
+ content_custom_dt += ''
+ content_custom_dt += ''
+ //button end
+
+
+
+ //append
spec_custom_dt += ''
+ image_custom_dt += ''
+ content_custom_dt += ''
+
$(res).find('.specification_bl').empty()
$(res).find('.specification_bl').append(spec_custom_dt)
- $(res).append(``)
- // $(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(``)
+ $(res).append(``)
+
+ $(res).append(``)
+ //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(){
diff --git a/smart_service/phase_2/doctype/feature_finder/feature_finder.json b/smart_service/phase_2/doctype/feature_finder/feature_finder.json
index 91da100..f937df8 100644
--- a/smart_service/phase_2/doctype/feature_finder/feature_finder.json
+++ b/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",
diff --git a/smart_service/phase_2/doctype/feature_finder/feature_finder.py b/smart_service/phase_2/doctype/feature_finder/feature_finder.py
index f2100ef..03f4cea 100644
--- a/smart_service/phase_2/doctype/feature_finder/feature_finder.py
+++ b/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'),
diff --git a/smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json b/smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json
index be3b91f..65c1540 100644
--- a/smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json
+++ b/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",
diff --git a/smart_service/transactions/doctype/publish_test/__init__.py b/smart_service/phase_2/doctype/publish_test/__init__.py
similarity index 100%
rename from smart_service/transactions/doctype/publish_test/__init__.py
rename to smart_service/phase_2/doctype/publish_test/__init__.py
diff --git a/smart_service/transactions/doctype/publish_test/publish_test.js b/smart_service/phase_2/doctype/publish_test/publish_test.js
similarity index 61%
rename from smart_service/transactions/doctype/publish_test/publish_test.js
rename to smart_service/phase_2/doctype/publish_test/publish_test.js
index 7dbbd09..b3db8f2 100644
--- a/smart_service/transactions/doctype/publish_test/publish_test.js
+++ b/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(__("Publish Description: Only letters, numbers and / - () & , ' : 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(__("Planned Publish Date: 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 Inactive or not configured')
+ });
+ }
+ }
+ },
+ 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', {
diff --git a/smart_service/transactions/doctype/publish_test/publish_test.json b/smart_service/phase_2/doctype/publish_test/publish_test.json
similarity index 98%
rename from smart_service/transactions/doctype/publish_test/publish_test.json
rename to smart_service/phase_2/doctype/publish_test/publish_test.json
index 6d848ea..ec98d10 100644
--- a/smart_service/transactions/doctype/publish_test/publish_test.json
+++ b/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": [
diff --git a/smart_service/transactions/doctype/publish_test/publish_test.py b/smart_service/phase_2/doctype/publish_test/publish_test.py
similarity index 98%
rename from smart_service/transactions/doctype/publish_test/publish_test.py
rename to smart_service/phase_2/doctype/publish_test/publish_test.py
index 50dfe28..0cc2c3f 100644
--- a/smart_service/transactions/doctype/publish_test/publish_test.py
+++ b/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
diff --git a/smart_service/transactions/doctype/publish_test/test_publish_test.py b/smart_service/phase_2/doctype/publish_test/test_publish_test.py
similarity index 100%
rename from smart_service/transactions/doctype/publish_test/test_publish_test.py
rename to smart_service/phase_2/doctype/publish_test/test_publish_test.py
diff --git a/smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json b/smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json
index 3cb66b0..d9d4459 100644
--- a/smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json
+++ b/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",
diff --git a/smart_service/phase_2/doctype/repair_service_master/repair_service_master.json b/smart_service/phase_2/doctype/repair_service_master/repair_service_master.json
index 4f7ab05..1349fc2 100644
--- a/smart_service/phase_2/doctype/repair_service_master/repair_service_master.json
+++ b/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",
diff --git a/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json b/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json
index 06ce21b..946d8ca 100644
--- a/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.json
+++ b/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",
diff --git a/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.py b/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.py
index 581325a..1e6159b 100644
--- a/smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.py
+++ b/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 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
+ # 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
diff --git a/smart_service/phase_2/doctype/repair_service_publish_data/__init__.py b/smart_service/phase_2/doctype/repair_service_publish_data/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json b/smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json
new file mode 100644
index 0000000..f98b1b1
--- /dev/null
+++ b/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"
+}
\ No newline at end of file
diff --git a/smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.py b/smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.py
new file mode 100644
index 0000000..0335b15
--- /dev/null
+++ b/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
diff --git a/smart_service/phase_2/doctype/training_information/training_information.py b/smart_service/phase_2/doctype/training_information/training_information.py
index da86af4..5a8148d 100644
--- a/smart_service/phase_2/doctype/training_information/training_information.py
+++ b/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:
diff --git a/smart_service/phase_2/doctype/training_information_master/training_information_master.py b/smart_service/phase_2/doctype/training_information_master/training_information_master.py
index 4d02dc2..2afd374 100644
--- a/smart_service/phase_2/doctype/training_information_master/training_information_master.py
+++ b/smart_service/phase_2/doctype/training_information_master/training_information_master.py
@@ -4,18 +4,18 @@
# import frappe
from frappe.model.document import Document
-class TrainingInformationMaster(Document):
- 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:
- self.my_id = count[0][0] + 1
- else:
- self.my_id = 1
+class TrainingInformationMaster(Document):
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
diff --git a/smart_service/public/js/common_fun.js b/smart_service/public/js/common_fun.js
new file mode 100644
index 0000000..f570023
--- /dev/null
+++ b/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 = ''+count+''
+ $(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);
+ }
+}
\ No newline at end of file
diff --git a/smart_service/transactions/doctype/publish/publish.js b/smart_service/transactions/doctype/publish/publish.js
index e0753ba..7309b87 100644
--- a/smart_service/transactions/doctype/publish/publish.js
+++ b/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: {