rendered paste body[strip interpolate=1]
[if session arg]
[seti page_title][msg arg.0="[field key='[data session arg]' name=description]"]Edit Service %s[/msg][/seti]
[else]
[set page_title][L]Add Service[/L][/set]
[/else]
[/if]
[tmpn page_submenu]Billing[/tmpn]
[set table_perm]products[/set]
[/strip]
__STD_PREFIX__
__STD_HEAD__
<H2>[scratchd page_title]</H2>
[perl tables="access products metadata"]
my @fields = qw(sku description full_description);
my (%label, %widget, %options, $profile);
if ($Session->{arg}) {
$cref = $Db{products}->row_hash($Session->{arg});
} else {
$cref = {};
}
$profile = <<EOP;
description=required
full_description=required
EOP
$label{sku} = 'SKU';
if ($Session->{arg}) {
$widget{sku} = 'hidden';
} else {
$profile .= "\nsku=required";
}
$label{description} = 'Description';
$label{full_description} = 'Full Description';
$widget{full_description} = 'textarea_6_70';
$tehashref = {table => 'products',
key => $Session->{arg},
fields => join(',', @fields),
label => \%label,
widget => \%widget,
options => \%options,
mv_nextpage => 'services',
ui_profile => $profile,
auto_secure => 1,
no_meta => 1,
};
$tehashref->{row_template} = <<'EOP';
<td>{LABEL}</td><td>{WIDGET}</td>
EOP
$tehashref->{body} = << 'EOQ';
{TOP_OF_FORM}
{HIDDEN_FIELDS}
<table>
{:REST}
<tr>
<td> </td>
<td>{BOTTOM_BUTTONS}</td>
</tr>
</table>
{BOTTOM_OF_FORM}
EOQ
my $out = '';
if ($Tag->error({all => 1, keep => 1})) {
$out .= '<p class="signal">' . $Tag->error({all => 1, show_error => 1, keep => 1}) . '</p>';
}
$out .= $Tag->table_editor($tehashref);
[/perl]
__STD_FOOTER__