Skip to content

A free open source IT asset/license management system

3.2 KB
Raw Blame
<!-- Location -->
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"{!!  (isset($style)) ? ' style="'.e($style).'"' : ''  !!}>

    <label for="{{ $fieldname }}" class="col-md-3 control-label">{{ $translated_name }}</label>
    <div class="col-md-7">
        <select class="js-data-ajax" data-endpoint="locations" data-placeholder="{{ trans('general.select_location') }}" name="{{ $fieldname }}" style="width: 100%" id="{{ $fieldname }}_location_select" aria-label="{{ $fieldname }}"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}{!!  ((isset($item)) && (Helper::checkIfRequired($item, $fieldname))) ? ' required ' : '' !!}{!! (!empty($company_id)) ? ' data-company-id="'.e($company_id).'"' : '' !!}{!! (!empty($exclude_id)) ? ' data-exclude-id="'.e($exclude_id).'"' : '' !!}>
            @isset($selected)
                @foreach($selected as $location_id)
                    <option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true"  role="option">
                        {{ (\App\Models\Location::find($location_id))->name }}
                    </option>
                @endforeach
            @endisset
            @if ($location_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
                <option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true"  role="option">
                    {{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }}
                </option>
            @endif
        </select>
    </div>

    <div class="col-md-1 col-sm-1 text-left">
        @can('create', \App\Models\Location::class)
            @if ((!isset($hide_new)) || ($hide_new!='true'))
            <x-button.modal-add type="location" :target="$fieldname.'_location_select'"/>
            @endif
        @endcan
    </div>

    <div class="col-md-8 col-md-offset-3"><x-form.error :name="$fieldname" /></div>

    @if ($snipeSettings->full_multiple_companies_support == '1' && $snipeSettings->scope_locations_fmcs == '1')
        @cannot('superadmin')
            <div class="col-md-7 col-md-offset-3">
                <p class="help-block"><x-icon type="tip" /> {{ trans('general.fmcs_location_select_note') }}</p>
            </div>
        @endcannot
    @endif

    @if (isset($help_text))
    <div class="col-md-7 col-sm-11 col-md-offset-3">
        <p class="help-block">{{ $help_text }}</p>
    </div>
    @endif

    @if (isset($hide_location_radio))
    <!-- Update actual location  -->
    <div class="form-group">
        <div class="col-md-9 col-md-offset-3">
            <label class="form-control">
                <input name="update_default_location" type="radio" value="1" checked="checked" aria-label="update_default_location" />
                {{ trans('admin/hardware/form.asset_location') }}
            </label>
            <label class="form-control">
                <input name="update_default_location" type="radio" value="0" aria-label="update_default_location" />
                {{ trans('admin/hardware/form.asset_location_update_default_current') }}
            </label>
        </div>
    </div> <!--/form-group-->
    @endif

</div>