+sub setup_search_action_bar {
+ my ($self, %params) = @_;
+
+ return if $::form->{inline};
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Update'),
+ submit => [ '#search_form', { action => 'PriceRule/list' } ],
+ accesskey => 'enter',
+ ],
+
+ combobox => [
+ action => [
+ t8('Add'),
+ ],
+ link => [
+ t8('New Sales Price Rule'),
+ link => $self->url_for(action => 'new', 'price_rule.type' => 'customer', callback => $self->models->get_callback),
+ ],
+ link => [
+ t8('New Purchase Price Rule'),
+ link => $self->url_for(action => 'new', 'price_rule.type' => 'vendor', callback => $self->models->get_callback),
+ ],
+ ], # end of combobox "Add"
+ );
+ }
+}
+
+sub setup_form_action_bar {
+ my ($self) = @_;
+
+ my $is_new = !$self->price_rule->id;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ combobox => [
+ action => [
+ $is_new ? t8('Create') : t8('Save'),
+ submit => [ '#form', { action => 'PriceRule/' . ($is_new ? 'create' : 'update') } ],
+ accesskey => 'enter',
+ ],
+ action => [
+ t8('Use as new'),
+ submit => [ '#form', { action => 'PriceRule/create' } ],
+ disabled => $is_new ? t8('The object has not been saved yet.') : undef,
+ ],
+ ], # end of combobox "Save"
+
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => 'PriceRule/destroy' } ],
+ confirm => t8('Do you really want to delete this object?'),
+ disabled => $is_new ? t8('The object has not been saved yet.')
+ : $self->price_rule->in_use ? t8('This object has already been used.')
+ : undef,
+ ],
+
+ link => [
+ t8('Abort'),
+ link => $self->url_for(action => 'list', 'filter.type' => $self->price_rule->type),
+ ],
+ );
+ }
+}
+