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

This commit is contained in:
Cüneyt Şentürk 2021-08-18 19:01:19 +03:00
commit ac97b08b44
6 changed files with 62 additions and 3 deletions

View File

@ -101,6 +101,12 @@ abstract class TransferShow extends Component
/** @var string */
public $routeButtonDelete;
/** @var string */
public $routeFromAccountShow;
/** @var string */
public $routeToAccountShow;
/** @var string */
public $textDeleteModal;
@ -267,7 +273,7 @@ abstract class TransferShow extends Component
bool $hideButtonGroupDivider1 = false, bool $hideButtonGroupDivider2 = false, bool $hideButtonGroupDivider3 = false,
string $permissionCreate = '', string $permissionUpdate = '', string $permissionDelete = '',
string $routeButtonAddNew = '', string $routeButtonEdit = '', string $routeButtonDuplicate = '', string $routeButtonPrint = '', string $signedUrl = '',
string $routeButtonEmail = '', string $routeButtonPdf = '', string $routeButtonDelete = '',
string $routeButtonEmail = '', string $routeButtonPdf = '', string $routeButtonDelete = '', string $routeFromAccountShow = '', string $routeToAccountShow = '',
string $textDeleteModal = '',
bool $hideHeader = false, bool $hideHeaderFromAccount = false, bool $hideHeaderToAccount = false, bool $hideHeaderAmount = false, bool $hideHeaderPaidAt = false,
string $textHeaderFromAccount = '', string $textHeaderToAccount = '', string $textHeaderAmount = '', string $textHeaderPaidAt = '',
@ -324,6 +330,8 @@ abstract class TransferShow extends Component
$this->routeButtonEmail = $this->getRouteButtonEmail($routeButtonEmail);
$this->routeButtonPdf = $this->getRouteButtonPdf($routeButtonPdf);
$this->routeButtonDelete = $this->getRouteButtonDelete($routeButtonDelete);
$this->routeFromAccountShow = $this->getRouteFromAccountShow($routeFromAccountShow);
$this->routeToAccountShow = $this->getRouteToAccountShow($routeToAccountShow);
// Navbar Text
$this->textDeleteModal = $textDeleteModal;
@ -501,6 +509,24 @@ abstract class TransferShow extends Component
return 'transfers.destroy';
}
protected function getRouteFromAccountShow($routeFromAccountShow)
{
if (!empty($routeFromAccountShow)) {
return $routeFromAccountShow;
}
return 'accounts.show';
}
protected function getRouteToAccountShow($routeToAccountShow)
{
if (!empty($routeToAccountShow)) {
return $routeToAccountShow;
}
return 'accounts.show';
}
protected function getPermissionCreate($permissionCreate)
{
if (!empty($permissionCreate)) {

View File

@ -55,6 +55,7 @@ class CreateTransfer extends Job
'category_id' => Category::transfer(), // Transfer Category ID
'payment_method' => $this->request->get('payment_method'),
'reference' => $this->request->get('reference'),
'created_by' => $this->request->get('created_by'),
]);
$amount = $this->request->get('amount');
@ -77,12 +78,14 @@ class CreateTransfer extends Job
'category_id' => Category::transfer(), // Transfer Category ID
'payment_method' => $this->request->get('payment_method'),
'reference' => $this->request->get('reference'),
'created_by' => $this->request->get('created_by'),
]);
$this->transfer = Transfer::create([
'company_id' => $this->request['company_id'],
'expense_transaction_id' => $expense_transaction->id,
'income_transaction_id' => $income_transaction->id,
'created_by' => $this->request->get('created_by'),
]);
// Upload attachment

View File

@ -349,6 +349,16 @@ class Transaction extends Model
}
}
/**
* Check if the record is attached to a transfer.
*
* @return bool
*/
public function getHasTransferRelationAttribute()
{
return (bool) (optional($this->category)->id == optional($this->category)->transfer());
}
/**
* Get the title of type.
*

View File

@ -8,6 +8,7 @@
<div class="dropdown-menu" role="menu">
@stack('button_dropdown_start')
@stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEdit)
@can($permissionUpdate)
<a class="dropdown-item" href="{{ route($routeButtonEdit, $transaction->id) }}">
@ -15,9 +16,11 @@
</a>
@endcan
@endif
@endif
@stack('edit_button_end')
@stack('duplicate_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDuplicate)
@can($permissionCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $transaction->id) }}">
@ -25,12 +28,15 @@
</a>
@endcan
@endif
@endif
@stack('duplicate_button_end')
@stack('button_dropdown_divider_1_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider1)
<div class="dropdown-divider"></div>
@endif
@endif
@stack('button_dropdown_divider_1_end')
@if (!$hideButtonPrint)
@ -42,14 +48,17 @@
@endif
@stack('share_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonShare)
<a class="dropdown-item" href="{{ $signedUrl }}" target="_blank">
{{ trans('general.share') }}
</a>
@endif
@endif
@stack('share_button_end')
@stack('edit_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonEmail)
@if($transaction->contact->email)
<a class="dropdown-item" href="{{ route($routeButtonEmail, $transaction->id) }}">
@ -63,6 +72,7 @@
</el-tooltip>
@endif
@endif
@endif
@stack('edit_button_end')
@stack('button_pdf_start')
@ -74,12 +84,15 @@
@stack('button_pdf_end')
@stack('button_dropdown_divider_3_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonGroupDivider3)
<div class="dropdown-divider"></div>
@endif
@endif
@stack('button_dropdown_divider_3_end')
@stack('delete_button_start')
@if (!$transaction->hasTransferRelation)
@if (!$hideButtonDelete)
@can($permissionDelete)
@if ($checkButtonReconciled)
@ -91,6 +104,7 @@
@endif
@endcan
@endif
@endif
@stack('delete_button_end')
@stack('button_dropdown_end')
</div>

View File

@ -8,6 +8,8 @@
hide-header-to-account="{{ $hideHeaderToAccount }}"
text-header-to-account="{{ $textHeaderToAccount }}"
class-header-to-account="{{ $classHeaderToAccount }}"
route-from-account-show="{{ $routeFromAccountShow }}"
route-to-account-show="{{ $routeToAccountShow }}"
hide-header-amount="{{ $hideHeaderAmount }}"
text-header-amount="{{ $textHeaderAmount }}"
class-header-amount="{{ $classHeaderAmount }}"

View File

@ -7,7 +7,9 @@
<strong>
<span class="float-left long-texts mwpx-200 transaction-head-text">
{{ $transfer->expense_transaction->account->name }}
<a href="{{ route($routeFromAccountShow, $transfer->expense_transaction->account->id) }}">
{{ $transfer->expense_transaction->account->name }}
</a>
</span>
</strong>
<br><br>
@ -23,7 +25,9 @@
<strong>
<span class="float-left long-texts mwpx-300 transaction-head-text">
{{ $transfer->income_transaction->account->name }}
<a href="{{ route($routeToAccountShow, $transfer->income_transaction->account->id) }}">
{{ $transfer->income_transaction->account->name }}
</a>
</span>
</strong>
<br><br>