mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
adds table structure for asset history
This commit is contained in:
parent
e1a6a2afc6
commit
b2f7262cd2
|
@ -102,12 +102,12 @@ class AcceptanceController extends Controller
|
|||
}
|
||||
|
||||
$sig_filename = '';
|
||||
|
||||
if ($request->filled('signature_output')) {
|
||||
$sig_filename = 'siglog-'.Str::uuid().'-'.date('Y-m-d-his').'.png';
|
||||
$data_uri = e($request->input('signature_output'));
|
||||
$encoded_image = explode(',', $data_uri);
|
||||
$decoded_image = base64_decode($encoded_image[1]);
|
||||
$acceptance->stored_eula_file = 'private_uploads/eula-pdfs/accepted-eula-'.date('Y-m-d-h-i-s').'.pdf';
|
||||
$path = Storage::put('private_uploads/signatures/'.$sig_filename, (string) $decoded_image);
|
||||
}
|
||||
|
||||
|
@ -139,19 +139,13 @@ class AcceptanceController extends Controller
|
|||
\Log::error(storage_path().'/eula-pdfs/'.$sig_filename);
|
||||
|
||||
$pdf = Pdf::loadView('account.accept.accept-eula', $data);
|
||||
$stored_eula= Storage::put('private_uploads/eula-pdfs/accepted-eula-'.date('Y-m-d-h-i-s').'.pdf', $pdf->output());
|
||||
\Log::info($stored_eula);
|
||||
//not sure what im doing here,but I think its something of this.
|
||||
Actionlog::Create([
|
||||
'item_id' => $acceptance->id,
|
||||
'stored_eula' => $stored_eula,
|
||||
'action_type' => 'accepted',
|
||||
]);
|
||||
\log::info(Actionlog::Create([
|
||||
'item_id' => $acceptance->id,
|
||||
'stored_eula' => $stored_eula,
|
||||
'action_type' => 'accepted',
|
||||
]));
|
||||
Storage::put($acceptance->stored_eula_file, $pdf->output());
|
||||
$a=new Actionlog();
|
||||
$a->stored_eula = $item->getEula();
|
||||
$a->stored_eula_file = $acceptance->stored_eula_file;
|
||||
$a->save();
|
||||
\log::info($a);
|
||||
|
||||
|
||||
return redirect()->to('account/accept')->with('success', $return_msg);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class ActionlogController extends Controller
|
|||
|
||||
public function getStoredEula($filename){
|
||||
$this->authorize('view', \App\Models\Asset::class);
|
||||
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;
|
||||
$file = config('app'.$filename);
|
||||
|
||||
|
||||
return Response::download($file);
|
||||
|
|
|
@ -112,7 +112,7 @@ class ActionlogsTransformer
|
|||
'signature_file' => ($actionlog->accept_signature) ? route('log.signature.view', ['filename' => $actionlog->accept_signature ]) : null,
|
||||
'log_meta' => ((isset($clean_meta)) && (is_array($clean_meta))) ? $clean_meta: null,
|
||||
'action_date' => ($actionlog->action_date) ? Helper::getFormattedDateObject($actionlog->action_date, 'datetime'): Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
|
||||
'stored_eula_file' => ($actionlog->stored_eula_file) ? route('log.storedeula.download', [ 'filename' => $actionlog->stored_eula_file]) : null,
|
||||
'stored_eula_file' => $actionlog->stored_eula_file,
|
||||
];
|
||||
|
||||
return $array;
|
||||
|
|
|
@ -34,11 +34,12 @@ class LogListener
|
|||
|
||||
public function onCheckoutAccepted(CheckoutAccepted $event)
|
||||
{
|
||||
$logaction = new Actionlog();
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->item()->associate($event->acceptance->checkoutable);
|
||||
$logaction->target()->associate($event->acceptance->assignedTo);
|
||||
$logaction->accept_signature = $event->acceptance->signature_filename;
|
||||
$logaction->stored_eula_file = $event->acceptance->stored_eula_file;
|
||||
$logaction->action_type = 'accepted';
|
||||
|
||||
// TODO: log the actual license seat that was checked out
|
||||
|
|
|
@ -25,7 +25,7 @@ class Actionlog extends SnipeModel
|
|||
|
||||
protected $table = 'action_logs';
|
||||
public $timestamps = true;
|
||||
protected $fillable = ['created_at', 'item_type', 'user_id', 'item_id', 'action_type', 'note', 'target_id', 'target_type'];
|
||||
protected $fillable = ['created_at', 'item_type', 'user_id', 'item_id', 'action_type', 'note', 'target_id', 'target_type', 'stored_eula', 'stored_eula_file'];
|
||||
|
||||
use Searchable;
|
||||
|
||||
|
|
|
@ -5,3 +5,34 @@ use Illuminate\Database\Schema\Blueprint;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEulaToCheckoutAcceptance extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
$table->text('stored_eula')->nullable()->default(null);
|
||||
$table->string('stored_eula_file')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) {
|
||||
$table->dropColumn('stored_eula');
|
||||
}
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula_file')) {
|
||||
$table->dropColumn('stored_eula_file');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1093,11 +1093,51 @@
|
|||
<th class="col-sm-2" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
|
||||
<th class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>
|
||||
<th class="col-sm-2" data-field="note">{{ trans('general.notes') }}</th>
|
||||
<th class="col-sm-1" data-field="stored_eula_file" data-visible="true">{{ trans('general.accept_eula') }}</th>
|
||||
<th class="col-sm-1" data-field="stored_eula_file" data-visible="true" data-formatter="fileUploadFormatter">{{ trans('general.accept_eula') }}</th>
|
||||
<th class="col-md-3" data-visible="false" data-field="file" data-visible="false" data-formatter="fileUploadFormatter">{{ trans('general.download') }}</th>
|
||||
<th class="col-sm-2" data-field="log_meta" data-visible="true" data-formatter="changeLogFormatter">{{ trans('admin/hardware/table.changed')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach($action_logs as $log)
|
||||
<tr>
|
||||
<td><i class="{{ Helper::filetype_icon($log->filename) }} icon-med" aria-hidden="true"></i></td>
|
||||
<td>
|
||||
@if($log->created_at)
|
||||
{{ Helper::getFormattedDateObject($file->created_at, 'datetime', false) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{$log->user_id}}
|
||||
</td>
|
||||
<td>
|
||||
{{$log->action_type}}
|
||||
</td>
|
||||
<td>
|
||||
{{$log->item_type}}
|
||||
</td>
|
||||
<td>
|
||||
{{$log->item_type}}
|
||||
</td>
|
||||
<td>
|
||||
@if($log->note)
|
||||
{{$log->note}}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($log->stored_eula_file)
|
||||
{{$log->stored_eula_file}}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($log->file)
|
||||
{{$log->file}}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{$log->log_meta}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- /.row -->
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
@push('js')
|
||||
|
||||
<script src="{{ url(mix('js/dist/bootstrap-table.js')) }}"></script>
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
$(function () {
|
||||
var locale = '{{ config('app.locale') }}';
|
||||
|
|
Loading…
Reference in a new issue