use SL::DB::DeliveryTerm;
use SL::DB::Language;
use SL::Helper::Flash;
+use SL::Locale::String qw(t8);
use Rose::Object::MakeMethods::Generic
(
sub action_list {
my ($self) = @_;
+ $self->setup_list_action_bar;
$self->render('delivery_term/list',
title => $::locale->text('Delivery terms'),
DELIVERY_TERMS => SL::DB::Manager::DeliveryTerm->get_all_sorted);
my ($self) = @_;
$self->{delivery_term} = SL::DB::DeliveryTerm->new;
+ $self->setup_form_action_bar;
$self->render('delivery_term/form', title => $::locale->text('Create a new delivery term'));
}
sub action_edit {
my ($self) = @_;
+ $self->setup_form_action_bar;
$self->render('delivery_term/form', title => $::locale->text('Edit delivery term'));
}
$self->{languages} = SL::DB::Manager::Language->get_all_sorted;
}
+sub setup_list_action_bar {
+ my ($self) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ link => [
+ t8('Add'),
+ link => $self->url_for(action => 'new'),
+ ],
+ );
+ }
+}
+
+sub setup_form_action_bar {
+ my ($self) = @_;
+
+ my $is_new = !$self->delivery_term->id;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => 'DeliveryTerm/' . ($is_new ? 'create' : 'update') } ],
+ checks => [ 'kivi.validate_form' ],
+ accesskey => 'enter',
+ ],
+
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => 'DeliveryTerm/destroy' } ],
+ confirm => t8('Do you really want to delete this object?'),
+ disabled => $is_new ? t8('This object has not been saved yet.') : undef,
+ ],
+
+ 'separator',
+
+ link => [
+ t8('Abort'),
+ link => $self->url_for(action => 'list'),
+ ],
+ );
+ }
+}
+
1;
'Ar aging on %s' => 'Offene Forderungen zum %s',
'Are you sure to generate cb/ob transactions?' => 'Sollen die EB/SB Buchungen wirklich erzeugt werden?',
'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:',
- 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?',
'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?',
'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?',
'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise aktualisieren wollen?',
'Create invoice?' => 'Rechnung erstellen?',
'Create new' => 'Neu erfassen',
'Create new client #1' => 'Neuen Mandanten #1 anlegen',
- 'Create new delivery term' => 'Neue Lieferbedingungen anlegen',
'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen',
'Create new quotation/order' => 'Neues Angebot/neuen Auftrag anlegen',
'Create new qutoation/order' => 'Neues Angebot/neuen Auftrag anlegen',
-[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]
<h1>[% FORM.title %]</h1>
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" id="form">
[%- INCLUDE 'common/flash.html' %]
<tr>
<td>[%- 'Description' | $T8 %]</td>
<td>
- <input name="delivery_term.description" value="[%- HTML.escape(SELF.delivery_term.description) %]">
+ [% P.input_tag("delivery_term.description", SELF.delivery_term.description, size="60", "data-validate"="required", "data-title"=LxERP.t8("Description")) %]
</td>
</tr>
<tr>
<td>[%- 'Long Description' | $T8 %]</td>
<td>
- <input name="delivery_term.description_long" value="[%- HTML.escape(SELF.delivery_term.description_long) %]" size="60">
+ [% P.input_tag("delivery_term.description_long", SELF.delivery_term.description_long, size="60", "data-validate"="required", "data-title"=LxERP.t8("Long Description")) %]
</td>
</tr>
</td>
</tr>
[%- END %]
+ </table>
- <p>
- <input type="hidden" name="id" value="[% SELF.delivery_term.id %]">
- <input type="hidden" name="action" value="DeliveryTerm/dispatch">
- <input type="submit" class="submit" name="action_[% IF SELF.delivery_term.id %]update[% ELSE %]create[% END %]" value="[% 'Save' | $T8 %]">
- [%- IF SELF.delivery_term.id %]
- <input type="submit" class="submit" name="action_destroy" value="[% 'Delete' | $T8 %]"
- onclick="if (confirm('[% 'Are you sure you want to delete this delivery term?' | $T8 %]')) return true; else return false;">
- [%- END %]
- <a href="[% SELF.url_for(action => 'list') %]">[%- 'Abort' | $T8 %]</a>
- </p>
-
+ [% P.hidden_tag("id", SELF.delivery_term.id) %]
</form>
-
[%- INCLUDE 'common/flash.html' %]
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" id="form">
[% IF !DELIVERY_TERMS.size %]
<p>
[%- 'No delivery term has been created yet.' | $T8 %]
</tbody>
</table>
[%- END %]
-
- <p>
- <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new delivery term' | $T8 %]</a>
- </p>
</form>
[% L.sortable_element('#delivery_term_list tbody', url => 'controller.pl?action=DeliveryTerm/reorder', with => 'delivery_term_id') %]
-