James Cole
2023-06-03 17:16:28 +02:00
parent 244d9be46e
commit 1357074dcd
4 changed files with 46 additions and 32 deletions

View File

@@ -281,6 +281,7 @@ trait RecurringTransactionTrait
}
}
/**
* @param RecurrenceTransaction $transaction
* @param array $tags

View File

@@ -73,6 +73,9 @@ trait GetRecurrenceData
if (array_key_exists('piggy_bank_id', $transaction)) {
$return['piggy_bank_id'] = (int)$transaction['piggy_bank_id'];
}
if (array_key_exists('bill_id', $transaction)) {
$return['bill_id'] = (int)$transaction['bill_id'];
}
if (array_key_exists('tags', $transaction)) {
$return['tags'] = $transaction['tags'];

View File

@@ -203,12 +203,13 @@ trait RecurrenceValidation
*/
foreach ($repetitions as $index => $repetition) {
if (!array_key_exists('moment', $repetition)) {
continue;
$repetition['moment'] = '';
}
if (null === $repetition['moment']) {
$repetition['moment'] = '';
}
$repetition['moment'] = $repetition['moment'] ?? 'invalid';
switch ($repetition['type'] ?? 'empty') {
default:
$validator->errors()->add(sprintf('repetitions.%d.type', $index), (string)trans('validation.valid_recurrence_rep_type'));

View File

@@ -59,37 +59,39 @@
{{ trans('firefly.repeat_until_in_past', {date: array.repeat_until.isoFormat(monthAndDayFormat) }) }}
</span>
{% endif %}
{% for rep in array.repetitions %}
<p>
<strong>{{ rep.description }}
{% if rep.repetition_skip == 1 %}
({{ trans('firefly.recurring_skips_one')|lower }})
{% endif %}
{% if rep.repetition_skip > 1 %}
({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }})
{% endif %}
</strong>
</p>
<table class="table" aria-label="Table">
<tbody>
{% for occ in rep.occurrences %}
<tr>
<th scope="row">{{ occ.date.isoFormat(trans('config.month_and_date_day_js')) }}</th>
<td>
{% if not occ.fired %}
<form action="{{ route('recurring.trigger', [recurrence.id]) }}" method="post" style="display: inline;">
{% for rep in array.repetitions %}
<p>
<strong>{{ rep.description }}
{% if rep.repetition_skip == 1 %}
({{ trans('firefly.recurring_skips_one')|lower }})
{% endif %}
{% if rep.repetition_skip > 1 %}
({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }})
{% endif %}
</strong>
</p>
<table class="table" aria-label="Table">
<tbody>
{% for occ in rep.occurrences %}
<tr>
<th scope="row">{{ occ.date.isoFormat(trans('config.month_and_date_day_js')) }}</th>
<td>
{% if not occ.fired %}
<form action="{{ route('recurring.trigger', [recurrence.id]) }}" method="post"
style="display: inline;">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="date" value="{{ occ.date.isoFormat('YYYY-MM-DD') }}">
<input type="submit" name="submit" value="{{ 'create_right_now'|_ }}"
class="btn btn-sm btn-default">
<input type="hidden" name="date"
value="{{ occ.date.isoFormat('YYYY-MM-DD') }}">
<input type="submit" name="submit" value="{{ 'create_right_now'|_ }}"
class="btn btn-sm btn-default">
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</div>
<div class="box-footer">
<small>
@@ -161,8 +163,15 @@
{% endfor %}
</p>
{% endif %}
{% if 0 != transaction.piggy_bank_id and array.type == 'Transfer' %}
<a href="{{ route('piggy-banks.show', [transaction.piggy_bank_id]) }}">{{ transaction.piggy_bank_name }}</a>
{% if 0 != transaction.piggy_bank_id %}
<p>
<a href="{{ route('piggy-banks.show', [transaction.piggy_bank_id]) }}">{{ transaction.piggy_bank_name }}</a>
</p>
{% endif %}
{% if 0 != transaction.bill_id %}
<p>
<a href="{{ route('bills.show', [transaction.bill_id]) }}">{{ transaction.bill_name }}</a>
</p>
{% endif %}
</td>
</tr>