close #2975 Fixed: Recurring Invoice Custom Interval
This commit is contained in:
parent
a83d446141
commit
8387830ecd
@ -22,10 +22,14 @@ class Schedule extends Component
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
$started_date = '<span class="font-medium">' . company_date($recurring->started_at) . '</span>';
|
$started_date = '<span class="font-medium">' . company_date($recurring->started_at) . '</span>';
|
||||||
$frequency = Str::lower(trans('recurring.' . str_replace('ly', 's', $recurring->frequency)));
|
$frequency = Str::lower(trans('recurring.' . str_replace(['daily', 'ly'], ['days', 's'], $recurring->frequency)));
|
||||||
$invertal = $recurring->interval;
|
$invertal = $recurring->interval;
|
||||||
|
|
||||||
$this->description = trans('transactions.slider.schedule', ['frequency' => $frequency, 'interval' => $invertal, 'date' => $started_date]);
|
$this->description = trans('transactions.slider.schedule', [
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $invertal,
|
||||||
|
'date' => $started_date
|
||||||
|
]);
|
||||||
|
|
||||||
return view('components.documents.show.schedule', compact('recurring'));
|
return view('components.documents.show.schedule', compact('recurring'));
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ class Recurring extends Component
|
|||||||
public $frequency;
|
public $frequency;
|
||||||
public $frequencies = [];
|
public $frequencies = [];
|
||||||
|
|
||||||
|
public $interval = '';
|
||||||
|
|
||||||
public $customFrequency = '';
|
public $customFrequency = '';
|
||||||
public $customFrequencies = [];
|
public $customFrequencies = [];
|
||||||
|
|
||||||
@ -35,6 +37,8 @@ class Recurring extends Component
|
|||||||
$frequency = '',
|
$frequency = '',
|
||||||
$frequencies = [],
|
$frequencies = [],
|
||||||
|
|
||||||
|
$interval = '',
|
||||||
|
|
||||||
$customFrequency = '',
|
$customFrequency = '',
|
||||||
$customFrequencies = [],
|
$customFrequencies = [],
|
||||||
|
|
||||||
@ -49,10 +53,13 @@ class Recurring extends Component
|
|||||||
$sendEmail = false
|
$sendEmail = false
|
||||||
) {
|
) {
|
||||||
$this->type = $this->getType($type);
|
$this->type = $this->getType($type);
|
||||||
$this->frequency = $this->getFrequency($frequency);
|
|
||||||
|
$this->interval = $this->getInterval($interval);
|
||||||
|
|
||||||
|
$this->frequency = $this->getFrequency($frequency, $interval);
|
||||||
$this->frequencies = $this->getFrequencies($frequencies);
|
$this->frequencies = $this->getFrequencies($frequencies);
|
||||||
|
|
||||||
$this->customFrequency = $this->getCustomFrequency($customFrequency);
|
$this->customFrequency = $this->getCustomFrequency($frequency, $customFrequency, $interval);
|
||||||
$this->customFrequencies = $this->getCustomFrequencies($customFrequencies);
|
$this->customFrequencies = $this->getCustomFrequencies($customFrequencies);
|
||||||
|
|
||||||
$this->limit = $this->getLimit($limit);
|
$this->limit = $this->getLimit($limit);
|
||||||
@ -85,8 +92,12 @@ class Recurring extends Component
|
|||||||
return 'invoice';
|
return 'invoice';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFrequency($frequency)
|
protected function getFrequency($frequency, $interval = 0)
|
||||||
{
|
{
|
||||||
|
if ($interval > 1) {
|
||||||
|
return 'custom';
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($frequency)) {
|
if (! empty($frequency)) {
|
||||||
return $frequency;
|
return $frequency;
|
||||||
}
|
}
|
||||||
@ -109,8 +120,21 @@ class Recurring extends Component
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCustomFrequency($customFrequency)
|
protected function getInterval($interval)
|
||||||
{
|
{
|
||||||
|
if (! empty($interval)) {
|
||||||
|
return $interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCustomFrequency($frequency, $customFrequency, $interval = 0)
|
||||||
|
{
|
||||||
|
if ($interval > 1) {
|
||||||
|
return $frequency;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($customFrequency)) {
|
if (! empty($customFrequency)) {
|
||||||
return $customFrequency;
|
return $customFrequency;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,11 @@ export default {
|
|||||||
default: 'monthly',
|
default: 'monthly',
|
||||||
description: "Default reccuring type"
|
description: "Default reccuring type"
|
||||||
},
|
},
|
||||||
|
intervalValue: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
description: 'Default interval value'
|
||||||
|
},
|
||||||
invertalError: {
|
invertalError: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
@ -310,6 +315,7 @@ export default {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.frequency = this.frequencyValue;
|
this.frequency = this.frequencyValue;
|
||||||
|
this.interval = this.intervalValue;
|
||||||
this.customFrequency = this.customFrequencyValue;
|
this.customFrequency = this.customFrequencyValue;
|
||||||
this.started_at = this.startedValue;
|
this.started_at = this.startedValue;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ return [
|
|||||||
'send_email_auto' => 'Send email automatically',
|
'send_email_auto' => 'Send email automatically',
|
||||||
|
|
||||||
'frequency_type' => 'Repeat this :type',
|
'frequency_type' => 'Repeat this :type',
|
||||||
|
'custom_frequency_desc' => 'Repeat every :interval :frequency',
|
||||||
'limit_date' => 'Create first :type on',
|
'limit_date' => 'Create first :type on',
|
||||||
'limit_middle' => 'and end',
|
'limit_middle' => 'and end',
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<x-slot name="body">
|
<x-slot name="body">
|
||||||
<x-form.group.recurring
|
<x-form.group.recurring
|
||||||
type="transaction"
|
type="transaction"
|
||||||
|
:interval="$recurring_transaction ? $recurring_transaction->recurring->interval : null"
|
||||||
:frequency="$recurring_transaction ? $recurring_transaction->recurring->frequency : null"
|
:frequency="$recurring_transaction ? $recurring_transaction->recurring->frequency : null"
|
||||||
:custom-frequency="$recurring_transaction ? $recurring_transaction->recurring->custom_frequency : null"
|
:custom-frequency="$recurring_transaction ? $recurring_transaction->recurring->custom_frequency : null"
|
||||||
:limit="$recurring_transaction ? $recurring_transaction->recurring->limit_by : null"
|
:limit="$recurring_transaction ? $recurring_transaction->recurring->limit_by : null"
|
||||||
|
@ -123,7 +123,20 @@
|
|||||||
|
|
||||||
<x-table.td class="w-2/12" hidden-mobile>
|
<x-table.td class="w-2/12" hidden-mobile>
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
{{ trans('recurring.' . $item->recurring->frequency) }}
|
@if ($item->recurring->interval > 1)
|
||||||
|
<x-tooltip
|
||||||
|
id="tooltip-frequency-{{ $item->recurring->id }}"
|
||||||
|
placement="top"
|
||||||
|
message="{{ trans('recurring.custom_frequency_desc', [
|
||||||
|
'interval' => $item->recurring->interval,
|
||||||
|
'frequency' => str()->lower(trans('recurring.' . str_replace(['daily', 'ly'], ['days', 's'], $item->recurring->frequency)))
|
||||||
|
]) }}"
|
||||||
|
>
|
||||||
|
{{ trans('recurring.custom') }}
|
||||||
|
</x-tooltip>
|
||||||
|
@else
|
||||||
|
{{ trans('recurring.' . $item->recurring->frequency) }}
|
||||||
|
@endif
|
||||||
</x-slot>
|
</x-slot>
|
||||||
<x-slot name="second">
|
<x-slot name="second">
|
||||||
@if ($item->recurring->limit_by == 'count')
|
@if ($item->recurring->limit_by == 'count')
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<x-form.group.recurring
|
<x-form.group.recurring
|
||||||
:type="$type"
|
:type="$type"
|
||||||
@started="onChangeRecurringDate()"
|
@started="onChangeRecurringDate()"
|
||||||
|
:interval="$document ? $document->recurring->interval : null"
|
||||||
:frequency="$document ? $document->recurring->frequency : null"
|
:frequency="$document ? $document->recurring->frequency : null"
|
||||||
:custom-frequency="$document ? $document->recurring->custom_frequency : null"
|
:custom-frequency="$document ? $document->recurring->custom_frequency : null"
|
||||||
:limit="$document ? $document->recurring->limit_by : null"
|
:limit="$document ? $document->recurring->limit_by : null"
|
||||||
|
@ -81,7 +81,20 @@
|
|||||||
|
|
||||||
<x-table.td class="w-2/12" hidden-mobile>
|
<x-table.td class="w-2/12" hidden-mobile>
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
{{ trans('recurring.' . $item->recurring->frequency) }}
|
@if ($item->recurring->interval > 1)
|
||||||
|
<x-tooltip
|
||||||
|
id="tooltip-frequency-{{ $item->recurring->id }}"
|
||||||
|
placement="top"
|
||||||
|
message="{{ trans('recurring.custom_frequency_desc', [
|
||||||
|
'interval' => $item->recurring->interval,
|
||||||
|
'frequency' => str()->lower(trans('recurring.' . str_replace(['daily', 'ly'], ['days', 's'], $item->recurring->frequency)))
|
||||||
|
]) }}"
|
||||||
|
>
|
||||||
|
{{ trans('recurring.custom') }}
|
||||||
|
</x-tooltip>
|
||||||
|
@else
|
||||||
|
{{ trans('recurring.' . $item->recurring->frequency) }}
|
||||||
|
@endif
|
||||||
</x-slot>
|
</x-slot>
|
||||||
<x-slot name="second">
|
<x-slot name="second">
|
||||||
@if ($item->recurring->limit_by == 'count')
|
@if ($item->recurring->limit_by == 'count')
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
:custom-frequencies="{{ json_encode($customFrequencies) }}"
|
:custom-frequencies="{{ json_encode($customFrequencies) }}"
|
||||||
custom-frequency-value="{{ $customFrequency }}"
|
custom-frequency-value="{{ $customFrequency }}"
|
||||||
:custom-frequency-error="form.errors.get('recurring_custom_frequency')"
|
:custom-frequency-error="form.errors.get('recurring_custom_frequency')"
|
||||||
|
|
||||||
|
interval-value="{{ $interval }}"
|
||||||
@if ($attributes->has('@interval'))
|
@if ($attributes->has('@interval'))
|
||||||
@interval="form.recurring_interval = $event;{{ $attributes['@interval'] }}"
|
@interval="form.recurring_interval = $event;{{ $attributes['@interval'] }}"
|
||||||
@else
|
@else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user