Browse Source

Qwik fixes

version2
venkataakhil 1 year ago
parent
commit
d2ca624140
  1. 34
      smart_service/apis/v2/master.py
  2. 30
      smart_service/phase_2/doctype/qwik_service/qwik_service.js
  3. 41
      smart_service/public/js/common_fun.js

34
smart_service/apis/v2/master.py

@ -172,7 +172,6 @@ def new_publish():
elif module == "Qwik Service":
flag, data = get_qwik_service(variant, language)
return data
if flag:
return {'status': 1, 'error': None, 'data': data}
@ -261,3 +260,36 @@ def get_qwik_service(variant,language):
return True, qwik_service_details
except Exception as e:
return False, e
@frappe.whitelist(allow_guest=1)
def update_publish_mapping(vehicle, variant, language, module):
frappe.set_user('Administrator')
pub_data = frappe.db.get_list('Module Publish Mapping', filters={
"vehicle": vehicle,
"variant": variant,
"language": language
}, fields=['name'])
if pub_data:
doc = frappe.get_doc('Module Publish Mapping', pub_data[0]['name'])
else:
doc = frappe.get_doc({
'doctype': 'Module Publish Mapping',
"vehicle": vehicle,
"variant": variant,
"language": language
})
if module == 'Automotive System':
doc.automotive_system = 1
doc.tsb = 1
doc.fsa = 1
doc.tekalert = 1
elif module == 'Feature Finder':
doc.feature_finder = 1
elif module == 'Repair service':
doc.repairservice_check_sheet = 1
doc.save()
return 1

30
smart_service/phase_2/doctype/qwik_service/qwik_service.js

@ -16,12 +16,14 @@ frappe.ui.form.on('Qwik Service', {
custom_tab_html(frm)
}
set_display_order(frm)
variant(frm)
},
onload:function(frm){
if (!frm.is_new()) {
custom_tab_html(frm)
}
set_display_order(frm)
variant(frm)
},
validate:function(frm){
cur_frm.refresh_fields("display_order")
@ -56,6 +58,7 @@ frappe.ui.form.on('Qwik Service', {
}
});
}
check_field_character(frm.doc.service_time)
},
after_save: function (frm) {
cur_frm.refresh_fields("display_order")
@ -77,7 +80,6 @@ frappe.ui.form.on('Qwik Service', {
frm.refresh_field('kilometers')
}
})
},
});
@ -417,3 +419,29 @@ frappe.ui.form.on('Qwik Service Content',{
}
})
function check_field_character(field_name) {
if (field_name) {
if (field_name.length > 1) {
if (field_name.length > 3) {
frappe.throw("<b>Service Time:</b> Only <b> 3 </b> characters are allowed")
frappe.validated = false;
}
}
}
}
function variant(frm){
frappe.call({
method: "smart_service.phase_2.doctype.qwik_service.qwik_service.get_kilometer",
args: {
vehicle: frm.doc.vehicle,
service_kilometers: frm.doc.service_kilometers
},
callback: function (r) {
console.log(r.message)
frm.set_df_property('kilometers', 'options', r.message);
frm.refresh_field('kilometers')
}
})
}

41
smart_service/public/js/common_fun.js

@ -1,6 +1,8 @@
var row;
var row1;
var row2;
var row3;
function dragstartFunction(evt) {
row = evt.target;
}
@ -115,3 +117,42 @@ function dragovertFunction_2(evt){
e.target.parentNode.before(row2);
}
}
function dragstartFunctionQwik(evt) {
row3 = evt.target;
}
function dragovertFunctionQwik(evt) {
var global_name = 1
var e = evt;
e.preventDefault();
let children = Array.from(e.target.parentNode.parentNode.children);
//change count value
var count = 1
var unchecked_value = 0
children.map(h => {
var html = '<input id=' + count + ' type="checkbox" class="qwikcheck grid-row-check pull-left"><span class="qwik_check">' + count + '</span>'
$(h).find('#qwik_count').html(html)
count += 1
})
$(document).ready(function () {
// cur_frm.doc.__unsaved = 1
// $('.title-area').find('.indicator-pill').remove()
$('.title-area').find('.indicator-pill').removeClass("hide");
$('.title-area').find('.indicator-pill').addClass("orange");
console.log("hiii")
$('.title-area').find('.indicator-pill').find('span').remove()
$('.title-area').find('.indicator-pill').append("<span>Not Saved</span>");
// $('.specification_bl').find('.spec_custom_save').css("display","inline-block")
})
//end
if (children.indexOf(e.target.parentNode) > children.indexOf(row)) {
e.target.parentNode.after(row);
}
else {
e.target.parentNode.before(row);
}
}

Loading…
Cancel
Save