+
+ $self->render('requirement_spec/_show_time_and_cost_estimate', { layout => 0 });
+}
+
+sub action_ajax_cancel_time_and_cost_estimate {
+ my ($self) = @_;
+
+ my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
+
+ $self->js
+ ->replaceWith('#time_cost_estimate', $html)
+ ->render($self);
+}
+
+sub action_ajax_edit_time_and_cost_estimate {
+ my ($self) = @_;
+
+ my $html = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 });
+
+ $self->js
+ ->replaceWith('#time_cost_estimate', $html)
+ ->render($self);
+}
+
+sub action_ajax_save_time_and_cost_estimate {
+ my ($self) = @_;
+
+ $self->requirement_spec->db->do_transaction(sub {
+ # Make Emacs happy
+ 1;
+ foreach my $attributes (@{ $::form->{requirement_spec_items} || [] }) {
+ SL::DB::RequirementSpecItem
+ ->new(id => delete $attributes->{id})
+ ->load
+ ->update_attributes(%{ $attributes });
+ }
+
+ 1;
+ });
+
+ my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
+ $self->js->replaceWith('#time_cost_estimate', $html);
+
+ if ($self->visible_section) {
+ $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->visible_section);
+ $self->js->html('#column-content', $html);
+ }
+
+ $self->js->render($self);