Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updating form_columns_extra_params in all controllers

  • Loading branch information...
commit 6f86e63157afc8c539630837720f972c9d19d2fe 1 parent 510720b
@andrewalker authored
Showing with 158 additions and 4 deletions.
  1. +5 −0 lib/Impacto/Controller/Finance/Installment.pm
  2. +6 −0 lib/Impacto/Controller/Finance/InstallmentPayment.pm
  3. +7 −0 lib/Impacto/Controller/Finance/Ledger.pm
  4. +3 −0  lib/Impacto/Controller/People/Address.pm
  5. +6 −0 lib/Impacto/Controller/People/BankAccount.pm
  6. +3 −0  lib/Impacto/Controller/People/Client.pm
  7. +6 −0 lib/Impacto/Controller/People/Contact.pm
  8. +3 −0  lib/Impacto/Controller/People/Document.pm
  9. +3 −0  lib/Impacto/Controller/People/Employee.pm
  10. +5 −0 lib/Impacto/Controller/People/Person.pm
  11. +3 −0  lib/Impacto/Controller/People/Representant.pm
  12. +3 −0  lib/Impacto/Controller/People/Supplier.pm
  13. +5 −0 lib/Impacto/Controller/Product/Category.pm
  14. +7 −0 lib/Impacto/Controller/Product/Consignation.pm
  15. +7 −1 lib/Impacto/Controller/Product/Product.pm
  16. +6 −0 lib/Impacto/Controller/Product/ProductCategory.pm
  17. +6 −0 lib/Impacto/Controller/Product/ProductStock.pm
  18. +7 −0 lib/Impacto/Controller/Product/Return.pm
  19. +22 −0 lib/Impacto/Controller/Product/StockMovement.pm
  20. +6 −0 lib/Impacto/Controller/Product/Subscription.pm
  21. +39 −3 lib/Impacto/Schema/Product/Result/Category.pm
View
5 lib/Impacto/Controller/Finance/Installment.pm
@@ -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
View
6 lib/Impacto/Controller/Finance/InstallmentPayment.pm
@@ -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
View
7 lib/Impacto/Controller/Finance/Ledger.pm
@@ -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
View
3  lib/Impacto/Controller/People/Address.pm
@@ -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
View
6 lib/Impacto/Controller/People/BankAccount.pm
@@ -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
View
3  lib/Impacto/Controller/People/Client.pm
@@ -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
View
6 lib/Impacto/Controller/People/Contact.pm
@@ -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
View
3  lib/Impacto/Controller/People/Document.pm
@@ -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
View
3  lib/Impacto/Controller/People/Employee.pm
@@ -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
View
5 lib/Impacto/Controller/People/Person.pm
@@ -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
View
3  lib/Impacto/Controller/People/Representant.pm
@@ -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
View
3  lib/Impacto/Controller/People/Supplier.pm
@@ -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
View
5 lib/Impacto/Controller/Product/Category.pm
@@ -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
View
7 lib/Impacto/Controller/Product/Consignation.pm
@@ -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
View
8 lib/Impacto/Controller/Product/Product.pm
@@ -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/
View
6 lib/Impacto/Controller/Product/ProductCategory.pm
@@ -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
View
6 lib/Impacto/Controller/Product/ProductStock.pm
@@ -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
View
7 lib/Impacto/Controller/Product/Return.pm
@@ -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
View
22 lib/Impacto/Controller/Product/StockMovement.pm
@@ -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
View
6 lib/Impacto/Controller/Product/Subscription.pm
@@ -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
View
42 lib/Impacto/Schema/Product/Result/Category.pm
@@ -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.
Something went wrong with that request. Please try again.