mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix attachment overview
This commit is contained in:
parent
1278f92355
commit
36021d84cf
@ -26,9 +26,12 @@ namespace FireflyIII\Http\Controllers\Recurring;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
|
||||
use FireflyIII\Transformers\AttachmentTransformer;
|
||||
use FireflyIII\Transformers\RecurrenceTransformer;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\View\View;
|
||||
@ -71,13 +74,14 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a single recurring transaction.
|
||||
*
|
||||
* @param Recurrence $recurrence
|
||||
* @param Recurrence $recurrence
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show(Recurrence $recurrence)
|
||||
{
|
||||
$repos = app(AttachmentRepositoryInterface::class);
|
||||
/** @var RecurrenceTransformer $transformer */
|
||||
$transformer = app(RecurrenceTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag());
|
||||
@ -93,12 +97,25 @@ class ShowController extends Controller
|
||||
$date = (new Carbon($occurrence))->startOfDay();
|
||||
$set = [
|
||||
'date' => $date,
|
||||
'fired' => $this->recurring->createdPreviously($recurrence, $date) || $this->recurring->getJournalCount($recurrence, $date) > 0,
|
||||
'fired' => $this->recurring->createdPreviously($recurrence, $date)
|
||||
|| $this->recurring->getJournalCount($recurrence, $date) > 0,
|
||||
];
|
||||
$array['repetitions'][$index]['occurrences'][$item] = $set;
|
||||
}
|
||||
}
|
||||
|
||||
// add attachments to the recurrence object.
|
||||
$attachments = $recurrence->attachments()->get();
|
||||
$array['attachments'] = [];
|
||||
$attachmentTransformer = app(AttachmentTransformer::class);
|
||||
/** @var Attachment $attachment */
|
||||
foreach ($attachments as $attachment) {
|
||||
$item = $attachmentTransformer->transform($attachment);
|
||||
$item['file_exists'] = $repos->exists($attachment); // TODO this should be part of the transformer
|
||||
$array['attachments'][] = $item;
|
||||
|
||||
}
|
||||
|
||||
$subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
|
||||
|
||||
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups', 'today'));
|
||||
|
@ -21,7 +21,8 @@
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p><em>{{ array.description }}</em></p>
|
||||
<h4>{{ 'transaction_journal_meta'|_ }}</h4>
|
||||
<p>{{ 'description'|_ }}: <em>{{ array.description }}</em></p>
|
||||
|
||||
{% if array.active == false %}
|
||||
<p>
|
||||
@ -34,6 +35,8 @@
|
||||
<li>{{ rep.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h4>{{ 'attachments'|_ }}</h4>
|
||||
{% include 'list.attachments' with {attachments: array.attachments} %}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="btn-group">
|
||||
|
Loading…
Reference in New Issue
Block a user