Revision 205 (by ahitrov, 2012/04/06 11:27:43) |
Delivery price differs according to order sum
|
<%once>
use JSON::XS;
my $json = JSON::XS->new->utf8;
</%once>
<%args>
$name => undef
$rusname => undef
$check => undef
</%args>
<%init>
my $fields = $check ? $json->decode($check) : [];
$m->out('');
$m->out('<table width="95%" style="margin:5px 0;padding:5 6 5 6;border:1px solid #ccc;font-size:70%;font-family:Tahoma;background-color:#f5f5f5;color:#000;">');
$m->out('<tr bgcolor="silver" valign="top"><th width="40%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue;">Порог стоимости (сумма заказа больше или равна):</h5></th>');
$m->out('<th width="60%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue;">Стоимость доставки (% или число):</h5></th></tr>');
my $max = scalar @$fields + 2;
for my $i ( 1..$max ) {
my $rusname = "$rusname N$i";
my $object = $fields->[$i-1];
$m->comp('.field',
name => $name,
object => $object,
number => $i,
);
}
$m->out('</table>');
</%init>
<%def .field>
<%args>
$name => undef
$object => undef
$number => undef
</%args>
<%init>
</%init>
<tr valign="top">
<td><input type="text" name="<% $name.'_level_'.$number %>" value="<% (ref $object ? $object->{level} : '') |h %>" style="width:97%"></td>
<td><input type="text" name="<% $name.'_cost_'.$number %>" value="<% (ref $object ? $object->{cost} : '') |h %>" style="width:97%;"></td>
</tr>
</%def>