mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
adds most of the fields for an accessory eula agreement pdf
This commit is contained in:
parent
b2e78e3382
commit
220df9710e
|
@ -13,12 +13,16 @@ use App\Models\CheckoutAcceptance;
|
|||
use App\Models\Company;
|
||||
use App\Models\Contracts\Acceptable;
|
||||
use App\Models\User;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Accessory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Http\Controllers\SettingsController;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AcceptanceController extends Controller
|
||||
{
|
||||
|
@ -129,30 +133,60 @@ class AcceptanceController extends Controller
|
|||
}
|
||||
|
||||
$item = $acceptance->checkoutable_type::find($acceptance->checkoutable_id);
|
||||
$assigned_to = User::find($item->assigned_to);
|
||||
$branding_settings= SettingsController::getPDFBranding();
|
||||
$data = [
|
||||
'item_tag' => $item->asset_tag,
|
||||
'item_model' => $item->model_id,
|
||||
'item_serial' => $item->serial,
|
||||
'eula' => $item->getEula(),
|
||||
'check_out_date' => $acceptance->created_at,
|
||||
'accepted_date' => $acceptance->accepted_at,
|
||||
|
||||
if ($acceptance->checkoutable_type== 'App\Models\Asset') {
|
||||
$assigned_to = User::find($item->assigned_to);
|
||||
$asset_model = AssetModel::find($item->model_id);
|
||||
$branding_settings = SettingsController::getPDFBranding();
|
||||
$data = [
|
||||
'item_tag' => $item->asset_tag,
|
||||
'item_model' => $asset_model->name,
|
||||
'item_serial' => $item->serial,
|
||||
'eula' => $item->getEula(),
|
||||
'check_out_date' => Carbon::parse($acceptance->created_at)->format($branding_settings->date_display_format),
|
||||
'accepted_date' => Carbon::parse($acceptance->accepted_at)->format($branding_settings->date_display_format),
|
||||
// 'assigned_by' => self
|
||||
'assigned_to' => $assigned_to->first_name.' '.$assigned_to->last_name,
|
||||
'company_name' => $branding_settings->site_name,
|
||||
'signature' => storage_path().'/private_uploads/signatures/'.$sig_filename,
|
||||
'logo' => public_path().'/uploads/'.$branding_settings->logo,
|
||||
'date_settings' => $branding_settings->date_display_format,
|
||||
'assigned_to' => $assigned_to->first_name . ' ' . $assigned_to->last_name,
|
||||
'company_name' => $branding_settings->site_name,
|
||||
'signature' => storage_path() . '/private_uploads/signatures/' . $sig_filename,
|
||||
'logo' => public_path() . '/uploads/' . $branding_settings->logo,
|
||||
'date_settings' => $branding_settings->date_display_format,
|
||||
];
|
||||
$pdf = Pdf::loadView('account.accept.accept-asset-eula', $data);
|
||||
Storage::put('private_uploads/eula-pdfs/' . $acceptance->stored_eula_file, $pdf->output());
|
||||
|
||||
$a = new Actionlog();
|
||||
$a->stored_eula = $item->getEula();
|
||||
$a->stored_eula_file = $acceptance->stored_eula_file;
|
||||
$a->save();
|
||||
|
||||
return redirect()->to('account/accept')->with('success', $return_msg);
|
||||
}
|
||||
// TBC: trying to get the user_id here
|
||||
$accessory_user= DB::table('accessories_users')->find($acceptance->assigned_to_id);
|
||||
$assigned_to = User::find($accessory_user);
|
||||
$accessory_model = Accessory::find($item->id);
|
||||
$branding_settings = SettingsController::getPDFBranding();
|
||||
$data = [
|
||||
'item_tag' => $item->model_number,
|
||||
'item_model' => $accessory_model->name,
|
||||
'eula' => $item->getEula(),
|
||||
'check_out_date' => Carbon::parse($acceptance->created_at)->format($branding_settings->date_display_format),
|
||||
'accepted_date' => Carbon::parse($acceptance->accepted_at)->format($branding_settings->date_display_format),
|
||||
// 'assigned_by' => self
|
||||
'assigned_to' => $assigned_to->first_name . ' ' . $assigned_to->last_name,
|
||||
'company_name' => $branding_settings->site_name,
|
||||
'signature' => storage_path() . '/private_uploads/signatures/' . $sig_filename,
|
||||
'logo' => public_path() . '/uploads/' . $branding_settings->logo,
|
||||
'date_settings' => $branding_settings->date_display_format,
|
||||
];
|
||||
$pdf = Pdf::loadView('account.accept.accept-accessory-eula', $data);
|
||||
Storage::put('private_uploads/eula-pdfs/' . $acceptance->stored_eula_file, $pdf->output());
|
||||
|
||||
$pdf = Pdf::loadView('account.accept.accept-eula', $data);
|
||||
Storage::put('private_uploads/eula-pdfs/'.$acceptance->stored_eula_file, $pdf->output());
|
||||
|
||||
$a=new Actionlog();
|
||||
$a->stored_eula = $item->getEula();
|
||||
$a->stored_eula_file = $acceptance->stored_eula_file;
|
||||
$a->save();
|
||||
$a = new Actionlog();
|
||||
$a->stored_eula = $item->getEula();
|
||||
$a->stored_eula_file = $acceptance->stored_eula_file;
|
||||
$a->save();
|
||||
|
||||
return redirect()->to('account/accept')->with('success', $return_msg);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
@if ($signature)
|
||||
<center>
|
||||
<img src="{{ $logo }}">
|
||||
<p>{{$company_name}}</p>
|
||||
</center>
|
||||
@endif
|
||||
<br>
|
||||
|
@ -17,16 +18,14 @@
|
|||
<p>Date: {{ date($date_settings) }} </p><br>
|
||||
<p>Asset Tag: {{ $item_tag }}</p>
|
||||
<p>Asset Model: {{ $item_model }}</p>
|
||||
<p>Asset Tag: {{ $item_serial }}</p><br>
|
||||
@if ($eula)
|
||||
{!! $eula !!}
|
||||
@endif
|
||||
|
||||
<br><br>
|
||||
<p> On {{$check_out_date}} {{$company_name}} is assigning item {{$item_tag}} to {{$assigned_to}}. <br>
|
||||
They accept responsibility of said item until it is returned.</p><br>
|
||||
<br>
|
||||
|
||||
<p>Assigned on: {{$check_out_date}}</p>
|
||||
<p>Accepted on: {{$accepted_date}}</p><br>
|
||||
<p>Accepted on: {{$accepted_date}}</p>
|
||||
<p>Assigned to: {{$assigned_to}}</p>
|
||||
@if ($signature)
|
||||
<center>
|
37
resources/views/account/accept/accept-asset-eula.blade.php
Normal file
37
resources/views/account/accept/accept-asset-eula.blade.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!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">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@if ($signature)
|
||||
<center>
|
||||
<img src="{{ $logo }}">
|
||||
<p>{{$company_name}}</p>
|
||||
</center>
|
||||
@endif
|
||||
<br>
|
||||
|
||||
<p>Date: {{ date($date_settings) }} </p><br>
|
||||
<p>Asset Tag: {{ $item_tag }}</p>
|
||||
<p>Asset Model: {{ $item_model }}</p>
|
||||
<p>Asset Serial: {{ $item_serial }}</p><br>
|
||||
@if ($eula)
|
||||
{!! $eula !!}
|
||||
@endif
|
||||
|
||||
<br>
|
||||
|
||||
<p>Assigned on: {{$check_out_date}}</p>
|
||||
<p>Accepted on: {{$accepted_date}}</p>
|
||||
<p>Assigned to: {{$assigned_to}}</p>
|
||||
@if ($signature)
|
||||
<center>
|
||||
<img src="{{ $signature }}" style="max-width: 50%">
|
||||
</center>
|
||||
@endif
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue