194 |
194 |
my ($self, %params) = @_;
|
195 |
195 |
|
196 |
196 |
$self->_set_javascript;
|
|
197 |
$self->_setup_form_action_bar;
|
197 |
198 |
|
198 |
199 |
my (%assortment_vars, %assembly_vars);
|
199 |
200 |
%assortment_vars = %{ $self->prepare_assortment_render_vars } if $self->part->is_assortment;
|
... | ... | |
216 |
217 |
$self->render(
|
217 |
218 |
'part/form',
|
218 |
219 |
title => $title_hash{$self->part->part_type},
|
219 |
|
show_edit_buttons => $::auth->assert('part_service_assembly_edit'),
|
220 |
220 |
%assortment_vars,
|
221 |
221 |
%assembly_vars,
|
222 |
222 |
translations_map => { map { ($_->language_id => $_) } @{$self->part->translations} },
|
... | ... | |
596 |
596 |
check_has_valid_part_type($self->part->part_type);
|
597 |
597 |
|
598 |
598 |
$self->_set_javascript;
|
|
599 |
$self->_setup_form_action_bar;
|
599 |
600 |
|
600 |
601 |
my %title_hash = ( part => t8('Add Part'),
|
601 |
602 |
assembly => t8('Add Assembly'),
|
... | ... | |
605 |
606 |
|
606 |
607 |
$self->render(
|
607 |
608 |
'part/form',
|
608 |
|
title => $title_hash{$self->part->part_type},
|
609 |
|
show_edit_buttons => $::auth->assert('part_service_assembly_edit'),
|
|
609 |
title => $title_hash{$self->part->part_type},
|
610 |
610 |
);
|
611 |
611 |
}
|
612 |
612 |
|
... | ... | |
1127 |
1127 |
return \@item_objects;
|
1128 |
1128 |
}
|
1129 |
1129 |
|
|
1130 |
sub _setup_form_action_bar {
|
|
1131 |
my ($self) = @_;
|
|
1132 |
|
|
1133 |
my $may_edit = $::auth->assert('part_service_assembly_edit', 'may fail');
|
|
1134 |
|
|
1135 |
for my $bar ($::request->layout->get('actionbar')) {
|
|
1136 |
$bar->add(
|
|
1137 |
combobox => [
|
|
1138 |
action => [
|
|
1139 |
t8('Save'),
|
|
1140 |
call => [ 'kivi.Part.save' ],
|
|
1141 |
disabled => !$may_edit ? t8('You do not have the permissions to access this function.') : undef,
|
|
1142 |
],
|
|
1143 |
action => [
|
|
1144 |
t8('Use as new'),
|
|
1145 |
call => [ 'kivi.Part.use_as_new' ],
|
|
1146 |
disabled => !$self->part->id ? t8('The object has not been saved yet.')
|
|
1147 |
: !$may_edit ? t8('You do not have the permissions to access this function.')
|
|
1148 |
: undef,
|
|
1149 |
],
|
|
1150 |
], # end of combobox "Save"
|
|
1151 |
|
|
1152 |
action => [
|
|
1153 |
t8('Delete'),
|
|
1154 |
call => [ 'kivi.Part.delete' ],
|
|
1155 |
confirm => t8('Do you really want to delete this object?'),
|
|
1156 |
disabled => !$self->part->id ? t8('This object has not been saved yet.')
|
|
1157 |
: !$may_edit ? t8('You do not have the permissions to access this function.')
|
|
1158 |
: !$self->part->orphaned ? t8('This object has already been used.')
|
|
1159 |
: undef,
|
|
1160 |
],
|
|
1161 |
|
|
1162 |
'separator',
|
|
1163 |
|
|
1164 |
action => [
|
|
1165 |
t8('History'),
|
|
1166 |
call => [ 'kivi.Part.open_history_popup' ],
|
|
1167 |
disabled => !$self->part->id ? t8('This object has not been saved yet.')
|
|
1168 |
: !$may_edit ? t8('You do not have the permissions to access this function.')
|
|
1169 |
: undef,
|
|
1170 |
],
|
|
1171 |
);
|
|
1172 |
}
|
|
1173 |
}
|
|
1174 |
|
1130 |
1175 |
1;
|
1131 |
1176 |
|
1132 |
1177 |
__END__
|
ActionBar: Verwendung im Part-Controller