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:
Daniel Meltzer 2020-05-12 14:36:14 -04:00
parent 1321304720
commit a6f90cb3fc
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
5 changed files with 8 additions and 7 deletions

View file

@ -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');
}
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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>

View file

@ -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'
]);