connection between docs or transactions added to recurring messages part #1pbthq3
This commit is contained in:
parent
2087a2de3b
commit
b6f5394bbd
@ -314,6 +314,12 @@ abstract class TransactionShow extends Base
|
||||
/** @var string */
|
||||
public $classFooterHistories;
|
||||
|
||||
/** @var string */
|
||||
public $textRecurringType;
|
||||
|
||||
/** @var bool */
|
||||
public $hideRecurringMessage;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
@ -346,7 +352,7 @@ abstract class TransactionShow extends Base
|
||||
|
||||
bool $hideAttachment = false, $attachment = [],
|
||||
bool $hideFooter = false, bool $hideFooterHistories = false, $histories = [],
|
||||
string $textHistories = '', string $classFooterHistories = ''
|
||||
string $textHistories = '', string $classFooterHistories = '', string $textRecurringType = '', bool $hideRecurringMessage = false
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->transaction = $transaction;
|
||||
@ -354,6 +360,8 @@ abstract class TransactionShow extends Base
|
||||
$this->logo = $this->getLogo($logo);
|
||||
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
|
||||
$this->date_format = $this->getCompanyDateFormat();
|
||||
$this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType);
|
||||
$this->hideRecurringMessage = $hideRecurringMessage;
|
||||
|
||||
// Navbar Hide
|
||||
$this->hideButtonAddNew = $hideButtonAddNew;
|
||||
@ -1276,4 +1284,21 @@ abstract class TransactionShow extends Base
|
||||
|
||||
return 'col-sm-6 col-md-6 col-lg-6 col-xl-6';
|
||||
}
|
||||
|
||||
protected function getTextRecurringType($type, $textRecurringType)
|
||||
{
|
||||
if (!empty($textRecurringType)) {
|
||||
return $textRecurringType;
|
||||
}
|
||||
|
||||
$default_key = config('type.' . $type . '.translation.prefix');
|
||||
|
||||
$translation = $this->getTextFromConfig($type, 'recurring_tye', $default_key);
|
||||
|
||||
if (!empty($translation)) {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return 'general.revenues';
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +126,11 @@ class Transaction extends Model
|
||||
return $this->belongsTo('App\Models\Auth\User', 'contact_id', 'id');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Banking\Transaction', 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to only include contacts of a given type.
|
||||
*
|
||||
|
@ -140,6 +140,11 @@ class Document extends Model
|
||||
return $this->totals()->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Document\Document', 'parent_id');
|
||||
}
|
||||
|
||||
public function scopeLatest(Builder $query)
|
||||
{
|
||||
return $query->orderBy('issued_at', 'desc');
|
||||
|
@ -16,5 +16,6 @@ return [
|
||||
'months' => 'Month(s)',
|
||||
'years' => 'Year(s)',
|
||||
'message' => 'This is a recurring :type and the next :type will be automatically generated on :date',
|
||||
'message_parent' => 'This :type was automatically generated from :link',
|
||||
|
||||
];
|
||||
|
@ -20,4 +20,25 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($document->parent)
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-info fade show" role="alert">
|
||||
<div class="d-flex">
|
||||
@stack('recurring_parent_message_head_start')
|
||||
<h5 class="mt-0 text-white"><strong>{{ trans('recurring.recurring') }}</strong></h5>
|
||||
@stack('recurring_parent_message_head_end')
|
||||
</div>
|
||||
|
||||
@stack('recurring_parent_message_body_start')
|
||||
<p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [
|
||||
'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
|
||||
'link' => '<a href="' . route(mb_strtolower(trans_choice($textRecurringType, 2)) . '.show', $document->parent->id) . '">' . $document->parent->document_number . '</a>'
|
||||
]) !!}
|
||||
</p>
|
||||
@stack('recurring_parent_message_body_end')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@stack('recurring_message_end')
|
||||
|
@ -22,6 +22,16 @@
|
||||
@endif
|
||||
@stack('content_header_end')
|
||||
|
||||
@stack('recurring_message_start')
|
||||
@if (!$hideRecurringMessage)
|
||||
<x-transactions.show.recurring-message
|
||||
type="{{ $type }}"
|
||||
:transaction="$transaction"
|
||||
text-recurring-type="{{ $textRecurringType }}"
|
||||
/>
|
||||
@endif
|
||||
@stack('recurring_message_end')
|
||||
|
||||
@stack('transaction_start')
|
||||
<x-transactions.show.transaction
|
||||
type="{{ $type }}"
|
||||
|
@ -0,0 +1,44 @@
|
||||
@stack('recurring_message_start')
|
||||
@if (($recurring = $transaction->recurring) && ($next = $recurring->getNextRecurring()))
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-info fade show" role="alert">
|
||||
<div class="d-flex">
|
||||
@stack('recurring_message_head_start')
|
||||
<h5 class="mt-0 text-white"><strong>{{ trans('recurring.recurring') }}</strong></h5>
|
||||
@stack('recurring_message_head_end')
|
||||
</div>
|
||||
|
||||
@stack('recurring_message_body_start')
|
||||
<p class="text-sm lh-160 mb-0">{{ trans('recurring.message', [
|
||||
'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
|
||||
'date' => $next->format($date_format)
|
||||
]) }}
|
||||
</p>
|
||||
@stack('recurring_message_body_end')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($transaction->parent)
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-info fade show" role="alert">
|
||||
<div class="d-flex">
|
||||
@stack('recurring_parent_message_head_start')
|
||||
<h5 class="mt-0 text-white"><strong>{{ trans('recurring.recurring') }}</strong></h5>
|
||||
@stack('recurring_parent_message_head_end')
|
||||
</div>
|
||||
|
||||
@stack('recurring_parent_message_body_start')
|
||||
<p class="text-sm lh-160 mb-0">{!! trans('recurring.message_parent', [
|
||||
'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
|
||||
'link' => '<a href="' . route(mb_strtolower(trans_choice($textRecurringType, 2)) . '.show', $transaction->parent->id) . '">' . trans_choice($textRecurringType, 1) . '#' . $transaction->parent->id . '</a>'
|
||||
]) !!}
|
||||
</p>
|
||||
@stack('recurring_parent_message_body_end')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@stack('recurring_message_end')
|
Loading…
x
Reference in New Issue
Block a user