Compare commits

...

17 Commits

Author SHA1 Message Date
snipe
c3d834cb9d Re-adding scope
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:16:40 +01:00
snipe
4e52aa7e12 Removed the wrong method lol
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:15:40 +01:00
snipe
4e97eac13c Dev assets
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:12:10 +01:00
snipe
b7ba48c589 Remove unused method
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
9a2403b4a1 Refactor for more logging, switch to use the components
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
14f95033a8 Consumables history table
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
cca52a1e70 Use target *or* item
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
93a809ecaf Added history count badge, use blade component
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
28051d82c2 Create history table component
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
91265184a7 Added translations
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
b91971961b Find targetlogs
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
52d0fcc802 Fixed user file uploads > 1
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
2f1b7ec8c1 Added created by
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
3f74b6cc72 Fixed doofy export filename
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
a455f82474 Prod assets
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:07:12 +01:00
snipe
d450847754 Comment out location scoping option for now
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:06:48 +01:00
snipe
737ddb173f Prod assets
Signed-off-by: snipe <snipe@snipe.net>
2025-04-18 04:06:47 +01:00
21 changed files with 399 additions and 348 deletions

View File

@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Transformers\ActionlogsTransformer;
use App\Models\Actionlog;
use App\Models\Location;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
@@ -26,22 +28,22 @@ class ReportsController extends Controller
$actionlogs = $actionlogs->TextSearch(e($request->input('search')));
}
if (($request->filled('target_type')) && ($request->filled('target_id'))) {
$actionlogs = $actionlogs->where('target_id', '=', $request->input('target_id'))
->where('target_type', '=', 'App\\Models\\'.ucwords($request->input('target_type')));
// If we want allll the logs
if (($request->filled('id')) && ($request->filled('type'))) {
$actionlogs = $actionlogs->ByTargetOrItem($request->input('id'), $request->input('type'));
}
// We've passed a target
if (($request->filled('target_type')) && ($request->filled('target_id'))) {
$actionlogs = $actionlogs->where('target_id', '=', $request->input('target_id'))
->where('target_type', '=', 'App\\Models\\' . ucwords($request->input('target_type')));
}
// We've passed an item
if (($request->filled('item_type')) && ($request->filled('item_id'))) {
$actionlogs = $actionlogs->where(function($query) use ($request)
{
$query->where('item_id', '=', $request->input('item_id'))
->where('item_type', '=', 'App\\Models\\'.ucwords($request->input('item_type')))
->orWhere(function($query) use ($request)
{
$query->where('target_id', '=', $request->input('item_id'))
->where('target_type', '=', 'App\\Models\\'.ucwords($request->input('item_type')));
});
});
$actionlogs = $actionlogs->where('item_id', '=', $request->input('item_id'))
->where('item_type', '=', 'App\\Models\\'.ucwords($request->input('item_type')));
}
if ($request->filled('action_type')) {

View File

@@ -26,12 +26,14 @@ class UserFilesController extends Controller
{
$this->authorize('update', $user);
$files = $request->file('file');
$errors = 0;
if (is_null($files)) {
return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles'));
}
foreach ($files as $file) {
$file_name = $request->handleFile('private_uploads/users/', 'user-'.$user->id, $file);
$file_name = $request->handleFile('private_uploads/users/', 'user-' . $user->id, $file);
//Log the uploaded file to the log
$logAction = new Actionlog();
@@ -39,18 +41,25 @@ class UserFilesController extends Controller
$logAction->item_type = User::class;
$logAction->created_by = auth()->id();
$logAction->note = $request->input('notes');
$logAction->target_id = null;
$logAction->created_at = date("Y-m-d H:i:s");
$logAction->target_type = User::class;
$logAction->target_id = $user->id;
$logAction->action_date = date("Y-m-d H:i:s");
$logAction->filename = $file_name;
$logAction->action_source = 'gui';
$logAction->user_agent = request()->header('User-Agent');
$logAction->remote_ip = request()->ip();
$logAction->action_type = 'uploaded';
if (! $logAction->save()) {
return JsonResponse::create(['error' => 'Failed validation: '.print_r($logAction->getErrors(), true)], 500);
if (!$logAction->save()) {
$errors++;
}
return redirect()->back()->withFragment('files')->with('success', trans('admin/users/message.upload.success'));
}
if ($errors > 0) {
return redirect()->back()->withFragment('files')->with('warning', 'Some files could not be uploaded');
}
return redirect()->back()->withFragment('files')->with('success', trans('admin/users/message.upload.success'));
}

View File

@@ -66,6 +66,7 @@ class LogListener
$logaction->note = $event->acceptance->note;
$logaction->action_type = 'accepted';
$logaction->action_date = $event->acceptance->accepted_at;
$logaction->created_by = auth()->user()->id;
// TODO: log the actual license seat that was checked out
if ($event->acceptance->checkoutable instanceof LicenseSeat) {
@@ -84,6 +85,7 @@ class LogListener
$logaction->note = $event->acceptance->note;
$logaction->action_type = 'declined';
$logaction->action_date = $event->acceptance->declined_at;
$logaction->created_by = auth()->user()->id;
// TODO: log the actual license seat that was checked out
if ($event->acceptance->checkoutable instanceof LicenseSeat) {

View File

@@ -454,4 +454,20 @@ class Actionlog extends SnipeModel
{
return $query->leftJoin('users as admin_sort', 'action_logs.created_by', '=', 'admin_sort.id')->select('action_logs.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
}
public function scopeByTargetOrItem($query, $id, $type) {
return $query->where(function($query) use ($id, $type)
{
$query->where('item_id', '=', $id)
->where('item_type', '=', 'App\\Models\\'.ucwords($type));
})
->orWhere(function($query) use ($id, $type)
{
$query->where('target_id', '=', $id)
->where('target_type', '=', 'App\\Models\\'.ucwords($type));
});
}
}

View File

@@ -487,6 +487,13 @@ class Asset extends Depreciable
->orderBy('created_at', 'desc');
}
public function targetLogs()
{
return $this->hasMany('\App\Models\Actionlog', 'target_id')
->where('target_type', '=', Asset::class)
->orderBy('created_at', 'desc');
}
/**
* Determines whether the asset is checked out to a user
*

View File

@@ -4,7 +4,6 @@ namespace App\Observers;
use App\Models\Accessory;
use App\Models\Actionlog;
use Illuminate\Support\Facades\Auth;
class AccessoryObserver
{
@@ -16,12 +15,43 @@ class AccessoryObserver
*/
public function updated(Accessory $accessory)
{
$attributes = $accessory->getAttributes();
$attributesOriginal = $accessory->getRawOriginal();
$restoring_or_deleting = false;
// This is a gross hack to prevent the double logging when restoring an asset
if (array_key_exists('deleted_at', $attributes) && array_key_exists('deleted_at', $attributesOriginal)){
$restoring_or_deleting = (($attributes['deleted_at'] != $attributesOriginal['deleted_at']));
}
if (!$restoring_or_deleting) {
$changed = [];
foreach ($accessory->getRawOriginal() as $key => $value) {
if ((array_key_exists($key, $accessory->getAttributes())) && ($accessory->getRawOriginal()[$key] != $accessory->getAttributes()[$key])) {
$changed[$key]['old'] = $accessory->getRawOriginal()[$key];
$changed[$key]['new'] = $accessory->getAttributes()[$key];
}
}
}
if (empty($changed)){
return;
}
$logAction = new Actionlog();
$logAction->item_type = Accessory::class;
$logAction->item_id = $accessory->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
}
/**
@@ -38,6 +68,8 @@ class AccessoryObserver
$logAction->item_id = $accessory->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
if($accessory->imported) {
$logAction->setActionSource('importer');
}
@@ -56,6 +88,7 @@ class AccessoryObserver
$logAction->item_type = Accessory::class;
$logAction->item_id = $accessory->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('delete');
}

View File

@@ -5,7 +5,6 @@ namespace App\Observers;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\Setting;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
class AssetObserver
@@ -52,7 +51,7 @@ class AssetObserver
$changed[$key]['old'] = $asset->getRawOriginal()[$key];
$changed[$key]['new'] = $asset->getAttributes()[$key];
}
}
}
if (empty($changed)){
return;

View File

@@ -4,7 +4,6 @@ namespace App\Observers;
use App\Models\Actionlog;
use App\Models\Component;
use Illuminate\Support\Facades\Auth;
class ComponentObserver
{
@@ -16,11 +15,37 @@ class ComponentObserver
*/
public function updated(Component $component)
{
$attributes = $component->getAttributes();
$attributesOriginal = $component->getRawOriginal();
$restoring_or_deleting = false;
// This is a gross hack to prevent the double logging when restoring an asset
if (array_key_exists('deleted_at', $attributes) && array_key_exists('deleted_at', $attributesOriginal)){
$restoring_or_deleting = (($attributes['deleted_at'] != $attributesOriginal['deleted_at']));
}
if (!$restoring_or_deleting) {
$changed = [];
foreach ($component->getRawOriginal() as $key => $value) {
if ((array_key_exists($key, $component->getAttributes())) && ($component->getRawOriginal()[$key] != $component->getAttributes()[$key])) {
$changed[$key]['old'] = $component->getRawOriginal()[$key];
$changed[$key]['new'] = $component->getAttributes()[$key];
}
}
}
if (empty($changed)){
return;
}
$logAction = new Actionlog();
$logAction->item_type = Component::class;
$logAction->item_id = $component->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
}
@@ -38,6 +63,7 @@ class ComponentObserver
$logAction->item_id = $component->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
if($component->imported) {
$logAction->setActionSource('importer');
}
@@ -57,6 +83,7 @@ class ComponentObserver
$logAction->item_id = $component->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->logaction('delete');
}
}

View File

@@ -4,7 +4,6 @@ namespace App\Observers;
use App\Models\Actionlog;
use App\Models\Consumable;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
@@ -19,25 +18,38 @@ class ConsumableObserver
public function updated(Consumable $consumable)
{
$changed = [];
foreach ($consumable->getRawOriginal() as $key => $value) {
// Check and see if the value changed
if ($consumable->getRawOriginal()[$key] != $consumable->getAttributes()[$key]) {
$changed[$key]['old'] = $consumable->getRawOriginal()[$key];
$changed[$key]['new'] = $consumable->getAttributes()[$key];
$attributes = $consumable->getAttributes();
$attributesOriginal = $consumable->getRawOriginal();
$restoring_or_deleting = false;
// This is a gross hack to prevent the double logging when restoring an asset
if (array_key_exists('deleted_at', $attributes) && array_key_exists('deleted_at', $attributesOriginal)){
$restoring_or_deleting = (($attributes['deleted_at'] != $attributesOriginal['deleted_at']));
}
if (!$restoring_or_deleting) {
$changed = [];
foreach ($consumable->getRawOriginal() as $key => $value) {
if ((array_key_exists($key, $consumable->getAttributes())) && ($consumable->getRawOriginal()[$key] != $consumable->getAttributes()[$key])) {
$changed[$key]['old'] = $consumable->getRawOriginal()[$key];
$changed[$key]['new'] = $consumable->getAttributes()[$key];
}
}
}
if (count($changed) > 0) {
$logAction = new Actionlog();
$logAction->item_type = Consumable::class;
$logAction->item_id = $consumable->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
if (empty($changed)){
return;
}
$logAction = new Actionlog();
$logAction->item_type = Consumable::class;
$logAction->item_id = $consumable->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
}
/**

View File

@@ -4,7 +4,6 @@ namespace App\Observers;
use App\Models\Actionlog;
use App\Models\License;
use Illuminate\Support\Facades\Auth;
class LicenseObserver
{
@@ -16,11 +15,39 @@ class LicenseObserver
*/
public function updated(License $license)
{
$attributes = $license->getAttributes();
$attributesOriginal = $license->getRawOriginal();
$restoring_or_deleting = false;
// This is a gross hack to prevent the double logging when restoring an asset
if (array_key_exists('deleted_at', $attributes) && array_key_exists('deleted_at', $attributesOriginal)){
$restoring_or_deleting = (($attributes['deleted_at'] != $attributesOriginal['deleted_at']));
}
if (!$restoring_or_deleting) {
$changed = [];
foreach ($license->getRawOriginal() as $key => $value) {
if ((array_key_exists($key, $license->getAttributes())) && ($license->getRawOriginal()[$key] != $license->getAttributes()[$key])) {
$changed[$key]['old'] = $license->getRawOriginal()[$key];
$changed[$key]['new'] = $license->getAttributes()[$key];
}
}
}
if (empty($changed)){
return;
}
$logAction = new Actionlog();
$logAction->item_type = License::class;
$logAction->item_id = $license->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
}
@@ -38,6 +65,7 @@ class LicenseObserver
$logAction->item_id = $license->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
if($license->imported) {
$logAction->setActionSource('importer');
}
@@ -57,6 +85,7 @@ class LicenseObserver
$logAction->item_id = $license->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->logaction('delete');
}
}

View File

@@ -2,8 +2,8 @@
"/js/build/app.js": "/js/build/app.js?id=607de09b70b83ef82a427e4b36341682",
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=06c13e817cc022028b3f4a33c0ca303a",
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=79aa889a1a6691013be6c342ca7391cd",
"/css/build/overrides.css": "/css/build/overrides.css?id=f13e3ea204d73f94d3a448bef8e42fdc",
"/css/build/app.css": "/css/build/app.css?id=4ad0f7a9e40f2dc2f191454b0c5fa697",
"/css/build/overrides.css": "/css/build/overrides.css?id=95567897762fdc429b1dba7f536fc5e6",
"/css/build/app.css": "/css/build/app.css?id=910fd122e36ad81638f79e4813e4bce7",
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=4ea0068716c1bb2434d87a16d51b98c9",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=ea22079836a432d7f46a5d390c445e13",
@@ -19,7 +19,7 @@
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=a82b065847bf3cd5d713c04ee8dc86c6",
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=6ea836d8126de101081c49abbdb89417",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb",
"/css/dist/all.css": "/css/dist/all.css?id=e3039439091c414e7ce77471bcad921c",
"/css/dist/all.css": "/css/dist/all.css?id=e7a4652b5674820210772aa4a7a85c19",
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",

View File

@@ -574,6 +574,8 @@ return [
'user_managed_passwords' => 'Password Management',
'user_managed_passwords_disallow' => 'Disallow users from managing their own passwords',
'user_managed_passwords_allow' => 'Allow users to manage their own passwords',
'created_at_tooltip' => 'The date the record was created in the database. This is usually the same as the Date column, but may sometimes be different',
'action_date_tooltip' => 'This is usually the same as the Created At column, but may sometimes be different if an action was pre or post-dated',
'from' => 'From',
'by' => 'By',

View File

@@ -31,27 +31,33 @@
</a>
</li>
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="history" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}</span>
</a>
</li>
@can('accessories.files', $accessory)
@if ($accessory->assetlog->count() >= 0 )
<li>
<a href="#files" data-toggle="tab">
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="files" class="fa-2x" />
<i class="far fa-history fa-2x" aria-hidden="true"></i>
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.file_uploads') }}
{!! ($accessory->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($accessory->uploads->count()).'</badge>' : '' !!}
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}
{!! ($accessory->assetlog->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($accessory->assetlog->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
@can('accessories.files', $accessory)
@if ($accessory->uploads->count() > 0 )
<li>
<a href="#files" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="files" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.file_uploads') }}
{!! ($accessory->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($accessory->uploads->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
@endcan
@can('update', $accessory)
@@ -102,45 +108,13 @@
<!-- history tab pane -->
<div class="tab-pane fade" id="history">
<div class="table-responsive">
<div class="row">
<div class="col-md-12">
<table
class="table table-striped snipe-table"
data-cookie-id-table="AccessoryHistoryTable"
data-id-table="AccessoryHistoryTable"
id="AccessoryHistoryTable"
data-pagination="true"
data-show-columns="true"
data-side-pagination="server"
data-show-refresh="true"
data-show-export="true"
data-sort-order="desc"
data-export-options='{
"fileName": "export-{{ str_slug($accessory->name) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'
data-url="{{ route('api.activity.index', ['item_id' => $accessory->id, 'item_type' => 'accessory']) }}">
<thead>
<tr>
<th class="col-sm-2" data-visible="false" data-sortable="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.record_created') }}</th>
<th class="col-sm-2"data-visible="true" data-sortable="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="note">{{ trans('general.notes') }}</th>
<th class="col-sm-2" data-visible="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
@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>
@endif
</tr>
</thead>
</table>
</div> <!-- /.col-md-12-->
</div> <!-- /.row-->
</div><!--tab history-->
<x-historytable
filepath="private_uploads/accessories/"
showfile_routename="show.accessoryfile"
object_type="accessory"
:object="$accessory" />
</div>

View File

@@ -25,7 +25,7 @@
data-sort-name="name"
class="table table-striped snipe-table"
data-export-options='{
"fileName": "export-license-uploads-{{ str_slug($object->name) }}-{{ date('Y-m-d') }}",
"fileName": "export-uploads-{{ str_slug($object->name) }}-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","delete","download","icon"]
}'>

View File

@@ -0,0 +1,85 @@
<!-- begin redirect submit options -->
@props([
'filepath',
'object',
'object_type',
'showfile_routename',
])
<!-- begin non-ajaxed file listing table -->
<div class="table-responsive">
<table
data-cookie-id-table="{{ $object_type }}HistoryTable"
data-id-table="{{ $object_type }}HistoryTable"
id="{{ $object_type }}HistoryTable"
data-search="true"
data-pagination="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
data-show-export="true"
data-show-footer="true"
data-toolbar="#history-toolbar"
data-show-refresh="true"
data-sort-order="asc"
data-sort-name="name"
data-url="{{ route('api.activity.index', ['id' => $object->id, 'type' => $object_type]) }}"
class="table table-striped snipe-table"
data-export-options='{
"fileName": "export-history-{{ str_slug($object->name) }}-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","delete","download","icon"]
}'>
<thead>
<tr>
<th data-visible="true" data-field="icon" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter">
{{ trans('admin/hardware/table.icon') }}
</th>
<th data-visible="true" data-tooltip="true" title="{{ trans('general.created_at_tooltip') }}" data-field="created_at" data-sortable="true" data-formatter="dateDisplayFormatter">
{{ trans('general.created_at') }}
</th>
<th data-visible="true" data-tooltip="true" title="{{ trans('general.action_date_tooltip') }}" data-field="action_date" data-sortable="true" data-formatter="dateDisplayFormatter">
{{ trans('general.date') }}
</th>
<th data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">
{{ trans('general.created_by') }}
</th>
<th data-visible="true" data-field="action_type">
{{ trans('general.action') }}
</th>
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">
{{ trans('general.file_name') }}
</th>
<th data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">
{{ trans('general.item') }}
</th>
<th data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">
{{ trans('general.target') }}
</th>
<th data-field="note">
{{ trans('general.notes') }}
</th>
<th data-field="signature_file" data-visible="false" data-formatter="imageFormatter">
{{ trans('general.signature') }}
</th>
<th data-visible="false" data-field="file" data-visible="false" data-formatter="fileUploadFormatter">
{{ trans('general.download') }}
</th>
<th data-field="log_meta" data-visible="true" data-formatter="changeLogFormatter">
{{ trans('admin/hardware/table.changed')}}
</th>
<th data-field="remote_ip" data-visible="false" data-sortable="true">
{{ trans('admin/settings/general.login_ip') }}
</th>
<th data-field="user_agent" data-visible="false" data-sortable="true">
{{ trans('admin/settings/general.login_user_agent') }}
</th>
<th data-field="action_source" data-visible="false" data-sortable="true">
{{ trans('general.action_source') }}
</th>
</tr>
</thead>
</table>
</div>
<!-- end non-ajaxed file listing table -->

View File

@@ -8,46 +8,6 @@
@parent
@stop
{{-- Right header --}}
@section('header_right')
@can('manage', $component)
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu22">
@if ($component->assigned_to != '')
@can('checkin', $component)
<li role="menuitem">
<a href="{{ route('components.checkin.show', $component->id) }}">
{{ trans('admin/components/general.checkin') }}
</a>
</li>
@endcan
@else
@can('checkout', $component)
<li role="menuitem">
<a href="{{ route('components.checkout.show', $component->id) }}">
{{ trans('admin/components/general.checkout') }}
</a>
</li>
@endcan
@endif
@can('update', $component)
<li role="menuitem">
<a href="{{ route('components.edit', $component->id) }}">
{{ trans('admin/components/general.edit') }}
</a>
</li>
@endcan
</ul>
</div>
@endcan
@stop
{{-- Page content --}}
@section('content')
{{-- Page content --}}
@@ -87,6 +47,21 @@
</a>
</li>
@endcan
@if ($component->assetlog->count() >= 0 )
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="far fa-history fa-2x" aria-hidden="true"></i>
</span>
<span class="hidden-xs hidden-sm">
{{ trans('general.history') }}
{!! ($component->assetlog->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($component->assetlog->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
</ul>
<div class="tab-content">
@@ -152,6 +127,18 @@
</div> <!-- /.tab-pane -->
@endcan
<!-- history tab pane -->
<div class="tab-pane fade" id="history">
<x-historytable
filepath="private_uploads/components/"
showfile_routename="show.componentfile"
object_type="component"
:object="$component" />
</div>
</div>
</div>
</div> <!-- .col-md-9-->

View File

@@ -60,16 +60,18 @@
</li>
@endcan
<li>
<a href="#history" data-toggle="tab">
@if ($consumable->assetlog->count() >= 0 )
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="fas fa-history fa-2x" aria-hidden="true"></i>
<i class="far fa-history fa-2x" aria-hidden="true"></i>
</span>
<span class="hidden-xs hidden-sm">
{{ trans('general.history') }}
</span>
</a>
</li>
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}
{!! ($consumable->assetlog->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($consumable->assetlog->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
@can('update', $consumable)
<li class="pull-right">
@@ -445,49 +447,13 @@
</div><!--/FILES-->
<div class="tab-pane" id="history">
<div class="table-responsive">
<table
class="table table-striped snipe-table"
id="consumableHistory"
data-pagination="true"
data-id-table="consumableHistory"
data-search="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
data-show-refresh="true"
data-sort-order="desc"
data-sort-name="created_at"
data-show-export="true"
data-export-options='{
"fileName": "export-consumable-{{ $consumable->id }}-history",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'
<x-historytable
filepath="private_uploads/consumables/"
showfile_routename="show.consumablefile"
object_type="consumable"
:object="$consumable" />
data-url="{{ route('api.activity.index', ['item_id' => $consumable->id, 'item_type' => 'consumable']) }}"
data-cookie-id-table="assetHistory"
data-cookie="true">
<thead>
<tr>
<th data-visible="true" data-field="icon" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter">{{ trans('admin/hardware/table.icon') }}</th>
<th data-visible="true" data-field="action_date" data-sortable="true" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>
<th data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th data-field="note">{{ trans('general.notes') }}</th>
<th data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
<th data-visible="false" data-field="file" data-visible="false" data-formatter="fileUploadFormatter">{{ trans('general.download') }}</th>
<th data-field="log_meta" data-visible="true" data-formatter="changeLogFormatter">{{ trans('admin/hardware/table.changed')}}</th>
<th data-field="remote_ip" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_ip') }}</th>
<th data-field="user_agent" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_user_agent') }}</th>
<th data-field="action_source" data-visible="false" data-sortable="true">{{ trans('general.action_source') }}</th>
</tr>
</thead>
</table>
</div>
</div><!-- /.tab-pane -->
</div><!-- /.tab-content -->
</div><!-- nav-tabs-custom -->

View File

@@ -133,6 +133,7 @@
<x-icon type="history" class="fa-2x "/>
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}
{!! ($asset->targetLogs->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->targetLogs->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@@ -1453,52 +1454,13 @@
<div class="tab-pane fade" id="history">
<!-- checked out assets table -->
<div class="row">
<div class="col-md-12">
<table
class="table table-striped snipe-table"
id="assetHistory"
data-pagination="true"
data-id-table="assetHistory"
data-search="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
data-show-refresh="true"
data-sort-order="desc"
data-sort-name="created_at"
data-show-export="true"
data-export-options='{
"fileName": "export-asset-{{ $asset->id }}-history",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'
data-url="{{ route('api.activity.index', ['item_id' => $asset->id, 'item_type' => 'asset']) }}"
data-cookie-id-table="assetHistory"
data-cookie="true">
<thead>
<tr>
<th data-visible="true" data-field="icon" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter">{{ trans('admin/hardware/table.icon') }}</th>
<th data-visible="true" data-field="action_date" data-sortable="true" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>
<th data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th data-field="note">{{ trans('general.notes') }}</th>
<th data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
<th data-visible="false" data-field="file" data-visible="false" data-formatter="fileUploadFormatter">{{ trans('general.download') }}</th>
<th data-field="log_meta" data-visible="true" data-formatter="changeLogFormatter">{{ trans('admin/hardware/table.changed')}}</th>
<th data-field="remote_ip" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_ip') }}</th>
<th data-field="user_agent" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_user_agent') }}</th>
<th data-field="action_source" data-visible="false" data-sortable="true">{{ trans('general.action_source') }}</th>
</tr>
</thead>
</table>
</div>
</div> <!-- /.row -->
</div> <!-- /.tab-pane history -->
<x-historytable
filepath="private_uploads/hardware/"
showfile_routename="show/assetfile"
object_type="asset"
:object="$asset" />
</div> <!-- /.tab-pane history -->
<div class="tab-pane fade" id="files">
<div class="row{{ ($asset->uploads->count() > 0 ) ? '' : ' hidden-print' }}">

View File

@@ -50,14 +50,19 @@
</li>
@endcan
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="history" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}</span>
</a>
</li>
@if ($license->assetlog->count() >= 0 )
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<i class="far fa-history fa-2x" aria-hidden="true"></i>
</span>
<span class="hidden-xs hidden-sm">
{{ trans('general.history') }}
{!! ($license->assetlog->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($license->assetlog->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
@can('update', \App\Models\License::class)
<li class="pull-right"><a href="#" data-toggle="modal" data-target="#uploadFileModal">
@@ -475,47 +480,11 @@
@endcan
<div class="tab-pane" id="history">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table
class="table table-striped snipe-table"
data-cookie-id-table="licenseHistoryTable"
data-id-table="licenseHistoryTable"
id="licenseHistoryTable"
data-pagination="true"
data-show-columns="true"
data-side-pagination="server"
data-show-refresh="true"
data-show-export="true"
data-sort-order="desc"
data-export-options='{
"fileName": "export-{{ str_slug($license->name) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'
data-url="{{ route('api.activity.index', ['item_id' => $license->id, 'item_type' => 'license']) }}">
<thead>
<tr>
<th class="col-sm-2" data-visible="false" data-sortable="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.record_created') }}</th>
<th class="col-sm-2"data-visible="true" data-sortable="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th class="col-sm-2" data-sortable="true" data-visible="true" data-field="note">{{ trans('general.notes') }}</th>
<th class="col-sm-2" data-visible="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
@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>
@endif
</tr>
</thead>
</table>
</div>
</div> <!-- /.col-md-12-->
</div> <!-- /.row-->
<x-historytable
filepath="private_uploads/licenses/"
showfile_routename="show.licensefile"
object_type="license"
:object="$license" />
</div> <!-- /.tab-pane -->
</div> <!-- /.tab-content -->

View File

@@ -57,21 +57,21 @@
<!-- /.form-group -->
<!-- Scope Locations with Full Multiple Companies Support -->
<div class="form-group {{ $errors->has('scope_locations_fmcs') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('scope_locations_fmcs', trans('admin/settings/general.scope_locations_fmcs_support_text')) }}
</div>
<div class="col-md-9">
<label class="form-control">
{{ Form::checkbox('scope_locations_fmcs', '1', old('scope_locations_fmcs', $setting->scope_locations_fmcs),array('class' => 'minimal', 'aria-label'=>'scope_locations_fmcs')) }}
{{ trans('admin/settings/general.scope_locations_fmcs_support_text') }}
</label>
{!! $errors->first('scope_locations_fmcs', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">
{{ trans('admin/settings/general.scope_locations_fmcs_support_help_text') }}
</p>
</div>
</div>
{{-- <div class="form-group {{ $errors->has('scope_locations_fmcs') ? 'error' : '' }}">--}}
{{-- <div class="col-md-3">--}}
{{-- {{ Form::label('scope_locations_fmcs', trans('admin/settings/general.scope_locations_fmcs_support_text')) }}--}}
{{-- </div>--}}
{{-- <div class="col-md-9">--}}
{{-- <label class="form-control">--}}
{{-- {{ Form::checkbox('scope_locations_fmcs', '1', old('scope_locations_fmcs', $setting->scope_locations_fmcs),array('class' => 'minimal', 'aria-label'=>'scope_locations_fmcs')) }}--}}
{{-- {{ trans('admin/settings/general.scope_locations_fmcs_support_text') }}--}}
{{-- </label>--}}
{{-- {!! $errors->first('scope_locations_fmcs', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}--}}
{{-- <p class="help-block">--}}
{{-- {{ trans('admin/settings/general.scope_locations_fmcs_support_help_text') }}--}}
{{-- </p>--}}
{{-- </div>--}}
{{-- </div>--}}
<!-- /.form-group -->
<!-- Require signature for acceptance -->

View File

@@ -88,20 +88,26 @@
<span class="hidden-lg hidden-md">
<x-icon type="files" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.file_uploads') }}
{!! ($user->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($user->uploads->count()).'</badge>' : '' !!}
<span class="hidden-xs hidden-sm">
{{ trans('general.file_uploads') }}
{!! ($user->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($user->uploads->count()).'</badge>' : '' !!}
</span>
</a>
</li>
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="history" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">{{ trans('general.history') }}</span>
</a>
</li>
@if ($user->userlog->count() >= 0 )
<li>
<a href="#history" data-toggle="tab">
<span class="hidden-lg hidden-md">
<x-icon type="history" class="fa-2x" />
</span>
<span class="hidden-xs hidden-sm">
{{ trans('general.history') }}
{!! ($user->userlog->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($user->userlog->count()).'</badge>' : '' !!}
</span>
</a>
</li>
@endif
@if ($user->managedLocations->count() >= 0 )
<li>
@@ -969,50 +975,14 @@
</div><!--/FILES-->
<div class="tab-pane" id="history">
<div class="table-responsive">
<x-historytable
filepath="private_uploads/users/"
showfile_routename="show/userfile"
deletefile_routename="delete/userfile"
object_type="user"
:object="$user" />
<table
data-click-to-select="true"
data-cookie-id-table="usersHistoryTable"
data-pagination="true"
data-id-table="usersHistoryTable"
data-search="true"
data-side-pagination="server"
data-show-columns="true"
data-show-fullscreen="true"
data-show-export="true"
data-show-refresh="true"
data-sort-order="desc"
id="usersHistoryTable"
class="table table-striped snipe-table"
data-url="{{ route('api.activity.index', ['target_id' => $user->id, 'target_type' => 'user']) }}"
data-export-options='{
"fileName": "export-{{ str_slug($user->present()->fullName ) }}-history-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'>
<thead>
<tr>
<th data-field="icon" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter">Icon</th>
<th data-field="created_at" data-formatter="dateDisplayFormatter" data-sortable="true">{{ trans('general.date') }}</th>
<th data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th data-field="action_type">{{ trans('general.action') }}</th>
<th data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
<th data-field="note">{{ trans('general.notes') }}</th>
@if ($snipeSettings->require_accept_signature=='1')
<th data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
@endif
<th data-field="item.serial" data-visible="false">{{ trans('admin/hardware/table.serial') }}</th>
<th data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>
<th data-field="remote_ip" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_ip') }}</th>
<th data-field="user_agent" data-visible="false" data-sortable="true">{{ trans('admin/settings/general.login_user_agent') }}</th>
<th data-field="action_source" data-visible="false" data-sortable="true">{{ trans('general.action_source') }}</th>
</tr>
</thead>
</table>
</div>
</div><!-- /.tab-pane -->
<div class="tab-pane" id="managed-locations">