adds translation for accept_eula, a bit more logic on the Acceptance Controller that is not working yet

This commit is contained in:
Godfrey M 2022-03-10 12:15:50 -08:00
parent 59c583ac74
commit e1a6a2afc6
8 changed files with 61 additions and 10 deletions

View file

@ -7,9 +7,12 @@ use App\Events\CheckoutDeclined;
use App\Events\ItemAccepted;
use App\Events\ItemDeclined;
use App\Http\Controllers\Controller;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\CheckoutAcceptance;
use App\Models\Company;
use App\Models\Contracts\Acceptable;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
@ -136,10 +139,19 @@ 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());
$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.
route('log.storedeula.download', $stored_eula);
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',
]));
return redirect()->to('account/accept')->with('success', $return_msg);
}

View file

@ -21,6 +21,7 @@ class ActionlogController extends Controller
$this->authorize('view', \App\Models\Asset::class);
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;
return Response::download($file);
}
}

View file

@ -0,0 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddEulaToCheckoutAcceptance extends Migration

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddEulaToActionLogs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('action_logs', 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('action_logs', function (Blueprint $table) {
$table->dropColumn('stored_eula');
$table->dropColumn('stored_eula_file');
});
}
}

View file

@ -237,6 +237,7 @@
'state' => 'State',
'status_labels' => 'Status Labels',
'status' => 'Status',
'accept_eula' => 'Acceptance Agreement',
'supplier' => 'Supplier',
'suppliers' => 'Suppliers',
'sure_to_delete' => 'Are you sure you wish to delete',

View file

@ -1093,15 +1093,12 @@
<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>
@if ($snipeSettings->require_accept_signature=='1')
<th class="col-md-3" data-field="signature_file" data-visible="false" data-formatter="imageFormatter">{{ trans('general.signature') }}</th>
@endif
<th class="col-sm-1" data-field="stored_eula_file" data-visible="true">{{ 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>
</table>
</div>
</div> <!-- /.row -->
</div> <!-- /.tab-pane history -->

View file

@ -53,7 +53,6 @@
<th class="col-sm-2" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.to') }}</th>
<th class="col-sm-1" data-field="note">{{ trans('general.notes') }}</th>
<th class="col-sm-2" data-field="log_meta" data-visible="false" data-formatter="changeLogFormatter">{{ trans('general.changed') }}</th>
<th class="col-sm-1" data-field="stored_eula_file" data-visible="true">{{ trans('general.accept_eula') }}</th>
</tr>
</thead>
</table>

View file

@ -125,8 +125,8 @@ Route::group(['middleware' => 'auth'], function () {
[ActionlogController::class, 'displaySig']
)->name('log.signature.view');
Route::get(
'stored-eula-file/{$filename}/download',
[ActionlogController::class, 'getStoredEula']
'stored-eula-file/{$filename}/',
[\App\Http\Controllers\Api\ReportsController::class, 'getStoredEula']
)->name('log.storedeula.download');
});