added warning messages for connected transactions with taxes

This commit is contained in:
Cihan Şentürk 2025-04-28 20:28:45 +03:00 committed by GitHub
parent 635fee12ff
commit dd4d09305f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 3 deletions

View File

@ -304,6 +304,9 @@ abstract class Show extends Component
/** @var bool */
public $hideRecurringMessage;
/** @var bool */
public $hideConnectMessage;
/** @var bool */
public $hideCreated;
@ -335,7 +338,7 @@ abstract class Show extends Component
string $routeDocumentShow = '', string $routeTransactionShow = '', string $textButtonAddNew = '',
bool $hideSchedule = false, bool $hideChildren = false, bool $hideConnect = false, bool $hideTransfer = false, bool $hideAttachment = false, $attachment = [],
array $connectTranslations = [], string $textRecurringType = '', bool $hideRecurringMessage = false, bool $hideCreated = false
array $connectTranslations = [], string $textRecurringType = '', bool $hideRecurringMessage = false, $hideConnectMessage = false, bool $hideCreated = false
) {
$this->type = $type;
$this->transaction = $transaction;
@ -472,6 +475,7 @@ abstract class Show extends Component
// Connect translations
$this->connectTranslations = $this->getTranslationsForConnect($type);
$this->hideConnectMessage = $hideConnectMessage;
$this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType);
$this->hideRecurringMessage = $hideRecurringMessage;

View File

@ -39,7 +39,7 @@ class Transactions extends Controller
{
$this->setActiveTabForTransactions();
$transactions = Transaction::with('account', 'category', 'contact')->collect(['paid_at'=> 'desc']);
$transactions = Transaction::with('account', 'category', 'contact', 'taxes')->collect(['paid_at'=> 'desc']);
$total_transactions = Transaction::count();
@ -395,7 +395,7 @@ class Transactions extends Controller
$translations = collect($this->getTranslationsForConnect($transaction->type));
$data = [
'transaction' => $transaction->load(['account', 'category'])->toJson(),
'transaction' => $transaction->load(['account', 'category', 'taxes'])->toJson(),
'currency' => $transaction->currency->toJson(),
'documents' => $documents,
'translations' => $translations->toJson(),

View File

@ -192,6 +192,7 @@ trait Transactions
'add_an' => trans('general.form.add_an', ['field' => trans_choice('general.' . Str::plural($document_type), 1)]),
'transaction' => trans_choice('general.' . Str::plural($type), 1),
'difference' => trans('general.difference'),
'connect_tax' => trans('messages.warning.connect_tax', ['type' => $type]),
];
}

View File

@ -21,6 +21,11 @@
</button>
</slot>
</div>
<div v-if="transaction && transaction.taxes.length" class="rounded-xl px-5 py-3 mt-4 bg-orange-100">
<p class="text-sm mb-0 text-orange-600">
{{ translations.connect_tax }}
</p>
</div>
</div>
<slot name="modal-body">

View File

@ -46,6 +46,7 @@ return [
'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.',
'connect_tax' => 'Warning: This :type has a tax amount. Taxes added to the :type can not be connected, so the tax will be added to the total and calculated accordingly.',
],
];

View File

@ -12,6 +12,7 @@ return [
'recurring_expense' => 'Recurring Expense',
'included_tax' => 'Included tax amount',
'connected' => 'Connected',
'connect_message' => 'Taxes for this :type were not calculated during the connection process. Taxes can not be connected.',
'form_description' => [
'general' => 'Here you can enter the general information of transaction such as date, amount, account, description, etc.',

View File

@ -28,6 +28,14 @@
@stack('recurring_message_end')
@stack('connect_message_start')
@if (! $hideConnectMessage && $transaction->isSplitTransaction() && $transaction->taxes->count())
<x-documents.show.message type="connect" background-color="bg-orange-100" text-color="text-orange-600" message="{{ trans('transactions.connect_message', ['type' => Str::plural($type), 1]) }}" />
@endif
@stack('connect_message_end')
@stack('row_create_start')
@if (! $hideCreated)
<x-transactions.show.create