Include quotes in observer

This commit is contained in:
David Bomba 2021-10-08 20:51:55 +11:00
parent 9e1418cb11
commit de4aaabcc9
4 changed files with 10 additions and 3 deletions

View File

@ -237,9 +237,12 @@ class Import implements ShouldQueue
//company size check //company size check
if ($this->company->invoices()->count() > 500 || $this->company->products()->count() > 500 || $this->company->clients()->count() > 500) { if ($this->company->invoices()->count() > 500 || $this->company->products()->count() > 500 || $this->company->clients()->count() > 500) {
$this->company->is_large = true; $this->company->is_large = true;
$this->company->save();
} }
$this->company->client_registration_fields = \App\DataMapper\ClientRegistrationFields::generate();
$this->company->save();
$this->setInitialCompanyLedgerBalances(); $this->setInitialCompanyLedgerBalances();
// $this->fixClientBalances(); // $this->fixClientBalances();

View File

@ -30,9 +30,9 @@ class QuoteObserver
->where('event_id', Webhook::EVENT_CREATE_QUOTE) ->where('event_id', Webhook::EVENT_CREATE_QUOTE)
->exists(); ->exists();
$quote->load('client');
if ($subscriptions) { if ($subscriptions) {
$quote->load('client');
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company); WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company);
} }
} }
@ -49,10 +49,10 @@ class QuoteObserver
->where('event_id', Webhook::EVENT_UPDATE_QUOTE) ->where('event_id', Webhook::EVENT_UPDATE_QUOTE)
->exists(); ->exists();
$quote->load('client');
if ($subscriptions) { if ($subscriptions) {
$quote->load('client');
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company); WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company);
} }
@ -71,6 +71,7 @@ class QuoteObserver
->exists(); ->exists();
if ($subscriptions) { if ($subscriptions) {
$quote->load('client');
WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company); WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company);
} }
} }

View File

@ -165,6 +165,7 @@ class CompanyTransformer extends EntityTransformer
'markdown_enabled' => (bool) $company->markdown_enabled, 'markdown_enabled' => (bool) $company->markdown_enabled,
'use_comma_as_decimal_place' => (bool) $company->use_comma_as_decimal_place, 'use_comma_as_decimal_place' => (bool) $company->use_comma_as_decimal_place,
'report_include_drafts' => (bool) $company->report_include_drafts, 'report_include_drafts' => (bool) $company->report_include_drafts,
'client_registration_fields' => (array) $company->client_registration_fields,
]; ];
} }

View File

@ -14,6 +14,7 @@
@csrf @csrf
<div class="grid grid-cols-12 gap-4 mt-10"> <div class="grid grid-cols-12 gap-4 mt-10">
@if($company->client_registration_fields)
@foreach($company->client_registration_fields as $field) @foreach($company->client_registration_fields as $field)
@if($field['required']) @if($field['required'])
<div class="col-span-12 md:col-span-6"> <div class="col-span-12 md:col-span-6">
@ -96,6 +97,7 @@
@endif @endif
@endif @endif
@endforeach @endforeach
@endif
</div> </div>
<div class="flex justify-between items-center mt-8"> <div class="flex justify-between items-center mt-8">