Skip to content
Open
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
7 changes: 7 additions & 0 deletions app/Http/Controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use App\Http\Requests\CustomAssetReportRequest;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\RedirectResponse;
use function Livewire\before;

/**
* This controller handles all actions related to Reports for
Expand Down Expand Up @@ -740,9 +741,15 @@ public function postCustom(CustomAssetReportRequest $request) : StreamedResponse
$assets->whereBetween('assets.updated_at', [$request->input('last_updated_start'), $request->input('last_updated_end')]);
}

if(($request->filled('last_updated_before'))){
$last_updated_window = Carbon::parse(today()->subDays($request->input('last_updated_before')));
$assets->where('assets.updated_at', '<' , $last_updated_window);
}

if ($request->filled('exclude_archived')) {
$assets->notArchived();
}

if ($request->input('deleted_assets') == 'include_deleted') {
$assets->withTrashed();
}
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en-US/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
'created_by' => 'Created By',
'record_created' => 'Record Created',
'updated_at' => 'Updated at',
'updated_before' => 'Updated Before',
'currency' => '$', // this is deprecated
'currency_text' => 'Currency', //
'current' => 'Current',
Expand All @@ -104,6 +105,7 @@
'dashboard' => 'Dashboard',
'data_source' => 'Data Source',
'days' => 'days',
'days_ago' => 'days ago',
'days_to_next_audit' => 'Days to Next Audit',
'date' => 'Date',
'debug_warning' => 'Warning!',
Expand Down
14 changes: 14 additions & 0 deletions resources/views/reports/custom.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,21 @@ class="form-control"
{!! $errors->first('last_updated_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@endif
</div>

<!-- Last Updated before -->
<div class="form-group">
<label for="last_updated_before" class="col-md-3 control-label">{{ trans('general.updated_before') }}</label>
<div class="input-group col-md-2">
<input class="form-control input-group" type="number" min="0" name="last_updated_before" value="{{ $template->textValue('last_updated_before', old('last_updated_before')) }}" aria-label="last_updated_before">
{{ trans('general.days_ago') }}
</div>

@if ($errors->has('last_updated_before'))
<div class="col-md-9 col-lg-offset-3">
{!! $errors->first('last_updated_before', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
@endif
</div>

<div class="col-md-9 col-md-offset-3">
Expand Down
Loading