.float-left {
float: left;
}
+.float-right {
+ float: right;
+}
.block-context {
overflow: hidden;
}
div.part_picker_part {
- float:left; width: 350px;
padding: 5px;
margin: 5px;
- overflow:hidden;
border: 1px;
border-color: darkgray;
border-style: solid;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
- background-color: whitesmoke;
+ background-color: white;
cursor: pointer;
}
-
div.part_picker_part:hover {
background-color: #CCCCCC;
color: #FE5F14;
border-color: gray;
}
+div.ppp_block {
+ overflow:hidden;
+ float:left;
+ width: 350px;
+}
+div.ppp_block span.ppp_block_number {
+ float:left;
+}
+div.ppp_block span.ppp_block_description {
+ float:right;
+ font-weight:bold;
+}
+div.ppp_line span.ppp_block_description {
+ margin-left:1em;
+ font-weight:bold;
+}
+div.ppp_line span.ppp_block_sellprice {
+ display:none;
+}
+span.toggle_selected {
+ font-weight: bold;
+}
.float-left {
float: left;
}
+.float-right {
+ float: right;
+}
.block-context {
overflow: hidden;
}
div.part_picker_part {
- float:left; width: 350px;
padding: 5px;
margin: 5px;
- overflow:hidden;
border: 1px;
border-color: darkgray;
border-style: solid;
background-color: whitesmoke;
cursor: pointer;
}
-
div.part_picker_part:hover {
background-color: lightgray;
border-color: gray;
}
+div.ppp_block {
+ overflow:hidden;
+ float:left;
+ width: 350px;
+}
+div.ppp_block span.ppp_block_number {
+ float:left;
+}
+div.ppp_block span.ppp_block_description {
+ float:right;
+ font-weight:bold;
+}
+div.ppp_line span.ppp_block_description {
+ margin-left:1em;
+ font-weight:bold;
+}
+div.ppp_line span.ppp_block_sellprice {
+ display:none;
+}
+span.toggle_selected {
+ font-weight: bold;
+}
ESCAPE: 27,
ENTER: 13,
TAB: 9,
+ LEFT: 37,
+ RIGHT: 39,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
};
var o = $.extend({
limit: 20,
delay: 50,
+ fat_set_item: 0, // use this option to get a fat item json with all
+ // relevant data instead of the guaranteed id + name
}, options);
var STATES = {
UNIQUE: 1,
real_id: real_id,
}, ajax_data($dummy.val())),
id: 'part_selection',
- dialog: { title: k.t8('Part picker') }
+ dialog: {
+ title: k.t8('Part picker'),
+ width: 800,
+ height: 800,
+ }
});
window.clearTimeout(timer);
return true;
'filter.all:substr::ilike': term,
'filter.obsolete': 0,
'filter.unit_obj.convertible_to': $convertible_unit && $convertible_unit.val() ? $convertible_unit.val() : '',
+ no_paginate: $('#no_paginate').prop('checked') ? 1 : 0,
column: $column && $column.val() ? $column.val() : '',
current: $real.val(),
};
state = STATES.PICKED;
last_real = $real.val();
last_dummy = $dummy.val();
- $real.trigger('change').trigger('set_item:PartPicker', item);
+ $real.trigger('change');
+
+ if (o.fat_set_item) {
+ $.ajax({
+ url: 'controller.pl?action=Part/show.json',
+ data: { id: item.id },
+ success: function(rsp) {
+ $real.trigger('set_item:PartPicker', rsp);
+ },
+ });
+ } else {
+ $real.trigger('set_item:PartPicker', item);
+ }
}
function make_defined_state () {
};
function result_timer (event) {
+ if (!$('no_paginate').prop('checked')) {
+ if (event.keyCode == KEY.PAGE_UP) {
+ $('#part_picker_result a.paginate-prev').click();
+ return;
+ }
+ if (event.keyCode == KEY.PAGE_DOWN) {
+ $('#part_picker_result a.paginate-next').click();
+ return;
+ }
+ }
window.clearTimeout(timer);
timer = window.setTimeout(update_results, 100);
}
var picker = $('<div>');
$dummy.after(pcont);
pcont.append(picker);
- picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog);
+ picker.addClass('icon16 crm--search').click(open_dialog);
var pp = {
real: function() { return $real },
$('div.part_picker_part').each(function(){
$(this).click(function(){
set_item({
- name: $(this).children('input.part_picker_description').val(),
id: $(this).children('input.part_picker_id').val(),
+ name: $(this).children('input.part_picker_description').val(),
+ unit: $(this).children('input.part_picker_unit').val(),
});
close_popup();
+ $dummy.focus();
return true;
});
});
'Aktion' => 'Aktion',
'All' => 'Alle',
'All Accounts' => 'Alle Konten',
+ 'All as list' => 'Alle als Liste',
'All changes in that file have been reverted.' => 'Alle Änderungen in dieser Datei wurden rückgängig gemacht.',
'All clients' => 'Alle Mandanten',
'All general ledger entries' => 'Alle Hauptbucheinträge',
[%# L.dump(SELF.parts) %]
-[% FOREACH part = SELF.parts %]
- [% PROCESS part_block %]
-[% END %]
-
-[%- BLOCK part_block %]
-<div class='part_picker_part'>
+[% BLOCK part_block %]
+<div class='part_picker_part [% FORM.no_paginate ? 'ppp_line' : 'ppp_block' %]'>
<input type='hidden' class='part_picker_id' value='[% part.id %]'>
<input type='hidden' class='part_picker_partnumber' value='[% part.partnumber %]'>
<input type='hidden' class='part_picker_description' value='[% part.description %]'>
- <span style='float:left'>[% part.partnumber | html %]</span>
- <span style='float:right; font-weight:bold'>[% part.description | html %]</span>
+ <input type='hidden' class='part_picker_unit' value='[% part.unit %]'>
+ <span class='ppp_block_number'>[% part.partnumber | html %]</span>
+ <span class='ppp_block_description'>[% part.description | html %]</span>
<div style='clear:both;'></div>
- [% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]
+ <span class='ppp_block_sellprice'>[% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]</span>
</div>
[%- END %]
+
+[% FOREACH part = SELF.parts %]
+ [% PROCESS part_block %]
+[% END %]
+
<div style='clear:both'></div>
[% L.paginate_controls(target='#part_picker_result', selector='#part_picker_result', models=SELF.models) %]
[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', SELF.filter.all_substr__ilike, class='part_picker_filter') %]
[% L.hidden_tag('part_picker_real_id', FORM.real_id) %]
+<div class='float-right'>
+ [% L.checkbox_tag('no_paginate', checked=FORM.no_paginate, id='no_paginate', for_submit=1, label=LxERP.t8('All as list')) %]
+</div>
+
<div style='clear:both'></div>
<div id='part_picker_result'></div>
</div>
pp.update_results();
});
$('#part_picker_filter').keypress(pp.result_timer);
+ $('#no_paginate').change(pp.update_results);
+
</script>