mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
Forward request to V5
This commit is contained in:
parent
2d02e4f569
commit
a99aa30669
@ -6,6 +6,7 @@ use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\MigrationAuthRequest;
|
||||
use App\Http\Requests\MigrationCompaniesRequest;
|
||||
use App\Http\Requests\MigrationEndpointRequest;
|
||||
use App\Http\Requests\MigrationForwardRequest;
|
||||
use App\Http\Requests\MigrationTypeRequest;
|
||||
use App\Libraries\Utils;
|
||||
use App\Models\Account;
|
||||
@ -15,6 +16,8 @@ use App\Services\Migration\CompleteService;
|
||||
use App\Traits\GenerateMigrationResources;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Validator;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StepsController extends BaseController
|
||||
{
|
||||
@ -83,6 +86,28 @@ class StepsController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
public function forwardUrl(Request $request)
|
||||
{
|
||||
|
||||
$rules = [
|
||||
'url' => 'nullable|url',
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
|
||||
$account = \Auth::user()->account;
|
||||
$account->forward_url_for_v5 = rtrim($request->input('url'),'/');
|
||||
$account->save();
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
public function endpoint()
|
||||
{
|
||||
if ($this->shouldGoBack('endpoint')) {
|
||||
|
30
app/Http/Requests/MigrationForwardRequest.php
Normal file
30
app/Http/Requests/MigrationForwardRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class MigrationForwardRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'url' => 'nullable|url',
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddForwardUrlForV5 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accounts', function ($table) {
|
||||
$table->text('forward_url_for_v5')->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -264,9 +264,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Forward customers to V5</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ url('/migration/forward') }}" method="post" id="forward-form">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
|
||||
<div class="col-lg-8 col-sm-8">
|
||||
<div class="help-block">
|
||||
Once you are ready to forward your customers, enter your client portal URL for V5 here:<br/>
|
||||
</div><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="url" class="control-label col-lg-4 col-sm-4 text-right">{!! trans('texts.url') !!}</label>
|
||||
<div class="col-lg-8 col-sm-8">
|
||||
<input type="text" name="url" placeholder="https://subdomain.invoicing.co" class="form form-control" value="{{ $account->forward_url_for_v5}}">
|
||||
@if($errors->has('url'))
|
||||
<div class="col-sm-5">
|
||||
@foreach ($errors->get('url') as $message)
|
||||
<span class="help-block">
|
||||
<span class="glyphicon glyphicon-warning-sign"></span>
|
||||
{{ $message }}
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<br/>
|
||||
<button form="forward-form" class="btn btn-primary btn-lg">{!! trans('texts.submit') !!}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (! Auth::user()->account->isNinjaOrLicenseAccount())
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
|
@ -159,6 +159,7 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
|
||||
Route::get('migration/companies', 'Migration\StepsController@companies');
|
||||
Route::post('migration/companies', 'Migration\StepsController@handleCompanies');
|
||||
Route::get('migration/completed', 'Migration\StepsController@completed');
|
||||
Route::post('migration/forward', 'Migration\StepsController@forwardUrl');
|
||||
|
||||
Route::get('migration/import', 'Migration\StepsController@import');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user