$new_attr{discount} = $cv_discount if ! $item->discount;
$item->assign_attributes(%new_attr);
- $item->id(join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000)) if !$item->id;
$self->order->add_items($item);
$self->_recalc();
- my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item);
+ my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
+ my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id);
$self->js
->append('#row_table_id', $row_as_html)
->val('#add_item_sellprice_as_number', '')
->val('#add_item_discount_as_percent', '')
->run('row_table_scroll_down')
- ->run('row_set_keyboard_events_by_id', $item->id)
+ ->run('row_set_keyboard_events_by_id', $item_id)
->focus('#add_item_parts_id_name');
$self->_js_redisplay_amounts_and_taxes;
<tr class="listrow0">
<td style='display:none'>
- [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ITEM.id) %]
+ [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %]
[% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %]
</td>
<td align="center">
<td colspan="100%">
<table>
<tr class="listrow1">
- <td>hi1</td>
- <td>hi2</td>
- <td>hi3</td>
- <td>[%- ITEM.description %]</td>
- </tr>
- <tr class="listrow1">
- <td>ho1</td>
- <td>ho2</td>
- <td>ho3</td>
- <td>[%- ITEM.longdescription %]</td>
+ [%- SET n = 0 %]
+ [%- FOREACH var = ITEM.cvars_by_config %]
+ [%- NEXT UNLESS (var.config.processed_flags.editable && ITEM.part.cvar_by_name(var.config.name).is_valid) %]
+ [%- SET n = n + 1 %]
+ <th>
+ [% var.config.description %]
+ </th>
+ <td>
+ [% L.hidden_tag('order.orderitems[].custom_variables[+].config_id', var.config.id) %]
+ [% INCLUDE 'common/render_cvar_input.html' var_name='order.orderitems[].custom_variables[].unparsed_value' %]
+ </td>
+ [%- IF (n % (MYCONFIG.form_cvars_nr_cols || 3)) == 0 %]
+ </tr><tr class="listrow1">
+ [%- END %]
+ [%- END %]
</tr>
</table>
</td>