From 5ce95010d5508bc525a4d09a08842c557716053d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 16 Jun 2022 13:04:05 +1000 Subject: [PATCH] Add switch to force react as front end --- app/Http/Controllers/BaseController.php | 2 +- app/Http/Controllers/SelfUpdateController.php | 19 +- app/Models/Account.php | 5 +- app/Transformers/AccountTransformer.php | 2 +- ...6_10_030503_set_account_flag_for_react.php | 3 - ..._06_16_025156_add_react_switching_flag.php | 30 +++ .../react/invoiceninja-logo@dark.365f6449.png | Bin 0 -> 4280 bytes .../ninja2020/vendor_profile/edit.blade.php | 177 ++++++++++++++++++ 8 files changed, 227 insertions(+), 11 deletions(-) create mode 100644 database/migrations/2022_06_16_025156_add_react_switching_flag.php create mode 100644 public/react/invoiceninja-logo@dark.365f6449.png create mode 100644 resources/views/portal/ninja2020/vendor_profile/edit.blade.php diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 90bdc3429ff7..9332df3876f6 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -800,7 +800,7 @@ class BaseController extends Controller $this->buildCache(); - if(config('ninja.react_app_enabled')) + if(Ninja::isSelfHost() && $account->set_react_as_default_ap) return response()->view('react.index', $data)->header('X-Frame-Options', 'SAMEORIGIN', false); else return response()->view('index.index', $data)->header('X-Frame-Options', 'SAMEORIGIN', false); diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 06105ab32e20..051b4066d1a4 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -196,15 +196,26 @@ class SelfUpdateController extends BaseController private function cleanOldSnapChromeBinaries() { $current_revision = base_path('vendor/beganovich/snappdf/versions/revision.txt'); + $current_revision_text = file_get_contents($current_revision); - $directoryIterator = new \RecursiveDirectoryIterator(base_path('vendor/beganovich/snappdf/versions'), \RecursiveDirectoryIterator::SKIP_DOTS); + $iterator = new \DirectoryIterator(base_path('vendor/beganovich/snappdf/versions')); - foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) { + foreach ($iterator as $file) + { - unlink($file->getPathName()); + if($file->isDir() && !$file->isDot() && ($current_revision_text != $file->getFileName())) + { - } + $directoryIterator = new \RecursiveDirectoryIterator(base_path('vendor/beganovich/snappdf/versions/'.$file->getFileName()), \RecursiveDirectoryIterator::SKIP_DOTS); + foreach (new \RecursiveIteratorIterator($directoryIterator) as $filex) + { + unlink($filex->getPathName()); + } + + } + + } } diff --git a/app/Models/Account.php b/app/Models/Account.php index b2a94fb95dff..1692ac7d6ea4 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -57,7 +57,7 @@ class Account extends BaseModel 'utm_content', 'user_agent', 'platform', - // 'set_react_as_default_ap', + 'set_react_as_default_ap', ]; /** @@ -75,7 +75,8 @@ class Account extends BaseModel 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', - 'onboarding' => 'object' + 'onboarding' => 'object', + 'set_react_as_default_ap' => 'bool' ]; const PLAN_FREE = 'free'; diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index 502f0b9dedc5..9536a9dc422f 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -86,7 +86,7 @@ class AccountTransformer extends EntityTransformer 'hosted_client_count' => (int) $account->hosted_client_count, 'hosted_company_count' => (int) $account->hosted_company_count, 'is_hosted' => (bool) Ninja::isHosted(), - // 'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap + 'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap ]; } diff --git a/database/migrations/2022_06_10_030503_set_account_flag_for_react.php b/database/migrations/2022_06_10_030503_set_account_flag_for_react.php index a81f53fa4c3e..3a26ea68b3a3 100644 --- a/database/migrations/2022_06_10_030503_set_account_flag_for_react.php +++ b/database/migrations/2022_06_10_030503_set_account_flag_for_react.php @@ -23,9 +23,6 @@ class SetAccountFlagForReact extends Migration { Illuminate\Support\Facades\Artisan::call('ninja:design-update'); - // Schema::table('accounts', function (Blueprint $table) { - // $table->boolean('set_react_as_default_ap')->default(0); - // }); } /** diff --git a/database/migrations/2022_06_16_025156_add_react_switching_flag.php b/database/migrations/2022_06_16_025156_add_react_switching_flag.php new file mode 100644 index 000000000000..704846795358 --- /dev/null +++ b/database/migrations/2022_06_16_025156_add_react_switching_flag.php @@ -0,0 +1,30 @@ +boolean('set_react_as_default_ap')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/public/react/invoiceninja-logo@dark.365f6449.png b/public/react/invoiceninja-logo@dark.365f6449.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad35df2688293325358b12956c3c919d2a71727 GIT binary patch literal 4280 zcmd5<_dnE+115W~vmM!cdZ{9pQIwB<{6%i59*Vo74a2y;QR8&-p zi;DpP0ma3|1OlO_r^nvj-o(UYeSIB^#XfuXjERYc6KHuC247Csj8}4T3Y7i<<-{KMn*<@dwYWYugg5dHKCn;7&6Xi)Jt!#Ef9 z`D6Rayy|-|6GY@++Y0E|czQxQwa1cl>%TvrL{Zo0BUmKrpR*OUrwD(-R$7fbw9xg%0}_h~FIoMxZWquW5traZa~{v5qX+MzFcDXD6}t{M_1 zc2-cXQOSyxuq07A* zxRw`Nsg%yk6`Iy>c#3MV@?gHr`|$$3dXQ@Y-j8W<)I^irdY9P}NINcQQW%t7@gj>i z^=YNsof=_J2p|TJl~e2AU=r8IhnS(N?ufuE6eaTXDe57LyZ))v7$xl95~0~_!sp`f zqh1FZ;-pjIVaMu)!4AlO#>^~YaKS_LZ6n3eHwuRQTSP>WPz ze&!Z*C~(0u)Rcq$J_O(s`h~nW0(N%icj(`D&iS02uiRC0cIGM_MidYGKC_yL#Sm6i z1C>_eF6>QG5L)e!`KCKelVhxS01Ucz~n@43jx#{ zBs$R*$HS#h5Gb6JuiyA>myoGIJq&|%4+C-Un||Ph5eaQ3XXLHwd$QEAVI(DRsy)80 z3(ZY?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ILTz(bDnK8KW_Aefi4x#BTa zis`L*>dCC%nU)5yy#RFF;;yKk7=sCB(L;pg7;GV@vrGrsBbz1DFAlEJho8q1N(%Oa0p3dVNa{aNC`FD%HA(y;4IT07qczn1MSk347I z<{b6|64-V5H)H?HbOEjKlTo9ccg%zjzvWXevVUud9pnyNKlV(Rwt8#*LkC0Eygzv8 z#rIs`_P0~bYlo4kV*VdVE0zbAsoVd3Iw4Rh16cD>%ALFC4{FnSZariXamuC|+~xkl zSN1gIM*z#j^UaPNjFDZkDbL~Sx&{tlY? Q?_Lub=o#rYXgkLJ4^s;BKmY&$ literal 0 HcmV?d00001 diff --git a/resources/views/portal/ninja2020/vendor_profile/edit.blade.php b/resources/views/portal/ninja2020/vendor_profile/edit.blade.php new file mode 100644 index 000000000000..f7fb6a6d1289 --- /dev/null +++ b/resources/views/portal/ninja2020/vendor_profile/edit.blade.php @@ -0,0 +1,177 @@ +@extends('portal.ninja2020.layout.vendor_app') + +@section('meta_title', ctrans('texts.vendor_information')) + +@section('header') +

{{ ctrans('texts.update_your_personal_info') }}

+@endsection + +@section('body') + @if(session()->has('missing_required_fields')) +
+

{{ ctrans('texts.before_proceeding_with_payment_warning') }}:

+ +
    + @foreach(session()->get('missing_required_fields') as $field) +
  • — {{ ctrans("texts.{$field}") }}
  • + @endforeach +
+ + +
+ @endif + +
+
+
+
+

{{ ctrans('texts.contact_details') }}

+
+
+ +
+
+ @csrf + @method('PUT') +
+
+
+
+ + + @error('first_name') +
+ {{ $message }} +
+ @enderror +
+ +
+ + + @error('last_name') +
+ {{ $message }} +
+ @enderror +
+ +
+ + + @error('email') +
+ {{ $message }} +
+ @enderror +
+ +
+ + + @error('phone') +
+ {{ $message }} +
+ @enderror +
+ + +
+
+ +
+
+
+
+ +
+
+
+
+

{{ ctrans('texts.billing_address') }}

+
+
+
+
+
+
+ + + @error('address1') +
+ {{ $message }} +
+ @enderror +
+
+ + + @error('address2') +
+ {{ $message }} +
+ @enderror +
+
+ + + @error('city') +
+ {{ $message }} +
+ @enderror +
+
+ + + @error('state') +
+ {{ $message }} +
+ @enderror +
+
+ + + @error('postal_code') +
+ {{ $message }} +
+ @enderror +
+
+ + + @error('country') +
+ {{ $message }} +
+ @enderror +
+
+
+
+ +
+
+ +
+
+ + +@endsection