mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Added more company_id filtering, more transformers
This commit is contained in:
parent
2986747fd7
commit
86198badbb
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api;
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Transformers\DatatablesTransformer;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
@ -16,11 +17,28 @@ class CompaniesController extends Controller
|
||||||
* @since [v4.0]
|
* @since [v4.0]
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('view', Company::class);
|
$this->authorize('view', Company::class);
|
||||||
$companies = Company::all();
|
|
||||||
return $companies;
|
$allowed_columns = ['id','name'];
|
||||||
|
|
||||||
|
$companies = Company::withCount('assets','licenses','accessories','consumables','components','users');
|
||||||
|
|
||||||
|
if ($request->has('search')) {
|
||||||
|
$companies->TextSearch($request->input('search'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset = $request->input('offset', 0);
|
||||||
|
$limit = $request->input('limit', 50);
|
||||||
|
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||||
|
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
|
||||||
|
$companies->orderBy($sort, $order);
|
||||||
|
|
||||||
|
$total = $companies->count();
|
||||||
|
$companies = $companies->skip($offset)->take($limit)->get();
|
||||||
|
return (new DatatablesTransformer)->transformDatatables($companies, $total);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,10 @@ class UsersController extends Controller
|
||||||
$users = $users->TextSearch($request->input('search'));
|
$users = $users->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->has('company_id')) {
|
||||||
|
$users = $users->where('company_id','=',$request->input('company_id'));
|
||||||
|
}
|
||||||
|
|
||||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||||
$offset = request('offset', 0);
|
$offset = request('offset', 0);
|
||||||
$limit = request('limit', 50);
|
$limit = request('limit', 50);
|
||||||
|
|
|
@ -66,10 +66,15 @@ class AssetsController extends Controller
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('index', Asset::class);
|
$this->authorize('index', Asset::class);
|
||||||
return View::make('hardware/index');
|
if ($request->has('company_id')) {
|
||||||
|
$company = Company::find($request->input('company_id'));
|
||||||
|
} else {
|
||||||
|
$company = null;
|
||||||
|
}
|
||||||
|
return View::make('hardware/index')->with('company',$company);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -137,4 +137,16 @@ final class CompaniesController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show($id) {
|
||||||
|
$this->authorize('view', Company::class);
|
||||||
|
|
||||||
|
if (is_null($company = Company::find($id))) {
|
||||||
|
return redirect()->route('companies.index')
|
||||||
|
->with('error', trans('admin/companies/message.not_found'));
|
||||||
|
} else {
|
||||||
|
return View::make('companies/view')->with('company',$company);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class AssetsTransformer
|
||||||
'created_at' => $asset->created_at,
|
'created_at' => $asset->created_at,
|
||||||
'purchase_date' => $asset->purchase_date,
|
'purchase_date' => $asset->purchase_date,
|
||||||
'purchase_cost' => $asset->purchase_cost,
|
'purchase_cost' => $asset->purchase_cost,
|
||||||
|
'can_checkout' => $asset->availableForCheckout(),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class UsersTransformer
|
||||||
'licenses_count' => $user->licenses_count,
|
'licenses_count' => $user->licenses_count,
|
||||||
'accessories_count' => $user->accessories_count,
|
'accessories_count' => $user->accessories_count,
|
||||||
'consumables_count' => $user->consumables_count,
|
'consumables_count' => $user->consumables_count,
|
||||||
|
'company' => ($user->company) ? ['id' => $user->company->id,'name'=> e($user->company->name)] : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
|
|
|
@ -21,13 +21,13 @@ class AssetPresenter extends Presenter
|
||||||
[
|
[
|
||||||
"field" => "checkbox",
|
"field" => "checkbox",
|
||||||
"checkbox" => true
|
"checkbox" => true
|
||||||
],[
|
], [
|
||||||
"field" => "id",
|
"field" => "id",
|
||||||
"searchable" => false,
|
"searchable" => false,
|
||||||
"sortable" => true,
|
"sortable" => true,
|
||||||
|
"switchable" => true,
|
||||||
"title" => trans('general.id'),
|
"title" => trans('general.id'),
|
||||||
"visible" => false,
|
"visible" => false
|
||||||
"formatter" => null
|
|
||||||
], [
|
], [
|
||||||
"field" => "company",
|
"field" => "company",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
@ -35,7 +35,7 @@ class AssetPresenter extends Presenter
|
||||||
"switchable" => true,
|
"switchable" => true,
|
||||||
"title" => trans('general.company'),
|
"title" => trans('general.company'),
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
"formatter" => "companiesLinkObjFormatter"
|
"formatter" => 'assetCompanyObjFilterFormatter'
|
||||||
], [
|
], [
|
||||||
"field" => "name",
|
"field" => "name",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
@ -138,6 +138,7 @@ class AssetPresenter extends Presenter
|
||||||
"sortable" => true,
|
"sortable" => true,
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
"title" => trans('general.order_number'),
|
"title" => trans('general.order_number'),
|
||||||
|
'formatter' => "orderNumberObjFilterFormatter"
|
||||||
], [
|
], [
|
||||||
"field" => "notes",
|
"field" => "notes",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
@ -158,6 +159,15 @@ class AssetPresenter extends Presenter
|
||||||
"formatter" => null ];
|
"formatter" => null ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$layout[] = [
|
||||||
|
"field" => "checkincheckout",
|
||||||
|
"searchable" => false,
|
||||||
|
"sortable" => false,
|
||||||
|
"switchable" => true,
|
||||||
|
"title" => 'Checkin/Checkout',
|
||||||
|
"formatter" => "hardwareInOutFormatter",
|
||||||
|
];
|
||||||
|
|
||||||
$layout[] = [
|
$layout[] = [
|
||||||
"field" => "actions",
|
"field" => "actions",
|
||||||
"searchable" => false,
|
"searchable" => false,
|
||||||
|
|
|
@ -33,11 +33,12 @@ class UserPresenter extends Presenter
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"field" => "id",
|
"field" => "id",
|
||||||
"searchable" => false,
|
"searchable" => true,
|
||||||
"sortable" => true,
|
"sortable" => true,
|
||||||
"switchable" => true,
|
"switchable" => true,
|
||||||
"title" => trans('general.id'),
|
"title" => trans('general.id'),
|
||||||
"visible" => false
|
"visible" => false,
|
||||||
|
"formatter" => null
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"field" => "company",
|
"field" => "company",
|
||||||
|
|
7
public/assets/js/FileSaver.min.js
vendored
Normal file
7
public/assets/js/FileSaver.min.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||||
|
var saveAs=saveAs||"undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(a){"use strict";if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var k=a.document,n=k.createElementNS("http://www.w3.org/1999/xhtml","a"),w="download"in n,x=function(c){var e=k.createEvent("MouseEvents");e.initMouseEvent("click",!0,!1,a,0,0,0,0,0,!1,!1,!1,!1,0,null);c.dispatchEvent(e)},q=a.webkitRequestFileSystem,u=a.requestFileSystem||q||a.mozRequestFileSystem,
|
||||||
|
y=function(c){(a.setImmediate||a.setTimeout)(function(){throw c;},0)},r=0,s=function(c){var e=function(){"string"===typeof c?(a.URL||a.webkitURL||a).revokeObjectURL(c):c.remove()};a.chrome?e():setTimeout(e,500)},t=function(c,a,d){a=[].concat(a);for(var b=a.length;b--;){var l=c["on"+a[b]];if("function"===typeof l)try{l.call(c,d||c)}catch(f){y(f)}}},m=function(c,e){var d=this,b=c.type,l=!1,f,p,k=function(){t(d,["writestart","progress","write","writeend"])},g=function(){if(l||!f)f=(a.URL||a.webkitURL||
|
||||||
|
a).createObjectURL(c);p?p.location.href=f:void 0==a.open(f,"_blank")&&"undefined"!==typeof safari&&(a.location.href=f);d.readyState=d.DONE;k();s(f)},h=function(a){return function(){if(d.readyState!==d.DONE)return a.apply(this,arguments)}},m={create:!0,exclusive:!1},v;d.readyState=d.INIT;e||(e="download");if(w)f=(a.URL||a.webkitURL||a).createObjectURL(c),n.href=f,n.download=e,x(n),d.readyState=d.DONE,k(),s(f);else{a.chrome&&b&&"application/octet-stream"!==b&&(v=c.slice||c.webkitSlice,c=v.call(c,0,
|
||||||
|
c.size,"application/octet-stream"),l=!0);q&&"download"!==e&&(e+=".download");if("application/octet-stream"===b||q)p=a;u?(r+=c.size,u(a.TEMPORARY,r,h(function(a){a.root.getDirectory("saved",m,h(function(a){var b=function(){a.getFile(e,m,h(function(a){a.createWriter(h(function(b){b.onwriteend=function(b){p.location.href=a.toURL();d.readyState=d.DONE;t(d,"writeend",b);s(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&g()};["writestart","progress","write","abort"].forEach(function(a){b["on"+
|
||||||
|
a]=d["on"+a]});b.write(c);d.abort=function(){b.abort();d.readyState=d.DONE};d.readyState=d.WRITING}),g)}),g)};a.getFile(e,{create:!1},h(function(a){a.remove();b()}),h(function(a){a.code===a.NOT_FOUND_ERR?b():g()}))}),g)}),g)):g()}},b=m.prototype;b.abort=function(){this.readyState=this.DONE;t(this,"abort")};b.readyState=b.INIT=0;b.WRITING=1;b.DONE=2;b.error=b.onwritestart=b.onprogress=b.onwrite=b.onabort=b.onerror=b.onwriteend=null;return function(a,b){return new m(a,b)}}}("undefined"!==typeof self&&
|
||||||
|
self||"undefined"!==typeof window&&window||this.content);"undefined"!==typeof module&&null!==module?module.exports=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
|
|
@ -43,13 +43,13 @@
|
||||||
if (!$export.length) {
|
if (!$export.length) {
|
||||||
$export = $([
|
$export = $([
|
||||||
'<div class="export btn-group">',
|
'<div class="export btn-group">',
|
||||||
'<button class="btn btn-default dropdown-toggle" ' +
|
'<button class="btn btn-default dropdown-toggle" ' +
|
||||||
'data-toggle="dropdown" type="button">',
|
'data-toggle="dropdown" type="button">',
|
||||||
'<i class="fa fa-download"></i> ',
|
'<i class="fa fa-download"></i> ',
|
||||||
'<span class="caret"></span>',
|
'<span class="caret"></span>',
|
||||||
'</button>',
|
'</button>',
|
||||||
'<ul class="dropdown-menu" role="menu">',
|
'<ul class="dropdown-menu" role="menu">',
|
||||||
'</ul>',
|
'</ul>',
|
||||||
'</div>'].join('')).appendTo($btnGroup);
|
'</div>'].join('')).appendTo($btnGroup);
|
||||||
|
|
||||||
var $menu = $export.find('.dropdown-menu'),
|
var $menu = $export.find('.dropdown-menu'),
|
||||||
|
@ -66,9 +66,9 @@
|
||||||
$.each(exportTypes, function (i, type) {
|
$.each(exportTypes, function (i, type) {
|
||||||
if (TYPE_NAME.hasOwnProperty(type)) {
|
if (TYPE_NAME.hasOwnProperty(type)) {
|
||||||
$menu.append(['<li data-type="' + type + '">',
|
$menu.append(['<li data-type="' + type + '">',
|
||||||
'<a href="javascript:void(0)">',
|
'<a href="javascript:void(0)">',
|
||||||
TYPE_NAME[type],
|
TYPE_NAME[type],
|
||||||
'</a>',
|
'</a>',
|
||||||
'</li>'].join(''));
|
'</li>'].join(''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
17003
public/assets/js/jspdf.min.js
vendored
Normal file
17003
public/assets/js/jspdf.min.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
public/assets/js/jspdf.plugin.autotable.js
Normal file
10
public/assets/js/jspdf.plugin.autotable.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,68 +2,75 @@
|
||||||
|
|
||||||
{{-- Page title --}}
|
{{-- Page title --}}
|
||||||
@section('title')
|
@section('title')
|
||||||
{{ trans('admin/companies/table.companies') }}
|
{{ trans('general.companies') }}
|
||||||
@parent
|
@parent
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('header_right')
|
@section('header_right')
|
||||||
<a href="{{ route('companies.create') }}" class="btn btn-primary pull-right">
|
<a href="{{ route('companies.create') }}" class="btn btn-primary pull-right">
|
||||||
{{ trans('general.create') }}</a>
|
{{ trans('general.create') }}</a>
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
{{-- Page content --}}
|
{{-- Page content --}}
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-md-9">
|
||||||
<div class="col-md-9">
|
<div class="box box-default">
|
||||||
<div class="box box-default">
|
<div class="box-body">
|
||||||
<div class="box-body">
|
<div class="table-responsive">
|
||||||
<div class="table-responsive">
|
<table
|
||||||
<table class="table table-striped" name="companies">
|
name="companies"
|
||||||
<thead>
|
class="table table-striped snipe-table"
|
||||||
|
id="table"
|
||||||
|
data-url="{{ route('api.companies.index') }}"
|
||||||
|
data-cookie="true"
|
||||||
|
data-click-to-select="true"
|
||||||
|
data-cookie-id-table="companiesTable-{{ config('version.hash_version') }}">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-1">{{ trans('general.id') }}</th>
|
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||||
<th class="col-md-9">{{ trans('admin/companies/table.name') }}</th>
|
<th data-sortable="true" data-formatter="companiesLinkFormatter" data-field="name" data-searchable="true">{{ trans('admin/companies/table.name') }}</th>
|
||||||
<th class="col-md-2">{{ trans('table.actions') }}</th>
|
<th data-sortable="false" data-field="users_count" data-formatter="usersCompanyObjFilterFormatter" data-searchable="false">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-users"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.users') }}</span></th>
|
||||||
|
<th data-sortable="false" data-field="assets_count" data-searchable="false" data-formatter="assetCompanyFilterFormatter">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-barcode"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.assets') }}</span></th>
|
||||||
|
</th>
|
||||||
|
<th data-sortable="false" data-field="licenses_count" data-searchable="false">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-floppy-o"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.licenses') }}</span></th>
|
||||||
|
</th>
|
||||||
|
<th data-sortable="false" data-field="accessories_count" data-searchable="false">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-keyboard-o"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.accessories') }}</span></th>
|
||||||
|
</th>
|
||||||
|
<th data-sortable="false" data-field="consumables_count" data-searchable="false">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-tint"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.consumables') }}</span></th>
|
||||||
|
</th>
|
||||||
|
<th data-sortable="false" data-field="components_count" data-searchable="false">
|
||||||
|
<span class="hidden-xs"><i class="fa fa-hdd-o"></i></span>
|
||||||
|
<span class="hidden-md hidden-lg">{{ trans('general.users') }}</span></th>
|
||||||
|
</th>
|
||||||
|
<th data-switchable="false" data-formatter="companiesActionsFormatter" data-searchable="false" data-sortable="false" data-field="actions">{{ trans('table.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
</table>
|
||||||
<tbody>
|
</div>
|
||||||
@foreach ($companies as $company)
|
</div>
|
||||||
<tr>
|
</div>
|
||||||
<td>{{ $company->id }}</td>
|
|
||||||
<td>{{ $company->name }}</td>
|
|
||||||
<td>
|
|
||||||
<form method="POST" action="{{ route('companies.destroy', $company->id) }}" role="form">
|
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
|
|
||||||
|
|
||||||
<a href="{{ route('companies.edit', $company->id) }}" class="btn btn-sm btn-warning"
|
|
||||||
title="{{ trans('button.edit') }}">
|
|
||||||
<i class="fa fa-pencil icon-white"></i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-danger" title="{{ trans('button.delete') }}">
|
|
||||||
<i class="fa fa-trash icon-white"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div><!-- /.box-body -->
|
|
||||||
</div><!-- /.box -->
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- side address column -->
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h4>About Companies</h4>
|
||||||
|
<p>
|
||||||
|
You can use companies as a simple informative field, or you can use them to restrict asset visibility and availability to users with a specific company by enabling Full Company Support in your Admin Settings.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- side address column -->
|
@stop
|
||||||
<div class="col-md-3">
|
|
||||||
<h4>About Companies</h4>
|
@section('moar_scripts')
|
||||||
<p>
|
@include ('partials.bootstrap-table', ['exportFile' => 'companies-export', 'search' => true])
|
||||||
You can use companies as a simple placeholder, or you can use them to restrict asset visibility and availability to users with a specific company.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
157
resources/views/companies/view.blade.php
Normal file
157
resources/views/companies/view.blade.php
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
@extends('layouts/default')
|
||||||
|
|
||||||
|
{{-- Page title --}}
|
||||||
|
@section('title')
|
||||||
|
{{ $company->name }}
|
||||||
|
@parent
|
||||||
|
@stop
|
||||||
|
|
||||||
|
{{-- Page content --}}
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="nav-tabs-custom">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
|
||||||
|
|
||||||
|
<li class="active">
|
||||||
|
<a href="#asset_tab" 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>
|
||||||
|
<a href="#licenses_tab" 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>
|
||||||
|
<a href="#accessories_tab" data-toggle="tab">
|
||||||
|
<span class="hidden-lg hidden-md">
|
||||||
|
<i class="fa fa-keyboard-o"></i>
|
||||||
|
</span> <span class="hidden-xs hidden-sm">{{ trans('general.accessories') }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#consumables_tab" data-toggle="tab">
|
||||||
|
<span class="hidden-lg hidden-md">
|
||||||
|
<i class="fa fa-tint"></i></span>
|
||||||
|
<span class="hidden-xs hidden-sm">{{ trans('general.consumables') }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane" id="asset_tab">
|
||||||
|
<!-- checked out assets table -->
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table
|
||||||
|
name="companyAssets"
|
||||||
|
class="table table-striped snipe-table"
|
||||||
|
id="table"
|
||||||
|
data-url="{{route('api.assets.index',['company_id' => $company->id]) }}"
|
||||||
|
data-cookie="true"
|
||||||
|
data-click-to-select="true"
|
||||||
|
data-cookie-id-table="lcompanyAssetsTable-{{ config('version.hash_version') }}">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||||
|
<th data-sortable="true" data-formatter="locationsLinkFormatter" data-field="name" data-searchable="true">{{ trans('admin/locations/table.name') }}</th>
|
||||||
|
<th data-sortable="true" data-field="parent">{{ trans('admin/locations/table.parent') }}</th>
|
||||||
|
<th data-searchable="false" data-sortable="false" data-field="assets_default">{{ trans('admin/locations/table.assets_rtd') }}</th>
|
||||||
|
<th data-searchable="false" data-sortable="false" data-field="assets_checkedout">{{ trans('admin/locations/table.assets_checkedout') }}</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="currency">{{ App\Models\Setting::first()->default_currency }}</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="address">{{ trans('admin/locations/table.address') }}</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="city">{{ trans('admin/locations/table.city') }}
|
||||||
|
</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="state">
|
||||||
|
{{ trans('admin/locations/table.state') }}
|
||||||
|
</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="zip">
|
||||||
|
{{ trans('admin/locations/table.zip') }}
|
||||||
|
</th>
|
||||||
|
<th data-searchable="true" data-sortable="true" data-field="country">
|
||||||
|
{{ trans('admin/locations/table.country') }}</th>
|
||||||
|
<th data-switchable="false" data-formatter="locationsActionsFormatter" data-searchable="false" data-sortable="false" data-field="actions">{{ trans('table.actions') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!-- /asset_tab -->
|
||||||
|
|
||||||
|
<div class="tab-pane" id="licenses_tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="display table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-5">{{ trans('general.name') }}</th>
|
||||||
|
<th class="col-md-6">{{ trans('admin/hardware/form.serial') }}</th>
|
||||||
|
<th class="col-md-1 hidden-print">{{ trans('general.action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!-- /licenses-tab -->
|
||||||
|
|
||||||
|
<div class="tab-pane" id="accessories_tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="display table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-5">Name</th>
|
||||||
|
<th class="col-md-1 hidden-print">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!-- /accessories-tab -->
|
||||||
|
|
||||||
|
<div class="tab-pane" id="consumables_tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="display table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-8">{{ trans('general.name') }}</th>
|
||||||
|
<th class="col-md-4">{{ trans('general.date') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!-- /consumables-tab -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div><!-- /.tab-content -->
|
||||||
|
</div><!-- nav-tabs-custom -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@stop
|
||||||
|
@section('moar_scripts')
|
||||||
|
@include ('partials.bootstrap-table', ['exportFile' => 'companies-export', 'search' => true])
|
||||||
|
|
||||||
|
@stop
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
@section('title0')
|
@section('title0')
|
||||||
|
|
||||||
|
@if ((Input::get('company_id')) && ($company))
|
||||||
|
{{ $company->name }}
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@if (Input::get('status'))
|
@if (Input::get('status'))
|
||||||
@if (Input::get('status')=='Pending')
|
@if (Input::get('status')=='Pending')
|
||||||
{{ trans('general.pending') }}
|
{{ trans('general.pending') }}
|
||||||
|
@ -22,6 +28,10 @@
|
||||||
{{ trans('general.all') }}
|
{{ trans('general.all') }}
|
||||||
@endif
|
@endif
|
||||||
{{ trans('general.assets') }}
|
{{ trans('general.assets') }}
|
||||||
|
|
||||||
|
@if (Input::has('order_number'))
|
||||||
|
: Order #{{ Input::get('order_number') }}
|
||||||
|
@endif
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
{{-- Page title --}}
|
{{-- Page title --}}
|
||||||
|
@ -64,8 +74,11 @@
|
||||||
data-toolbar="#toolbar"
|
data-toolbar="#toolbar"
|
||||||
class="table table-striped snipe-table"
|
class="table table-striped snipe-table"
|
||||||
id="table"
|
id="table"
|
||||||
data-url="{{route('api.assets.index', array('status' => e(Input::get('status')),'order_number'=>e(Input::get('order_number')), 'status_id'=>e(Input::get('status_id'))))}}"
|
data-url="{{ route('api.assets.index',
|
||||||
data-cookie="true"
|
array('status' => e(Input::get('status')),
|
||||||
|
'order_number'=>e(Input::get('order_number')),
|
||||||
|
'company_id'=>e(Input::get('company_id')),
|
||||||
|
'status_id'=>e(Input::get('status_id'))))}}"
|
||||||
data-click-to-select="true"
|
data-click-to-select="true"
|
||||||
data-cookie-id-table="{{ e(Input::get('status')) }}assetTable-{{ config('version.hash_version') }}">
|
data-cookie-id-table="{{ e(Input::get('status')) }}assetTable-{{ config('version.hash_version') }}">
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
<script src="{{ asset('assets/js/extensions/export/bootstrap-table-export.js?v=1') }}"></script>
|
<script src="{{ asset('assets/js/extensions/export/bootstrap-table-export.js?v=1') }}"></script>
|
||||||
<script src="{{ asset('assets/js/extensions/cookie/bootstrap-table-cookie.js?v=1') }}"></script>
|
<script src="{{ asset('assets/js/extensions/cookie/bootstrap-table-cookie.js?v=1') }}"></script>
|
||||||
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
|
<script src="{{ asset('assets/js/extensions/export/tableExport.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/FileSaver.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/jspdf.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/jspdf.plugin.autotable.js') }}"></script>
|
||||||
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
|
<script src="{{ asset('assets/js/extensions/export/jquery.base64.js') }}"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('.snipe-table').bootstrapTable({
|
$('.snipe-table').bootstrapTable({
|
||||||
classes: 'table table-responsive table-no-bordered',
|
classes: 'table table-responsive table-no-bordered',
|
||||||
|
@ -32,10 +36,22 @@ $('.snipe-table').bootstrapTable({
|
||||||
showColumns: true,
|
showColumns: true,
|
||||||
trimOnSearch: false,
|
trimOnSearch: false,
|
||||||
exportDataType: 'all',
|
exportDataType: 'all',
|
||||||
exportTypes: ['csv', 'excel', 'txt','json', 'xml'],
|
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
fileName: '{{ $exportFile . "-" }}' + (new Date()).toISOString().slice(0,10),
|
fileName: '{{ $exportFile . "-" }}' + (new Date()).toISOString().slice(0,10),
|
||||||
ignoreColumn: ['actions','change','checkbox']
|
ignoreColumn: ['actions','change','checkbox','checkincheckout'],
|
||||||
|
worksheetName: "Snipe-IT Export",
|
||||||
|
jspdf: {
|
||||||
|
autotable: {
|
||||||
|
styles: {
|
||||||
|
rowHeight: 20,
|
||||||
|
fontSize: 10,
|
||||||
|
overflow: 'linebreak',
|
||||||
|
},
|
||||||
|
headerStyles: {fillColor: 255, textColor: 0},
|
||||||
|
//alternateRowStyles: {fillColor: [60, 69, 79], textColor: 255}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
maintainSelected: true,
|
maintainSelected: true,
|
||||||
paginationFirstText: "{{ trans('general.first') }}",
|
paginationFirstText: "{{ trans('general.first') }}",
|
||||||
|
@ -111,12 +127,16 @@ $('.snipe-table').bootstrapTable({
|
||||||
|
|
||||||
function genericCheckinCheckoutFormatter(destination) {
|
function genericCheckinCheckoutFormatter(destination) {
|
||||||
return function (value,row) {
|
return function (value,row) {
|
||||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.id + '/edit" class="btn btn-sm btn-warning"><i class="fa fa-pencil"></i></a> '
|
if (row.can_checkout === true) {
|
||||||
+ '<a data-html="false" class="btn delete-asset btn-danger btn-sm" ' +
|
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm btn-primary">{{ trans('general.checkout') }}</a>';
|
||||||
+ 'data-toggle="modal" href="" data-content="Are you sure you wish to delete this?" '
|
} else if (((row.can_checkout === false)) && (row.assigned_to == null)) {
|
||||||
+ 'data-title="{{ trans('general.delete') }}?" onClick="return false;">'
|
return '<a class="btn btn-sm btn-primary disabled">{{ trans('general.checkout') }}</a>';
|
||||||
+ '<i class="fa fa-trash"></i></a></nobr>';
|
} else {
|
||||||
};
|
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkin" class="btn btn-sm btn-primary">{{ trans('general.checkin') }}</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,6 +164,7 @@ $('.snipe-table').bootstrapTable({
|
||||||
window[formatters[i] + 'LinkFormatter'] = genericRowLinkFormatter(formatters[i]);
|
window[formatters[i] + 'LinkFormatter'] = genericRowLinkFormatter(formatters[i]);
|
||||||
window[formatters[i] + 'LinkObjFormatter'] = genericColumnObjLinkFormatter(formatters[i]);
|
window[formatters[i] + 'LinkObjFormatter'] = genericColumnObjLinkFormatter(formatters[i]);
|
||||||
window[formatters[i] + 'ActionsFormatter'] = genericActionsFormatter(formatters[i]);
|
window[formatters[i] + 'ActionsFormatter'] = genericActionsFormatter(formatters[i]);
|
||||||
|
window[formatters[i] + 'InOutFormatter'] = genericCheckinCheckoutFormatter(formatters[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,7 +190,34 @@ $('.snipe-table').bootstrapTable({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function imageFormatter(value, row) {
|
function assetCompanyFilterFormatter(value, row) {
|
||||||
|
if (value) {
|
||||||
|
return '<a href="{{ url('/') }}/hardware/?company_id=' + row.id + '"> ' + value + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function assetCompanyObjFilterFormatter(value, row) {
|
||||||
|
if (row.company) {
|
||||||
|
return '<a href="{{ url('/') }}/hardware/?company_id=' + row.company.id + '"> ' + row.company.name + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function usersCompanyObjFilterFormatter(value, row) {
|
||||||
|
if (value) {
|
||||||
|
return '<a href="{{ url('/') }}/users/?company_id=' + row.id + '"> ' + value + '</a>';
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function orderNumberObjFilterFormatter(value, row) {
|
||||||
|
if (value) {
|
||||||
|
return '<a href="{{ url('/') }}/hardware/?order_number=' + row.order_number + '"> ' + row.order_number + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function imageFormatter(value, row) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return '<img src="' + value + '" height="50" width="50">';
|
return '<img src="' + value + '" height="50" width="50">';
|
||||||
}
|
}
|
||||||
|
@ -184,4 +232,6 @@ $('.snipe-table').bootstrapTable({
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
@can('delete', \App\Models\User::class)
|
@can('delete', \App\Models\User::class)
|
||||||
<div id="toolbar">
|
<div id="toolbar">
|
||||||
<select name="bulk_actions" class="form-control select2" style="width: 200px;">
|
<select name="bulk_actions" class="form-control select2" style="width: 200px;">
|
||||||
<option value="delete">Bulk Checkin & Delete</option>
|
<option value="delete">Bulk Checkin &amp; Delete</option>
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" id="bulkEdit" disabled>Go</button>
|
<button class="btn btn-default" id="bulkEdit" disabled>Go</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,7 +63,8 @@
|
||||||
id="table"
|
id="table"
|
||||||
data-maintain-selected="true"
|
data-maintain-selected="true"
|
||||||
data-toggle="table"
|
data-toggle="table"
|
||||||
data-url="{{ route('api.users.index', array(''=>e(Input::get('status')))) }}"
|
data-url="{{ route('api.users.index',
|
||||||
|
array(''=>e(Input::get('status')),'company_id'=>e(Input::get('company_id')))) }}"
|
||||||
data-cookie="true"
|
data-cookie="true"
|
||||||
data-click-to-select="true"
|
data-click-to-select="true"
|
||||||
data-cookie-id-table="userTableDisplay-{{ config('version.hash_version') }}">
|
data-cookie-id-table="userTableDisplay-{{ config('version.hash_version') }}">
|
||||||
|
|
Loading…
Reference in a new issue