diff --git a/app/controllers/admin/ImprovementsController.php b/app/controllers/admin/ImprovementsController.php index e03e039851a4..938a63b474e5 100644 --- a/app/controllers/admin/ImprovementsController.php +++ b/app/controllers/admin/ImprovementsController.php @@ -85,12 +85,15 @@ public function getDatatable() return $improvements->start_date->toDateString(); } ) ->addColumn( 'completion_date', function ( $improvements ) { - - return $improvements->completion_date->toDateString(); + if (is_null($improvements->completion_date)) { + return null; + } else { + return $improvements->completion_date->toDateString(); + } } ) ->addColumn( 'cost', function ( $improvements ) { - return sprintf( Lang::get( 'general.currency' ) . '%01.2f', $improvements->cost); + return sprintf( Lang::get( 'general.currency' ) . '%01.2f', $improvements->cost ); } ) ->addColumn( $actions ) ->searchColumns( 'asset', 'supplier', 'improvement_type', 'title', 'start_date', @@ -234,6 +237,7 @@ public function postCreate() /** * getDelete + * * @param $improvementId * * @return mixed @@ -257,4 +261,17 @@ public function getDelete( $improvementId ) ->with( 'success', Lang::get( 'admin/improvements/message.delete.success' ) ); } + public function getView( $improvementId ) + { + + // Check if the improvement exists + if (is_null( $improvement = Improvement::find( $improvementId ) )) { + // Redirect to the improvement management page + return Redirect::to( 'admin/improvements' ) + ->with( 'error', Lang::get( 'admin/improvements/message.not_found' ) ); + } + + return View::make('backend/improvements/view')->with('improvement', $improvement); + } + } \ No newline at end of file diff --git a/app/database/migrations/2015_06_26_213716_create_improvements_table.php b/app/database/migrations/2015_06_26_213716_create_improvements_table.php index e210f408a3f9..58f5c18da503 100644 --- a/app/database/migrations/2015_06_26_213716_create_improvements_table.php +++ b/app/database/migrations/2015_06_26_213716_create_improvements_table.php @@ -27,7 +27,7 @@ public function up() $table->date( 'start_date' ); $table->date( 'completion_date' ) ->nullable(); - $table->decimal( 'improvement_time', 8, 2 ) + $table->integer( 'improvement_time') ->nullable(); $table->longText( 'notes' ) ->nullable(); diff --git a/app/lang/en/admin/improvements/form.php b/app/lang/en/admin/improvements/form.php index a5e42532cb5f..25b8814ceb79 100755 --- a/app/lang/en/admin/improvements/form.php +++ b/app/lang/en/admin/improvements/form.php @@ -7,6 +7,7 @@ 'completion_date' => 'Completion Date', 'cost' => 'Cost', 'is_warranty' => 'Warranty Improvement', + 'improvement_time' => 'Improvement Time (in days)', 'notes' => 'Notes', 'update' => 'Update Improvement', 'create' => 'Create Improvement' diff --git a/app/lang/en/admin/improvements/general.php b/app/lang/en/admin/improvements/general.php index bc70f76a3c21..46defda5e4c8 100755 --- a/app/lang/en/admin/improvements/general.php +++ b/app/lang/en/admin/improvements/general.php @@ -3,4 +3,6 @@ return [ 'improvements' => 'Improvements', 'edit' => 'Edit Improvement', + 'delete' => 'Delete Improvement', + 'view' => 'View Improvement Details' ]; diff --git a/app/lang/en/admin/improvements/message.php b/app/lang/en/admin/improvements/message.php index a644c29fe813..85d457d0232b 100644 --- a/app/lang/en/admin/improvements/message.php +++ b/app/lang/en/admin/improvements/message.php @@ -1,15 +1,17 @@ 'Improvement you were looking for was not found!', - 'delete' => [ + 'not_found' => 'Improvement you were looking for was not found!', + 'delete' => [ 'confirm' => 'Are you sure you wish to delete this improvement?', 'error' => 'There was an issue deleting the improvement. Please try again.', 'success' => 'The improvement was deleted successfully.' ], - 'create' => [ + 'create' => [ 'error' => 'Improvement was not created, please try again.', 'success' => 'Improvement created successfully.' ], - + 'improvement_incomplete' => 'Not Completed Yet', + 'warranty' => 'Warranty', + 'not_warranty' => 'Not Warranty', ]; \ No newline at end of file diff --git a/app/views/backend/hardware/view.blade.php b/app/views/backend/hardware/view.blade.php index c7022549f1e6..f3ce89db9423 100755 --- a/app/views/backend/hardware/view.blade.php +++ b/app/views/backend/hardware/view.blade.php @@ -229,7 +229,7 @@