283 |
283 |
this.o = $.extend({
|
284 |
284 |
limit: 20,
|
285 |
285 |
delay: 50,
|
286 |
|
fat_set_item: $real.hasClass(this.CLASSES.FAT_SET_ITEM),
|
287 |
286 |
action: {
|
288 |
287 |
on_enter_match_none: function(){ },
|
289 |
288 |
on_enter_match_one: function(){ $('#update_button').click(); },
|
290 |
289 |
on_enter_match_many: function(){ self.open_dialog(); }
|
291 |
290 |
}
|
292 |
|
}, options);
|
|
291 |
}, $real.data('part-picker-data'), options);
|
293 |
292 |
this.$real = $real;
|
294 |
293 |
this.real_id = $real.attr('id');
|
295 |
294 |
this.last_real = $real.val();
|
296 |
|
this.$dummy = $('#' + this.real_id + '_name');
|
297 |
|
this.$part_type = $('#' + this.real_id + '_part_type');
|
298 |
|
this.$classification_id = $('#' + this.real_id + '_classification_id');
|
299 |
|
this.$unit = $('#' + this.real_id + '_unit');
|
300 |
|
this.$convertible_unit = $('#' + this.real_id + '_convertible_unit');
|
|
295 |
this.$dummy = $($real.siblings()[0]);
|
301 |
296 |
this.autocomplete_open = false;
|
302 |
297 |
this.state = this.STATES.PICKED;
|
303 |
298 |
this.last_dummy = this.$dummy.val();
|
... | ... | |
310 |
305 |
CLASSES: {
|
311 |
306 |
PICKED: 'partpicker-picked',
|
312 |
307 |
UNDEFINED: 'partpicker-undefined',
|
313 |
|
FAT_SET_ITEM: 'partpicker_fat_set_item',
|
314 |
308 |
},
|
315 |
309 |
ajax_data: function(term) {
|
316 |
310 |
var data = {
|
317 |
311 |
'filter.all:substr:multi::ilike': term,
|
318 |
312 |
'filter.obsolete': 0,
|
319 |
|
'filter.unit_obj.convertible_to': this.$convertible_unit && this.$convertible_unit.val() ? this.$convertible_unit.val() : '',
|
320 |
313 |
current: this.$real.val(),
|
321 |
314 |
};
|
322 |
315 |
|
323 |
|
if (this.$part_type && this.$part_type.val())
|
324 |
|
data['filter.part_type'] = this.$part_type.val().split(',');
|
|
316 |
if (this.o.part_type)
|
|
317 |
data['filter.part_type'] = this.o.part_type.split(',');
|
325 |
318 |
|
326 |
|
if (this.$classification_id && this.$classification_id.val())
|
327 |
|
data['filter.classification_id'] = this.$classification_id.val().split(',');
|
|
319 |
if (this.o.classification_id)
|
|
320 |
data['filter.classification_id'] = this.o.classification_id.split(',');
|
328 |
321 |
|
329 |
|
if (this.$unit && this.$unit.val())
|
330 |
|
data['filter.unit'] = this.$unit.val().split(',');
|
|
322 |
if (this.o.unit)
|
|
323 |
data['filter.unit'] = this.o.unit.split(',');
|
|
324 |
|
|
325 |
if (this.o.convertible_unit)
|
|
326 |
data['filter.unit_obj.convertible_to'] = this.o.convertible_unit;
|
331 |
327 |
|
332 |
328 |
return data;
|
333 |
329 |
},
|
kivi.Part.js: Datenübergabe Picker<->Presenter auf data umgestellt
Ist in Summe kompakter und einfacher erweiterbar.