Added notes to user consumables tab

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-08-10 15:34:07 -07:00
parent 8de7e9a2ab
commit acd666fdf5
3 changed files with 7 additions and 5 deletions

View file

@ -230,7 +230,7 @@ class ConsumablesController extends Controller
$rows[] = [ $rows[] = [
'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User', 'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User',
'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'), '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, 'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : null,
]; ];
} }

View file

@ -308,7 +308,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/ */
public function consumables() 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();
} }
/** /**

View file

@ -763,9 +763,10 @@
}'> }'>
<thead> <thead>
<tr> <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-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> </tr>
</thead> </thead>
<tbody> <tbody>
@ -775,7 +776,8 @@
<td> <td>
{!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!} {!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!}
</td> </td>
<td>{{ $consumable->pivot->created_at }}</td> <td>{{ Helper::getFormattedDateObject($consumable->pivot->created_at, 'datetime', false) }}</td>
<td>{{ $consumable->pivot->note }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>