bind title and subheading to the respective document
This commit is contained in:
parent
d9d342f9d4
commit
12ca46381a
@ -58,20 +58,8 @@ abstract class Form extends Component
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hideLogo;
|
public $hideLogo;
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
public $hideDocumentTitle;
|
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
public $hideDocumentSubheading;
|
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hideCompanyEdit;
|
public $hideCompanyEdit;
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
public $titleSetting;
|
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
public $subheadingSetting;
|
|
||||||
/* -- Company End -- */
|
/* -- Company End -- */
|
||||||
|
|
||||||
/* -- Main Start -- */
|
/* -- Main Start -- */
|
||||||
@ -113,6 +101,18 @@ abstract class Form extends Component
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $textChooseDifferentContact;
|
public $textChooseDifferentContact;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
public $hideDocumentTitle;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
public $hideDocumentSubheading;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $title;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $subheading;
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hideIssuedAt;
|
public $hideIssuedAt;
|
||||||
|
|
||||||
@ -269,10 +269,11 @@ abstract class Form extends Component
|
|||||||
string $type, $model = false, $document = false, $currencies = false, $currency = false, $currency_code = false,
|
string $type, $model = false, $document = false, $currencies = false, $currency = false, $currency_code = false,
|
||||||
string $formId = 'document', $formRoute = '', $formMethod = '',
|
string $formId = 'document', $formRoute = '', $formMethod = '',
|
||||||
bool $hideCompany = false, string $textSectionCompaniesTitle = '', string $textSectionCompaniesDescription = '',
|
bool $hideCompany = false, string $textSectionCompaniesTitle = '', string $textSectionCompaniesDescription = '',
|
||||||
bool $hideLogo = false, bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, bool $hideCompanyEdit = false, string $titleSetting = '', $subheadingSetting = '',
|
bool $hideLogo = false, bool $hideCompanyEdit = false,
|
||||||
string $textSectionMainTitle = '', string $textSectionMainDescription = '',
|
string $textSectionMainTitle = '', string $textSectionMainDescription = '',
|
||||||
string $typeContact = '', string $textContact = '', $contacts = [], $contact = false, string $searchContactRoute = '', string $createContactRoute = '',
|
string $typeContact = '', string $textContact = '', $contacts = [], $contact = false, string $searchContactRoute = '', string $createContactRoute = '',
|
||||||
string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = '',
|
string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = '',
|
||||||
|
bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, string $title = '', string $subheading = '',
|
||||||
bool $hideIssuedAt = false, string $textIssuedAt = '', string $issuedAt = '', bool $hideDueAt = false, string $textDueAt = '', string $dueAt = '', $periodDueAt = '',
|
bool $hideIssuedAt = false, string $textIssuedAt = '', string $issuedAt = '', bool $hideDueAt = false, string $textDueAt = '', string $dueAt = '', $periodDueAt = '',
|
||||||
bool $hideDocumentNumber = false, string $textDocumentNumber = '', string $documentNumber = '', bool $hideOrderNumber = false, string $textOrderNumber = '', string $orderNumber = '',
|
bool $hideDocumentNumber = false, string $textDocumentNumber = '', string $documentNumber = '', bool $hideOrderNumber = false, string $textOrderNumber = '', string $orderNumber = '',
|
||||||
bool $hideEditItemColumns = false, bool $hideItems = false, bool $hideItemName = false, string $textItemName = '', bool $hideItemDescription = false, string $textItemDescription = '',
|
bool $hideEditItemColumns = false, bool $hideItems = false, bool $hideItemName = false, string $textItemName = '', bool $hideItemDescription = false, string $textItemDescription = '',
|
||||||
@ -306,11 +307,7 @@ abstract class Form extends Component
|
|||||||
$this->textSectionCompaniesTitle = $this->getTextSectionCompaniesTitle($type, $textSectionCompaniesTitle);
|
$this->textSectionCompaniesTitle = $this->getTextSectionCompaniesTitle($type, $textSectionCompaniesTitle);
|
||||||
$this->textSectionCompaniesDescription = $this->getTextSectionCompaniesDescription($type, $textSectionCompaniesDescription);
|
$this->textSectionCompaniesDescription = $this->getTextSectionCompaniesDescription($type, $textSectionCompaniesDescription);
|
||||||
$this->hideLogo = $hideLogo;
|
$this->hideLogo = $hideLogo;
|
||||||
$this->hideDocumentTitle = $hideDocumentTitle;
|
|
||||||
$this->hideDocumentSubheading = $hideDocumentSubheading;
|
|
||||||
$this->hideCompanyEdit = $hideCompanyEdit;
|
$this->hideCompanyEdit = $hideCompanyEdit;
|
||||||
$this->titleSetting = $this->getTitleSettingValue($type, $titleSetting);
|
|
||||||
$this->subheadingSetting = $this->getSubheadingSettingValue($type, $subheadingSetting);
|
|
||||||
/** Company End */
|
/** Company End */
|
||||||
|
|
||||||
/* -- Main Start -- */
|
/* -- Main Start -- */
|
||||||
@ -332,6 +329,11 @@ abstract class Form extends Component
|
|||||||
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
||||||
$this->textChooseDifferentContact = $this->getTextChooseDifferentContact($type, $textChooseDifferentContact);
|
$this->textChooseDifferentContact = $this->getTextChooseDifferentContact($type, $textChooseDifferentContact);
|
||||||
|
|
||||||
|
$this->hideDocumentTitle = $hideDocumentTitle;
|
||||||
|
$this->hideDocumentSubheading = $hideDocumentSubheading;
|
||||||
|
$this->title = $this->getTitleValue($type, $title);
|
||||||
|
$this->subheading = $this->getSubheadingValue($type, $subheading);
|
||||||
|
|
||||||
$this->hideIssuedAt = $hideIssuedAt;
|
$this->hideIssuedAt = $hideIssuedAt;
|
||||||
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
||||||
$this->issuedAt = $this->getIssuedAt($type, $document, $issuedAt);
|
$this->issuedAt = $this->getIssuedAt($type, $document, $issuedAt);
|
||||||
@ -1165,19 +1167,27 @@ abstract class Form extends Component
|
|||||||
return $this->getTextSectionDescription($type, 'advanced', 'documents.form_description.advanced');
|
return $this->getTextSectionDescription($type, 'advanced', 'documents.form_description.advanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTitleSettingValue($type, $titleSetting)
|
protected function getTitleValue($type, $title)
|
||||||
{
|
{
|
||||||
if (! empty($titleSetting)) {
|
if (! empty($title)) {
|
||||||
return $titleSetting;
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->title !== '') {
|
||||||
|
return $this->document->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($type, 'title'));
|
return setting($this->getSettingKey($type, 'title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSubheadingSettingValue($type, $subheadingSetting)
|
protected function getSubheadingValue($type, $subheading)
|
||||||
{
|
{
|
||||||
if (! empty($subheadingSetting)) {
|
if (! empty($subheading)) {
|
||||||
return $subheadingSetting;
|
return $subheading;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->title !== '') {
|
||||||
|
return $this->document->subheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($type, 'subheading'));
|
return setting($this->getSettingKey($type, 'subheading'));
|
||||||
|
@ -482,7 +482,7 @@ abstract class Show extends Component
|
|||||||
$this->hideDueAt = $hideDueAt;
|
$this->hideDueAt = $hideDueAt;
|
||||||
|
|
||||||
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
|
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
|
||||||
$this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading);
|
$this->textDocumentSubheading = $this->getTextDocumentSubheading($type, $textDocumentSubheading);
|
||||||
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
||||||
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
||||||
$this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber);
|
$this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber);
|
||||||
@ -994,6 +994,10 @@ abstract class Show extends Component
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->title !== '') {
|
||||||
|
return $this->document->title;
|
||||||
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'title');
|
$key = $this->getSettingKey($type, 'title');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
@ -1015,6 +1019,10 @@ abstract class Show extends Component
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->subheading !== '') {
|
||||||
|
return $this->document->subheading;
|
||||||
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'subheading');
|
$key = $this->getSettingKey($type, 'subheading');
|
||||||
|
|
||||||
if (!empty(setting($key))) {
|
if (!empty(setting($key))) {
|
||||||
|
@ -172,7 +172,7 @@ abstract class Template extends Component
|
|||||||
$this->hideDueAt = $hideDueAt;
|
$this->hideDueAt = $hideDueAt;
|
||||||
|
|
||||||
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
|
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
|
||||||
$this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading);
|
$this->textDocumentSubheading = $this->getTextDocumentSubheading($type, $textDocumentSubheading);
|
||||||
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
|
||||||
$this->showContactRoute = $this->getShowContactRoute($type, $showContactRoute);
|
$this->showContactRoute = $this->getShowContactRoute($type, $showContactRoute);
|
||||||
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
|
||||||
@ -193,7 +193,7 @@ abstract class Template extends Component
|
|||||||
$this->textQuantity = $this->getTextQuantity($type, $textQuantity);
|
$this->textQuantity = $this->getTextQuantity($type, $textQuantity);
|
||||||
$this->textPrice = $this->getTextPrice($type, $textPrice);
|
$this->textPrice = $this->getTextPrice($type, $textPrice);
|
||||||
$this->textAmount = $this->getTextAmount($type, $textAmount);
|
$this->textAmount = $this->getTextAmount($type, $textAmount);
|
||||||
|
|
||||||
$this->print = $this->getPrint($print);
|
$this->print = $this->getPrint($print);
|
||||||
|
|
||||||
// Set Parent data
|
// Set Parent data
|
||||||
@ -295,6 +295,10 @@ abstract class Template extends Component
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->title !== '') {
|
||||||
|
return $this->document->title;
|
||||||
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'title');
|
$key = $this->getSettingKey($type, 'title');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
@ -316,6 +320,10 @@ abstract class Template extends Component
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($this->document) && $this->document->subheading !== '') {
|
||||||
|
return $this->document->subheading;
|
||||||
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'subheading');
|
$key = $this->getSettingKey($type, 'subheading');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
|
@ -56,6 +56,8 @@ class Document extends Model
|
|||||||
'contact_city',
|
'contact_city',
|
||||||
'notes',
|
'notes',
|
||||||
'footer',
|
'footer',
|
||||||
|
'title',
|
||||||
|
'subheading',
|
||||||
'parent_id',
|
'parent_id',
|
||||||
'created_from',
|
'created_from',
|
||||||
'created_by',
|
'created_by',
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('documents', function (Blueprint $table) {
|
||||||
|
$table->string('title')->nullable()->default('');
|
||||||
|
$table->string('subheading')->nullable()->default('');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('documents', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('title');
|
||||||
|
$table->dropColumn('subheading');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -7,20 +7,9 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
|
|
||||||
<x-slot name="body">
|
<x-slot name="body">
|
||||||
<div class="sm:col-span-2 grid gap-x-8 gap-y-6">
|
|
||||||
@if (! $hideDocumentTitle)
|
|
||||||
<x-form.group.text name="title" label="{{ trans('settings.invoice.title') }}" value="{{ $titleSetting }}" not-required data-field="setting" />
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if (! $hideDocumentSubheading)
|
|
||||||
<x-form.group.text name="subheading" label="{{ trans('settings.invoice.subheading') }}" value="{{ $subheadingSetting }}" not-required data-field="setting" />
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sm:col-span-1"></div>
|
|
||||||
|
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
@if (! $hideLogo)
|
@if (! $hideLogo)
|
||||||
|
<x-form.input.hidden name="company_logo" data-field="setting" />
|
||||||
<x-form.group.file name="company_logo" label="{{ trans('settings.company.logo') }}" :value="setting('company.logo')" not-required data-field="setting" />
|
<x-form.group.file name="company_logo" label="{{ trans('settings.company.logo') }}" :value="setting('company.logo')" not-required data-field="setting" />
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,6 +22,28 @@
|
|||||||
<div class="sm:col-span-1"></div>
|
<div class="sm:col-span-1"></div>
|
||||||
|
|
||||||
<div class="sm:col-span-4 grid sm:grid-cols-4 gap-x-8 gap-y-6">
|
<div class="sm:col-span-4 grid sm:grid-cols-4 gap-x-8 gap-y-6">
|
||||||
|
@stack('title_start')
|
||||||
|
|
||||||
|
@if (! $hideDocumentTitle)
|
||||||
|
<x-form.group.text
|
||||||
|
name="title"
|
||||||
|
label="{{ trans('settings.invoice.title') }}"
|
||||||
|
value="{{ $title }}"
|
||||||
|
not-required
|
||||||
|
form-group-class="sm:col-span-2" />
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@stack('subheading_start')
|
||||||
|
|
||||||
|
@if (! $hideDocumentSubheading)
|
||||||
|
<x-form.group.text
|
||||||
|
name="subheading"
|
||||||
|
label="{{ trans('settings.invoice.subheading') }}"
|
||||||
|
value="{{ $subheading }}"
|
||||||
|
not-required
|
||||||
|
form-group-class="sm:col-span-2" />
|
||||||
|
@endif
|
||||||
|
|
||||||
@stack('issue_start')
|
@stack('issue_start')
|
||||||
|
|
||||||
@if (! $hideIssuedAt)
|
@if (! $hideIssuedAt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user