diff --git a/app/Abstracts/View/Components/DocumentIndex.php b/app/Abstracts/View/Components/DocumentIndex.php index b736f2c40..120d7d68e 100644 --- a/app/Abstracts/View/Components/DocumentIndex.php +++ b/app/Abstracts/View/Components/DocumentIndex.php @@ -83,7 +83,7 @@ abstract class DocumentIndex extends Component public $textContactName; /** @var string */ - public $textIssueAt; + public $textIssuedAt; /** @var string */ public $textDueAt; @@ -196,7 +196,7 @@ abstract class DocumentIndex extends Component string $textBulkAction = '', array $bulkActions = [], string $bulkActionClass = '', array $bulkActionRouteParameters = [], string $formCardHeaderRoute = '', string $searchStringModel = '', bool $hideBulkAction = false, bool $hideSearchString = false, string $classActions = '', string $classBulkAction = '', string $classDocumentNumber = '', string $classContactName = '', string $classIssuedAt = '', string $classDueAt = '', string $classStatus = '', - string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssueAt = '', string $textDueAt = '', string $textDocumentStatus = '', + string $textDocumentNumber = '', string $textContactName = '', string $classAmount = '', string $textIssuedAt = '', string $textDueAt = '', string $textDocumentStatus = '', bool $checkButtonReconciled = true, bool $checkButtonCancelled = true, string $routeButtonShow = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonCancelled = '', string $routeButtonDelete = '', bool $hideDocumentNumber = false, bool $hideContactName = false, bool $hideAmount = false, bool $hideIssuedAt = false, bool $hideDueAt = false, bool $hideStatus = false, bool $hideActions = false, @@ -241,7 +241,7 @@ abstract class DocumentIndex extends Component /* -- Card Body Start -- */ $this->textDocumentNumber = $this->getTextDocumentNumber($textDocumentNumber); $this->textContactName = $this->getTextContactName($type, $textContactName); - $this->textIssueAt = $this->getTextIssueAt($type, $textIssueAt); + $this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt); $this->textDueAt = $this->getTextDueAt($type, $textDueAt); $this->textDocumentStatus = $this->getTextDocumentStatus($type, $textDocumentStatus); @@ -584,24 +584,24 @@ abstract class DocumentIndex extends Component return 'col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right'; } - protected function getTextIssueAt($type, $textIssueAt) + protected function getTextIssuedAt($type, $textIssuedAt) { - if (!empty($textIssueAt)) { - return $textIssueAt; + if (!empty($textIssuedAt)) { + return $textIssuedAt; } switch ($type) { case 'bill': case 'expense': case 'purchase': - $textIssueAt = 'bills.bill_date'; + $textIssuedAt = 'bills.bill_date'; break; default: - $textIssueAt = 'invoices.invoice_date'; + $textIssuedAt = 'invoices.invoice_date'; break; } - return $textIssueAt; + return $textIssuedAt; } protected function getclassIssuedAt($type, $classIssuedAt) @@ -910,11 +910,11 @@ abstract class DocumentIndex extends Component $this->class_count++; break; case 2: - $class = 'col-md-4 col-lg-2 col-xl-2 d-none d-md-block'; + $class = 'col-md-4 col-lg-3 col-xl-3 d-none d-md-block'; $this->class_count += 2; break; case 3: - $class = 'col-md-5 col-lg-2 col-xl-2 d-none d-md-block'; + $class = 'col-md-5 col-lg-4 col-xl-4 d-none d-md-block'; $this->class_count += 3; break; } diff --git a/app/Http/Controllers/Auth/Users.php b/app/Http/Controllers/Auth/Users.php index 98a1721d2..770ebc93f 100644 --- a/app/Http/Controllers/Auth/Users.php +++ b/app/Http/Controllers/Auth/Users.php @@ -127,7 +127,7 @@ class Users extends Controller if ($user->company_ids) { foreach($user->company_ids as $company_id) { - if (array_key_exists($company_id, $companies)) { + if ($companies->has($company_id)) { continue; } diff --git a/app/Http/Controllers/Common/Items.php b/app/Http/Controllers/Common/Items.php index 6c93a5996..5cb304a93 100644 --- a/app/Http/Controllers/Common/Items.php +++ b/app/Http/Controllers/Common/Items.php @@ -131,7 +131,7 @@ class Items extends Controller { $categories = Category::item()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); - if ($item->category && !array_key_exists($item->category_id, $categories)) { + if ($item->category && !$categories->has($item->category_id)) { $categories->put($item->category->id, $item->category->name); } diff --git a/app/Http/Controllers/Purchases/Payments.php b/app/Http/Controllers/Purchases/Payments.php index d2ac7acb3..5c4c73d41 100644 --- a/app/Http/Controllers/Purchases/Payments.php +++ b/app/Http/Controllers/Purchases/Payments.php @@ -150,13 +150,13 @@ class Payments extends Controller $vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); - if ($payment->contact && !array_key_exists($payment->contact_id, $vendors)) { + if ($payment->contact && !$vendors->has($payment->contact_id)) { $vendors->put($payment->contact->id, $payment->contact->name); } $categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); - if ($payment->category && !array_key_exists($payment->category_id, $categories)) { + if ($payment->category && !$categories->has($payment->category_id)) { $categories->put($payment->category->id, $payment->category->name); } diff --git a/app/Http/Controllers/Sales/Revenues.php b/app/Http/Controllers/Sales/Revenues.php index cc15f39e3..6f5bad53f 100644 --- a/app/Http/Controllers/Sales/Revenues.php +++ b/app/Http/Controllers/Sales/Revenues.php @@ -150,13 +150,13 @@ class Revenues extends Controller $customers = Contact::customer()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); - if ($revenue->contact && !array_key_exists($revenue->contact_id, $customers)) { + if ($revenue->contact && !$customers->has($revenue->contact_id)) { $customers->put($revenue->contact->id, $revenue->contact->name); } $categories = Category::income()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); - if ($revenue->category && !array_key_exists($revenue->category_id, $categories)) { + if ($revenue->category && !$categories->has($revenue->category_id)) { $categories->put($revenue->category->id, $revenue->category->name); } diff --git a/app/Http/Controllers/Settings/Defaults.php b/app/Http/Controllers/Settings/Defaults.php index 3bcc27cf8..4af8fe39d 100644 --- a/app/Http/Controllers/Settings/Defaults.php +++ b/app/Http/Controllers/Settings/Defaults.php @@ -21,7 +21,7 @@ class Defaults extends Controller $sale_category_id = setting('default.income_category'); - if ($sale_category_id && !array_key_exists($sale_category_id, $sales_categories)) { + if ($sale_category_id && !$sales_categories->has($sale_category_id)) { $category = Category::find($sale_category_id); $sales_categories->put($category->id, $category->name); @@ -31,7 +31,7 @@ class Defaults extends Controller $expense_category_id = setting('default.expense_category'); - if ($expense_category_id && !array_key_exists($expense_category_id, $purchases_categories)) { + if ($expense_category_id && !$purchases_categories->has($expense_category_id)) { $category = Category::find($expense_category_id); $purchases_categories->put($category->id, $category->name); diff --git a/resources/assets/js/components/AkauntingSelect.vue b/resources/assets/js/components/AkauntingSelect.vue index 5a9fb0548..de12bbcc0 100644 --- a/resources/assets/js/components/AkauntingSelect.vue +++ b/resources/assets/js/components/AkauntingSelect.vue @@ -185,6 +185,8 @@ export default { options: null, + dynamicOptions: null, + disabledOptions: { type: Array, default: function () { @@ -686,6 +688,55 @@ export default { this.change(); }, + + dynamicOptions: function(options) { + if (this.group) { + // Option set sort_option data + if (!Array.isArray(options)) { + for (const [index, _options] of Object.entries(options)) { + let values = []; + + for (const [key, value] of Object.entries(_options)) { + values.push({ + key: key, + value: value + }); + } + + this.sort_options.push({ + key: index, + value: values + }); + } + } else { + options.forEach(function (option, index) { + this.sort_options.push({ + index: index, + key: option.id, + value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name + }); + }, this); + } + } else { + // Option set sort_option data + if (!Array.isArray(options)) { + for (const [key, value] of Object.entries(options)) { + this.sort_options.push({ + key: key, + value: value + }); + } + } else { + options.forEach(function (option, index) { + this.sort_options.push({ + index: index, + key: option.id, + value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name + }); + }, this); + } + } + }, }, } diff --git a/resources/assets/js/components/AkauntingSelectRemote.vue b/resources/assets/js/components/AkauntingSelectRemote.vue index ed67ff1a8..8e09698d2 100644 --- a/resources/assets/js/components/AkauntingSelectRemote.vue +++ b/resources/assets/js/components/AkauntingSelectRemote.vue @@ -286,6 +286,8 @@ export default { options: null, + dynamicOptions: null, + disabledOptions: { type: Array, default: function () { @@ -895,6 +897,55 @@ export default { this.change(); }, + + dynamicOptions: function(options) { + if (this.group) { + // Option set sort_option data + if (!Array.isArray(options)) { + for (const [index, _options] of Object.entries(options)) { + let values = []; + + for (const [key, value] of Object.entries(_options)) { + values.push({ + key: key, + value: value + }); + } + + this.sort_options.push({ + key: index, + value: values + }); + } + } else { + options.forEach(function (option, index) { + this.sort_options.push({ + index: index, + key: option.id, + value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name + }); + }, this); + } + } else { + // Option set sort_option data + if (!Array.isArray(options)) { + for (const [key, value] of Object.entries(options)) { + this.sort_options.push({ + key: key, + value: value + }); + } + } else { + options.forEach(function (option, index) { + this.sort_options.push({ + index: index, + key: option.id, + value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name + }); + }, this); + } + } + }, }, } diff --git a/resources/views/components/documents/form/content.blade.php b/resources/views/components/documents/form/content.blade.php index aad23eb79..ec74b2f6a 100644 --- a/resources/views/components/documents/form/content.blade.php +++ b/resources/views/components/documents/form/content.blade.php @@ -22,9 +22,9 @@ 'novalidate' => true ]) !!} @endif - @if (!$hideCompany) + @if (!$hideCompany) @endif - - @if (!$hideFooter) - @endif - @if (!$hideAdvanced) - @endif - @if (!$hideButtons) + @if (!$hideButtons) - @stack('issued_at_th_inside_start') - @sortablelink('issued_at', trans($textIssueAt)) + @sortablelink('issued_at', trans($textIssuedAt)) @stack('issued_at_th_inside_end') @@ -258,4 +258,4 @@ @endforeach - \ No newline at end of file + diff --git a/resources/views/components/documents/index/content.blade.php b/resources/views/components/documents/index/content.blade.php index 27fe36398..f4645c60d 100644 --- a/resources/views/components/documents/index/content.blade.php +++ b/resources/views/components/documents/index/content.blade.php @@ -26,7 +26,7 @@ hide-amount="{{ $hideAmount }}" class-amount="{{ $classAmount }}" hide-issued-at="{{ $hideIssuedAt }}" - text-issued-at="{{ $textIssueAt }}" + text-issued-at="{{ $textIssuedAt }}" class-issued-at="{{ $classIssuedAt }}" hide-due-at="{{ $hideDueAt }}" class-due-at="{{ $classDueAt }}" @@ -47,7 +47,7 @@ route-button-duplicate="{{ $routeButtonDuplicate }}" hide-button-cancel="{{ $hideButtonCancel }}" permission-document-update="{{ $permissionDocumentUpdate }}" - route-button-called="{{ $routeButtonCancelled }}" + route-button-cancelled="{{ $routeButtonCancelled }}" hide-button-delete="{{ $hideButtonDelete }}" permission-document-delete="{{ $permissionDocumentDelete }}" route-button-delete="{{ $routeButtonDelete }}" @@ -64,4 +64,4 @@ page="{{ $page }}" docs-path="{{ $docsPath }}" /> -@endif \ No newline at end of file +@endif diff --git a/resources/views/partials/form/multi_select_add_new_group.blade.php b/resources/views/partials/form/multi_select_add_new_group.blade.php index a19c1599f..efb9d5af2 100644 --- a/resources/views/partials/form/multi_select_add_new_group.blade.php +++ b/resources/views/partials/form/multi_select_add_new_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) :value="{{ json_encode(old($name, $selected)) }}" @endif diff --git a/resources/views/partials/form/multi_select_group.blade.php b/resources/views/partials/form/multi_select_group.blade.php index bbc7c9e46..ce33f842e 100644 --- a/resources/views/partials/form/multi_select_group.blade.php +++ b/resources/views/partials/form/multi_select_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) :value="{{ json_encode(old($name, $selected)) }}" @endif diff --git a/resources/views/partials/form/multi_select_remote_add_new_group.blade.php b/resources/views/partials/form/multi_select_remote_add_new_group.blade.php index 8f6e25580..9a7d06084 100644 --- a/resources/views/partials/form/multi_select_remote_add_new_group.blade.php +++ b/resources/views/partials/form/multi_select_remote_add_new_group.blade.php @@ -21,6 +21,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (!empty($selected) || old($name)) :value="{{ json_encode(old($name, $selected)) }}" @endif diff --git a/resources/views/partials/form/multi_select_remote_group.blade.php b/resources/views/partials/form/multi_select_remote_group.blade.php index a462a4132..c7a81485f 100644 --- a/resources/views/partials/form/multi_select_remote_group.blade.php +++ b/resources/views/partials/form/multi_select_remote_group.blade.php @@ -21,6 +21,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (!empty($selected) || old($name)) :value="{{ json_encode(old($name, $selected)) }}" @endif diff --git a/resources/views/partials/form/select_add_new_group.blade.php b/resources/views/partials/form/select_add_new_group.blade.php index 4c0540c40..0ea7ea92f 100644 --- a/resources/views/partials/form/select_add_new_group.blade.php +++ b/resources/views/partials/form/select_add_new_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif diff --git a/resources/views/partials/form/select_group.blade.php b/resources/views/partials/form/select_group.blade.php index 3b96d963c..8b7f39340 100644 --- a/resources/views/partials/form/select_group.blade.php +++ b/resources/views/partials/form/select_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif diff --git a/resources/views/partials/form/select_group_add_new_group.blade.php b/resources/views/partials/form/select_group_add_new_group.blade.php index c16bba08b..8ca502b84 100644 --- a/resources/views/partials/form/select_group_add_new_group.blade.php +++ b/resources/views/partials/form/select_group_add_new_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif diff --git a/resources/views/partials/form/select_group_group.blade.php b/resources/views/partials/form/select_group_group.blade.php index b539e3c85..da7a7aca2 100644 --- a/resources/views/partials/form/select_group_group.blade.php +++ b/resources/views/partials/form/select_group_group.blade.php @@ -19,6 +19,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif diff --git a/resources/views/partials/form/select_remote_add_new_group.blade.php b/resources/views/partials/form/select_remote_add_new_group.blade.php index 004efbfbf..ef58df6f7 100644 --- a/resources/views/partials/form/select_remote_add_new_group.blade.php +++ b/resources/views/partials/form/select_remote_add_new_group.blade.php @@ -21,6 +21,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif diff --git a/resources/views/partials/form/select_remote_group.blade.php b/resources/views/partials/form/select_remote_group.blade.php index 358f28cac..8492f36b1 100644 --- a/resources/views/partials/form/select_remote_group.blade.php +++ b/resources/views/partials/form/select_remote_group.blade.php @@ -21,6 +21,10 @@ :disabled-options="{{ json_encode($attributes['disabledOptions']) }}" @endif + @if (isset($attributes['dynamicOptions'])) + :dynamic-options="{{ $attributes['dynamicOptions'] }}" + @endif + @if (isset($selected) || old($name)) value="{{ old($name, $selected) }}" @endif