mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Merge pull request #13704 from Godmartinz/feature/sc-23571_v2
Added a check-in button on components tab of Asset view
This commit is contained in:
commit
cd3b4754e8
|
@ -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'));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="row">
|
||||
<!-- left column -->
|
||||
<div class="col-md-7">
|
||||
<form class="form-horizontal" method="post" action="{{ route('components.checkin.store', $component_assets->id) }}" autocomplete="off">
|
||||
<form class="form-horizontal" method="post" action="{{ route('components.checkin.store', [$component_assets->id, 'backto' => 'asset']) }}" autocomplete="off">
|
||||
{{csrf_field()}}
|
||||
|
||||
<div class="box box-default">
|
||||
|
|
|
@ -1030,6 +1030,8 @@
|
|||
<th>{{ trans('general.qty') }}</th>
|
||||
<th>{{ trans('general.purchase_cost') }}</th>
|
||||
<th>{{trans('admin/hardware/form.serial')}}</th>
|
||||
<th>{{trans('general.checkin')}}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $totalCost = 0; ?>
|
||||
|
@ -1044,6 +1046,9 @@
|
|||
<td>{{ $component->pivot->assigned_qty }}</td>
|
||||
<td>{{ Helper::formatCurrencyOutput($component->purchase_cost) }} each</td>
|
||||
<td>{{ $component->serial }}</td>
|
||||
<td>
|
||||
<a href="{{ route('components.checkin.show', $component->pivot->id) }}" class="btn btn-sm bg-purple" data-tooltip="true">{{ trans('general.checkin') }}</a>
|
||||
</td>
|
||||
|
||||
<?php $totalCost = $totalCost + ($component->purchase_cost *$component->pivot->assigned_qty) ?>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue