Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/View/Components/Documents/Show/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ public function render()
->first();

$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;

$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'));
}
Expand Down
32 changes: 28 additions & 4 deletions app/View/Components/Form/Group/Recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Recurring extends Component
public $frequency;
public $frequencies = [];

public $interval = '';

public $customFrequency = '';
public $customFrequencies = [];

Expand All @@ -35,6 +37,8 @@ public function __construct(
$frequency = '',
$frequencies = [],

$interval = '',

$customFrequency = '',
$customFrequencies = [],

Expand All @@ -49,10 +53,13 @@ public function __construct(
$sendEmail = false
) {
$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->customFrequency = $this->getCustomFrequency($customFrequency);
$this->customFrequency = $this->getCustomFrequency($frequency, $customFrequency, $interval);
$this->customFrequencies = $this->getCustomFrequencies($customFrequencies);

$this->limit = $this->getLimit($limit);
Expand Down Expand Up @@ -85,8 +92,12 @@ protected function getType($type)
return 'invoice';
}

protected function getFrequency($frequency)
protected function getFrequency($frequency, $interval = 0)
{
if ($interval > 1) {
return 'custom';
}

if (! empty($frequency)) {
return $frequency;
}
Expand All @@ -109,8 +120,21 @@ protected function getFrequencies($frequencies)
];
}

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)) {
return $customFrequency;
}
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ window.axios.defaults.headers.common['Content-Type'] = 'multipart/form-data';
// #start NProgress integration
// Added nprogress to use nprogress bar
import NProgress from "nprogress";
import 'nprogress/nprogress.css';

window.axios.interceptors.request.use(function (config) {
// Do something before request is sent
Expand Down
6 changes: 6 additions & 0 deletions resources/assets/js/components/AkauntingRecurring.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ export default {
default: 'monthly',
description: "Default reccuring type"
},
intervalValue: {
type: String,
default: '',
description: 'Default interval value'
},
invertalError: {
type: String,
default: null,
Expand Down Expand Up @@ -310,6 +315,7 @@ export default {

mounted() {
this.frequency = this.frequencyValue;
this.interval = this.intervalValue;
this.customFrequency = this.customFrequencyValue;
this.started_at = this.startedValue;

Expand Down
1 change: 1 addition & 0 deletions resources/lang/en-GB/recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'send_email_auto' => 'Send email automatically',

'frequency_type' => 'Repeat this :type',
'custom_frequency_desc' => 'Repeat every :interval :frequency',
'limit_date' => 'Create first :type on',
'limit_middle' => 'and end',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<x-slot name="body">
<x-form.group.recurring
type="transaction"
:interval="$recurring_transaction ? $recurring_transaction->recurring->interval : null"
:frequency="$recurring_transaction ? $recurring_transaction->recurring->frequency : null"
:custom-frequency="$recurring_transaction ? $recurring_transaction->recurring->custom_frequency : null"
:limit="$recurring_transaction ? $recurring_transaction->recurring->limit_by : null"
Expand Down
15 changes: 14 additions & 1 deletion resources/views/banking/recurring_transactions/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,20 @@

<x-table.td class="w-2/12" hidden-mobile>
<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 name="second">
@if ($item->recurring->limit_by == 'count')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<x-form.group.recurring
:type="$type"
@started="onChangeRecurringDate()"
:interval="$document ? $document->recurring->interval : null"
:frequency="$document ? $document->recurring->frequency : null"
:custom-frequency="$document ? $document->recurring->custom_frequency : null"
:limit="$document ? $document->recurring->limit_by : null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,20 @@

<x-table.td class="w-2/12" hidden-mobile>
<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 name="second">
@if ($item->recurring->limit_by == 'count')
Expand Down
2 changes: 2 additions & 0 deletions resources/views/components/form/group/recurring.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
:custom-frequencies="{{ json_encode($customFrequencies) }}"
custom-frequency-value="{{ $customFrequency }}"
:custom-frequency-error="form.errors.get('recurring_custom_frequency')"

interval-value="{{ $interval }}"
@if ($attributes->has('@interval'))
@interval="form.recurring_interval = $event;{{ $attributes['@interval'] }}"
@else
Expand Down