Skip to content

Commit

Permalink
Added ability to turn items on/off in checkout-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 22, 2017
1 parent 3aaaea3 commit 980be65
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion resources/views/hardware/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
@include ('partials.forms.checkout-selector')
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])

@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'required'=>'true'])
@if ($asset->requireAcceptance())
Expand Down
9 changes: 5 additions & 4 deletions resources/views/hardware/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
@include ('partials.forms.edit.status')

@if (!$item->id)
@include ('partials.forms.checkout-selector', ['style' => 'display:none;'])
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true', 'style' => 'display:none;'])

@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_user', 'style' => 'display:none;'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_user', 'style' => 'display:none;', 'required' => 'false'])

@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;'])
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;', 'required' => 'false'])

@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_location', 'style' => 'display:none;'])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required' => 'false'])
@endif

@include ('partials.forms.edit.serial', ['translated_serial' => trans('admin/hardware/form.serial')])
Expand Down Expand Up @@ -146,6 +146,7 @@ function user_add(status_id) {
if (data == true) {
$("#assignto_selector").show();
$("#assigned_user").show();
$("#selected_status_status").removeClass('text-danger');
$("#selected_status_status").addClass('text-success');
Expand Down
8 changes: 3 additions & 5 deletions resources/views/licenses/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@
</div>
</div>

@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/licenses/form.asset'), 'fieldname' => 'asset_id'])
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'false'])

@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_to'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_to', 'required'=>'true'])

<p class="col-md-offset-3 help-block">
{{ trans('admin/licenses/form.checkout_help') }}
</p>
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/licenses/form.asset'), 'fieldname' => 'asset_id', 'style' => 'display:none;'])


<!-- Note -->
Expand Down
6 changes: 6 additions & 0 deletions resources/views/partials/forms/checkout-selector.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
{{ Form::label('name', trans('admin/hardware/form.checkout_to'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
<div class="btn-group" data-toggle="buttons">
@if ((isset($user_select)) && ($user_select!='false'))
<label class="btn btn-default active">
<input name="checkout_to_type" value="user" type="radio" selected><i class="fa fa-user"></i> {{ trans('general.user') }}
</label>
@endif
@if ((isset($asset_select)) && ($asset_select!='false'))
<label class="btn btn-default">
<input name="checkout_to_type" value="asset" type="radio"><i class="fa fa-barcode"></i> {{ trans('general.asset') }}
</label>
@endif
@if ((isset($location_select)) && ($location_select!='false'))
<label class="btn btn-default">
<input name="checkout_to_type" value="location" class="active" type="radio"><i class="fa fa-map-marker"></i> {{ trans('general.location') }}
</label>
@endif
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion resources/views/partials/forms/edit/asset-select.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Asset -->
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
<div id="assigned_asset" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
<select class="js-data-ajax select2" data-endpoint="hardware" name="{{ $fieldname }}" style="width: 100%" id="assigned_asset_select"{{ (isset($multiple)) ? ' multiple="multiple"' : '' }}>
Expand Down

0 comments on commit 980be65

Please sign in to comment.