adds eula blade for licenses and fixes assigned_to for dom_pdf

This commit is contained in:
Godfrey M 2022-06-23 11:15:15 -07:00
parent 366f3aacef
commit df76e6eacf
2 changed files with 79 additions and 12 deletions

View file

@ -133,19 +133,39 @@ class AcceptanceController extends Controller
// this is horrible
if ($acceptance->checkoutable_type == 'App\Models\Asset') {
$pdf_view_route ='account.accept.accept-asset-eula';
$asset_model = AssetModel::find($item->model_id);
$display_model = $asset_model->name;
$assigned_to = User::find($item->assigned_to)->present()->fullName;
} elseif ($acceptance->checkoutable_type== 'App\Models\Accessory') {
$pdf_view_route ='account.accept.accept-accessory-eula';
$accessory = Accessory::find($item->id);
$display_model = $accessory->name;
$assigned_to = User::find($item->assignedTo);
switch($acceptance->checkoutable_type){
case 'App\Models\Asset':
$pdf_view_route ='account.accept.accept-asset-eula';
$asset_model = AssetModel::find($item->model_id);
$display_model = $asset_model->name;
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;
case 'App\Models\Accessory':
$pdf_view_route ='account.accept.accept-accessory-eula';
$accessory = Accessory::find($item->id);
$display_model = $accessory->name;
$assigned_to = User::find($item->assignedTo);
break;
case 'App\Models\LicenseSeat':
$pdf_view_route ='account.accept.accept-license-eula';
$license = License::find($item->id);
$display_model = $license->name;
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;
}
// if ($acceptance->checkoutable_type == 'App\Models\Asset') {
// $pdf_view_route ='account.accept.accept-asset-eula';
// $asset_model = AssetModel::find($item->model_id);
// $display_model = $asset_model->name;
// $assigned_to = User::find($item->assigned_to)->present()->fullName;
//
// } elseif ($acceptance->checkoutable_type== 'App\Models\Accessory') {
// $pdf_view_route ='account.accept.accept-accessory-eula';
// $accessory = Accessory::find($item->id);
// $display_model = $accessory->name;
// $assigned_to = User::find($item->assignedTo);
//
// }
/**
* Gather the data for the PDF. We fire this whether there is a signature required or not,

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
body {
font-family:'Dejavu Sans', Arial, Helvetica, sans-serif;
font-size: 11px;
}
</style>
</head>
<body>
@if ($logo)
<center>
<img src="{{ $logo }}">
<p>{{$company_name}}</p>
</center>
@endif
<br>
<p>
{{ trans('general.date') }}: {{ date($date_settings) }} <br>
{{ trans('general.license') }}: {{ $item_model }}<br>
</p>
@if ($eula)
<hr>
{!! $eula !!}
<hr>
@endif
<p>
Assigned on: {{$check_out_date}}<br>
Assigned to: {{$assigned_to}}<br>
Accepted on: {{$accepted_date}}
</p>
@if ($signature!='')
<img src="{{ $signature }}" style="max-width: 600px; border-bottom: black solid 1px;">
@endif
</body>
</html>