Component checkout/checkin fixes.

- Provide proper translated messages for checkin vs checkout
- Pass appropriate methods to the Checkout event, fixes an error on
checkin.
- Default to a value of 1 on checkin in UI to save a click sometimes.
This commit is contained in:
Daniel Meltzer 2020-04-29 12:50:09 -04:00
parent c34650458f
commit 358609720a
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
2 changed files with 5 additions and 4 deletions

View file

@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
use App\Models\Asset; use App\Models\Asset;
use App\Models\Component; use App\Models\Component;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
@ -96,12 +97,12 @@ class ComponentCheckinController extends Controller
$asset = Asset::find($component_assets->asset_id); $asset = Asset::find($component_assets->asset_id);
event(new CheckoutableCheckedIn($component, $asset, Auth::user(), $request->input('note'))); event(new CheckoutableCheckedIn($component, $asset, Auth::user(), $request->input('note'), Carbon::now()));
return redirect()->route('components.index')->with('success', return redirect()->route('components.index')->with('success',
trans('admin/components/message.checkout.success')); trans('admin/components/message.checkin.success'));
} }
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found')); return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
} }
} }

View file

@ -42,7 +42,7 @@
<label for="assigned_qty" class="col-md-3 control-label">{{ trans('general.qty') }} <label for="assigned_qty" class="col-md-3 control-label">{{ trans('general.qty') }}
<i class='icon-asterisk'></i></label> <i class='icon-asterisk'></i></label>
<div class="col-md-9"> <div class="col-md-9">
<input class="form-control" type="text" name="assigned_qty" id="assigned_qty" style="width: 70px;" value="{{ old('assigned_qty') }}" /> <input class="form-control" type="text" name="assigned_qty" id="assigned_qty" style="width: 70px;" value="{{ old('assigned_qty') ?? 1 }}" />
{!! $errors->first('assigned_qty', '<br><span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('assigned_qty', '<br><span class="alert-msg" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>