Merge branch 'develop'

This commit is contained in:
snipe 2018-01-10 06:25:06 -08:00
commit 3566f37981
7 changed files with 179 additions and 58 deletions

View file

@ -122,6 +122,11 @@ class AssetsController extends Controller
$assets->where('assets.supplier_id', '=', $request->input('supplier_id')); $assets->where('assets.supplier_id', '=', $request->input('supplier_id'));
} }
if (($request->has('assigned_to')) && ($request->has('assigned_type'))) {
$assets->where('assets.assigned_to', '=', $request->input('assigned_to'))
->where('assets.assigned_type', '=', $request->input('assigned_type'));
}
if ($request->has('company_id')) { if ($request->has('company_id')) {
$assets->where('assets.company_id', '=', $request->input('company_id')); $assets->where('assets.company_id', '=', $request->input('company_id'));
} }
@ -243,7 +248,8 @@ class AssetsController extends Controller
$assets->orderBy($column_sort, $order); $assets->orderBy($column_sort, $order);
break; break;
} }
$total = $assets->count(); $total = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get(); $assets = $assets->skip($offset)->take($limit)->get();
return (new AssetsTransformer)->transformAssets($assets, $total); return (new AssetsTransformer)->transformAssets($assets, $total);

View file

@ -31,6 +31,10 @@ class ComponentsController extends Controller
$components = $components->TextSearch($request->input('search')); $components = $components->TextSearch($request->input('search'));
} }
if ($request->has('company_id')) {
$components->where('company_id','=',$request->input('company_id'));
}
$offset = request('offset', 0); $offset = request('offset', 0);
$limit = request('limit', 50); $limit = request('limit', 50);

View file

@ -480,6 +480,11 @@ class UsersController extends Controller
if ($request->has('company_id')) { if ($request->has('company_id')) {
$update_array['company_id'] = $request->input('company_id'); $update_array['company_id'] = $request->input('company_id');
} }
if ($request->has('locale')) {
$update_array['locale'] = $request->input('locale');
}
if ($request->has('manager_id')) { if ($request->has('manager_id')) {

View file

@ -49,6 +49,23 @@
</a> </a>
</li> </li>
<li>
<a href="#components_tab" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="fa fa-hdd-o"></i></span>
<span class="hidden-xs hidden-sm">{{ trans('general.components') }}</span>
</a>
</li>
<li>
<a href="#users_tab" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="fa fa-users"></i></span>
<span class="hidden-xs hidden-sm">{{ trans('general.people') }}</span>
</a>
</li>
</ul> </ul>
@ -61,53 +78,44 @@
name="companyAssets" name="companyAssets"
class="table table-striped snipe-table" class="table table-striped snipe-table"
id="table" id="table"
data-search="true"
data-url="{{route('api.assets.index',['company_id' => $company->id]) }}" data-url="{{route('api.assets.index',['company_id' => $company->id]) }}"
data-export-file="{{ str_slug($company->name) }}-assets"
data-cookie="true" data-cookie="true"
data-cookie-id-table="companyAssetsTable-{{ config('version.hash_version') }}"> data-cookie-id-table="companyAssetsTable"
<thead> data-show-footer="true"
<tr> data-columns="{{ \App\Presenters\AssetPresenter::dataTableLayout() }}">
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-sortable="true" data-formatter="hardwareLinkFormatter" data-field="name" data-searchable="true">{{ trans('admin/hardware/form.name') }}</th>
<th data-sortable="true" data-field="image" data-visible="true" data-formatter="imageFormatter">{{ trans('general.image') }}</th>
<th data-searchable="false" data-formatter="modelsLinkObjFormatter" data-sortable="false" data-field="model">{{ trans('admin/hardware/form.model') }}</th>
<th data-searchable="false" data-sortable="false" data-field="asset_tag">{{ trans('admin/hardware/form.tag') }}</th>
<th data-searchable="false" data-sortable="false" data-field="serial">{{ trans('admin/hardware/form.serial') }}</th>
<th data-searchable="false" data-sortable="false" data-formatter="hardwareInOutFormatter" data-field="checkincheckout">Checkin/Checkout</th>
<th data-searchable="false" data-sortable="false" data-field="actions" data-formatter="hardwareActionsFormatter">{{ trans('general.action') }}</th>
</tr>
</thead>
</table> </table>
</div> </div>
</div><!-- /asset_tab --> </div><!-- /asset_tab -->
<div class="tab-pane" id="licenses_tab"> <div class="tab-pane" id="licenses_tab">
<div class="table-responsive"> <div class="table-responsive">
<table class="display table table-hover"> <table
<thead> name="companyLicenses"
<tr> class="table table-striped snipe-table"
<th class="col-md-5">{{ trans('general.name') }}</th> id="companyLicenses"
<th class="col-md-6">{{ trans('admin/hardware/form.serial') }}</th> data-url="{{route('api.licenses.index',['company_id' => $company->id]) }}"
<th class="col-md-1 hidden-print">{{ trans('general.action') }}</th> data-cookie="true"
</tr> data-export-file="{{ str_slug($company->name) }}-licenses"
</thead> data-cookie-id-table="companyLicenses"
<tbody> data-columns="{{ \App\Presenters\LicensePresenter::dataTableLayout() }}">
</tbody>
</table> </table>
</div> </div>
</div><!-- /licenses-tab --> </div><!-- /licenses-tab -->
<div class="tab-pane" id="accessories_tab"> <div class="tab-pane" id="accessories_tab">
<div class="table-responsive"> <div class="table-responsive">
<table class="display table table-hover"> <table
<thead> name="companyAccessories"
<tr> class="table table-striped snipe-table"
<th class="col-md-5">Name</th> id="companyAccessories"
<th class="col-md-1 hidden-print">Actions</th> data-url="{{route('api.accessories.index',['company_id' => $company->id]) }}"
</tr> data-cookie="true"
</thead> data-export-file="{{ str_slug($company->name) }}-accessories"
<tbody> data-cookie-id-table="companyAccessories"
data-columns="{{ \App\Presenters\AccessoryPresenter::dataTableLayout() }}">
</tbody> </tbody>
</table> </table>
</div> </div>
@ -115,23 +123,54 @@
<div class="tab-pane" id="consumables_tab"> <div class="tab-pane" id="consumables_tab">
<div class="table-responsive"> <div class="table-responsive">
<table class="display table table-striped"> <table
<thead> name="companyConsumables"
<tr> class="table table-striped snipe-table"
<th class="col-md-8">{{ trans('general.name') }}</th> id="companyConsumables"
<th class="col-md-4">{{ trans('general.date') }}</th> data-url="{{route('api.consumables.index',['company_id' => $company->id]) }}"
</tr> data-cookie="true"
</thead> data-export-file="{{ str_slug($company->name) }}-consumables"
<tbody> data-cookie-id-table="companyConsumables"
data-columns="{{ \App\Presenters\ConsumablePresenter::dataTableLayout() }}">
</tbody>
</table> </table>
</div> </div>
</div><!-- /consumables-tab --> </div><!-- /consumables-tab -->
<div class="tab-pane" id="components_tab">
<div class="table-responsive">
<table
name="companyComponents"
data-search="true"
class="table table-striped snipe-table"
id="companyUsers"
data-url="{{route('api.components.index',['company_id' => $company->id]) }}"
data-cookie="true"
data-export-file="{{ str_slug($company->name) }}-components"
data-cookie-id-table="companyComponents"
data-columns="{{ \App\Presenters\ComponentPresenter::dataTableLayout() }}">
</table>
</div>
</div><!-- /consumables-tab -->
<div class="tab-pane" id="users_tab">
<div class="table-responsive">
<table
name="companyUsers"
data-search="true"
class="table table-striped snipe-table"
id="companyUsers"
data-url="{{route('api.users.index',['company_id' => $company->id]) }}"
data-cookie="true"
data-export-file="{{ str_slug($company->name) }}-users"
data-cookie-id-table="companyUsers"
data-columns="{{ \App\Presenters\UserPresenter::dataTableLayout() }}">
</table>
</div>
</div><!-- /consumables-tab -->
</div><!-- /.tab-content --> </div><!-- /.tab-content -->
</div><!-- nav-tabs-custom --> </div><!-- nav-tabs-custom -->
</div> </div>
@ -139,7 +178,7 @@
@stop @stop
@section('moar_scripts') @section('moar_scripts')
@include ('partials.bootstrap-table', ['exportFile' => 'companies-export', 'search' => true]) @include ('partials.bootstrap-table')
@stop @stop

View file

@ -105,9 +105,15 @@
@section('moar_scripts') @section('moar_scripts')
<script nonce="{{ csrf_token() }}"> <script nonce="{{ csrf_token() }}">
var transformed_oldvals={};
function fetchCustomFields() { function fetchCustomFields() {
//save custom field choices
var oldvals = $('#custom_fields_content').find('input,select').serializeArray();
for(var i in oldvals) {
transformed_oldvals[oldvals[i].name]=oldvals[i].value;
}
var modelid = $('#model_select_id').val(); var modelid = $('#model_select_id').val();
if (modelid == '') { if (modelid == '') {
$('#custom_fields_content').html(""); $('#custom_fields_content').html("");
@ -123,8 +129,15 @@
_token: "{{ csrf_token() }}", _token: "{{ csrf_token() }}",
dataType: 'html', dataType: 'html',
success: function (data) { success: function (data) {
data: data,
$('#custom_fields_content').html(data); $('#custom_fields_content').html(data);
$('#custom_fields_content select').select2(); //enable select2 on any custom fields that are select-boxes
//now re-populate the custom fields based on the previously saved values
$('#custom_fields_content').find('input,select').each(function (index,elem) {
if(transformed_oldvals[elem.name]) {
$(elem).val(transformed_oldvals[elem.name]).trigger('change'); //the trigger is for select2-based objects, if we have any
}
});
} }
}); });
} }

View file

@ -56,16 +56,19 @@
<a href="#details" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-info-circle"></i></span> <span class="hidden-xs hidden-sm">Details</span></a> <a href="#details" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-info-circle"></i></span> <span class="hidden-xs hidden-sm">Details</span></a>
</li> </li>
<li> <li>
<a href="#software" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-floppy-o"></i></span> <span class="hidden-xs hidden-sm">Licenses</span></a> <a href="#software" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-floppy-o"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.licenses') }}</span></a>
</li> </li>
<li> <li>
<a href="#components" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-hdd-o"></i></span> <span class="hidden-xs hidden-sm">Components</span></a> <a href="#components" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-hdd-o"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.components') }}</span></a>
</li>
<li>
<a href="#assets" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-barcode"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.assets') }}</span></a>
</li> </li>
<li> <li>
<a href="#maintenances" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-wrench"></i></span> <span class="hidden-xs hidden-sm">Maintenances</span></a> <a href="#maintenances" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-wrench"></i></span> <span class="hidden-xs hidden-sm">Maintenances</span></a>
</li> </li>
<li> <li>
<a href="#history" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-history"></i></span> <span class="hidden-xs hidden-sm">History</span></a> <a href="#history" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-history"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.history') }}</span></a>
</li> </li>
<li> <li>
<a href="#files" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-files-o"></i></span> <span class="hidden-xs hidden-sm">Files</span></a> <a href="#files" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-files-o"></i></span> <span class="hidden-xs hidden-sm">Files</span></a>
@ -531,6 +534,47 @@
</div> </div>
</div> <!-- /.tab-pane components --> </div> <!-- /.tab-pane components -->
<div class="tab-pane fade" id="assets">
<div class="row">
<div class="col-md-12">
{{ Form::open([
'method' => 'POST',
'route' => ['hardware/bulkedit'],
'class' => 'form-inline',
'id' => 'bulkForm']) }}
<div id="toolbar">
<select name="bulk_actions" class="form-control select2" style="300px;">
<option value="edit">Edit</option>
<option value="delete">Delete</option>
<option value="labels">Generate Labels</option>
</select>
<button class="btn btn-primary" id="bulkEdit" disabled>Go</button>
</div>
<!-- checked out assets table -->
<div class="table-responsive">
<table
name="assetAssets"
data-toolbar="#toolbar"
class="table table-striped snipe-table"
id="assetAssets"
data-search="false"
data-url="{{route('api.assets.index',['assigned_to' => $asset->id, 'assigned_type' => 'App\Models\Asset']) }}"
data-export-options='{"fileName": "asset-assets"}'
data-cookie="true"
data-show-footer="true"
data-cookie-id-table="assetAssetsTable"
data-columns="{{ \App\Presenters\AssetPresenter::dataTableLayout() }}">
</table>
{{ Form::close() }}
</div>
</div><!-- /col -->
</div> <!-- row -->
</div> <!-- /.tab-pane software -->
<div class="tab-pane fade" id="maintenances"> <div class="tab-pane fade" id="maintenances">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -616,16 +660,17 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<table <table
class="table table-striped snipe-table"
name="asset-history" name="asset-history"
id="table" id="asset-history"
class="table table-striped snipe-table" class="table table-striped snipe-table"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="asset-history"
data-sort-order="desc" data-sort-order="desc"
data-show-columns="true" data-show-columns="true"
data-search="true" data-search="true"
data-cookie="true"
data-show-refresh="true" data-show-refresh="true"
data-cookie-id-table="asset-history" data-id-table="asset-history"
data-url="{{ route('api.activity.index', ['item_id' => $asset->id, 'item_type' => 'asset']) }}"> data-url="{{ route('api.activity.index', ['item_id' => $asset->id, 'item_type' => 'asset']) }}">
<thead> <thead>
<tr> <tr>
@ -639,7 +684,7 @@
@if ($snipeSettings->require_accept_signature=='1') @if ($snipeSettings->require_accept_signature=='1')
<th class="col-md-3" data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th> <th class="col-md-3" data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
@endif @endif
<th class="col-sm-2" data-field="log_meta" data-visible="false" data-formatter="changeLogFormatter">Changed</th> <th class="col-sm-2" data-field="log_meta" data-visible="true" data-formatter="changeLogFormatter">Changed</th>
</tr> </tr>
</thead> </thead>
</table> </table>
@ -736,7 +781,7 @@
@stop @stop
@section('moar_scripts') @section('moar_scripts')
@include ('partials.bootstrap-table', ['simple_view' => true]) @include ('partials.bootstrap-table')
<script nonce="{{ csrf_token() }}"> <script nonce="{{ csrf_token() }}">
$(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) { $(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {

View file

@ -46,6 +46,15 @@
<!-- Manager --> <!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id']) @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
<!-- language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
<div class="col-md-8">
{!! Form::locales('locale', Input::old('locale', $user->locale), 'select2') !!}
{!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- activated --> <!-- activated -->
<div class="form-group"> <div class="form-group">
<div class="col-sm-3 control-label"> <div class="col-sm-3 control-label">