mirror of
https://github.com/snipe/snipe-it.git
synced 2026-02-04 14:35:46 +00:00
adds Eula tab and count to user account
This commit is contained in:
@ -39,6 +39,7 @@ class ViewAssetsController extends Controller
|
||||
'consumables',
|
||||
'accessories',
|
||||
'licenses',
|
||||
'eulas',
|
||||
)->find(auth()->id());
|
||||
|
||||
$field_array = array();
|
||||
|
||||
@ -551,6 +551,23 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes the user -> eula relationship
|
||||
*
|
||||
* @author A. Gianotto <snipe@snipe.net>
|
||||
* @since [v7.0.7]
|
||||
* @return \Illuminate\Database\Eloquent\Relations\Relation
|
||||
*/
|
||||
public function eulas()
|
||||
{
|
||||
return $this->hasMany(Actionlog::class, 'target_id')
|
||||
->where('target_type', self::class)
|
||||
->where('action_type', 'accepted')
|
||||
->whereNotNull('filename')
|
||||
->whereNotNull('accept_signature')
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes the user -> requested assets relationship
|
||||
*
|
||||
|
||||
@ -287,6 +287,7 @@ return [
|
||||
'status_label' => 'Status Label',
|
||||
'status' => 'Status',
|
||||
'accept_eula' => 'Acceptance Agreement',
|
||||
'eula' => 'EULAs',
|
||||
'show_or_hide_eulas' => 'Show/Hide EULAs',
|
||||
'supplier' => 'Supplier',
|
||||
'suppliers' => 'Suppliers',
|
||||
|
||||
@ -87,6 +87,17 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#eulas" data-toggle="tab">
|
||||
<span class="hidden-lg hidden-md" aria-hidden="true">
|
||||
<x-icon type="files" class="fa-2x" />
|
||||
</span>
|
||||
<span class="hidden-xs hidden-sm">{{ trans('general.eula') }}
|
||||
{!! ($user->eulas->count() > 0 ) ? '<span class="badge badge-secondary">'.number_format($user->eulas->count()).'</span>' : '' !!}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@ -703,7 +714,58 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /consumables-tab -->
|
||||
<div class="tab-pane" id="eulas">
|
||||
<table
|
||||
data-toolbar="#userEULAToolbar"
|
||||
data-cookie-id-table="userEULATable"
|
||||
data-id-table="userEULATable"
|
||||
id="userEULATable"
|
||||
data-search="true"
|
||||
data-pagination="true"
|
||||
data-side-pagination="client"
|
||||
data-show-columns="true"
|
||||
data-show-fullscreen="true"
|
||||
data-show-export="true"
|
||||
data-show-footer="true"
|
||||
data-show-refresh="false"
|
||||
data-sort-order="asc"
|
||||
data-sort-name="name"
|
||||
class="table table-striped snipe-table table-hover"
|
||||
data-export-options='{
|
||||
"fileName": "export-eula-{{ str_slug($user->username) }}-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","delete","purchasecost", "icon"]
|
||||
}'>
|
||||
|
||||
<caption id="userConsumableToolbar" class="tableCaption">
|
||||
{{ trans('general.consumables') }}
|
||||
</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{{ trans('general.name') }}</th>
|
||||
@can('self.view_purchase_cost')
|
||||
<th class="col-md-2" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
|
||||
@endcan
|
||||
<th class="col-md-2">{{ trans('general.date') }}</th>
|
||||
<th class="col-md-5">{{ trans('general.notes') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($user->consumables as $consumable)
|
||||
<tr>
|
||||
<td>{{ $consumable->name }}</td>
|
||||
@can('self.view_purchase_cost')
|
||||
<td>
|
||||
{!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
|
||||
</td>
|
||||
@endcan
|
||||
<td>{{ Helper::getFormattedDateObject($consumable->pivot->created_at, 'datetime', false) }}</td>
|
||||
<td>{{ $consumable->pivot->note }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /consumables-tab -->
|
||||
</div><!-- /.tab-content -->
|
||||
</div><!-- nav-tabs-custom -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user