mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -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
|
* @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->checkoutable = $checkoutable;
|
||||||
$this->checkedOutTo = $checkedOutTo;
|
$this->checkedOutTo = $checkedOutTo;
|
||||||
$this->checkedInBy = $checkedInBy;
|
$this->checkedInBy = $checkedInBy;
|
||||||
$this->note = $note;
|
$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);
|
$offset = (($seats) && (request('offset') > $seats->count())) ? 0 : request('offset', 0);
|
||||||
$limit = request('limit', 50);
|
$limit = request('limit', 50);
|
||||||
|
|
||||||
|
$total = $seats->count();
|
||||||
|
|
||||||
$seats = $seats->skip($offset)->take($limit)->get();
|
$seats = $seats->skip($offset)->take($limit)->get();
|
||||||
|
|
||||||
if ($seats) {
|
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
|
// Declare the rules for the form validation
|
||||||
$rules = [
|
$rules = [
|
||||||
'note' => 'string',
|
'note' => 'string|nullable',
|
||||||
'notes' => 'string',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Create a new validator instance from our validation rules
|
// Create a new validator instance from our validation rules
|
||||||
|
|
|
@ -417,7 +417,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-print">
|
<td class="hidden-print">
|
||||||
@can('update', $license)
|
@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
|
@endcan
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -18,7 +18,7 @@ Route::group([ 'prefix' => 'licenses', 'middleware' => ['auth'] ], function () {
|
||||||
'{licenseId}/checkout/{seatId?}',
|
'{licenseId}/checkout/{seatId?}',
|
||||||
[ 'as' => 'licenses.checkout', 'uses' => 'Licenses\LicenseCheckoutController@store' ]
|
[ 'as' => 'licenses.checkout', 'uses' => 'Licenses\LicenseCheckoutController@store' ]
|
||||||
);
|
);
|
||||||
Route::get('{licenseId}/checkin/{backto?}', [
|
Route::get('{licenseSeatId}/checkin/{backto?}', [
|
||||||
'as' => 'licenses.checkin',
|
'as' => 'licenses.checkin',
|
||||||
'uses' => 'Licenses\LicenseCheckinController@create'
|
'uses' => 'Licenses\LicenseCheckinController@create'
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue