mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 04:46:44 +00:00
Fix attachment overview
This commit is contained in:
@@ -26,9 +26,12 @@ namespace FireflyIII\Http\Controllers\Recurring;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Models\Recurrence;
|
use FireflyIII\Models\Recurrence;
|
||||||
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
|
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
|
||||||
|
use FireflyIII\Transformers\AttachmentTransformer;
|
||||||
use FireflyIII\Transformers\RecurrenceTransformer;
|
use FireflyIII\Transformers\RecurrenceTransformer;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
@@ -78,6 +81,7 @@ class ShowController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(Recurrence $recurrence)
|
public function show(Recurrence $recurrence)
|
||||||
{
|
{
|
||||||
|
$repos = app(AttachmentRepositoryInterface::class);
|
||||||
/** @var RecurrenceTransformer $transformer */
|
/** @var RecurrenceTransformer $transformer */
|
||||||
$transformer = app(RecurrenceTransformer::class);
|
$transformer = app(RecurrenceTransformer::class);
|
||||||
$transformer->setParameters(new ParameterBag());
|
$transformer->setParameters(new ParameterBag());
|
||||||
@@ -93,12 +97,25 @@ class ShowController extends Controller
|
|||||||
$date = (new Carbon($occurrence))->startOfDay();
|
$date = (new Carbon($occurrence))->startOfDay();
|
||||||
$set = [
|
$set = [
|
||||||
'date' => $date,
|
'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;
|
$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]);
|
$subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
|
||||||
|
|
||||||
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups', 'today'));
|
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups', 'today'));
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<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 %}
|
{% if array.active == false %}
|
||||||
<p>
|
<p>
|
||||||
@@ -34,6 +35,8 @@
|
|||||||
<li>{{ rep.description }}</li>
|
<li>{{ rep.description }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
<h4>{{ 'attachments'|_ }}</h4>
|
||||||
|
{% include 'list.attachments' with {attachments: array.attachments} %}
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
Reference in New Issue
Block a user