Skip to content

Commit

Permalink
Fixes #432 - add model name to checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Jan 22, 2015
1 parent d85e524 commit 95141d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
9 changes: 5 additions & 4 deletions app/controllers/admin/LicensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ public function getCheckout($seatId)
// Left join to get a list of assets and some other helpful info
$asset = DB::table('assets')
->leftJoin('users', 'users.id', '=', 'assets.assigned_to')
->select('assets.id', 'name', 'first_name', 'last_name','asset_tag',
DB::raw('concat (first_name," ",last_name) as full_name, assets.id as id'))
->leftJoin('models', 'assets.model_id', '=', 'models.id')
->select('assets.id', 'assets.name', 'first_name', 'last_name','asset_tag',
DB::raw('concat (first_name," ",last_name) as full_name, assets.id as id, models.name as modelname'))
->whereNull('assets.deleted_at')
->get();

Expand All @@ -389,9 +390,9 @@ public function getCheckout($seatId)
for ($x=0; $x<count($asset_array); $x++) {

if ($asset_array[$x]['full_name']!='') {
$full_name = ' ('.$asset_array[$x]['full_name'].')';
$full_name = ' ('.$asset_array[$x]['full_name'].') '.$asset_array[$x]['modelname'];
} else {
$full_name = ' (Unassigned)';
$full_name = ' (Unassigned) '.$asset_array[$x]['modelname'];
}
$asset_element[$asset_array[$x]['id']] = $asset_array[$x]['asset_tag'].' - '.$asset_array[$x]['name'].$full_name;

Expand Down
11 changes: 11 additions & 0 deletions app/views/backend/hardware/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
</div>
@endif

@if ($asset->model->name)
<!-- Asset name -->
<div class="form-group">
<label class="col-sm-2 control-label">@lang('admin/hardware/form.model')</label>
<div class="col-md-6">
<p class="form-control-static">{{{ $asset->model->name }}}</p>
</div>
</div>
@endif


<!-- User -->

<div class="form-group {{ $errors->has('assigned_to') ? ' has-error' : '' }}">
Expand Down
10 changes: 5 additions & 5 deletions app/views/backend/licenses/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
<div class="form-group">
<label class="col-sm-2 control-label">@lang('admin/hardware/form.name')</label>
<div class="col-md-6">
<p class="form-control-static">{{ $licenseseat->license->name }}</p>
<p class="form-control-static">{{{ $licenseseat->license->name }}}</p>
</div>
</div>

<!-- Serial -->
<div class="form-group">
<label class="col-sm-2 control-label">@lang('admin/hardware/form.serial')</label>
<div class="col-md-6">
<p class="form-control-static">{{ $licenseseat->license->serial }}</p>
<div class="col-md-10">
<p class="form-control-static" style="word-wrap: break-word;">{{{ $licenseseat->license->serial }}}</p>
</div>
</div>

Expand All @@ -48,8 +48,8 @@
<label for="asset_id" class="col-md-2 control-label">@lang('admin/licenses/form.asset')
</label>

<div class="col-md-9">
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $licenseseat->asset_id), array('class'=>'select2', 'style'=>'min-width:350px')) }}
<div class="col-md-10">
{{ Form::select('asset_id', $asset_list , Input::old('asset_id', $licenseseat->asset_id), array('class'=>'select2', 'style'=>'min-width:600px')) }}
{{ $errors->first('asset_id', '<span class="alert-msg"><i class="icon-remove-sign"></i> :message</span>') }}
</div>
</div>
Expand Down

0 comments on commit 95141d4

Please sign in to comment.