+For the selected table, you can give fields default or fixed (unchangeable)
+values, or select an inventory class to manually or automatically fill in
+that field.
+<& /elements/table-grid.html, cellpadding => 4 &>
+
+
Field
+
Label
+
Modifier
+
+% $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now
+% my $i = 0;
+% foreach my $field (@fields) {
+% my $def = shift @defs;
+% my $part_svc_column = $part_svc->part_svc_column($field);
+% my $flag = $part_svc_column->columnflag;
+% my $formatter = $def->{'format'} || sub { shift };
+% my $value = &{$formatter}($part_svc_column->columnvalue);
+
+
+ <% $def->{'label'} || $field %>
+
+
+
+
+
+
+% # flag selection
+% if ( $def->{'type'} eq 'disabled' ) {
+% $flag = '';
+ No default
+% } else {
+% my $name = $svcdb.'__'.$field.'_flag';
+
+% } # if $def->{'type'} eq 'disabled'
+
+
+% # value entry/selection
+% my $name = $svcdb.'__'.$field;
+% # These are all MANDATORY SELECT types. Regardless of the flag value,
+% # there will never be a text input (either in svc_* or in part_svc) for
+% # these fields.
+% if ( $def->{'type'} eq 'checkbox' ) {
+ <& /elements/checkbox.html,
+ 'field' => $name,
+ 'curr_value' => $value,
+ 'value' => 'Y' &>
+%
+% } elsif ( $def->{'type'} eq 'select' ) {
+%
+% if ( $def->{'select_table'} ) {
+ <& /elements/select-table.html,
+ 'field' => $name,
+ 'id' => $name.'_select',
+ 'table' => $def->{'select_table'},
+ 'name_col' => $def->{'select_label'},
+ 'value_col' => $def->{'select_key'},
+ 'order_by' => dbdef->table($def->{'select_table'})->primary_key,
+ 'multiple' => $def->{'multiple'},
+ 'disable_empty' => 1,
+ 'curr_value' => $value,
+ &>
+% } else {
+% my (@options, %labels);
+% if ( $def->{'select_list'} ) {
+% @options = @{ $def->{'select_list'} };
+% @labels{@options} = @options;
+% } elsif ( $def->{'select_hash'} ) {
+% if ( ref($def->{'select_hash'}) eq 'ARRAY' ) {
+% tie my %hash, 'Tie::IxHash', @{ $def->{'select_hash'} };
+% $def->{'select_hash'} = \%hash;
+% }
+% @options = keys( %{ $def->{'select_hash'} } );
+% %labels = %{ $def->{'select_hash'} };
+% }
+ <& /elements/select.html,
+ 'field' => $name,
+ 'id' => $name.'_select',
+ 'options' => \@options,
+ 'labels' => \%labels,
+ 'multiple' => $def->{'multiple'},
+ 'curr_value' => $value,
+ &>
+% }
+% } elsif ( $def->{'type'} =~ /select-(.*?).html/ ) {
+ <& '/elements/'.$def->{'type'},
+ 'field' => $name,
+ 'id' => $name.'_select',
+ 'multiple' => $def->{'multiple'},
+ 'curr_value' => $value,
+ &>
+% } elsif ( $def->{'type'} eq 'communigate_pro-accessmodes' ) {
+ <& /elements/communigate_pro-accessmodes.html,
+ 'element_name_prefix' => $name.'_',
+ 'curr_value' => $value,
+ &>
+% } elsif ( $def->{'type'} eq 'textarea' ) {
+% # special cases
+
+% } elsif ( $def->{'type'} eq 'disabled' ) {
+
+% } else {
+% # the normal case: a text input, and a _select which is an inventory
+% # or hardware class
+
+% # inventory class selection
+ <& /elements/select-table.html,
+ 'field' => $name.'_classnum',
+ 'id' => $name.'_select',
+ 'table' => 'inventory_class',
+ 'name_col' => 'classname',
+ 'curr_value' => $value,
+ 'empty_label' => 'Select inventory class',
+ 'multiple' => 1,
+ &>
+% }
+