Skip to content

Commit

Permalink
Transfer added created by and show page account link
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Aug 18, 2021
1 parent ef00815 commit 06d0ac1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
28 changes: 27 additions & 1 deletion app/Abstracts/View/Components/TransferShow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -267,7 +273,7 @@ public function __construct(
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 = '',
Expand Down Expand Up @@ -324,6 +330,8 @@ public function __construct(
$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;
Expand Down Expand Up @@ -501,6 +509,24 @@ protected function getRouteButtonDelete($routeButtonDelete)
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)) {
Expand Down
3 changes: 3 additions & 0 deletions app/Jobs/Banking/CreateTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function handle()
'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');
Expand All @@ -77,12 +78,14 @@ public function handle()
'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
Expand Down
2 changes: 2 additions & 0 deletions resources/views/components/transfers/show/content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class-header-from-account="{{ $classHeaderFromAccount }}"
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 }}"
Expand Down
8 changes: 6 additions & 2 deletions resources/views/components/transfers/show/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 06d0ac1

Please sign in to comment.