show peaktime dates as datatables table

agranig/1_0_subfix
Gerhard Jungwirth 13 years ago
parent 82386265f2
commit e89dfa5f4a

@ -419,6 +419,26 @@ sub load_weekdays {
$c->stash(weekdays => \@weekdays); $c->stash(weekdays => \@weekdays);
} }
sub peaktime_specials_ajax :Chained('peaktimes_list') :PathPart('ajax') :Args(0) {
my ($self, $c) = @_;
my $resultset = $c->stash->{'profile_result'}->billing_peaktime_specials;
$c->forward( "/ajax_process_resultset", [$resultset,
["id", "start", "end",],
[1,2]]);
for my $row (@{ $c->stash->{aaData} }) {
my $date = $row->[1]->date;
my $start = $row->[1]->hms;
my $end = $row->[2]->hms;
$row->[1] = $date;
$row->[2] = $start . ' - ' . $end;
}
$c->detach( $c->view("JSON") );
}
__PACKAGE__->meta->make_immutable; __PACKAGE__->meta->make_immutable;
1; 1;
@ -537,6 +557,14 @@ Show a modal to edit one weekday.
creates a weekdays structure from the stash variable weekdays_result creates a weekdays structure from the stash variable weekdays_result
puts the result under weekdays on stash (will be used by template) puts the result under weekdays on stash (will be used by template)
=head2 peaktime_specials_ajax
Returns an ajax representation of billing_peaktime_specials under the current
billing_profile. The rows are modified so that the final form will be
(id, date, startend).
This depends on inflation being activated in the schema.
=head1 AUTHOR =head1 AUTHOR
Gerhard Jungwirth C<< <gjungwirth@sipwise.com> >> Gerhard Jungwirth C<< <gjungwirth@sipwise.com> >>

@ -229,7 +229,7 @@ sub ajax_process_resultset :Private {
} }
for my $row ($rs->all) { for my $row ($rs->all) {
my %tmpRow = $row->get_columns; my %tmpRow = $row->get_inflated_columns;
my @aaRow = @tmpRow{@$columns}; my @aaRow = @tmpRow{@$columns};
push @$aaData, \@aaRow; push @$aaData, \@aaRow;
} }

@ -47,6 +47,20 @@
<h3>Dates</h3> <h3>Dates</h3>
[%
helper.name = 'Billing Profiles';
helper.column_titles = [ '#', 'Date', 'Start-End' ];
helper.column_fields = [ 'id', 'date', 'startend' ];
helper.create_flag = 0;
helper.edit_flag = 0;
helper.has_edit = 1;
helper.has_preferences = 0;
helper.ajax_uri = c.uri_for_action("/billing/peaktime_specials_ajax", [c.req.captures.0]);
helper.base_uri = "";
PROCESS 'helpers/datatables.tt';
-%]
[% IF edit_flag -%] [% IF edit_flag -%]
[% [%

Loading…
Cancel
Save