From 0ca85f8a8a62e028ef6cd9ec4a9e06eea705c411 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 22 Jun 2016 14:55:17 -0700 Subject: [PATCH] Updates to components --- app/Http/Controllers/ComponentsController.php | 2 +- app/Models/Component.php | 5 ++++- resources/views/components/checkout.blade.php | 9 ++++++--- resources/views/components/edit.blade.php | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/ComponentsController.php b/app/Http/Controllers/ComponentsController.php index 967523d134..6315012c23 100644 --- a/app/Http/Controllers/ComponentsController.php +++ b/app/Http/Controllers/ComponentsController.php @@ -437,7 +437,7 @@ class ComponentsController extends Controller $rows = array(); foreach ($components as $component) { - $actions = 'numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').''; + $actions = 'numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').''; $company = $component->company; $rows[] = array( diff --git a/app/Models/Component.php b/app/Models/Component.php index 8b3e3395dc..c571610e90 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -30,7 +30,10 @@ class Component extends Model */ public $rules = array( 'name' => 'required|min:3|max:255', - 'min_amt' => 'integer|min:1', + 'total_qty' => 'required|integer|min:1', + 'category_id' => 'required|integer', + 'company_id' => 'integer', + 'purchase_date' => 'date', ); /** diff --git a/resources/views/components/checkout.blade.php b/resources/views/components/checkout.blade.php index 1551ab7b68..24207b2cd8 100644 --- a/resources/views/components/checkout.blade.php +++ b/resources/views/components/checkout.blade.php @@ -21,7 +21,7 @@ @if ($component->id)
-

{{ $component->name }}

+

{{ $component->name }} ({{ $component->numRemaining() }} {{ trans('admin/components/general.remaining') }})

@endif @@ -54,10 +54,13 @@
-
- +
+ {!! $errors->first('assigned_qty', '
:message') !!}
+
+ {{ $component->numRemaining() }} Max +
diff --git a/resources/views/components/edit.blade.php b/resources/views/components/edit.blade.php index 17d6604725..7c00eea40a 100644 --- a/resources/views/components/edit.blade.php +++ b/resources/views/components/edit.blade.php @@ -58,7 +58,7 @@
- {{ Form::label('name', trans('admin/components/table.title')) }} + {{ Form::label('name', trans('admin/components/table.title')) }} *
@@ -70,7 +70,7 @@
- {{ Form::label('category_id', trans('general.category')) }} + {{ Form::label('category_id', trans('general.category')) }} *
@@ -134,7 +134,7 @@
- {{ Form::label('total_qty', trans('general.quantity')) }} + {{ Form::label('total_qty', trans('general.quantity')) }} *