From 368ac5b85d8d96ea561f23464decdecc5afec210 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 18:20:42 -0700 Subject: [PATCH 01/13] First stab at handling the n+1 issue on licenses --- app/Http/Controllers/Api/LicensesController.php | 2 +- app/Http/Transformers/LicensesTransformer.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index ff58362f6..965112613 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -21,7 +21,7 @@ class LicensesController extends Controller public function index(Request $request) { $this->authorize('view', License::class); - $licenses = Company::scopeCompanyables(License::with('company', 'licenseSeatsRelation', 'manufacturer', 'supplier')); + $licenses = Company::scopeCompanyables(License::with('company', 'licenseseats', 'manufacturer', 'supplier')->withCount('licenseseats')); if ($request->has('search')) { $licenses = $licenses->TextSearch($request->input('search')); diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index f3644dd4d..2c9472110 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -33,16 +33,14 @@ class LicensesTransformer 'notes' => e($license->notes), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'total_seats' => (int) $license->seats, - 'next_seat' => ($license->freeSeat()) ? (int) $license->freeSeat()->id : null, - 'remaining_qty' => (int) $license->remaincount(), - 'min_qty' => $license->remaincount(), + 'remaining_qty' => (int) ($license->seats - $license->licenseseats_count), 'license_name' => e($license->license_name), 'license_email' => e($license->license_email), 'maintained' => ($license->maintained == 1) ? true : false, 'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id,'name'=> e($license->supplier->name)] : null, 'created_at' => Helper::getFormattedDateObject($license->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($license->updated_at, 'datetime'), - 'user_can_checkout' => (bool) ($license->remaincount() > 0), + 'user_can_checkout' => (bool) (($license->seats - $license->licenseseats_count) > 0), ]; $permissions_array['available_actions'] = [ From 27d795508d6354cb75f48d5274b22d1fcd9205e0 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 19:16:09 -0700 Subject: [PATCH 02/13] Fixed n+1 query, changed checkout behavior to just ask for a license ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’re offloading the freeSeat() to the checkout page now --- .../Controllers/Api/LicensesController.php | 2 +- app/Http/Controllers/LicensesController.php | 146 ++++++++++-------- app/Http/Transformers/LicensesTransformer.php | 4 +- app/Models/License.php | 13 +- resources/views/licenses/checkout.blade.php | 8 +- 5 files changed, 102 insertions(+), 71 deletions(-) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 965112613..c27992984 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -21,7 +21,7 @@ class LicensesController extends Controller public function index(Request $request) { $this->authorize('view', License::class); - $licenses = Company::scopeCompanyables(License::with('company', 'licenseseats', 'manufacturer', 'supplier')->withCount('licenseseats')); + $licenses = Company::scopeCompanyables(License::with('company', 'manufacturer', 'freeSeats', 'supplier')->withCount('freeSeats')); if ($request->has('search')) { $licenses = $licenses->TextSearch($request->input('search')); diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 3d4366adb..94aa4add5 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -239,16 +239,19 @@ class LicensesController extends Controller * @param int $seatId * @return \Illuminate\Contracts\View\View */ - public function getCheckout($seatId) + public function getCheckout($licenceId) { - // Check if the license seat exists - if (is_null($licenseSeat = LicenseSeat::find($seatId))) { - // Redirect to the asset management page with error - return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); + // Check that the license is valid + if ($license = License::where('id',$licenceId)->first()) { + + // If the license is valid, check that there is an available seat + if ($license->getAvailSeatsCountAttribute() < 1) { + return redirect()->route('licenses.index')->with('error', 'There are no available seats for this license'); + } } - $this->authorize('checkout', $licenseSeat); - return view('licenses/checkout', compact('licenseSeat')); + $this->authorize('checkout', $license); + return view('licenses/checkout', compact('license')); } @@ -262,78 +265,95 @@ class LicensesController extends Controller * @param int $seatId * @return \Illuminate\Http\RedirectResponse */ - public function postCheckout(Request $request, $seatId) + public function postCheckout(Request $request, $licenseId) { - $licenseSeat = LicenseSeat::find($seatId); - $assigned_to = e($request->input('assigned_to')); - $asset_id = e($request->input('asset_id')); - $this->authorize('checkout', $licenseSeat); + // Check that the license is valid + if ($license = License::where('id',$licenseId)->first()) { - // Declare the rules for the form validation - $rules = [ - 'note' => 'string|nullable', - 'asset_id' => 'required_without:assigned_to', - ]; + // If the license is valid, check that there is an available seat + if ($license->getAvailSeatsCountAttribute() < 1) { + return redirect()->route('licenses.index')->with('error', 'There are no available seats for this license'); + } + $next = $license->freeSeat(); - // Create a new validator instance from our validation rules - $validator = Validator::make(Input::all(), $rules); - // If validation fails, we'll exit the operation now. - if ($validator->fails()) { - // Ooops.. something went wrong - return redirect()->back()->withInput()->withErrors($validator); - } - $target = null; - if ($assigned_to!='') { - // Check if the user exists - if (is_null($target = User::find($assigned_to))) { + $licenseSeat = LicenseSeat::where('license_id',$license->id)->find($next)->first(); + $assigned_to = $request->input('assigned_to'); + $asset_id = $request->input('asset_id'); + + $this->authorize('checkout', $licenseSeat); + + // Declare the rules for the form validation + $rules = [ + 'note' => 'string|nullable', + 'asset_id' => 'required_without:assigned_to', + ]; + + // Create a new validator instance from our validation rules + $validator = Validator::make(Input::all(), $rules); + + // If validation fails, we'll exit the operation now. + if ($validator->fails()) { + // Ooops.. something went wrong + return redirect()->back()->withInput()->withErrors($validator); + } + $target = null; + if ($assigned_to!='') { + // Check if the user exists + if (is_null($target = User::find($assigned_to))) { + // Redirect to the asset management page with error + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist')); + } + } + + if ($asset_id!='') { + if (is_null($target = Asset::find($asset_id))) { + // Redirect to the asset management page with error + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.asset_does_not_exist')); + } + + if (($request->has('assigned_to')) && ($request->has('asset_id'))) { + return redirect()->back()->withInput()->with('error', trans('admin/licenses/message.select_asset_or_person')); + } + } + + // Check if the asset exists + if (is_null($licenseSeat)) { // Redirect to the asset management page with error - return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist')); - } - } - - if ($asset_id!='') { - if (is_null($target = Asset::find($asset_id))) { - // Redirect to the asset management page with error - return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.asset_does_not_exist')); + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); } - if (($request->has('assigned_to')) && ($request->has('asset_id'))) { - return redirect()->back()->withInput()->with('error', trans('admin/licenses/message.select_asset_or_person')); + if ($request->input('asset_id') == '') { + $licenseSeat->asset_id = null; + } else { + $licenseSeat->asset_id = $request->input('asset_id'); } - } - // Check if the asset exists - if (is_null($licenseSeat)) { - // Redirect to the asset management page with error - return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); - } - - if ($request->input('asset_id') == '') { - $licenseSeat->asset_id = null; - } else { - $licenseSeat->asset_id = $request->input('asset_id'); - } - - // Update the asset data - if ($request->input('assigned_to') == '') { + // Update the asset data + if ($request->input('assigned_to') == '') { $licenseSeat->assigned_to = null; - } else { + } else { $licenseSeat->assigned_to = $request->input('assigned_to'); + } + + // Was the asset updated? + if ($licenseSeat->save()) { + $licenseSeat->logCheckout($request->input('note'), $target); + + $data['license_id'] = $licenseSeat->license_id; + $data['note'] = $request->input('note'); + + // Redirect to the new asset page + return redirect()->route("licenses.index")->with('success', trans('admin/licenses/message.checkout.success')); + } + } + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); + - // Was the asset updated? - if ($licenseSeat->save()) { - $licenseSeat->logCheckout($request->input('note'), $target); - $data['license_id'] = $licenseSeat->license_id; - $data['note'] = $request->input('note'); - // Redirect to the new asset page - return redirect()->route("licenses.index")->with('success', trans('admin/licenses/message.checkout.success')); - } - return redirect()->route("licenses.index")->with('error', trans('admin/licenses/message.checkout.error')); } diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index 2c9472110..6d809ecde 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -33,14 +33,14 @@ class LicensesTransformer 'notes' => e($license->notes), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'total_seats' => (int) $license->seats, - 'remaining_qty' => (int) ($license->seats - $license->licenseseats_count), + 'remaining_qty' => $license->free_seats_count, 'license_name' => e($license->license_name), 'license_email' => e($license->license_email), 'maintained' => ($license->maintained == 1) ? true : false, 'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id,'name'=> e($license->supplier->name)] : null, 'created_at' => Helper::getFormattedDateObject($license->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($license->updated_at, 'datetime'), - 'user_can_checkout' => (bool) (($license->seats - $license->licenseseats_count) > 0), + 'user_can_checkout' => (bool) ($license->free_seats_count > 0), ]; $permissions_array['available_actions'] = [ diff --git a/app/Models/License.php b/app/Models/License.php index 7258dae6d..4b2d69628 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -266,7 +266,9 @@ class License extends Depreciable public function availCount() { return $this->licenseSeatsRelation() - ->whereNull('asset_id'); + ->whereNull('asset_id') + ->whereNull('assigned_to') + ->whereNull('user_id'); } public function getAvailSeatsCountAttribute() @@ -345,6 +347,15 @@ class License extends Depreciable ->first(); } + /* + * Get the next available free seat - used by + * the API to populate next_seat + */ + public function freeSeats() + { + return $this->hasMany('\App\Models\LicenseSeat')->whereNull('assigned_to')->whereNull('deleted_at')->whereNull('asset_id'); + } + public static function getExpiringLicenses($days = 60) { diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.php index 50bbff7b9..47ce4a7c0 100755 --- a/resources/views/licenses/checkout.blade.php +++ b/resources/views/licenses/checkout.blade.php @@ -21,7 +21,7 @@
-

{{ $licenseSeat->license->name }}

+

{{ $license->name }}

@@ -29,7 +29,7 @@
-

{{ $licenseSeat->license->name }}

+

{{ $license->name }}

@@ -37,7 +37,7 @@
-

{{ $licenseSeat->license->serial }}

+

{{ $license->serial }}

@@ -54,7 +54,7 @@
- + {!! $errors->first('note', ' :message') !!}
From 0bd09f9c4612db092e7c6a2d4db66e7e596ca628 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 19:37:30 -0700 Subject: [PATCH 03/13] Added sorting on available and total seats --- app/Http/Controllers/Api/LicensesController.php | 2 +- app/Http/Transformers/LicensesTransformer.php | 4 ++-- app/Presenters/LicensePresenter.php | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index c27992984..3d649d663 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -87,7 +87,7 @@ class LicensesController extends Controller $licenses = $licenses->OrderCompany($order); break; default: - $allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','company','license_name','license_email']; + $allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','company','license_name','license_email','free_seats_count','seats']; $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; $licenses = $licenses->orderBy($sort, $order); break; diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index 6d809ecde..077f0908e 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -32,8 +32,8 @@ class LicensesTransformer 'purchase_cost' => e($license->purchase_cost), 'notes' => e($license->notes), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), - 'total_seats' => (int) $license->seats, - 'remaining_qty' => $license->free_seats_count, + 'seats' => (int) $license->seats, + 'free_seats_count' => $license->free_seats_count, 'license_name' => e($license->license_name), 'license_email' => e($license->license_email), 'maintained' => ($license->maintained == 1) ? true : false, diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php index fb0da5ccd..f58bbbe2d 100644 --- a/app/Presenters/LicensePresenter.php +++ b/app/Presenters/LicensePresenter.php @@ -76,14 +76,14 @@ class LicensePresenter extends Presenter "title" => trans('general.manufacturer'), "formatter" => "manufacturersLinkObjFormatter", ], [ - "field" => "total_seats", + "field" => "seats", "searchable" => false, - "sortable" => false, + "sortable" => true, "title" => trans('admin/accessories/general.total'), ], [ - "field" => "remaining_qty", + "field" => "free_seats_count", "searchable" => false, - "sortable" => false, + "sortable" => true, "title" => trans('admin/accessories/general.remaining'), ], [ "field" => "purchase_date", From 53175d50358e4fcf3b19c9cc9438cdd3bd570b8c Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 20:01:39 -0700 Subject: [PATCH 04/13] Fixed sorting issue on company/manufacturer/supplier --- app/Http/Controllers/Api/LicensesController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 3d649d663..83915905b 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -77,14 +77,14 @@ class LicensesController extends Controller switch ($request->input('sort')) { - case 'manufacturer': - $licenses = $licenses->OrderManufacturer($order); + case 'manufacturer': + $licenses = $licenses->leftJoin('manufacturers', 'licenses.manufacturer_id', '=', 'manufacturers.id')->orderBy('manufacturers.name', $order); break; case 'supplier': - $licenses = $licenses->OrderSupplier($order); + $licenses = $licenses->leftJoin('suppliers', 'licenses.supplier_id', '=', 'suppliers.id')->orderBy('suppliers.name', $order); break; case 'company': - $licenses = $licenses->OrderCompany($order); + $licenses = $licenses->leftJoin('companies', 'licenses.company_id', '=', 'companies.id')->orderBy('companies.name', $order); break; default: $allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','company','license_name','license_email','free_seats_count','seats']; @@ -95,6 +95,7 @@ class LicensesController extends Controller $total = $licenses->count(); + $licenses = $licenses->skip($offset)->take($limit)->get(); return (new LicensesTransformer)->transformLicenses($licenses, $total); From 0c794c103b5d46b69ae4872008d23641f84f44a2 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 20:23:04 -0700 Subject: [PATCH 05/13] Return an integer value for free seats if null --- app/Http/Transformers/LicensesTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index 077f0908e..e96a9ed84 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -33,7 +33,7 @@ class LicensesTransformer 'notes' => e($license->notes), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'seats' => (int) $license->seats, - 'free_seats_count' => $license->free_seats_count, + 'free_seats_count' => (int) $license->free_seats_count, 'license_name' => e($license->license_name), 'license_email' => e($license->license_email), 'maintained' => ($license->maintained == 1) ? true : false, From caa8ec31781a6e4d73175111bba16dcfaa1c4709 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 20:23:17 -0700 Subject: [PATCH 06/13] Fixed checkout on license view page --- resources/views/licenses/view.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 11a21ebf6..35a305de6 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -97,7 +97,7 @@ Assigned @endif @else - + {{ trans('general.checkout') }} @endif From 1659c3f1a6e4ba3ea10615ce9ffeaaef6d5ca593 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 20:42:07 -0700 Subject: [PATCH 07/13] Fixed inconsistent color type on checkin/checkout --- resources/views/licenses/view.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 35a305de6..d21c73b45 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -90,14 +90,14 @@ @can('checkout', $licensedto) @if (($licensedto->assigned_to) || ($licensedto->asset_id)) @if ($license->reassignable) - + {{ trans('general.checkin') }} @else Assigned @endif @else - + {{ trans('general.checkout') }} @endif From 104cc2bf11d87fa5d7c14755728787ef4d74849a Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 21:07:59 -0700 Subject: [PATCH 08/13] =?UTF-8?q?Make=20sure=20the=20seat=20hasn=E2=80=99t?= =?UTF-8?q?=20been=20deleted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/License.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/License.php b/app/Models/License.php index 4b2d69628..a5aa8572b 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -268,7 +268,8 @@ class License extends Depreciable return $this->licenseSeatsRelation() ->whereNull('asset_id') ->whereNull('assigned_to') - ->whereNull('user_id'); + ->whereNull('user_id') + ->whereNull('deleted_at'); } public function getAvailSeatsCountAttribute() From ab9729c39aa751383c384483bbc936e0834718e8 Mon Sep 17 00:00:00 2001 From: Kasey Date: Fri, 3 Nov 2017 09:51:15 -0700 Subject: [PATCH 09/13] fix to availCount() (licenseSeatRelation) (#4378) `license_seats`.`user_id` represents an overall "owner" of the license --- app/Models/License.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Models/License.php b/app/Models/License.php index a5aa8572b..11f1326aa 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -268,7 +268,6 @@ class License extends Depreciable return $this->licenseSeatsRelation() ->whereNull('asset_id') ->whereNull('assigned_to') - ->whereNull('user_id') ->whereNull('deleted_at'); } From 3ecaa999904ca9b5b1aaa0da83f576cc4cd584cc Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 3 Nov 2017 11:33:36 -0700 Subject: [PATCH 10/13] Fixed only undeployed assets in checkout to list --- app/Http/Controllers/Api/AssetsController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index b88bac9df..4ccd4c760 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -282,7 +282,8 @@ class AssetsController extends Controller 'assets.name', 'assets.asset_tag', 'assets.model_id', - ]))->with('model')->RTD(); + 'assets.status_id' + ])->with('model', 'assetstatus')->NotArchived()); if ($request->has('search')) { @@ -300,6 +301,10 @@ class AssetsController extends Controller // they may not have a ->name value but we want to display something anyway foreach ($assets as $asset) { $asset->use_text = $asset->present()->fullName; + if ($asset->assetstatus->getStatuslabelType()=='pending') { + $asset->use_text = $asset->present()->fullName.' ('.$asset->assetstatus->getStatuslabelType().')'; + } + $asset->use_image = ($asset->getImageUrl()) ? $asset->getImageUrl() : null; } From 733921f1f92da58b2e3add440e96875f5afeb729 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 3 Nov 2017 12:17:41 -0700 Subject: [PATCH 11/13] Added optional required parameter --- resources/views/consumables/checkout.blade.php | 2 +- resources/views/partials/forms/edit/department-select.blade.php | 2 +- resources/views/partials/forms/edit/user-select.blade.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php index dc6ba5450..2c9ce7e07 100644 --- a/resources/views/consumables/checkout.blade.php +++ b/resources/views/consumables/checkout.blade.php @@ -38,7 +38,7 @@ @endif - @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to']) + @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true']) @if ($consumable->category->require_acceptance=='1')
diff --git a/resources/views/partials/forms/edit/department-select.blade.php b/resources/views/partials/forms/edit/department-select.blade.php index 8ade5b018..d68b9d625 100644 --- a/resources/views/partials/forms/edit/department-select.blade.php +++ b/resources/views/partials/forms/edit/department-select.blade.php @@ -2,7 +2,7 @@ {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} -
+
@if ($user_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))