Files
citrus-cms/resources/views/admin-ajax/get-rfi-for-release-log.blade.php
T
2026-04-28 21:15:09 +03:00

66 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use App\Models\RFI;
// Parametreleri al
$rfiNo = request('rfi_no');
$discipline = request('discipline');
$projectNo = request('project_no');
$skip = (int) request('skip', 0);
$take = (int) request('take', 50);
// Response array
$response = [];
// RFI verilerini getir
$query = RFI::query();
if(!empty($rfiNo)) {
$query->where('rfi_no', 'like', '%' . $rfiNo . '%');
}
if(!empty($discipline)) {
$query->where('discipline', $discipline);
}
if(!empty($projectNo)) {
$query->where('project_no', $projectNo);
}
// Total count for pagination
$totalCount = $query->count();
// Sıralama: En son girilen önce, sonra RFI tarihine göre
// Pagination uygula
$rfiData = $query
->orderBy('id', 'DESC') // En son girilen önce
->orderBy('inspection_date', 'ASC') // Inspection tarihine göre sıralı
->skip($skip)
->take($take)
->get();
// Verileri formatla
foreach($rfiData as $item) {
$row = [
'id' => $item->id,
'rfi_no' => $item->rfi_no,
'inspection_date' => $item->inspection_date,
'discipline' => $item->discipline,
'project_no' => $item->project_no,
'itp' => $item->itp,
'status' => $item->status,
'subcontractor' => $item->subcontractor,
'contractor' => $item->contractor,
'unit' => $item->unit,
'area' => $item->area,
'location' => $item->location,
'description' => $item->description,
];
$response[] = $row;
}
// JSON formatında yanıt döndür
echo json_encode($response);
?>