mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Assorted licenses UI fixes while testing.
* Rename licenses route checkin parameter to clarify it's purpose and fix incorrect route in users view page. * Checkin note can be nullable for checking in a license. * License Seat view was only showing 20 license seats due to faulty transformer logic.
This commit is contained in:
parent
1321304720
commit
a6f90cb3fc
|
@ -21,12 +21,12 @@ class CheckoutableCheckedIn
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($checkoutable, $checkedOutTo, User $checkedInBy, $note, $action_date)
|
||||
public function __construct($checkoutable, $checkedOutTo, User $checkedInBy, $note, $action_date = null)
|
||||
{
|
||||
$this->checkoutable = $checkoutable;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->checkedInBy = $checkedInBy;
|
||||
$this->note = $note;
|
||||
$this->action_date = $action_date;
|
||||
$this->action_date = $action_date ?? date('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,10 +245,12 @@ class LicensesController extends Controller
|
|||
$offset = (($seats) && (request('offset') > $seats->count())) ? 0 : request('offset', 0);
|
||||
$limit = request('limit', 50);
|
||||
|
||||
$total = $seats->count();
|
||||
|
||||
$seats = $seats->skip($offset)->take($limit)->get();
|
||||
|
||||
if ($seats) {
|
||||
return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $seats->count());
|
||||
return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $total);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,8 +69,7 @@ class LicenseCheckinController extends Controller
|
|||
|
||||
// Declare the rules for the form validation
|
||||
$rules = [
|
||||
'note' => 'string',
|
||||
'notes' => 'string',
|
||||
'note' => 'string|nullable',
|
||||
];
|
||||
|
||||
// Create a new validator instance from our validation rules
|
||||
|
|
|
@ -417,7 +417,7 @@
|
|||
</td>
|
||||
<td class="hidden-print">
|
||||
@can('update', $license)
|
||||
<a href="{{ route('licenses.checkin', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm hidden-print">{{ trans('general.checkin') }}</a>
|
||||
<a href="{{ route('licenses.checkin', array('licenseSeatId'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm hidden-print">{{ trans('general.checkin') }}</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -18,7 +18,7 @@ Route::group([ 'prefix' => 'licenses', 'middleware' => ['auth'] ], function () {
|
|||
'{licenseId}/checkout/{seatId?}',
|
||||
[ 'as' => 'licenses.checkout', 'uses' => 'Licenses\LicenseCheckoutController@store' ]
|
||||
);
|
||||
Route::get('{licenseId}/checkin/{backto?}', [
|
||||
Route::get('{licenseSeatId}/checkin/{backto?}', [
|
||||
'as' => 'licenses.checkin',
|
||||
'uses' => 'Licenses\LicenseCheckinController@create'
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue