From c42b1a0bb81daff4fabec91dc5e4b1937bf3cbbd Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Tue, 20 May 2014 19:32:51 +0300 Subject: [PATCH] MT#5879 Form with datatable field for one page app. --- lib/NGCP/Panel/Form/Invoice/Generate.pm | 39 +++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/lib/NGCP/Panel/Form/Invoice/Generate.pm b/lib/NGCP/Panel/Form/Invoice/Generate.pm index 6baf3caf45..5f8f2fa026 100644 --- a/lib/NGCP/Panel/Form/Invoice/Generate.pm +++ b/lib/NGCP/Panel/Form/Invoice/Generate.pm @@ -1,22 +1,43 @@ package NGCP::Panel::Form::Invoice::Generate; -use Sipwise::Base; +#use Sipwise::Base; use HTML::FormHandler::Moose; #extends qw/HTML::FormHandler NGCP::Panel::Form::ValidatorBase/; extends 'NGCP::Panel::Form::ValidatorBase'; -use Moose::Util::TypeConstraints; +#extends qw/NGCP::Panel::Form::ValidatorBase HTML::FormHandler::Field::Compound/; +#extends 'HTML::FormHandler::Field::Compound'; +#use Moose::Util::TypeConstraints; use DateTime; use DateTime::Format::Strptime; use NGCP::Panel::Utils::DateTime; -has '+widget_wrapper' => ( default => 'Bootstrap' ); has_field 'submitid' => ( type => 'Hidden' ); +has '+widget_wrapper' => ( default => 'Bootstrap' ); sub build_render_list {[qw/submitid fields actions/]} sub build_form_element_class { [qw/form-horizontal/] } - -has_field 'submitid' => ( type => 'Hidden' ); +has_field 'client_contract_id' => ( + is => 'rw', + type => '+NGCP::Panel::Field::DataTable', + label => 'Contract', + do_label => 0, + do_wrapper => 0, + required => 1, + template => 'helpers/datatables_field.tt', + #we will set it in controller + #ajax_src => $c->uri_for_action( '/invoice/ajax_datatables_data', [ $self->provider_id, 'invoice_list_data' ], + ajax_src => '', + +# { name => 'contracts.id', title => c.loc('Client Contract Id'), search => 1}, +# { name => 'contracts.external_id', title => c.loc('External #'), search => 1 }, +# { name => 'email', title => c.loc('Contact Email'), search => 1 }, +# { name => 'contracts.billing_mappings.billing_profile.name', title => c.loc('Billing Profile'), search => 1 }, +# { name => 'contracts.billing_mappings.product.name', title => c.loc('Product'), search => 1 }, +# { name => 'contracts.status', title => c.loc('Status'), search => 1 }, + table_titles => ['Contract Id', 'First Name', 'Last Name', 'Email'], + table_fields => ['contracts.id', 'firstname', 'lastname', 'email'], +); #has_field 'contract.id' => ( # type => '+NGCP::Panel::Field::DataTable', @@ -50,10 +71,10 @@ has_field 'save' => ( do_label => 0, ); -has_field 'client_contract_id' => ( - type => 'Hidden', - required => 1, -); +#has_field 'client_contract_id' => ( +# type => 'Hidden', +# required => 1, +#); has_block 'fields' => ( tag => 'div',