3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 11:15:42 +00:00

Implement created at

This commit is contained in:
Marcus Moore
2026-05-07 13:19:13 -07:00
parent a1a7969d53
commit 16ff4b00d7
3 changed files with 25 additions and 4 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Reports;
use App\Http\Controllers\Controller;
use App\Models\Component;
use App\Models\ReportTemplate;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use League\Csv\EscapeFormula;
@ -95,6 +96,13 @@ class CustomComponentReportController extends Controller
]);
}
if (($request->filled('created_start')) && ($request->filled('created_end'))) {
$created_start = Carbon::parse($request->input('created_start'))->startOfDay();
$created_end = Carbon::parse($request->input('created_end'))->endOfDay();
$components->whereBetween('components.created_at', [$created_start, $created_end]);
}
$localConstraints = [
'by_model_number' => 'components.model_number',
'by_name' => 'components.name',
@ -181,6 +189,11 @@ class CustomComponentReportController extends Controller
// todo: checkout date
// todo: created_at
if ($request->filled('created_at')) {
$row[] = $component->created_at;
}
// todo: updated at
// todo: deleted
// todo: notes

View File

@ -598,6 +598,10 @@
@section('moar_scripts')
<script>
$("#checkAll").change(function () {
$("#included_fields_wrapper input:checkbox").prop('checked', $(this).prop("checked"));
});
$('.purchase-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,
@ -606,8 +610,14 @@
keepEmptyValues: true,
});
$("#checkAll").change(function () {
$("#included_fields_wrapper input:checkbox").prop('checked', $(this).prop("checked"));
// created_start
$('.created-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,
endDate:'0d',
format: 'yyyy-mm-dd',
keepEmptyValues: true,
});
{{--$("#savetemplateform").submit(function(e) {--}}

View File

@ -416,8 +416,6 @@ class CustomComponentReportTest extends TestCase
public function test_limiting_by_created_at()
{
$this->markTestIncomplete();
$this->travel(-60)->days(function () {
Component::factory()->create(['name' => 'Component A']);
});