adds acceptance for consumables and components

This commit is contained in:
Godfrey M 2022-06-23 11:52:35 -07:00
parent d00b469001
commit b0897a1fc9
3 changed files with 113 additions and 0 deletions

View file

@ -16,6 +16,8 @@ use App\Models\User;
use App\Models\AssetModel;
use App\Models\Accessory;
use App\Models\License;
use App\Models\Component;
use App\Models\Consumable;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
@ -24,6 +26,7 @@ use Illuminate\Support\Str;
use App\Http\Controllers\SettingsController;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
use phpDocumentor\Reflection\Types\Compound;
class AcceptanceController extends Controller
{
@ -141,18 +144,34 @@ class AcceptanceController extends Controller
$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->license_id);
$display_model = $license->name;
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;
case 'App\Models\Component':
$pdf_view_route ='account.accept.accept-component-eula';
$component = Component::find($item->id);
$display_model = $component->name;
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;
case 'App\Models\Consumable':
$pdf_view_route ='account.accept.accept-consumable-eula';
$consumable = Consumable::find($item->id);
$display_model = $consumable->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';

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.component') }}: {{ $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>

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.consumable') }}: {{ $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>