This commit is contained in:
Burak Civan 2022-06-28 15:33:08 +03:00
commit b0aa9ec060
4 changed files with 59 additions and 55 deletions

View File

@ -113,11 +113,13 @@ abstract class Model extends Eloquent implements Ownable
return $query->paginate($limit); return $query->paginate($limit);
} }
public function scopeUsingSearchString($query) public function scopeUsingSearchString(Builder $query, string|null $string = null)
{ {
event(new SearchStringApplying($query)); event(new SearchStringApplying($query));
$this->getSearchStringManager()->updateBuilder($query, request('search')); $string = $string ?: request('search');
$this->getSearchStringManager()->updateBuilder($query, $string);
event(new SearchStringApplied($query)); event(new SearchStringApplied($query));
} }

View File

@ -444,7 +444,7 @@ class Transaction extends Model
} catch (\Exception $e) {} } catch (\Exception $e) {}
try { try {
if (! $this->reconciled) { if (! $this->reconciled && ! $this->hasTransferRelation) {
$actions[] = [ $actions[] = [
'title' => trans('general.edit'), 'title' => trans('general.edit'),
'icon' => 'edit', 'icon' => 'edit',
@ -458,7 +458,7 @@ class Transaction extends Model
} catch (\Exception $e) {} } catch (\Exception $e) {}
try { try {
if (empty($this->document_id)) { if (empty($this->document_id) && ! $this->hasTransferRelation) {
$actions[] = [ $actions[] = [
'title' => trans('general.duplicate'), 'title' => trans('general.duplicate'),
'icon' => 'file_copy', 'icon' => 'file_copy',
@ -472,7 +472,7 @@ class Transaction extends Model
} catch (\Exception $e) {} } catch (\Exception $e) {}
try { try {
if ($this->is_splittable && empty($this->document_id) && empty($this->recurring)) { if ($this->is_splittable && empty($this->document_id) && empty($this->recurring) && ! $this->hasTransferRelation) {
$connect = [ $connect = [
'type' => 'button', 'type' => 'button',
'title' => trans('general.connect'), 'title' => trans('general.connect'),
@ -519,54 +519,56 @@ class Transaction extends Model
} catch (\Exception $e) {} } catch (\Exception $e) {}
if ($prefix != 'recurring-transactions') { if ($prefix != 'recurring-transactions') {
$actions[] = [ if (! $this->hasTransferRelation) {
'type' => 'divider',
];
try {
$actions[] = [ $actions[] = [
'type' => 'button', 'type' => 'divider',
'title' => trans('general.share_link'),
'icon' => 'share',
'url' => route('modals.transactions.share.create', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-share-' . $this->id,
'@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")',
],
]; ];
} catch (\Exception $e) {}
try { try {
$actions[] = [
'type' => 'button',
'title' => trans('invoices.send_mail'),
'icon' => 'email',
'url' => route('modals.transactions.emails.create', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id,
'@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")',
],
];
} catch (\Exception $e) {}
$actions[] = [
'type' => 'divider',
];
try {
if (! $this->reconciled) {
$actions[] = [ $actions[] = [
'type' => 'delete', 'type' => 'button',
'icon' => 'delete', 'title' => trans('general.share_link'),
'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template', 'icon' => 'share',
'route' => $prefix. '.destroy', 'url' => route('modals.transactions.share.create', $this->id),
'permission' => 'delete-banking-transactions', 'permission' => 'read-banking-transactions',
'model' => $this, 'attributes' => [
'id' => 'index-more-actions-share-' . $this->id,
'@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")',
],
]; ];
} } catch (\Exception $e) {}
} catch (\Exception $e) {}
try {
$actions[] = [
'type' => 'button',
'title' => trans('invoices.send_mail'),
'icon' => 'email',
'url' => route('modals.transactions.emails.create', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id,
'@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")',
],
];
} catch (\Exception $e) {}
$actions[] = [
'type' => 'divider',
];
try {
if (! $this->reconciled) {
$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template',
'route' => $prefix. '.destroy',
'permission' => 'delete-banking-transactions',
'model' => $this,
];
}
} catch (\Exception $e) {}
}
} else { } else {
try { try {
$actions[] = [ $actions[] = [

View File

@ -10,7 +10,7 @@
@stack('edit_button_start') @stack('edit_button_start')
@if (! $transaction->hasTransferRelation) @if (! $transaction->reconciled && ! $transaction->hasTransferRelation)
@if (! $hideButtonEdit) @if (! $hideButtonEdit)
@can($permissionUpdate) @can($permissionUpdate)
<x-link href="{{ route($routeButtonEdit, [$transaction->id, 'type' => $type]) }}"> <x-link href="{{ route($routeButtonEdit, [$transaction->id, 'type' => $type]) }}">

View File

@ -8,7 +8,7 @@
@stack('duplicate_button_start') @stack('duplicate_button_start')
@if (! $transaction->hasTransferRelation) @if (empty($transaction->document_id) && ! $transaction->hasTransferRelation)
@if (! $hideButtonDuplicate) @if (! $hideButtonDuplicate)
@can($permissionCreate) @can($permissionCreate)
<x-dropdown.link href="{{ route($routeButtonDuplicate, [$transaction->id, 'type' => $type]) }}"> <x-dropdown.link href="{{ route($routeButtonDuplicate, [$transaction->id, 'type' => $type]) }}">
@ -22,7 +22,7 @@
@stack('connect_button_start') @stack('connect_button_start')
@if ($transaction->is_splittable && empty($transaction->document_id) && empty($transaction->recurring)) @if ($transaction->is_splittable && empty($transaction->document_id) && empty($transaction->recurring) && ! $transaction->hasTransferRelation)
@if (! $hideButtonConnect) @if (! $hideButtonConnect)
@can($permissionCreate) @can($permissionCreate)
<button <button
@ -38,7 +38,7 @@
@stack('connect_button_end') @stack('connect_button_end')
@if (! $hideDivider1) @if (! $hideDivider1 && ! $transaction->hasTransferRelation)
<x-dropdown.divider /> <x-dropdown.divider />
@endif @endif
@ -62,7 +62,7 @@
@stack('button_pdf_end') @stack('button_pdf_end')
@if (! $hideDivider2) @if (! $hideDivider2 && ! $transaction->hasTransferRelation)
<x-dropdown.divider /> <x-dropdown.divider />
@endif @endif
@ -98,7 +98,7 @@
@stack('email_button_end') @stack('email_button_end')
@if (! $hideDivider3) @if (! $hideDivider3 && ! $transaction->hasTransferRelation)
<x-dropdown.divider /> <x-dropdown.divider />
@endif @endif
@ -112,7 +112,7 @@
@stack('button_end_end') @stack('button_end_end')
@if (! $hideDivider4) @if (! $hideDivider4 && ! $transaction->hasTransferRelation)
<x-dropdown.divider /> <x-dropdown.divider />
@endif @endif