Permalink
Browse files

updating form_columns_extra_params in all controllers

  • Loading branch information...
1 parent 510720b commit 6f86e63157afc8c539630837720f972c9d19d2fe @andrewalker committed Feb 17, 2012
@@ -5,6 +5,11 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Finance::Installment' );
+sub _build_form_columns_extra_params {
+ {
+ ledger => { fk => 1, label => 'id', },
+ }
+}
=head1 NAME
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Finance::InstallmentPayment' );
+sub _build_form_columns_extra_params {
+ {
+ account => { fk => 1, label => 'name', },
+ comments => { field_class => 'LongText' },
+ }
+}
=head1 NAME
@@ -5,6 +5,13 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Finance::Ledger' );
+sub _build_form_columns_extra_params {
+ {
+ ledger_type => { fk => 1, label => 'name', value => 'slug', },
+ stock_movement => { fk => 1, label => 'id' },
+ comment => { field_class => 'LongText' },
+ }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Address' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::BankAccount' );
+sub _build_form_columns_extra_params {
+ {
+ person => { fk => 1, label => 'name', value => 'slug', },
+ comments => { field_class => 'LongText' },
+ }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Client' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Contact' );
+sub _build_form_columns_extra_params {
+ {
+ client => { fk => 1, label => 'person.name', value => 'person', },
+ abstract => { field_class => 'LongText' },
+ }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Document' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Employee' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,11 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Person' );
+sub _build_form_columns_extra_params {
+ {
+ comments => { field_class => 'LongText' },
+ }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Representant' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,9 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::People::Supplier' );
+sub _build_form_columns_extra_params {
+ { person => { fk => 1, label => 'name', value => 'slug', } }
+}
=head1 NAME
@@ -5,6 +5,11 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::Category' );
+sub _build_form_columns_extra_params {
+ {
+ parent => { fk => 1, label => 'name', value => 'slug' }
+ }
+}
=head1 NAME
@@ -5,6 +5,13 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::Consignation' );
+sub _build_form_columns_extra_params {
+ {
+ representant => { fk => 1, label => 'person.name', value => 'person' },
+ stock_movement => { fk => 1, value => 'id' },
+ product => { fk => 1, label => 'name', value => 'id' },
+ }
+}
=head1 NAME
@@ -6,9 +6,15 @@ BEGIN { extends 'Impacto::ControllerBase::CRUD' }
sub _build_form_columns {
[qw/
- name supplier cost minimum_price price weight
+ name supplier cost minimum_price price weight image
/]
}
+sub _build_form_columns_extra_params {
+ {
+ supplier => { fk => 1, label => 'person.name', value => 'person' },
+ image => { field_class => 'FileUpload' },
+ }
+}
sub _build_datagrid_columns {
[qw/
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::ProductCategory' );
+sub _build_form_columns_extra_params {
+ {
+ category => { fk => 1, label => 'name', value => 'slug' },
+ product => { fk => 1, label => 'name', value => 'id' },
+ }
+}
=head1 NAME
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::ProductStock' );
+sub _build_form_columns_extra_params {
+ {
+ product => { fk => 1, label => 'name', value => 'id' },
+ place => { fk => 1, label => 'place' }
+ }
+}
=head1 NAME
@@ -5,6 +5,13 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::Return' );
+sub _build_form_columns_extra_params {
+ {
+ consignation => { fk => 1, value => 'id' },
+ stock_movement => { fk => 1, value => 'id' },
+ ledger => { fk => 1, value => 'id' },
+ }
+}
=head1 NAME
@@ -1,10 +1,32 @@
package Impacto::Controller::Product::StockMovement;
+use utf8;
use Moose;
use namespace::autoclean;
+use Form::Sensible::DelegateConnection;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::StockMovement' );
+sub _build_form_columns_extra_params {
+ my $self = shift;
+ {
+ type => { field_class => 'Select', options_delegate => FSConnector($self, 'get_stock_movement_types') },
+ place => { fk => 1, label => 'place' },
+ product => { fk => 1, label => 'name', value => 'id' },
+ }
+}
+
+sub get_stock_movement_types {
+ my ($self, $field, $args) = @_;
+ return [
+ { value => 'sell', name => 'Venda' },
+ { value => 'buy', name => 'Compra' },
+ { value => 'consignation', name => 'Consignação' },
+ { value => 'return', name => 'Retorno' },
+ { value => 'donation', name => 'Doação' },
+ { value => 'relocation', name => 'Mudança de local' },
+ ];
+}
=head1 NAME
@@ -5,6 +5,12 @@ use namespace::autoclean;
BEGIN { extends 'Impacto::ControllerBase::CRUD' }
has '+crud_model_name' => ( default => 'DB::Product::Subscription' );
+sub _build_form_columns_extra_params {
+ {
+ client => { fk => 1, label => 'person.name', value => 'person' },
+ product => { fk => 1, label => 'name', value => 'id' },
+ }
+}
=head1 NAME
@@ -50,6 +50,7 @@ __PACKAGE__->table("category");
=head2 parent
data_type: 'text'
+ is_foreign_key: 1
is_nullable: 1
=head2 name
@@ -63,7 +64,7 @@ __PACKAGE__->add_columns(
"slug",
{ data_type => "text", is_nullable => 0 },
"parent",
- { data_type => "text", is_nullable => 1 },
+ { data_type => "text", is_foreign_key => 1, is_nullable => 1 },
"name",
{ data_type => "text", is_nullable => 0 },
);
@@ -82,6 +83,41 @@ __PACKAGE__->set_primary_key("slug");
=head1 RELATIONS
+=head2 categories
+
+Type: has_many
+
+Related object: L<Impacto::Schema::Product::Result::Category>
+
+=cut
+
+__PACKAGE__->has_many(
+ "categories",
+ "Impacto::Schema::Product::Result::Category",
+ { "foreign.parent" => "self.slug" },
+ { cascade_copy => 0, cascade_delete => 0 },
+);
+
+=head2 parent
+
+Type: belongs_to
+
+Related object: L<Impacto::Schema::Product::Result::Category>
+
+=cut
+
+__PACKAGE__->belongs_to(
+ "parent",
+ "Impacto::Schema::Product::Result::Category",
+ { slug => "parent" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
+);
+
=head2 product_categories
Type: has_many
@@ -108,8 +144,8 @@ Composing rels: L</product_categories> -> product
__PACKAGE__->many_to_many("products", "product_categories", "product");
-# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-02-09 16:32:10
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0MPPkTv7LV/rS3KOV69+vw
+# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-02-17 15:36:57
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pbWKv6rgvYpkPOasUqk/3g
# You can replace this text with custom code or comments, and it will be preserved on regeneration

0 comments on commit 6f86e63

Please sign in to comment.