Skip to content

A free open source IT asset/license management system

Added notes to user consumables tab

snipeacd666fdf51b
diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php
index be0a0ec922..ebc27c608f 100644
--- a/app/Http/Controllers/Api/ConsumablesController.php
+++ b/app/Http/Controllers/Api/ConsumablesController.php
@@ -230,7 +230,7 @@ class ConsumablesController extends Controller
$rows[] = [
'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User',
'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'),
- 'note' => ($consumable_assignment->note) ? $consumable_assignment->note : null,
+ 'note' => ($consumable_assignment->note) ? e($consumable_assignment->note) : null,
'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : null,
];
}
diff --git a/app/Models/User.php b/app/Models/User.php
index c2f2e06116..b33997e860 100755
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -308,7 +308,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/
public function consumables()
{
- return $this->belongsToMany(\App\Models\Consumable::class, 'consumables_users', 'assigned_to', 'consumable_id')->withPivot('id','created_at')->withTrashed();
+ return $this->belongsToMany(\App\Models\Consumable::class, 'consumables_users', 'assigned_to', 'consumable_id')->withPivot('id','created_at','note')->withTrashed();
}
/**
diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php
index 8e7b531ec5..cc01c4853a 100755
--- a/resources/views/users/view.blade.php
+++ b/resources/views/users/view.blade.php
@@ -763,9 +763,10 @@
}'>
<thead>
<tr>
- <th class="col-md-6">{{ trans('general.name') }}</th>
+ <th class="col-md-3">{{ trans('general.name') }}</th>
<th class="col-md-2" data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
- <th class="col-md-4">{{ trans('general.date') }}</th>
+ <th class="col-md-2">{{ trans('general.date') }}</th>
+ <th class="col-md-5">{{ trans('general.notes') }}</th>
</tr>
</thead>
<tbody>
@@ -775,7 +776,8 @@
<td>
{!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
</td>
- <td>{{ $consumable->pivot->created_at }}</td>
+ <td>{{ Helper::getFormattedDateObject($consumable->pivot->created_at, 'datetime', false) }}</td>
+ <td>{{ $consumable->pivot->note }}</td>
</tr>
@endforeach
</tbody>