show a warning if transfer is deleted
This commit is contained in:
parent
3b4dbf3ee5
commit
8f54a87d14
@ -4,7 +4,6 @@ namespace App\Models\Banking;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use App\Models\Common\Media as MediaModel;
|
||||
use App\Models\Setting\Category;
|
||||
use App\Scopes\Transaction as Scope;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\DateTime;
|
||||
|
@ -320,6 +320,32 @@ return [
|
||||
],
|
||||
],
|
||||
|
||||
Transaction::INCOME_TRANSFER_TYPE => [
|
||||
'group' => 'banking',
|
||||
'route' => [
|
||||
'prefix' => 'transactions', // core use with group + prefix, module ex. estimates
|
||||
'parameter' => 'transaction', // banking/transactions/{parameter}/edit
|
||||
//'create' => 'transactions.create', // if you change route, you can write full path
|
||||
],
|
||||
'permission' => [
|
||||
'prefix' => 'transactions',
|
||||
//'create' => 'create-banking-transactions',
|
||||
],
|
||||
'translation' => [
|
||||
'prefix' => 'transactions', // this translation file name.
|
||||
'related_document_amount' => 'invoices.invoice_amount',
|
||||
'transactions' => 'general.incomes',
|
||||
],
|
||||
'contact_type' => 'customer',
|
||||
'document_type' => 'invoice',
|
||||
'split_type' => Transaction::INCOME_SPLIT_TYPE,
|
||||
'email_template' => 'payment_received_customer',
|
||||
'script' => [
|
||||
'folder' => 'banking',
|
||||
'file' => 'transactions',
|
||||
],
|
||||
],
|
||||
|
||||
Transaction::INCOME_RECURRING_TYPE => [
|
||||
'group' => 'banking',
|
||||
'route' => [
|
||||
@ -373,6 +399,31 @@ return [
|
||||
],
|
||||
],
|
||||
|
||||
Transaction::EXPENSE_TRANSFER_TYPE => [
|
||||
'group' => 'banking',
|
||||
'route' => [
|
||||
'prefix' => 'transactions', // core use with group + prefix, module ex. estimates
|
||||
'parameter' => 'transaction', // banking/transactions/{parameter}/edit
|
||||
//'create' => 'transactions.create', // if you change route, you can write full path
|
||||
],
|
||||
'permission' => [
|
||||
'prefix' => 'transactions',
|
||||
//'create' => 'create-banking-transactions',
|
||||
],
|
||||
'translation' => [
|
||||
'prefix' => 'transactions', // this translation file name.
|
||||
'related_document_amount' => 'bills.bill_amount',
|
||||
],
|
||||
'contact_type' => 'vendor',
|
||||
'document_type' => 'bill',
|
||||
'split_type' => Transaction::EXPENSE_SPLIT_TYPE,
|
||||
'email_template' => 'payment_made_vendor',
|
||||
'script' => [
|
||||
'folder' => 'banking',
|
||||
'file' => 'transactions',
|
||||
],
|
||||
],
|
||||
|
||||
Transaction::EXPENSE_RECURRING_TYPE => [
|
||||
'group' => 'banking',
|
||||
'route' => [
|
||||
|
@ -79,7 +79,7 @@ return [
|
||||
],
|
||||
|
||||
'sticky' => [
|
||||
'description' => 'You are previewing how your customer will see the web version of your invoice.',
|
||||
'description' => 'You are previewing how your customer will see the web version of your invoice.',
|
||||
],
|
||||
|
||||
];
|
||||
|
@ -41,6 +41,7 @@ return [
|
||||
'reconciled_doc' => 'Warning: You are not allowed to change/delete :type because it has reconciled transactions!',
|
||||
'disable_code' => 'Warning: You are not allowed to disable or change the currency of <b>:name</b> because it has :text related.',
|
||||
'payment_cancel' => 'Warning: You have cancelled your recent :method payment!',
|
||||
'missing_transfer' => 'Warning: The transfer related to this transaction is missing. You should consider deleting this transaction.',
|
||||
],
|
||||
|
||||
];
|
||||
|
@ -1,10 +1,15 @@
|
||||
@if ($transaction->isTransferTransaction())
|
||||
@php
|
||||
$from_account = '<span class="font-medium">' . $transaction->transfer->expense_account->title . '</span>';
|
||||
$to_account = '<span class="font-medium">' . $transaction->transfer->income_account->title . '</span>';
|
||||
@endphp
|
||||
@php $transfer = $transaction->transfer; @endphp
|
||||
|
||||
<div class="border-b pb-4" x-data="{ transfer : null }">
|
||||
@if ($transfer)
|
||||
@php
|
||||
$from_account = '<span class="font-medium">' . $transfer->expense_account->title . '</span>';
|
||||
$to_account = '<span class="font-medium">' . $transfer->income_account->title . '</span>';
|
||||
$date = '<a href="' . route('transfers.show', $transfer->id) . '" class="text-purple">' . company_date($transaction->paid_at) . '</a>';
|
||||
@endphp
|
||||
@endif
|
||||
|
||||
<div class="border-b pb-4" x-data="{ transfer : 1 }">
|
||||
<button class="relative w-full text-left cursor-pointer group"
|
||||
x-on:click="transfer !== 1 ? transfer = 1 : transfer = null"
|
||||
>
|
||||
@ -12,9 +17,11 @@
|
||||
{{ trans_choice('general.transfers', 1) }}
|
||||
</span>
|
||||
|
||||
<div class="text-black-400 text-sm">
|
||||
{!! trans('transactions.slider.transfer_headline', ['from_account' => $from_account, 'to_account' => $to_account]) !!}
|
||||
</div>
|
||||
@if ($transfer)
|
||||
<div class="text-black-400 text-sm">
|
||||
{!! trans('transactions.slider.transfer_headline', ['from_account' => $from_account, 'to_account' => $to_account]) !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<span class="material-icons absolute right-0 top-0 transition-all transform"
|
||||
x-bind:class="transfer === 1 ? 'rotate-180' : ''"
|
||||
@ -25,13 +32,19 @@
|
||||
x-ref="container1"
|
||||
x-bind:class="transfer === 1 ? 'h-auto' : 'scale-y-0 h-0'"
|
||||
>
|
||||
@php
|
||||
$date = '<a href="' . route('transfers.show', $transaction->transfer->id) . '" class="text-purple">' . company_date($transaction->paid_at) . '</a>';
|
||||
@endphp
|
||||
|
||||
<div class="my-2">
|
||||
{!! trans('transactions.slider.transfer_desc', ['date' => $date]) !!}
|
||||
</div>
|
||||
@if ($transfer)
|
||||
<div class="my-2">
|
||||
{!! trans('transactions.slider.transfer_desc', ['date' => $date]) !!}
|
||||
</div>
|
||||
@else
|
||||
<div class="mt-2">
|
||||
<div class="alert alert-notify p-4 text-black font-bold rounded-lg bg-orange-100 text-orange-600">
|
||||
<span class="alert-text">
|
||||
<span>{{ trans('messages.warning.missing_transfer') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user