Make dynamic invoice settings for documents
This commit is contained in:
parent
35fa63bf42
commit
8aac5fe433
@ -43,6 +43,12 @@ abstract class DocumentForm extends Base
|
|||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hideCompanyEdit;
|
public $hideCompanyEdit;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $titleSetting;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $subheadingSetting;
|
||||||
/** Company Component End */
|
/** Company Component End */
|
||||||
|
|
||||||
/** Content Component Start */
|
/** Content Component Start */
|
||||||
@ -72,6 +78,12 @@ abstract class DocumentForm extends Base
|
|||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hideButtons;
|
public $hideButtons;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $footerSetting;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $notesSetting;
|
||||||
/** Content Component End */
|
/** Content Component End */
|
||||||
|
|
||||||
/** Metadata Component Start */
|
/** Metadata Component Start */
|
||||||
@ -199,10 +211,12 @@ abstract class DocumentForm extends Base
|
|||||||
/** Advanced Component End */
|
/** Advanced Component End */
|
||||||
/** Company Component Start */
|
/** Company Component Start */
|
||||||
bool $hideLogo = false, bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, bool $hideCompanyEdit = false,
|
bool $hideLogo = false, bool $hideDocumentTitle = false, bool $hideDocumentSubheading = false, bool $hideCompanyEdit = false,
|
||||||
|
string $titleSetting = '', string $subheadingSetting = '',
|
||||||
/** Company Component End */
|
/** Company Component End */
|
||||||
/** Content Component Start */
|
/** Content Component Start */
|
||||||
string $routeStore = '', string $routeUpdate = '', string $formId = 'document', string $formSubmit = 'onSubmit', string $routeCancel = '',
|
string $routeStore = '', string $routeUpdate = '', string $formId = 'document', string $formSubmit = 'onSubmit', string $routeCancel = '',
|
||||||
bool $hideCompany = false, bool $hideAdvanced = false, bool $hideFooter = false, bool $hideButtons = false,
|
bool $hideCompany = false, bool $hideAdvanced = false, bool $hideFooter = false, bool $hideButtons = false,
|
||||||
|
string $footerSetting = '', string $notesSetting = '',
|
||||||
/** Content Component End */
|
/** Content Component End */
|
||||||
/** Metadata Component Start */
|
/** Metadata Component Start */
|
||||||
$contacts = [], $contact = false, string $contactType = '', string $contactSearchRoute = '', string $contactCreateRoute = '',
|
$contacts = [], $contact = false, string $contactType = '', string $contactSearchRoute = '', string $contactCreateRoute = '',
|
||||||
@ -234,6 +248,8 @@ abstract class DocumentForm extends Base
|
|||||||
$this->hideDocumentTitle = $hideDocumentTitle;
|
$this->hideDocumentTitle = $hideDocumentTitle;
|
||||||
$this->hideDocumentSubheading = $hideDocumentSubheading;
|
$this->hideDocumentSubheading = $hideDocumentSubheading;
|
||||||
$this->hideCompanyEdit = $hideCompanyEdit;
|
$this->hideCompanyEdit = $hideCompanyEdit;
|
||||||
|
$this->titleSetting = $this->getTitleSettingValue($titleSetting);
|
||||||
|
$this->subheadingSetting = $this->getSubheadingSettingValue($subheadingSetting);
|
||||||
/** Company Component End */
|
/** Company Component End */
|
||||||
|
|
||||||
/** Content Component Start */
|
/** Content Component Start */
|
||||||
@ -247,6 +263,8 @@ abstract class DocumentForm extends Base
|
|||||||
$this->hideAdvanced = $hideAdvanced;
|
$this->hideAdvanced = $hideAdvanced;
|
||||||
$this->hideFooter = $hideFooter;
|
$this->hideFooter = $hideFooter;
|
||||||
$this->hideButtons = $hideButtons;
|
$this->hideButtons = $hideButtons;
|
||||||
|
$this->footerSetting = $this->getFooterSettingValue($footerSetting);
|
||||||
|
$this->notesSetting = $this->getNotesSettingValue($notesSetting);
|
||||||
/** Content Component End */
|
/** Content Component End */
|
||||||
|
|
||||||
/** Metadata Component Start */
|
/** Metadata Component Start */
|
||||||
@ -580,7 +598,7 @@ abstract class DocumentForm extends Base
|
|||||||
$issuedAt = Date::now()->toDateString();
|
$issuedAt = Date::now()->toDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
$addDays = (setting($type . '.payment_terms', 0)) ? setting($type . '.payment_terms', 0) : 0;
|
$addDays = setting($this->getSettingKey($type, 'payment_terms'), 0) ?: 0;
|
||||||
|
|
||||||
$dueAt = Date::parse($issuedAt)->addDays($addDays)->toDateString();
|
$dueAt = Date::parse($issuedAt)->addDays($addDays)->toDateString();
|
||||||
|
|
||||||
@ -689,8 +707,8 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.item_name', 'items') == 'custom') {
|
if (setting($this->getSettingKey($type, 'item_name'), 'items') === 'custom') {
|
||||||
if (empty($textItems = setting($type . '.item_name_input'))) {
|
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
|
||||||
$textItems = 'general.items';
|
$textItems = 'general.items';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,8 +731,8 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.quantity_name', 'quantity') == 'custom') {
|
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
||||||
if (empty($textQuantity = setting($type . '.quantity_name_input'))) {
|
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
|
||||||
$textQuantity = 'invoices.quantity';
|
$textQuantity = 'invoices.quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,8 +755,8 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.price_name', 'price') == 'custom') {
|
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
|
||||||
if (empty($textPrice = setting($type . '.price_name_input'))) {
|
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
|
||||||
$textPrice = 'invoices.price';
|
$textPrice = 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,7 +811,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideName = setting($type . '.hide_item_name', false)) {
|
if ($hideName = setting($this->getSettingKey($type, 'hide_item_name'), false)) {
|
||||||
return $hideName;
|
return $hideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +832,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDescription = setting($type . '.hide_item_description', false)) {
|
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
|
||||||
return $hideDescription;
|
return $hideDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +853,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideQuantity = setting($type . '.hide_quantity', false)) {
|
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false)) {
|
||||||
return $hideQuantity;
|
return $hideQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -856,7 +874,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hidePrice = setting($type . '.hide_price', false)) {
|
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false)) {
|
||||||
return $hidePrice;
|
return $hidePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,7 +895,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDiscount = setting($type . '.hide_discount', false)) {
|
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
|
||||||
return $hideDiscount;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,7 +916,7 @@ abstract class DocumentForm extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideAmount = setting($type . '.hide_amount', false)) {
|
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
|
||||||
return $hideAmount;
|
return $hideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,4 +929,40 @@ abstract class DocumentForm extends Base
|
|||||||
// @todo what return value invoice or always false??
|
// @todo what return value invoice or always false??
|
||||||
return setting('invoice.hide_amount', $hideAmount);
|
return setting('invoice.hide_amount', $hideAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getTitleSettingValue($titleSetting)
|
||||||
|
{
|
||||||
|
if (!empty($titleSetting)) {
|
||||||
|
return $titleSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
return setting($this->getSettingKey($this->type, 'title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getSubheadingSettingValue($subheadingSetting)
|
||||||
|
{
|
||||||
|
if (!empty($subheadingSetting)) {
|
||||||
|
return $subheadingSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
return setting($this->getSettingKey($this->type, 'subheading'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getFooterSettingValue($footerSetting)
|
||||||
|
{
|
||||||
|
if (!empty($footerSetting)) {
|
||||||
|
return $footerSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
return setting($this->getSettingKey($this->type, 'footer'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getNotesSettingValue($notesSetting)
|
||||||
|
{
|
||||||
|
if (!empty($notesSetting)) {
|
||||||
|
return $notesSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
return setting($this->getSettingKey($this->type, 'notes'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Abstracts\View\Components;
|
|||||||
use App\Abstracts\View\Components\Document as Base;
|
use App\Abstracts\View\Components\Document as Base;
|
||||||
use App\Models\Common\Media;
|
use App\Models\Common\Media;
|
||||||
use App\Traits\DateTime;
|
use App\Traits\DateTime;
|
||||||
|
use App\Traits\Documents;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\URL;
|
use Illuminate\Support\Facades\URL;
|
||||||
@ -16,6 +17,7 @@ use Storage;
|
|||||||
abstract class DocumentShow extends Base
|
abstract class DocumentShow extends Base
|
||||||
{
|
{
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Documents;
|
||||||
|
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
@ -578,7 +580,7 @@ abstract class DocumentShow extends Base
|
|||||||
$type = $alias . '.' . str_replace('-', '_', $type);
|
$type = $alias . '.' . str_replace('-', '_', $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentTemplate = setting($type . '.template') ?: 'default';
|
$documentTemplate = setting($this->getSettingKey($type, 'template')) ?: 'default';
|
||||||
|
|
||||||
return $documentTemplate;
|
return $documentTemplate;
|
||||||
}
|
}
|
||||||
@ -1384,7 +1386,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideName = setting($type . '.hide_item_name', false)) {
|
if ($hideName = setting($this->getSettingKey($type, 'hide_item_name'), false)) {
|
||||||
return $hideName;
|
return $hideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1405,7 +1407,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDescription = setting($type . '.hide_item_description', false)) {
|
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
|
||||||
return $hideDescription;
|
return $hideDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,7 +1428,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideQuantity = setting($type . '.hide_quantity', false)) {
|
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false)) {
|
||||||
return $hideQuantity;
|
return $hideQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1447,7 +1449,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hidePrice = setting($type . '.hide_price', false)) {
|
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false)) {
|
||||||
return $hidePrice;
|
return $hidePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1468,7 +1470,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDiscount = setting($type . '.hide_discount', false)) {
|
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
|
||||||
return $hideDiscount;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,7 +1491,7 @@ abstract class DocumentShow extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideAmount = setting($type . '.hide_amount', false)) {
|
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
|
||||||
return $hideAmount;
|
return $hideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Abstracts\View\Components;
|
|||||||
use App\Abstracts\View\Components\Document as Base;
|
use App\Abstracts\View\Components\Document as Base;
|
||||||
use App\Models\Common\Media;
|
use App\Models\Common\Media;
|
||||||
use App\Traits\DateTime;
|
use App\Traits\DateTime;
|
||||||
|
use App\Traits\Documents;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Image;
|
use Image;
|
||||||
@ -14,6 +15,7 @@ use Storage;
|
|||||||
abstract class DocumentTemplate extends Base
|
abstract class DocumentTemplate extends Base
|
||||||
{
|
{
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Documents;
|
||||||
|
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentTemplate = setting($type . '.template', 'default');
|
$documentTemplate = setting($this->getSettingKey($type, 'template'), 'default');
|
||||||
|
|
||||||
return $documentTemplate;
|
return $documentTemplate;
|
||||||
}
|
}
|
||||||
@ -248,7 +250,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
$type = $alias . '.' . str_replace('-', '_', $type);
|
$type = $alias . '.' . str_replace('-', '_', $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$backgroundColor = setting($type . '.color', '#55588b');
|
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b');
|
||||||
|
|
||||||
return $backgroundColor;
|
return $backgroundColor;
|
||||||
}
|
}
|
||||||
@ -368,8 +370,8 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.item_name', 'items') == 'custom') {
|
if (setting($this->getSettingKey($type, 'item_name'), 'items') == 'custom') {
|
||||||
if (empty($textItems = setting($type . '.item_name_input'))) {
|
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
|
||||||
$textItems = 'general.items';
|
$textItems = 'general.items';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,8 +394,8 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.quantity_name', 'quantity') == 'custom') {
|
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
||||||
if (empty($textQuantity = setting($type . '.quantity_name_input'))) {
|
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
|
||||||
$textQuantity = 'invoices.quantity';
|
$textQuantity = 'invoices.quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,8 +418,8 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($type . '.price_name', 'price') == 'custom') {
|
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
|
||||||
if (empty($textPrice = setting($type . '.price_name_input'))) {
|
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
|
||||||
$textPrice = 'invoices.price';
|
$textPrice = 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,7 +474,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideName = setting($type . '.hide_item_name', false)) {
|
if ($hideName = setting($this->getSettingKey($type, 'hide_item_name'), false)) {
|
||||||
return $hideName;
|
return $hideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +495,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDescription = setting($type . '.hide_item_description', false)) {
|
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
|
||||||
return $hideDescription;
|
return $hideDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +516,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideQuantity = setting($type . '.hide_quantity', false)) {
|
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false)) {
|
||||||
return $hideQuantity;
|
return $hideQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +537,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hidePrice = setting($type . '.hide_price', false)) {
|
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false)) {
|
||||||
return $hidePrice;
|
return $hidePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,7 +558,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideDiscount = setting($type . '.hide_discount', false)) {
|
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
|
||||||
return $hideDiscount;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +579,7 @@ abstract class DocumentTemplate extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideAmount = setting($type . '.hide_amount', false)) {
|
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
|
||||||
return $hideAmount;
|
return $hideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,13 @@ namespace App\Http\Controllers\Modals;
|
|||||||
|
|
||||||
use App\Abstracts\Http\Controller;
|
use App\Abstracts\Http\Controller;
|
||||||
use App\Http\Requests\Setting\Setting as Request;
|
use App\Http\Requests\Setting\Setting as Request;
|
||||||
|
use App\Traits\Documents;
|
||||||
|
|
||||||
class DocumentItemColumns extends Controller
|
class DocumentItemColumns extends Controller
|
||||||
{
|
{
|
||||||
public $skip_keys = ['company_id', '_method', '_token', '_prefix', '_template', 'type'];
|
use Documents;
|
||||||
|
|
||||||
|
public $skip_keys = ['company_id', '_method', '_token', '_template', 'type'];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -54,12 +57,35 @@ class DocumentItemColumns extends Controller
|
|||||||
'90' => trans('settings.invoice.due_days', ['days' => 90]),
|
'90' => trans('settings.invoice.due_days', ['days' => 90]),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$item_name = setting($this->getSettingKey($type, 'item_name'));
|
||||||
|
$item_name_input = setting($this->getSettingKey($type, 'item_name_input'));
|
||||||
|
$price_name = setting($this->getSettingKey($type, 'price_name'));
|
||||||
|
$price_name_input = setting($this->getSettingKey($type, 'price_name_input'));
|
||||||
|
$quantity_name = setting($this->getSettingKey($type, 'quantity_name'));
|
||||||
|
$quantity_name_input = setting($this->getSettingKey($type, 'quantity_name_input'));
|
||||||
|
$hide_item_name = setting($this->getSettingKey($type, 'hide_item_name'));
|
||||||
|
$hide_item_description = setting($this->getSettingKey($type, 'hide_item_description'));
|
||||||
|
$hide_quantity = setting($this->getSettingKey($type, 'hide_quantity'));
|
||||||
|
$hide_price = setting($this->getSettingKey($type, 'hide_price'));
|
||||||
|
$hide_amount = setting($this->getSettingKey($type, 'hide_amount'));
|
||||||
|
|
||||||
$html = view('modals.documents.item_columns', compact(
|
$html = view('modals.documents.item_columns', compact(
|
||||||
'type',
|
'type',
|
||||||
'item_names',
|
'item_names',
|
||||||
'price_names',
|
'price_names',
|
||||||
'quantity_names',
|
'quantity_names',
|
||||||
'payment_terms'
|
'payment_terms',
|
||||||
|
'item_name',
|
||||||
|
'item_name_input',
|
||||||
|
'price_name',
|
||||||
|
'price_name_input',
|
||||||
|
'quantity_name',
|
||||||
|
'quantity_name_input',
|
||||||
|
'hide_item_name',
|
||||||
|
'hide_item_description',
|
||||||
|
'hide_quantity',
|
||||||
|
'hide_price',
|
||||||
|
'hide_amount',
|
||||||
))->render();
|
))->render();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -80,7 +106,7 @@ class DocumentItemColumns extends Controller
|
|||||||
public function update(Request $request)
|
public function update(Request $request)
|
||||||
{
|
{
|
||||||
$fields = $request->all();
|
$fields = $request->all();
|
||||||
$prefix = $request->get('_prefix', 'invoice');
|
$type = $request->get('type', 'invoice');
|
||||||
$company_id = $request->get('company_id');
|
$company_id = $request->get('company_id');
|
||||||
|
|
||||||
if (empty($company_id)) {
|
if (empty($company_id)) {
|
||||||
@ -88,7 +114,7 @@ class DocumentItemColumns extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
$real_key = $prefix . '.' . $key;
|
$real_key = $this->getSettingKey($type, $key);
|
||||||
|
|
||||||
// Don't process unwanted keys
|
// Don't process unwanted keys
|
||||||
if (in_array($key, $this->skip_keys)) {
|
if (in_array($key, $this->skip_keys)) {
|
||||||
|
@ -83,7 +83,7 @@ trait Documents
|
|||||||
{
|
{
|
||||||
return Str::slug($document->document_number, $separator, language()->getShortCode());
|
return Str::slug($document->document_number, $separator, language()->getShortCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTextDocumentStatuses($type)
|
protected function getTextDocumentStatuses($type)
|
||||||
{
|
{
|
||||||
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
$default_key = config('type.' . $type . '.translation.prefix') . '.statuses.';
|
||||||
@ -106,4 +106,21 @@ trait Documents
|
|||||||
|
|
||||||
return 'documents.statuses.';
|
return 'documents.statuses.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getSettingKey($type, $setting_key)
|
||||||
|
{
|
||||||
|
$key = '';
|
||||||
|
$alias = config('type.' . $type . '.alias');
|
||||||
|
|
||||||
|
if (!empty($alias)) {
|
||||||
|
$key .= $alias . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefix = config('type.' . $type . '.setting.prefix');
|
||||||
|
|
||||||
|
|
||||||
|
$key .= $prefix . '.' . $setting_key;
|
||||||
|
|
||||||
|
return $key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,9 @@ return [
|
|||||||
'issued_at' => 'invoices.invoice_date',
|
'issued_at' => 'invoices.invoice_date',
|
||||||
'due_at' => 'invoices.due_date',
|
'due_at' => 'invoices.due_date',
|
||||||
],
|
],
|
||||||
|
'setting' => [
|
||||||
|
'prefix' => 'invoice',
|
||||||
|
],
|
||||||
'category_type' => 'income',
|
'category_type' => 'income',
|
||||||
'transaction_type' => 'income',
|
'transaction_type' => 'income',
|
||||||
'contact_type' => 'customer', // use contact type
|
'contact_type' => 'customer', // use contact type
|
||||||
@ -47,6 +50,9 @@ return [
|
|||||||
'issued_at' => 'bills.bill_date',
|
'issued_at' => 'bills.bill_date',
|
||||||
'due_at' => 'bills.due_date',
|
'due_at' => 'bills.due_date',
|
||||||
],
|
],
|
||||||
|
'setting' => [
|
||||||
|
'prefix' => 'bill',
|
||||||
|
],
|
||||||
'category_type' => 'expense',
|
'category_type' => 'expense',
|
||||||
'transaction_type' => 'expense',
|
'transaction_type' => 'expense',
|
||||||
'contact_type' => 'vendor',
|
'contact_type' => 'vendor',
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||||
@if (!$hideDocumentTitle)
|
@if (!$hideDocumentTitle)
|
||||||
{{ Form::textGroup('title', trans('settings.invoice.title'), 'font', ['data-field' => 'setting'], setting($type . '.title'), 'col-md-12') }}
|
{{ Form::textGroup('title', trans('settings.invoice.title'), 'font', ['data-field' => 'setting'], $titleSetting, 'col-md-12') }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!$hideDocumentSubheading)
|
@if (!$hideDocumentSubheading)
|
||||||
{{ Form::textGroup('subheading', trans('settings.invoice.subheading'), 'font', ['data-field' => 'setting'], setting($type . '.subheading'), 'col-md-12') }}
|
{{ Form::textGroup('subheading', trans('settings.invoice.subheading'), 'font', ['data-field' => 'setting'], $subheadingSetting, 'col-md-12') }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!$hideCompanyEdit)
|
@if (!$hideCompanyEdit)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
hide-document-title="{{ $hideDocumentTitle }}"
|
hide-document-title="{{ $hideDocumentTitle }}"
|
||||||
hide-document-subheading="{{ $hideDocumentSubheading }}"
|
hide-document-subheading="{{ $hideDocumentSubheading }}"
|
||||||
hide-company-edit="{{ $hideCompanyEdit }}"
|
hide-company-edit="{{ $hideCompanyEdit }}"
|
||||||
|
title-setting="{{ $titleSetting }}"
|
||||||
/>
|
/>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -67,12 +68,14 @@
|
|||||||
text-amount="{{ $textAmount }}"
|
text-amount="{{ $textAmount }}"
|
||||||
is-sale-price="{{ $isSalePrice }}"
|
is-sale-price="{{ $isSalePrice }}"
|
||||||
is-purchase-price="{{ $isPurchasePrice }}"
|
is-purchase-price="{{ $isPurchasePrice }}"
|
||||||
|
notes-setting="{{ $notesSetting }}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@if (!$hideFooter)
|
@if (!$hideFooter)
|
||||||
<x-documents.form.footer
|
<x-documents.form.footer
|
||||||
type="{{ $type }}"
|
type="{{ $type }}"
|
||||||
:document="$document"
|
:document="$document"
|
||||||
|
footer-setting="{{ $footerSetting }}"
|
||||||
/>
|
/>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="accordion-footer-body" class="collapse hide" aria-labelledby="accordion-footer-header">
|
<div id="accordion-footer-body" class="collapse hide" aria-labelledby="accordion-footer-header">
|
||||||
{{ Form::textareaGroup('footer', '', '', setting($type . '.footer'), ['rows' => '3'], 'embed-acoordion-textarea') }}
|
{{ Form::textareaGroup('footer', '', '', $footerSetting, ['rows' => '3'], 'embed-acoordion-textarea') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
<x-documents.form.note
|
<x-documents.form.note
|
||||||
type="{{ $type }}"
|
type="{{ $type }}"
|
||||||
:document="$document"
|
:document="$document"
|
||||||
|
notes-setting="{{ $notesSetting }}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<div class="row embed-card-body-footer">
|
<div class="row embed-card-body-footer">
|
||||||
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2), '', setting($type . '.notes'), ['rows' => '3', 'class' => 'form-control embed-card-body-footer-textarea'], 'col-md-12 embed-acoordion-textarea') }}
|
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2), '', $notesSetting, ['rows' => '3', 'class' => 'form-control embed-card-body-footer-textarea'], 'col-md-12 embed-acoordion-textarea') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,23 +10,22 @@
|
|||||||
'novalidate' => true,
|
'novalidate' => true,
|
||||||
]) !!}
|
]) !!}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ Form::invoice_text('item_name', trans('settings.invoice.item_name'), 'font', $item_names, setting($type . '.item_name'), [], 'item_name_input', setting($type . '.item_name_input', null), 'col-md-12') }}
|
{{ Form::invoice_text('item_name', trans('settings.invoice.item_name'), 'font', $item_names, $item_name, [], 'item_name_input', $item_name_input, 'col-md-12') }}
|
||||||
|
|
||||||
{{ Form::invoice_text('price_name', trans('settings.invoice.price_name'), 'font', $price_names, setting($type . '.price_name'), [], 'price_name_input', setting($type . '.price_name_input', null), 'col-md-12') }}
|
{{ Form::invoice_text('price_name', trans('settings.invoice.price_name'), 'font', $price_names, $price_name, [], 'price_name_input', $price_name_input, 'col-md-12') }}
|
||||||
|
|
||||||
{{ Form::invoice_text('quantity_name', trans('settings.invoice.quantity_name'), 'font', $quantity_names, setting($type . '.quantity_name'), [], 'quantity_name_input', setting($type . '.quantity_name_input', null), 'col-md-12') }}
|
{{ Form::invoice_text('quantity_name', trans('settings.invoice.quantity_name'), 'font', $quantity_names, $quantity_name, [], 'quantity_name_input', $quantity_name_input, 'col-md-12') }}
|
||||||
|
|
||||||
{{ Form::radioGroup('hide_item_name', trans('settings.invoice.hide.item_name'), setting($type . '.hide_item_name', null)) }}
|
{{ Form::radioGroup('hide_item_name', trans('settings.invoice.hide.item_name'), $hide_item_name) }}
|
||||||
|
|
||||||
{{ Form::radioGroup('hide_item_description', trans('settings.invoice.hide.item_description'), setting($type . '.hide_item_description', null)) }}
|
{{ Form::radioGroup('hide_item_description', trans('settings.invoice.hide.item_description'), $hide_item_description) }}
|
||||||
|
|
||||||
{{ Form::radioGroup('hide_quantity', trans('settings.invoice.hide.quantity'), setting($type . '.hide_quantity', null)) }}
|
{{ Form::radioGroup('hide_quantity', trans('settings.invoice.hide.quantity'), $hide_quantity) }}
|
||||||
|
|
||||||
{{ Form::radioGroup('hide_price', trans('settings.invoice.hide.price'), setting($type . '.hide_price', null)) }}
|
{{ Form::radioGroup('hide_price', trans('settings.invoice.hide.price'), $hide_price) }}
|
||||||
|
|
||||||
{{ Form::radioGroup('hide_amount', trans('settings.invoice.hide.amount'), setting($type . '.hide_amount', null)) }}
|
{{ Form::radioGroup('hide_amount', trans('settings.invoice.hide.amount'), $hide_amount) }}
|
||||||
|
|
||||||
{!! Form::hidden('type', $type) !!}
|
{!! Form::hidden('type', $type) !!}
|
||||||
{!! Form::hidden('_prefix', $type) !!}
|
|
||||||
</div>
|
</div>
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user