Line # Revision Author
1 205 ahitrov <%once>
2
3 use JSON::XS;
4 my $json = JSON::XS->new->utf8;
5
6 </%once>
7 <%args>
8
9 $name => undef
10 $rusname => undef
11 $check => undef
12
13 </%args>
14 <%init>
15
16 my $fields = $check ? $json->decode($check) : [];
17
18 $m->out('');
19 $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;">');
20 $m->out('<tr bgcolor="silver" valign="top"><th width="40%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue;">Порог стоимости (сумма заказа больше или равна):</h5></th>');
21 $m->out('<th width="60%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue;">Стоимость доставки (% или число):</h5></th></tr>');
22
23 my $max = scalar @$fields + 2;
24 for my $i ( 1..$max ) {
25 my $rusname = "$rusname N$i";
26 my $object = $fields->[$i-1];
27 $m->comp('.field',
28 name => $name,
29 object => $object,
30 number => $i,
31 );
32 }
33 $m->out('</table>');
34
35 </%init>
36 <%def .field>
37 <%args>
38
39 $name => undef
40 $object => undef
41 $number => undef
42
43 </%args>
44 <%init>
45 </%init>
46 <tr valign="top">
47 <td><input type="text" name="<% $name.'_level_'.$number %>" value="<% (ref $object ? $object->{level} : '') |h %>" style="width:97%"></td>
48 <td><input type="text" name="<% $name.'_cost_'.$number %>" value="<% (ref $object ? $object->{cost} : '') |h %>" style="width:97%;"></td>
49 </tr>
50 </%def>