Document company component saved..
This commit is contained in:
parent
ad68183987
commit
42352dcc61
@ -8,13 +8,17 @@ class DocumentCreated extends Event
|
||||
{
|
||||
public $document;
|
||||
|
||||
public $request;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param $document
|
||||
* @param $request
|
||||
*/
|
||||
public function __construct($document)
|
||||
public function __construct($document, $request)
|
||||
{
|
||||
$this->document = $document;
|
||||
$this->request = $request;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class CreateDocument extends Job
|
||||
$this->document->createRecurring();
|
||||
});
|
||||
|
||||
event(new DocumentCreated($this->document));
|
||||
event(new DocumentCreated($this->document, $this->request));
|
||||
|
||||
return $this->document;
|
||||
}
|
||||
|
43
app/Listeners/Document/SettingFieldCreated.php
Normal file
43
app/Listeners/Document/SettingFieldCreated.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Document;
|
||||
|
||||
use App\Events\Document\DocumentCreated as Event;
|
||||
use App\Traits\Documents;
|
||||
|
||||
class SettingFieldCreated
|
||||
{
|
||||
use Documents;
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$request = $event->request;
|
||||
|
||||
if ($request->has('setting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $request->get('type');
|
||||
|
||||
foreach ($request->get('setting') as $key => $value) {
|
||||
if ($key == 'company_logo') {
|
||||
setting()->set('company.logo', $value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$real_key = $type . '.' . $key;
|
||||
|
||||
setting()->set($real_key, $value);
|
||||
}
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
}
|
||||
}
|
43
app/Listeners/Document/SettingFieldUpdated.php
Normal file
43
app/Listeners/Document/SettingFieldUpdated.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Document;
|
||||
|
||||
use App\Events\Document\DocumentUpdated as Event;
|
||||
use App\Traits\Documents;
|
||||
|
||||
class SettingFieldUpdated
|
||||
{
|
||||
use Documents;
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$request = $event->request;
|
||||
|
||||
if ($request->has('setting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $request->get('type');
|
||||
|
||||
foreach ($request->get('setting') as $key => $value) {
|
||||
if ($key == 'company_logo') {
|
||||
setting()->set('company.logo', $value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$real_key = $type . '.' . $key;
|
||||
|
||||
setting()->set($real_key, $value);
|
||||
}
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
}
|
||||
}
|
@ -39,6 +39,7 @@ class Event extends Provider
|
||||
'App\Events\Document\DocumentCreated' => [
|
||||
'App\Listeners\Document\CreateDocumentCreatedHistory',
|
||||
'App\Listeners\Document\IncreaseNextDocumentNumber',
|
||||
'App\Listeners\Document\SettingFieldCreated',
|
||||
],
|
||||
'App\Events\Document\DocumentReceived' => [
|
||||
'App\Listeners\Document\MarkDocumentReceived',
|
||||
@ -59,6 +60,9 @@ class Event extends Provider
|
||||
'App\Events\Document\DocumentSent' => [
|
||||
'App\Listeners\Document\MarkDocumentSent',
|
||||
],
|
||||
'App\Events\Document\DocumentUpdated' => [
|
||||
'App\Listeners\Document\SettingFieldUpdated',
|
||||
],
|
||||
'App\Events\Document\DocumentViewed' => [
|
||||
'App\Listeners\Document\MarkDocumentViewed',
|
||||
],
|
||||
|
@ -9,17 +9,17 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
@if (!$hideLogo)
|
||||
{{ Form::fileGroup('company_logo', trans('settings.company.logo'), 'file-image-o', [], setting('company.logo')) }}
|
||||
{{ Form::fileGroup('company_logo', trans('settings.company.logo'), 'file-image-o', ['data-field' => 'setting'], setting('company.logo')) }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
@if (!$hideDocumentTitle)
|
||||
{{ Form::textGroup($inputNameType . '_title', trans('settings.' . $type . '.title'), 'font', [], setting($type . '.title'), 'col-md-12') }}
|
||||
{{ Form::textGroup('title', trans('settings.' . $type . '.title'), 'font', ['data-field' => 'setting'], setting($type . '.title'), 'col-md-12') }}
|
||||
@endif
|
||||
|
||||
@if (!$hideDocumentSubheading)
|
||||
{{ Form::textGroup($inputNameType . '_subheading', trans('settings.' . $type . '.subheading'), 'font', [], setting($type . '.subheading'), 'col-md-12') }}
|
||||
{{ Form::textGroup('subheading', trans('settings.' . $type . '.subheading'), 'font', ['data-field' => 'setting'], setting($type . '.subheading'), 'col-md-12') }}
|
||||
@endif
|
||||
|
||||
@if (!$hideCompanyEdit)
|
||||
|
Loading…
x
Reference in New Issue
Block a user