Added min_amt to API transformer/presenter

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-02-28 11:07:18 +00:00
parent 3ccc55a78f
commit 4ffb7790df
2 changed files with 13 additions and 5 deletions

View file

@ -27,8 +27,8 @@ class LicensesTransformer
'company' => ($license->company) ? ['id' => (int) $license->company->id, 'name'=> e($license->company->name)] : null, 'company' => ($license->company) ? ['id' => (int) $license->company->id, 'name'=> e($license->company->name)] : null,
'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id, 'name'=> e($license->manufacturer->name)] : null, 'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id, 'name'=> e($license->manufacturer->name)] : null,
'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------', 'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------',
'order_number' => e($license->order_number), 'order_number' => ($license->order_number) ? e($license->order_number) : null,
'purchase_order' => e($license->purchase_order), 'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : null,
'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'), 'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'),
'termination_date' => Helper::getFormattedDateObject($license->termination_date, 'date'), 'termination_date' => Helper::getFormattedDateObject($license->termination_date, 'date'),
'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null, 'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null,
@ -38,8 +38,9 @@ class LicensesTransformer
'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'),
'seats' => (int) $license->seats, 'seats' => (int) $license->seats,
'free_seats_count' => (int) $license->free_seats_count, 'free_seats_count' => (int) $license->free_seats_count,
'license_name' => e($license->license_name), 'min_amt' => ($license->min_amt) ? (int) ($license->min_amt) : null,
'license_email' => e($license->license_email), 'license_name' => ($license->license_name) ? e($license->license_name) : null,
'license_email' => ($license->license_email) ? e($license->license_email) : null,
'reassignable' => ($license->reassignable == 1) ? true : false, 'reassignable' => ($license->reassignable == 1) ? true : false,
'maintained' => ($license->maintained == 1) ? true : false, 'maintained' => ($license->maintained == 1) ? true : false,
'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id, 'name'=> e($license->supplier->name)] : null, 'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id, 'name'=> e($license->supplier->name)] : null,

View file

@ -89,7 +89,14 @@ class LicensePresenter extends Presenter
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
'title' => trans('admin/accessories/general.remaining'), 'title' => trans('admin/accessories/general.remaining'),
], [ ],
[
'field' => 'min_amt',
'searchable' => false,
'sortable' => true,
'title' => trans('mail.min_QTY'),
'formatter' => 'minAmtFormatter',
],[
'field' => 'purchase_date', 'field' => 'purchase_date',
'searchable' => true, 'searchable' => true,
'sortable' => true, 'sortable' => true,