|
|
@ -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"); |
|
|
|