Fixes for setup flow

This commit is contained in:
= 2021-03-13 17:45:41 +11:00
parent 487cf555b9
commit 0bf8b9c9e5
10 changed files with 477 additions and 471 deletions

View File

@ -213,13 +213,13 @@ class InvoiceController extends BaseController
$invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id)); $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
$invoice = $invoice->service() $invoice = $invoice->service()
->fillDefaults() ->fillDefaults()
->triggeredActions($request) ->triggeredActions($request)
->save(); ->save();
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
return $this->itemResponse($invoice); return $this->itemResponse($invoice);
} }

View File

@ -145,12 +145,12 @@ class SetupController extends Controller
/* Make sure no stale connections are cached */ /* Make sure no stale connections are cached */
DB::purge('db-ninja-01'); DB::purge('db-ninja-01');
/* Run migrations */ /* Run migrations */
Artisan::call('optimize'); Artisan::call('optimize');
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);
Storage::disk('local')->delete('test.pdf'); Storage::disk('local')->delete('test.pdf');
/* Create the first account. */ /* Create the first account. */
@ -166,6 +166,7 @@ class SetupController extends Controller
} catch (Exception $e) { } catch (Exception $e) {
nlog($e->getMessage()); nlog($e->getMessage());
info($e->getMessage());
return redirect() return redirect()
->back() ->back()

View File

@ -83,10 +83,10 @@ class InvoiceController extends BaseController
$invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create($company->id, $company->owner()->id)); $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create($company->id, $company->owner()->id));
event(new InvoiceWasCreated($invoice, $company, Ninja::eventVars()));
$invoice = $invoice->service()->triggeredActions($request)->save(); $invoice = $invoice->service()->triggeredActions($request)->save();
event(new InvoiceWasCreated($invoice, $company, Ninja::eventVars()));
return $this->itemResponse($invoice); return $this->itemResponse($invoice);
} }
} }

View File

@ -60,7 +60,10 @@ class CreateAccount
private function create() private function create()
{ {
$sp794f3f = Account::create($this->request); Account::reguard();
$sp794f3f = new Account();
$sp794f3f->fill($this->request);
$sp794f3f->referral_code = Str::random(32); $sp794f3f->referral_code = Str::random(32);
if (! $sp794f3f->key) { if (! $sp794f3f->key) {

View File

@ -58,6 +58,7 @@ class CreateCompany
$company->db = config('database.default'); $company->db = config('database.default');
$company->enabled_modules = config('ninja.enabled_modules'); $company->enabled_modules = config('ninja.enabled_modules');
$company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : ''; $company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : '';
$company->custom_fields = new \stdClass;
$company->save(); $company->save();
return $company; return $company;

View File

@ -288,6 +288,7 @@ trait DesignHelpers
if (!array_key_exists($field, $fields)) { if (!array_key_exists($field, $fields)) {
return ''; return '';
} }
nlog($this->client->company);
if (!property_exists($this->client->company->custom_fields, $field)) { if (!property_exists($this->client->company->custom_fields, $field)) {
return ''; return '';

920
package-lock.json generated

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,6 @@
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12", "/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
"/js/clients/shared/multiple-downloads.js": "/js/clients/shared/multiple-downloads.js?id=5c35d28cf0a3286e7c45", "/js/clients/shared/multiple-downloads.js": "/js/clients/shared/multiple-downloads.js?id=5c35d28cf0a3286e7c45",
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=fc3055d6a099f523ea98", "/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=fc3055d6a099f523ea98",
"/js/setup/setup.js": "/js/setup/setup.js?id=5962ec6bcebeaac71d1b", "/js/setup/setup.js": "/js/setup/setup.js?id=8d454e7090f119552a6c",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad" "/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad"
} }

View File

@ -96,8 +96,8 @@ class Setup {
Axios.post(url, {}) Axios.post(url, {})
.then((response) => { .then((response) => {
try { try {
let win = window.open(response.data.url, '_blank'); //let win = window.open(response.data.url, '_blank');
win.focus(); //win.focus();
return this.handleSuccess( return this.handleSuccess(
this.checkPdfAlert, this.checkPdfAlert,