diff --git a/app/Models/Rent.php b/app/Models/Rent.php index 834185d..37e1da6 100644 --- a/app/Models/Rent.php +++ b/app/Models/Rent.php @@ -22,6 +22,7 @@ class Rent extends Model 'id', // FIXME : should not be there 'buildingIndividual', 'buildingStage', + 'buildingHLM', 'buildingName', 'street', 'zipcode', @@ -29,19 +30,21 @@ class Rent extends Model 'country', 'addrlat', 'addrlng', - 'geolocManual' // automatic or manual address geolocalization + 'geolocManual', // automatic or manual address geolocalization + 'roomsCount', + 'kitchenRoom', + 'surfaceM2' ]; public static $rules = [ 'buildingIndividual'=>'required|boolean', - 'buildingStage'=>'', - 'buildingName'=>'', + 'buildingHLM'=>'required|boolean', 'street'=>'required', 'zipcode'=>'required', 'city'=>'required', 'country'=>'required', - 'addrlat'=>'required', - 'addrlng'=>'required' + 'addrlat'=>'required|numeric', + 'addrlng'=>'required|numeric' ]; /** diff --git a/app/Models/RentPrice.php b/app/Models/RentPrice.php index 60049a7..36690dd 100644 --- a/app/Models/RentPrice.php +++ b/app/Models/RentPrice.php @@ -13,11 +13,22 @@ class RentPrice extends Model // http://laravel.com/docs/5.0/eloquent#soft-deleting use SoftDeletes; - protected $fillable = ['year', 'price']; + protected $fillable = [ + 'year', + 'month', + 'price', + 'loads', + 'loadsOther', + 'loadsOtherText', + ]; public static $rules = [ - 'year'=>'required|numeric', - 'price'=>'required|numeric' + 'year'=>'required|integer', + 'month'=>'required|integer', + 'price'=>'required|numeric', + 'loads'=>'required|numeric', + 'loadsOther'=>'numeric', + 'loadsOtherText'=>'numeric', ]; /** diff --git a/database/migrations/2015_05_01_145614_create_rents_table.php b/database/migrations/2015_05_01_145614_create_rents_table.php index da13f32..83be15c 100644 --- a/database/migrations/2015_05_01_145614_create_rents_table.php +++ b/database/migrations/2015_05_01_145614_create_rents_table.php @@ -15,13 +15,13 @@ public function up() Schema::create('rents', function(Blueprint $table) { $table->increments('id'); - $table->boolean('buildingIndividual'); + $table->boolean('buildingIndividual')->nullable(); $table->integer('buildingStage'); $table->string('buildingName'); $table->string('street'); $table->string('zipcode'); $table->string('city'); - $table->timestamps(); + $table->timestamps(); // Adds created_at and updated_at columns }); } diff --git a/database/migrations/2015_05_01_145615_create_rentprices_table.php b/database/migrations/2015_05_01_145615_create_rentprices_table.php index d3a98bd..717df64 100644 --- a/database/migrations/2015_05_01_145615_create_rentprices_table.php +++ b/database/migrations/2015_05_01_145615_create_rentprices_table.php @@ -21,7 +21,7 @@ public function up() $table->foreign('rent_id') ->references('id')->on('rents') ->onDelete('cascade'); - $table->timestamps(); + $table->timestamps(); // Adds created_at and updated_at columns }); } diff --git a/database/migrations/2015_05_14_215734_add_more_rent_data.php b/database/migrations/2015_05_14_215734_add_more_rent_data.php new file mode 100644 index 0000000..2552e44 --- /dev/null +++ b/database/migrations/2015_05_14_215734_add_more_rent_data.php @@ -0,0 +1,40 @@ +boolean('buildingHLM')->nullable()->after('buildingIndividual'); + $table->double('surfaceM2')->default(0.0)->after('buildingHLM'); + $table->integer('roomsCount')->default(0)->after('surfaceM2'); + $table->boolean('kitchenRoom')->nullable()->after('roomsCount'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('rents', function(Blueprint $table) + { + $table->removeColumn('buildingHLM'); + $table->removeColumn('roomsCount'); + $table->removeColumn('surfaceM2'); + $table->removeColumn('kitchenRoom'); + }); + } + +} diff --git a/database/migrations/2015_05_14_220531_add_more_rentprice_data.php b/database/migrations/2015_05_14_220531_add_more_rentprice_data.php new file mode 100644 index 0000000..55cc0fa --- /dev/null +++ b/database/migrations/2015_05_14_220531_add_more_rentprice_data.php @@ -0,0 +1,40 @@ +integer('month')->after('year')->default(0); + $table->double('loads')->after('price')->default(0.0); + $table->double('loadsOther')->default(0.0)->after('loads'); + $table->string('loadsOtherText')->nullable()->after('loadsOther'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('rent_prices', function(Blueprint $table) + { + $table->removeColumn('month'); + $table->removeColumn('loads'); + $table->removeColumn('loadsOther'); + $table->removeColumn('loadsOtherText'); + }); + } + +} diff --git a/resources/views/rentEdit.blade.php b/resources/views/rentEdit.blade.php index c860ef0..bdc7a84 100644 --- a/resources/views/rentEdit.blade.php +++ b/resources/views/rentEdit.blade.php @@ -25,63 +25,130 @@
La bâtiment héberge-t-il un (individuel) ou plusieurs logements (collectif).
- @if ($errors->first('buildingIndividual')) + La bâtiment héberge-t-il un (individuel) ou plusieurs logements (collectif). +error {{$errors->first('buildingIndividual')}}
- @endif + @endif +error {{$errors->first('buildingHLM')}}
+ @endiferror {{$errors->first('buildingStage')}}
- @endif + +error {{$errors->first('surfaceM2')}}
+ @endif +error {{$errors->first('roomsCount')}}
+ @endif +error {{$errors->first('kitchenRoom')}}
+ @endiferror {{$errors->first('buildingStage')}}
+ @endif +error {{$errors->first('buildingName')}}
+error {{$errors->first('buildingName')}}
@endiferror {{$errors->first('street')}}
+error {{$errors->first('street')}}
@endiferror {{$errors->first('zipcode')}}
+error {{$errors->first('zipcode')}}
@endiferror {{$errors->first('city')}}
+error {{$errors->first('city')}}
@endiferror {{$errors->first('country')}}
+error {{$errors->first('country')}}
@endiferror {{$errors->first('addrlat')}}
@endiferror {{$errors->first('addrlng')}}
@endifIndiquez les loyers par année.
+Saisie des loyers.