mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enhance Product Drop Down Selector on Invoices #1975
This commit is contained in:
parent
2b7b9f83e4
commit
a678044b4b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1158,7 +1158,7 @@ function prettyJson(json) {
|
||||
});
|
||||
}
|
||||
|
||||
function searchData(data, key, fuzzy) {
|
||||
function searchData(data, key, fuzzy, secondKey) {
|
||||
return function findMatches(q, cb) {
|
||||
var matches, substringRegex;
|
||||
if (fuzzy) {
|
||||
@ -1173,8 +1173,9 @@ function searchData(data, key, fuzzy) {
|
||||
$.each(data, function(i, obj) {
|
||||
if (substrRegex.test(obj[key])) {
|
||||
matches.push(obj);
|
||||
}
|
||||
});
|
||||
} else if (secondKey && substrRegex.test(obj[secondKey]))
|
||||
matches.push(obj);
|
||||
});
|
||||
}
|
||||
cb(matches);
|
||||
}
|
||||
|
@ -1039,13 +1039,12 @@ ko.bindingHandlers.productTypeahead = {
|
||||
display: allBindings.key,
|
||||
limit: 50,
|
||||
templates: {
|
||||
suggestion: function(item) { return '<div title="'
|
||||
suggestion: function(item) { return '<div title="' + _.escape(item.notes) + '" style="border-bottom: solid 1px #CCC">'
|
||||
+ _.escape(item.product_key) + ': '
|
||||
+ item.cost + "\n"
|
||||
+ item.notes.substring(0, 60) + '">'
|
||||
+ _.escape(item.product_key) + '</div>' }
|
||||
+ roundToTwo(item.cost, true) + "<br/>"
|
||||
+ _.escape(item.notes.substring(0, 100)) + '</div>' }
|
||||
},
|
||||
source: searchData(allBindings.items, allBindings.key)
|
||||
source: searchData(allBindings.items, allBindings.key, false, 'notes')
|
||||
}).on('typeahead:select', function(element, datum, name) {
|
||||
@if (Auth::user()->account->fill_products)
|
||||
var model = ko.dataFor(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user