Skip to content

Commit

Permalink
feat: search attr value in multiple variant creation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Shankarv19bcr committed Sep 27, 2024
1 parent e4e96d2 commit 80141e1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions erpnext/stock/doctype/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,23 @@ $.extend(erpnext.item, {
fields.push({ fieldtype: "Section Break" });
}
fields.push({ fieldtype: "Column Break", label: name });
fields.push({
fieldtype: "Data",
placeholder: "Search",
fieldname: `search_${frappe.scrub(name)}`,
onchange: function(e){
let value = e.target.value;
let result = attr_dict[name].filter(attr_value => attr_value.toString().toLowerCase().includes(value.toLowerCase()));
attr_dict[name].forEach((attr_value)=> {
if (result.includes(attr_value)) {
me.multiple_variant_dialog.set_df_property(attr_value, "hidden", 0);
}
else {
me.multiple_variant_dialog.set_df_property(attr_value, "hidden", 1);
}
})
}
});
attr_dict[name].forEach((value) => {
fields.push({
fieldtype: "Check",
Expand Down Expand Up @@ -643,6 +660,7 @@ $.extend(erpnext.item, {
me.multiple_variant_dialog.disable_primary_action();
me.multiple_variant_dialog.clear();
me.multiple_variant_dialog.show();
me.multiple_variant_dialog.$wrapper.find("div[data-fieldname^='search_']").find(".clearfix").hide();
}

function get_selected_attributes() {
Expand Down

0 comments on commit 80141e1

Please sign in to comment.