diff --git a/app/Http/Controllers/Components/ComponentCheckinController.php b/app/Http/Controllers/Components/ComponentCheckinController.php index 09acee0277..49199aa6d2 100644 --- a/app/Http/Controllers/Components/ComponentCheckinController.php +++ b/app/Http/Controllers/Components/ComponentCheckinController.php @@ -56,10 +56,11 @@ class ComponentCheckinController extends Controller * @return \Illuminate\Http\RedirectResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ - public function store(Request $request, $component_asset_id) + public function store(Request $request, $component_asset_id, $backto = null) { if ($component_assets = DB::table('components_assets')->find($component_asset_id)) { if (is_null($component = Component::find($component_assets->component_id))) { + return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found')); } @@ -95,6 +96,10 @@ class ComponentCheckinController extends Controller $asset = Asset::find($component_assets->asset_id); event(new CheckoutableCheckedIn($component, $asset, Auth::user(), $request->input('note'), Carbon::now())); + if($backto == 'asset'){ + return redirect()->route('hardware.view', $asset->id)->with('success', + trans('admin/components/message.checkin.success')); + } return redirect()->route('components.index')->with('success', trans('admin/components/message.checkin.success')); diff --git a/resources/views/components/checkin.blade.php b/resources/views/components/checkin.blade.php index 6a7055f727..e195685d2a 100644 --- a/resources/views/components/checkin.blade.php +++ b/resources/views/components/checkin.blade.php @@ -17,7 +17,7 @@
-
+ {{csrf_field()}}
diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index d1afaefcb2..7609feb35f 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -1030,6 +1030,8 @@ {{ trans('general.qty') }} {{ trans('general.purchase_cost') }} {{trans('admin/hardware/form.serial')}} + {{trans('general.checkin')}} + @@ -1044,6 +1046,9 @@ {{ $component->pivot->assigned_qty }} {{ Helper::formatCurrencyOutput($component->purchase_cost) }} each {{ $component->serial }} + + {{ trans('general.checkin') }} + purchase_cost *$component->pivot->assigned_qty) ?>