Merge branch 'master' of github.com:akaunting/akaunting

This commit is contained in:
Cüneyt Şentürk 2021-01-01 13:59:01 +03:00
commit c1b152a7aa
22 changed files with 181 additions and 39 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}
},
},
}
</script>

View File

@ -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);
}
}
},
},
}
</script>

View File

@ -22,9 +22,9 @@
'novalidate' => true
]) !!}
@endif
@if (!$hideCompany)
@if (!$hideCompany)
<x-documents.form.company
type="{{ $type }}"
type="{{ $type }}"
hide-logo="{{ $hideLogo }}"
hide-document-title="{{ $hideDocumentTitle }}"
hide-document-subheading="{{ $hideDocumentSubheading }}"
@ -32,7 +32,7 @@
/>
@endif
<x-documents.form.main
<x-documents.form.main
type="{{ $type }}"
:document="$document"
hide-contact="{{ $hideContact }}"
@ -41,9 +41,9 @@
:contacts="$contacts"
:search_route="$contactSearchRoute"
:create_route="$contactCreateRoute"
hide-issue-at="{{ $hideIssuedAt }}"
text-issue-at="{{ $textIssuedAt }}"
issue-at="{{ $issuedAt }}"
hide-issued-at="{{ $hideIssuedAt }}"
text-issued-at="{{ $textIssuedAt }}"
issued-at="{{ $issuedAt }}"
hide-document-number="{{ $hideDocumentNumber }}"
text-document-number="{{ $textDocumentNumber }}"
document-number="{{ $documentNumber }}"
@ -67,15 +67,15 @@
text-amount="{{ $textAmount }}"
/>
@if (!$hideFooter)
<x-documents.form.footer
@if (!$hideFooter)
<x-documents.form.footer
type="{{ $type }}"
:document="$document"
/>
@endif
@if (!$hideAdvanced)
<x-documents.form.advanced
@if (!$hideAdvanced)
<x-documents.form.advanced
type="{{ $type }}"
:document="$document"
hide-recurring="{{ $hideRecurring }}"
@ -84,7 +84,7 @@
/>
@endif
@if (!$hideButtons)
@if (!$hideButtons)
<x-documents.form.buttons
type="{{ $type }}"
:document="$document"

View File

@ -13,9 +13,9 @@
:contacts="$contacts"
:search_route="$contactSearchRoute"
:create_route="$contactCreateRoute"
hide-issue-at="{{ $hideIssuedAt }}"
text-issue-at="{{ $textIssuedAt }}"
issue-at="{{ $issuedAt }}"
hide-issued-at="{{ $hideIssuedAt }}"
text-issued-at="{{ $textIssuedAt }}"
issued-at="{{ $issuedAt }}"
hide-document-number="{{ $hideDocumentNumber }}"
text-document-number="{{ $textDocumentNumber }}"
document-number="{{ $documentNumber }}"
@ -27,7 +27,7 @@
order-number="{{ $orderNumber }}"
/>
<x-documents.form.items
<x-documents.form.items
type="{{ $type }}"
:document="$document"
hide-edit-item-columns="{{ $hideEditItemColumns }}"

View File

@ -49,7 +49,7 @@
<th class="{{ $classIssuedAt }}">
@stack('issued_at_th_inside_start')
@sortablelink('issued_at', trans($textIssueAt))
@sortablelink('issued_at', trans($textIssuedAt))
@stack('issued_at_th_inside_end')
</th>
@ -258,4 +258,4 @@
@endforeach
</tbody>
</table>
</div>
</div>

View File

@ -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
@endif

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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