Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2021-01-27 01:34:57 -08:00
commit a050aba72f
5 changed files with 63 additions and 8 deletions

View file

@ -103,11 +103,32 @@ class LicensesController extends Controller
case 'category': case 'category':
$licenses = $licenses->leftJoin('categories', 'licenses.category_id', '=', 'categories.id')->orderBy('categories.name', $order); $licenses = $licenses->leftJoin('categories', 'licenses.category_id', '=', 'categories.id')->orderBy('categories.name', $order);
break; break;
case 'depreciation':
$licenses = $licenses->leftJoin('depreciations', 'licenses.depreciation_id', '=', 'depreciations.id')->orderBy('depreciations.name', $order);
break;
case 'company': case 'company':
$licenses = $licenses->leftJoin('companies', 'licenses.company_id', '=', 'companies.id')->orderBy('companies.name', $order); $licenses = $licenses->leftJoin('companies', 'licenses.company_id', '=', 'companies.id')->orderBy('companies.name', $order);
break; break;
default: default:
$allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','company','category','license_name','license_email','free_seats_count','seats']; $allowed_columns =
[
'id',
'name',
'purchase_cost',
'expiration_date',
'purchase_order',
'order_number',
'notes',
'purchase_date',
'serial',
'company',
'category',
'license_name',
'license_email',
'free_seats_count',
'seats',
'termination_date',
];
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
$licenses = $licenses->orderBy($sort, $order); $licenses = $licenses->orderBy($sort, $order);
break; break;

View file

@ -29,6 +29,8 @@ class LicensesTransformer
'order_number' => e($license->order_number), 'order_number' => e($license->order_number),
'purchase_order' => e($license->purchase_order), 'purchase_order' => e($license->purchase_order),
'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'), 'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'),
'termination_date' => Helper::getFormattedDateObject($license->termination_date, 'date'),
'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null,
'purchase_cost' => e($license->purchase_cost), 'purchase_cost' => e($license->purchase_cost),
'notes' => e($license->notes), 'notes' => e($license->notes),
'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'), 'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'),

View file

@ -108,6 +108,7 @@ class License extends Depreciable
'manufacturer' => ['name'], 'manufacturer' => ['name'],
'company' => ['name'], 'company' => ['name'],
'category' => ['name'], 'category' => ['name'],
'depreciation' => ['name'],
]; ];
/** /**

View file

@ -97,7 +97,26 @@ class LicensePresenter extends Presenter
"visible" => false, "visible" => false,
"title" => trans('general.purchase_date'), "title" => trans('general.purchase_date'),
'formatter' => 'dateDisplayFormatter' 'formatter' => 'dateDisplayFormatter'
], [ ],
[
"field" => "termination_date",
"searchable" => true,
"sortable" => true,
"visible" => false,
"title" => trans('admin/licenses/form.termination_date'),
'formatter' => 'dateDisplayFormatter'
],
[
"field" => "depreciation",
"searchable" => true,
"sortable" => true,
"switchable" => true,
"title" => trans('admin/hardware/form.depreciation'),
"visible" => false,
"formatter" => "depreciationsLinkObjFormatter",
],
[
"field" => "maintained", "field" => "maintained",
"searchable" => false, "searchable" => false,
"sortable" => true, "sortable" => true,

View file

@ -167,11 +167,24 @@
</strong> </strong>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{{ $license->expiration_date }} {{ \App\Helpers\Helper::getFormattedDateObject($license->expiration_date, 'date', false) }}
</div> </div>
</div> </div>
@endif @endif
@if ($license->termination_date)
<div class="row">
<div class="col-md-4">
<strong>
{{ trans('admin/licenses/form.termination_date') }}
</strong>
</div>
<div class="col-md-8">
{{ \App\Helpers\Helper::getFormattedDateObject($license->termination_date, 'date', false) }}
</div>
</div>
@endif
@if ($license->depreciation) @if ($license->depreciation)
<div class="row"> <div class="row">
@ -188,8 +201,6 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<strong> <strong>
@ -197,7 +208,7 @@
</strong> </strong>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{{ $license->depreciated_date()->format("Y-m-d") }} {{ \App\Helpers\Helper::getFormattedDateObject($license->depreciated_date(), 'date', false) }}
</div> </div>
</div> </div>
@ -233,13 +244,14 @@
@endif @endif
@if (isset($license->purchase_date)) @if (isset($license->purchase_date))
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<strong>{{ trans('general.purchase_date') }}</strong> <strong>{{ trans('general.purchase_date') }}</strong>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{{ $license->purchase_date }} {{ \App\Helpers\Helper::getFormattedDateObject($license->purchase_date, 'date', false) }}
</div> </div>
</div> </div>
@endif @endif