mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Fix mismerged code. (#2705)
This commit is contained in:
parent
1394424760
commit
7ca7877740
|
@ -33,7 +33,7 @@ class ReportsController extends Controller
|
|||
{
|
||||
|
||||
/**
|
||||
* Returns a view that displaysthe accessories report.
|
||||
* Returns a view that displays the accessories report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
|
@ -292,11 +292,7 @@ class ReportsController extends Controller
|
|||
public function getActivityReport()
|
||||
{
|
||||
$log_actions = Actionlog::orderBy('created_at', 'DESC')
|
||||
->with('adminlog')
|
||||
->with('accessorylog')
|
||||
->with('assetlog')
|
||||
->with('licenselog')
|
||||
->with('userlog')
|
||||
->with('item')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
|
@ -304,16 +300,111 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Returns Activity Report JSON.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getActivityReportDataTable()
|
||||
{
|
||||
$activitylogs = Actionlog::orderBy('created_at', 'DESC');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$activity = $activity->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['created_at'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
|
||||
|
||||
|
||||
$activityCount = $activitylogs->count();
|
||||
$activitylogs = $activitylogs->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($activitylogs as $activity) {
|
||||
|
||||
if ($activity->itemType() == "asset") {
|
||||
$activity_icons = '<i class="fa fa-barcode"></i>';
|
||||
} elseif ($activity->itemType() == "accessory") {
|
||||
$activity_icons = '<i class="fa fa-keyboard-o"></i>';
|
||||
} elseif ($activity->itemType()=="consumable") {
|
||||
$activity_icons = '<i class="fa fa-tint"></i>';
|
||||
} elseif ($activity->itemType()=="license"){
|
||||
$activity_icons = '<i class="fa fa-floppy-o"></i>';
|
||||
} elseif ($activity->itemType()=="component") {
|
||||
$activity_icons = '<i class="fa fa-hdd-o"></i>';
|
||||
} else {
|
||||
$activity_icons = '<i class="fa fa-paperclip"></i>';
|
||||
}
|
||||
|
||||
if (($activity->item) && ($activity->itemType()=="asset")) {
|
||||
$actvity_item = '<a href="'.route('view/hardware', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>';
|
||||
$item_type = 'asset';
|
||||
} elseif ($activity->item) {
|
||||
$actvity_item = '<a href="'.route('view/'. $activity->itemType(), $activity->item_id).'">'.e($activity->item->name).'</a>';
|
||||
$item_type = $activity->itemType();
|
||||
}
|
||||
|
||||
|
||||
if (($activity->userasassetlog) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user")) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->userasassetlog->fullName().'</a>';
|
||||
} elseif (($activity->item) && ($activity->target instanceof \App\Models\Asset)) {
|
||||
$activity_target = '<a href="'.route('view/hardware', $activity->target_id).'">'.$activity->target->showAssetName().'</a>';
|
||||
} elseif (($activity->item) && ($activity->target instanceof \App\Models\User)) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->target->fullName().'</a>';
|
||||
} elseif ($activity->action_type=='requested') {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->user_id).'">'.$activity->user->fullName().'</a>';
|
||||
} else {
|
||||
$activity_target = $activity->target;
|
||||
}
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'icon' => $activity_icons,
|
||||
'created_at' => date("M d, Y g:iA", strtotime($activity->created_at)),
|
||||
'action_type' => strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))),
|
||||
'admin' => $activity->user ? (string) link_to('/admin/users/'.$activity->user_id.'/view', $activity->user->fullName()) : 'Deleted Admin',
|
||||
'target' => $activity_target,
|
||||
'item' => $actvity_item,
|
||||
'item_type' => $item_type,
|
||||
'note' => e($activity->note),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$activityCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
{
|
||||
|
||||
$licenses = License::orderBy('created_at', 'DESC')
|
||||
$licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
|
||||
->with('company')
|
||||
->get();
|
||||
|
||||
|
@ -340,6 +431,7 @@ class ReportsController extends Controller
|
|||
trans('admin/licenses/form.remaining_seats'),
|
||||
trans('admin/licenses/form.expiration'),
|
||||
trans('admin/licenses/form.date'),
|
||||
trans('admin/licenses/form.depreciation'),
|
||||
trans('admin/licenses/form.cost')
|
||||
];
|
||||
|
||||
|
@ -355,6 +447,7 @@ class ReportsController extends Controller
|
|||
$row[] = $license->remaincount();
|
||||
$row[] = $license->expiration_date;
|
||||
$row[] = $license->purchase_date;
|
||||
$row[] = ($license->depreciation!='') ? '' : e($license->depreciation->name);
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"';
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
|
|
|
@ -261,6 +261,12 @@ class AuthServiceProvider extends ServiceProvider
|
|||
}
|
||||
});
|
||||
|
||||
$gate->define('components.checkout', function ($user) {
|
||||
if (($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('components.manage', function ($user) {
|
||||
if (($user->hasAccess('components.edit')) || ($user->hasAccess('components.delete')) || ($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
|
||||
|
|
|
@ -129,6 +129,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Requestable -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-10">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="requestable" id="requestable" class="minimal" {{ Input::old('requestable', $model->requestable) == '1' ? ' checked="checked"' : '' }}> {{ trans('admin/models/general.requestable') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Image -->
|
||||
@if ($model->image)
|
||||
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
|
||||
|
|
|
@ -48,6 +48,13 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('company_name', '1') }}
|
||||
{{ trans('general.company') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('asset_tag', '1') }}
|
||||
|
|
Loading…
Reference in a new issue