Browse Source

remove logs and console

version2
venkataakhil 1 year ago
parent
commit
3d9acc82fc
  1. 12
      smart_service/apis/v2/master.py
  2. 181
      smart_service/phase_2/doctype/feature_finder/feature_finder.js
  3. 15
      smart_service/phase_2/doctype/feature_finder/feature_finder.json
  4. 31
      smart_service/phase_2/doctype/feature_finder_specification_master/feature_finder_specification_master.js
  5. 4
      smart_service/phase_2/doctype/feature_finder_specification_master/feature_finder_specification_master.json
  6. 7
      smart_service/phase_2/doctype/publish_test/publish_test.js
  7. 2
      smart_service/phase_2/doctype/publish_test/publish_test.json
  8. 20
      smart_service/phase_2/doctype/publish_test/publish_test.py
  9. 3
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.js
  10. 4
      smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json
  11. 32
      smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.js
  12. 11
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.js
  13. 4
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.json
  14. 72
      smart_service/phase_2/doctype/training_information/training_information.js
  15. 9
      smart_service/phase_2/doctype/training_information/training_information.py
  16. 5
      smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json
  17. 8
      smart_service/phase_2/doctype/training_information_master/training_information_master.py

12
smart_service/apis/v2/master.py

@ -72,13 +72,13 @@ 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
left join grmtest.`tabFeature Finder Master` ffm on ff.vehicle = ffm.vehicle
left join `tabFeature Finder Master` ffm on ff.vehicle = ffm.vehicle
where ff.vehicle = "{vehicle}" and ff.variant = "{variant}"
and ff.language = "{language}"; """, as_dict=1)
for d in feature_finder_details:
d['disclaimer'] = frappe.db.sql(f'''
SELECT name,content,active_status,idx as display_order FROM grmtest.`tabFeature Finder Disclaimer`
SELECT name,content,active_status,idx as display_order FROM `tabFeature Finder Disclaimer`
where parent = '{d['feature_name']}';
''', as_dict=1)
@ -101,7 +101,7 @@ def get_feature_finder(vehicle, variant, language):
if language == 'en':
feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.vehicle_id,ff.variant,ff.variant_id,ff.language,
ff.features_names as feature_name,ff.feature_category,ff.display_order,ff.active_status,
ffm.feature_pdf as pdf from grmtest.`tabFeature Finder` ff left join grmtest.`tabFeature Finder Master` ffm on
ffm.feature_pdf as pdf from `tabFeature Finder` ff left join `tabFeature Finder Master` ffm on
ff.features_names = ffm.feature_name
where ff.vehicle = "{vehicle}" and ffm.vehicle = "{vehicle}" and ff.variant = "{variant}"
and ff.language = "{language}";
@ -109,8 +109,8 @@ def get_feature_finder(vehicle, variant, language):
else:
feature_finder_details = frappe.db.sql(f"""select ff.name,ff.vehicle,ff.vehicle_id,ff.variant,ff.variant_id,ff.language,
ff.translated_feature_name as feature_name,ff.feature_category,
ff.display_order,ff.active_status,ffm.feature_pdf as pdf from grmtest.`tabFeature Finder` ff
left join grmtest.`tabFeature Finder Master` ffm on ff.features_names = ffm.feature_name
ff.display_order,ff.active_status,ffm.feature_pdf as pdf from `tabFeature Finder` ff
left join `tabFeature Finder Master` ffm on ff.features_names = ffm.feature_name
where ff.vehicle = "{vehicle}" and ffm.vehicle = "{vehicle}" and ff.variant = "{variant}"
and ff.language = "{language}"; """, as_dict=1)
@ -204,7 +204,7 @@ def new_publish():
@frappe.whitelist(methods=['POST'], allow_guest=1)
def get_special_tool_information(vehicle):
try:
special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, my_id from grmtest.`tabSpecial Tool Information`
special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order, my_id from `tabSpecial Tool Information`
where vehicle="{vehicle}";''', as_dict=1)
for s in special_tool_details:
s['tool_usage_content'] = frappe.db.sql(f'''select idx as 'display_order',image,content,video,asset_type,active_status from `tabMST Information Assets`

181
smart_service/phase_2/doctype/feature_finder/feature_finder.js

@ -54,7 +54,6 @@ frappe.ui.form.on('Feature Finder', {
vehicle: frm.doc.vehicle
}
}).then(records => {
console.log(records)
if(records.length>0){
frm.doc.feature_name = records[0].name
frm.doc.feature_category = records[0].feature_category
@ -81,7 +80,6 @@ frappe.ui.form.on('Feature Finder', {
}
},
language: function (frm) {
console.log('Language trigger');
if (frm.doc.language == "en") {
frm.toggle_display('translated_feature_name', false)
@ -97,21 +95,13 @@ frappe.ui.form.on('Feature Finder', {
language: frm.doc.language
},
callback: function (r) {
console.log(r.message)
frm.set_df_property('features_names', 'options', r.message);
frm.refresh_field('features_names')
}
})
}
},
// feature_type: function (frm) {
// if (frm.doc.feature_type == "Post VIN Cutoff") {
// frm.toggle_display('post_vin_cutoff_id', true)
// }
// else {
// frm.toggle_display('post_vin_cutoff_id', false)
// }
// },
validate: function (frm) {
if (frm.doc.language == "en") {
@ -141,11 +131,11 @@ frappe.ui.form.on('Feature Finder', {
}, 5);
});
} else {
// if (frm.doc.display_order >= vehicle_count) {
// let display_vehicle_count = vehicle_count - 1;
// msgprint('There are only ' + display_vehicle_count + " " + frm.doc.doctype);
// frappe.validated = false;
// }
if (frm.doc.display_order >= vehicle_count) {
let display_vehicle_count = vehicle_count - 1;
msgprint('There are only ' + display_vehicle_count + " " + frm.doc.doctype);
frappe.validated = false;
}
}
});
}
@ -170,32 +160,6 @@ function show_images(frm) {
}
function custom_tab_html(frm) {
// $('[data-fieldname="specification"]').show()
// $('[data-fieldname="feature_finder_images"]').show()
// $('[data-fieldname="feature_finder_content"]').show()
// $('[data-fieldname="specification"]').css('margin-bottom','unset')
// $('[data-fieldname="specification"]').css('border-right','1px solid var(--table-border-color)')
// $('[data-fieldname="specification"]').css('border-left','1px solid var(--table-border-color)')
// $('[data-fieldname="specification"]').css('padding-right','20px')
// $('[data-fieldname="specification"]').css('padding-left','20px')
// $('[data-fieldname="feature_finder_images"]').css('margin-bottom','unset')
// $('[data-fieldname="feature_finder_images"]').css('border-right','1px solid var(--table-border-color)')
// $('[data-fieldname="feature_finder_images"]').css('border-left','1px solid var(--table-border-color)')
// $('[data-fieldname="feature_finder_images"]').css('padding-right','20px')
// $('[data-fieldname="feature_finder_images"]').css('padding-left','20px')
// $('[data-fieldname="feature_finder_content"]').css('border-right','1px solid var(--table-border-color)')
// $('[data-fieldname="feature_finder_content"]').css('border-left','1px solid var(--table-border-color)')
// $('[data-fieldname="feature_finder_content"]').css('border-bottom','1px solid var(--table-border-color)')
// $('[data-fieldname="feature_finder_content"]').css('padding-right','20px')
// $('[data-fieldname="feature_finder_content"]').css('padding-left','20px')
var res = $(cur_frm.fields_dict.test_html.wrapper).empty();
var ret = '<div class="main"><div class="custom_tab style="border:1px solid var(--table-border-color);"><ul class="nav nav-tabs" role="tablist">'
ret += '<li class="nav-item">'
@ -245,7 +209,6 @@ function custom_tab_html(frm) {
all_tabs()
$('.main').find('.nav-link').click(function (event) {
console.log($(this)[0].id)
if ($(this)[0].id == "SOP") {
nav_spec.feature_type = "SOP"
nav_spec.post_vin_cutoff_name = ""
@ -263,7 +226,6 @@ function custom_tab_html(frm) {
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)
specification.sort((a, b) => a.display_order - b.display_order);
@ -279,7 +241,6 @@ 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'>
@ -290,7 +251,7 @@ function custom_tab_html(frm) {
<th>Value</th>
<th>Active Status</th>
<th>Feature Type</th>
<th>Post Vin CutOff Name</th>
<th id='postvin1'>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>
@ -307,7 +268,7 @@ function custom_tab_html(frm) {
<th>Image</th>
<th>Active Status</th>
<th>Feature Type</th>
<th>Post Vin CutOff Name</th>
<th id='postvin2'>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>
@ -324,7 +285,7 @@ function custom_tab_html(frm) {
<th>Content</th>
<th>Active Status</th>
<th>Feature Type</th>
<th>Post Vin CutOff Name</th>
<th id='postvin3'>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>
@ -335,6 +296,8 @@ function custom_tab_html(frm) {
//end heading
//list
var specification_count = 0
if (specification.length > 0) {
@ -351,8 +314,9 @@ function custom_tab_html(frm) {
spec_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
}
else {
spec_custom_dt += '<td> </td>'
// 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>'
@ -377,7 +341,7 @@ function custom_tab_html(frm) {
image_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
}
else {
image_custom_dt += '<td> </td>'
// 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>'
@ -403,7 +367,7 @@ function custom_tab_html(frm) {
content_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
}
else {
content_custom_dt += '<td> </td>'
// 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>'
@ -454,6 +418,11 @@ function custom_tab_html(frm) {
$(res).find('.feature_contbl').empty()
$(res).find('.feature_contbl').append(content_custom_dt)
if(nav_spec.feature_type=='SOP'){
$(res).find('#postvin1').hide()
$(res).find('#postvin2').hide()
$(res).find('#postvin3').hide()
}
$(res).append(`<style>.spec_check{padding:0px 5px 0px 5px !important}.spec_custom_save{display:none;margin:10px 0px 0px 10px;background-color:red !important;color:#fff !important;}.spec_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}</style>`)
$(res).append(`<style>.image_check{padding:0px 5px 0px 5px !important}.image_custom_save{display:none;margin:10px 0px 0px 10px;background-color:red !important;color:#fff !important;}.image_custom_delete{margin:10px 10px 0px 0px;background-color:red !important;color:#fff !important;display:none}
@ -526,7 +495,6 @@ function custom_tab_html(frm) {
values: values
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
}
@ -626,7 +594,6 @@ function custom_tab_html(frm) {
$(res).find('.specification_bl').find("input[type=checkbox]").each(function () {
var self = $(this);
if (self.is(':checked')) {
console.log(self.attr("id"), "sdcdcd")
arr.push(self.attr("id"));
}
});
@ -634,14 +601,12 @@ function custom_tab_html(frm) {
arr = arr.slice(1)
}
console.log(arr, "-------------------")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.delete_spec_data",
args: {
values: arr
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
}
@ -654,7 +619,6 @@ function custom_tab_html(frm) {
$(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"));
}
});
@ -662,14 +626,12 @@ function custom_tab_html(frm) {
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()
}
@ -682,7 +644,6 @@ function custom_tab_html(frm) {
$(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"));
}
});
@ -690,14 +651,12 @@ function custom_tab_html(frm) {
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()
}
@ -759,7 +718,6 @@ function custom_tab_html(frm) {
// size: 'small', // small, large, extra-large
primary_action_label: 'Submit',
primary_action(values) {
console.log(values, "values");
if (values) {
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.insert_spec_data",
@ -768,9 +726,9 @@ function custom_tab_html(frm) {
values: values
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
cur_frm.refresh()
}
}
})
@ -778,7 +736,6 @@ function custom_tab_html(frm) {
spec_dia.hide();
}
});
console.log(spec_dia, "spec_dia")
spec_dia.show();
}
@ -799,6 +756,7 @@ function custom_tab_html(frm) {
label: 'Image',
fieldname: 'image',
fieldtype: 'Attach',
default: image_dialog_value.image
},
{
@ -827,9 +785,7 @@ function custom_tab_html(frm) {
// size: 'small', // small, large, extra-large
primary_action_label: 'Submit',
primary_action(values) {
console.log(values, "values");
if (values && values.image) {
console.log(values, "---values")
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.insert_image_data",
args: {
@ -837,10 +793,9 @@ function custom_tab_html(frm) {
values: values
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
cur_frm.refresh()
// cur_frm.reload_doc()
}
}
})
@ -848,7 +803,6 @@ function custom_tab_html(frm) {
spec_dia.hide();
}
});
console.log(spec_dia, "spec_dia")
spec_dia.show();
}
@ -899,9 +853,7 @@ function custom_tab_html(frm) {
// 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: {
@ -909,9 +861,9 @@ function custom_tab_html(frm) {
values: values
},
callback: function (r) {
console.log(r.message.status, '-rmessage')
if (r.message.status == "success") {
cur_frm.reload_doc()
cur_frm.refresh()
}
}
})
@ -919,84 +871,13 @@ function custom_tab_html(frm) {
spec_dia.hide();
}
});
console.log(spec_dia, "spec_dia")
spec_dia.show();
}
// $("#specification").click(function(){
// $('[data-fieldname="specification"]').show()
// $('[data-fieldname="feature_finder_images"]').hide()
// $('[data-fieldname="feature_finder_content"]').hide()
// });
// $("#images").click(function(){
// $('[data-fieldname="specification"]').hide()
// $('[data-fieldname="feature_finder_images"]').show()
// $('[data-fieldname="feature_finder_content"]').hide()
// });
// $("#content").click(function(){
// $('[data-fieldname="specification"]').hide()
// $('[data-fieldname="feature_finder_images"]').hide()
// $('[data-fieldname="feature_finder_content"]').show()
// });
$('.nav-link').click(function (event) {
// console.log($(this)[0].id)
// filter_value = $(this)[0].id
// frappe.call({
// method: "smart_service.phase_2.doctype.feature_finder.feature_finder.get_list_data",
// args: {
// name:frm.doc.name,
// val:filter_value
// },
// callback: function (r) {
// console.log(r.message)
// frm.doc.specification = []
// frm.doc.feature_finder_images = []
// frm.doc.feature_finder_content = []
// cur_frm.refresh_fields("specification")
// cur_frm.refresh_fields("feature_finder_images")
// cur_frm.refresh_fields("feature_finder_content")
// frm.doc.specification= r.message[0]
// frm.doc.feature_finder_images = r.message[1]
// frm.doc.feature_finder_content = r.message[2]
// cur_frm.refresh_fields("specification")
// }
// })
})
}
// function set_default_tab(frm,filter_value){
// frappe.call({
// method: "smart_service.phase_2.doctype.feature_finder.feature_finder.get_list_data",
// args: {
// name:frm.doc.name,
// val:filter_value
// },
// callback: function (r) {
// console.log(r.message)
// frm.doc.specification = []
// cur_frm.refresh_fields("specification")
// frm.doc.specification= r.message[0]
// cur_frm.refresh_fields("specification")
// }
// })
// }
function set_display_order(frm) {
// if (frm.doc.feature_type == "Post VIN Cutoff") {
// frm.toggle_display('post_vin_cutoff_id', true)
// }
// else {
// frm.toggle_display('post_vin_cutoff_id', false)
// }
if (frm.doc.variant && frm.doc.vehicle && frm.doc.language) {
frappe.call({
method: "smart_service.phase_2.doctype.feature_finder.feature_finder.get_feature_list",
@ -1034,19 +915,9 @@ function set_display_order(frm) {
}
frappe.ui.form.on('Feature Finder Specification', {
// post_vin_cutoff_name: function(frm){
// frm.fields_dict.specification.grid.grid_rows.forEach((row) => {
// if (row.doc.post_vin_cutoff_name == filter_value) {
// $("div[data-fieldname=specification]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').hide();
// } else {
// $("div[data-fieldname=specification]").find('div.grid-row[data-idx="' + row.doc.idx + '"]').show();
// }
// });
// refresh_field("specification");
// },
specification_add: function (frm, cdt, cdn) {
console.log(locals[cdt][cdn], "locals[cdt][cdn]")
var child2 = locals[cdt][cdn];
child2.post_vin_cutoff_name = filter_value
refresh_field("specification");

15
smart_service/phase_2/doctype/feature_finder/feature_finder.json

@ -9,6 +9,8 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"is_published",
"section_break_o8kze",
"variant",
"language",
"display_order",
@ -170,11 +172,22 @@
"label": "Translated Feature Name",
"mandatory_depends_on": "eval:doc.language!=\"en\"",
"read_only_depends_on": "eval:doc.language==\"en\""
},
{
"default": "0",
"fieldname": "is_published",
"fieldtype": "Check",
"label": "Published",
"read_only": 1
},
{
"fieldname": "section_break_o8kze",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-10 10:50:41.774687",
"modified": "2023-08-10 13:41:34.327348",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder",

31
smart_service/phase_2/doctype/feature_finder_specification_master/feature_finder_specification_master.js

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

4
smart_service/phase_2/doctype/feature_finder_specification_master/feature_finder_specification_master.json

@ -30,12 +30,12 @@
"fieldtype": "Int",
"hidden": 1,
"in_list_view": 1,
"label": "My Id"
"label": "My ID"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-03 16:03:25.491315",
"modified": "2023-08-10 12:46:14.322512",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Specification Master",

7
smart_service/phase_2/doctype/publish_test/publish_test.js

@ -37,7 +37,12 @@ frappe.ui.form.on('Publish Test', {
$('[data-route="Form/Publish Test/' + frm.doc.name + '"]').find('.primary-action').html("Global Publish")
}
if(frm.doc.status="Published" && frm.doc.publish_module=='Others'){
frm.set_df_property('repair_checksheet_publish','hidden',0)
frm.refresh_field('repair_checksheet_publish')
}
$(document).on('mouseover', function (events) {
$("a:contains(Copy to Clipboard)").css({ 'pointer-events': 'none' }),
$("a:contains(Duplicate)").css({ 'pointer-events': 'none' });

2
smart_service/phase_2/doctype/publish_test/publish_test.json

@ -327,7 +327,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-08-10 11:22:21.366394",
"modified": "2023-08-10 12:12:01.149289",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Publish Test",

20
smart_service/phase_2/doctype/publish_test/publish_test.py

@ -53,6 +53,8 @@ class PublishTest(Document):
# for i in self.repair_checksheet_publish:
repair_checksheet_publish(self.vehicle,self.vehicle_id,self.language,self.publish_type,self.release_description,self.variant,self.repair_checksheet_publish)
update_published_docs(self)
update_publish_status=frappe.db.sql("""update `tabPublish Test` set publish_status='Published' where name='{0}'""".format(self.name))
@ -163,7 +165,11 @@ def update_procedure(vehicle, lang, publish_type, doc):
frappe.throw("There is no item for global publish")
# Generate Publish versions
def update_publish_status(self):
try:
update_status=frappe.db.sql("""update `tabPublish Test` set publish_status="Published" where name='{0}' """.format(self.name))
except Exception as e:
return e
@frappe.whitelist()
def cal_ver(vehicle, lang, publish_type, doc):
@ -479,6 +485,7 @@ def repair_checksheet_publish(vehicle,vehicle_id,language,publish_type,release_d
except Exception as e:
logger.info(f'{vehicle}-{language}-{publish_type} error in json creation'+str(e))
frappe.throw('Failed To Publish')
def update_published_docs(self):
@ -510,7 +517,7 @@ def create_publish_folders(folder_url):
except Exception as e:
frappe.throw(str(e))
return False
'''New Module Publish Section'''
def repair_checksheet_data(vehicle=None,language=None,publish_type=None,parent=None):
try:
logger_file=f'{vehicle}-{language}-{publish_type}'
@ -530,4 +537,11 @@ def repair_checksheet_data(vehicle=None,language=None,publish_type=None,parent=N
except Exception as e:
failure_reponse['error']=f"{vehicle}-{language} has following error-" +str(e)
logger.error('error in repair checksheet'+str(e))
return failure_reponse
return failure_reponse
def feature_finder_data(vehicle=None,language=None,publish_type=None,parent=None):
try:
pass
except Exception as e:
pass

3
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.js

@ -17,8 +17,7 @@ frappe.ui.form.on('Repair Service Mapping', {
},
validate: function (frm) {
//For Display Order
// cur_frm.refresh_fields("display_order")
cur_frm.refresh_fields("display_order")
if (frm.doc.display_order && frm.doc.name && !frm.is_new()) {
//***check if there is same display_order
frappe.db.get_list('Repair Service Mapping', {

4
smart_service/phase_2/doctype/repair_service_mapping/repair_service_mapping.json

@ -113,7 +113,7 @@
"fieldtype": "Int",
"hidden": 1,
"in_list_view": 1,
"label": "My Id",
"label": "My ID",
"set_only_once": 1
},
{
@ -126,7 +126,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-09 14:28:17.586504",
"modified": "2023-08-10 12:22:29.663210",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Mapping",

32
smart_service/phase_2/doctype/repair_service_master_mapping/repair_service_master_mapping.js

@ -7,20 +7,7 @@ frappe.require('assets/smart_service/js/utils.js', () => {})
frappe.ui.form.on('Repair Service Master Mapping', {
onload: function (frm) {
// Set Display Order
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Repair Service Master Mapping')
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
frm.set_query("check_list_name", function() {
return{
"filters": {
@ -69,7 +56,22 @@ frappe.ui.form.on('Repair Service Master Mapping', {
});
function set_display_order(frm){
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Repair Service Master Mapping')
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
}

11
smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

@ -18,7 +18,6 @@ frappe.ui.form.on('Special Tool Information', {
validate:function(frm){
//For Display Order
cur_frm.refresh_fields("display_order")
// console.log(module_name_count,"----",original_display_order)
if (frm.doc.display_order && frm.doc.name && !frm.is_new()) {
//***check if there is same display_order
frappe.db.get_list('Special Tool Information', {
@ -39,11 +38,11 @@ frappe.ui.form.on('Special Tool Information', {
}, 5);
});
} else {
// if (frm.doc.display_order >= vehicle_count) {
// let display_vehicle_count = vehicle_count - 1;
// msgprint('There are only ' + display_vehicle_count + " " + frm.doc.doctype);
// frappe.validated = false;
// }
if (frm.doc.display_order >= vehicle_count) {
let display_vehicle_count = vehicle_count - 1;
msgprint('There are only ' + display_vehicle_count + " " + frm.doc.doctype);
frappe.validated = false;
}
}
});
}

4
smart_service/phase_2/doctype/special_tool_information/special_tool_information.json

@ -55,7 +55,7 @@
"fieldtype": "Int",
"hidden": 1,
"in_list_view": 1,
"label": "My id"
"label": "My ID"
},
{
"fieldname": "tool_usage_content",
@ -76,7 +76,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-08 12:12:55.927631",
"modified": "2023-08-10 12:21:54.577165",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Special Tool Information",

72
smart_service/phase_2/doctype/training_information/training_information.js

@ -1,52 +1,38 @@
// Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors
// For license information, please see license.txt
var original_display_order = 0;
var vehicle_count=0;
frappe.ui.form.on('Training Information', {
onload: function (frm) {
// Set Display Order
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Repair Service Master Mapping',{
filters: {
"variant": cur_frm.doc.variant,
"language": frm.doc.language,
"feature_name": frm.doc.feature_name,
}
})
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
set_display_order(frm)
},
refresh: function (frm) {
set_display_order(frm)
},
validate:function(frm){
if(frm.doc.topic) {
let alphanum = /^[a-zA-Z]+/;
if (frm.doc.topic.length > 1) {
if (frm.doc.topic.length > 140) {
frappe.throw(__("<b>Topic:</b> Only <b> 140 </b> characters are allowed"))
frappe.validate=false;
} else {
if (alphanum.test(frm.doc.topic) === true) {
frappe.validated = false;
} else if (frm.doc.topic) {
frappe.throw(__("<b>Topic:</b> Enter letter or alpha numeric characters only."));
frappe.validate=false;
}
}
} else {
frappe.throw(__("<b>Topic:</b> Single character not allowed"))
frappe.validate=true;
}
}
cur_frm.refresh_fields("display_order")
},
});
function set_display_order(frm){
if (frm.is_new()) {
frm.set_df_property('display_order', 'read_only', 1);
} else {
frm.set_df_property('display_order', 'read_only', 0);
}
frappe.db.count('Training Information',{
filters: {
"variant": cur_frm.doc.variant,
"language": frm.doc.language,
"feature_name": frm.doc.feature_name,
}
})
.then(count => {
vehicle_count = count + 1;
if (frm.is_new()) {
frm.set_value("display_order", vehicle_count);
} else {
original_display_order = frm.doc.display_order;
}
});
}

9
smart_service/phase_2/doctype/training_information/training_information.py

@ -5,14 +5,13 @@ import frappe
from frappe.model.document import Document
class TrainingInformation(Document):
def autoname(self):
def validate(self):
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 Information`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
def validate(self):
if self.topic:
self.topic=self.topic.strip()

5
smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json

@ -22,24 +22,27 @@
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "content",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Content"
},
{
"fieldname": "image_video",
"fieldtype": "Attach",
"in_list_view": 1,
"label": "Image/Video"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-04 14:47:37.837618",
"modified": "2023-08-10 13:19:37.649272",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Training Information Content Reference",

8
smart_service/phase_2/doctype/training_information_master/training_information_master.py

@ -10,13 +10,13 @@ class TrainingInformationMaster(Document):
self.category = self.category.strip()
if self.topic:
self.topic = self.topic.strip()
def autoname(self):
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabTraining Informations`;''')
count = frappe.db.sql('''select max(my_id) as max_count from `tabTraining Information Master`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
self.my_id = 1

Loading…
Cancel
Save