ikinci temizlik tamamlandı
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @api-readonly
|
||||
* Returns RFI tasks
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
|
||||
$tasks = db("r_f_i_s");
|
||||
|
||||
if(!getesit("d1", ""))
|
||||
{
|
||||
$tasks = $tasks->whereBetween("inspection_date", [get("d1"), get("d2")]);
|
||||
} else {
|
||||
// Geçerli tarihi al
|
||||
$today = Carbon::today();
|
||||
|
||||
// Bir hafta öncesinin tarihini al
|
||||
$oneWeekAgo = $today->subDays(10);
|
||||
$today = Carbon::today()->addDays(10);
|
||||
$d1 = $oneWeekAgo->format('Y-m-d');
|
||||
$d2 = $today->format('Y-m-d');
|
||||
// Sorguyu güncelle
|
||||
$tasks = $tasks->whereBetween("inspection_date", [$d1, $d2]);
|
||||
}
|
||||
|
||||
if(!getesit("discipline", ""))
|
||||
{
|
||||
$tasks = $tasks->where("discipline", get("discipline"));
|
||||
}
|
||||
|
||||
if(!getesit("contractor", ""))
|
||||
{
|
||||
$tasks = $tasks->where("subcontractor", get("contractor"));
|
||||
}
|
||||
|
||||
$tasks = $tasks->get();
|
||||
|
||||
foreach ($tasks as &$task) {
|
||||
if (isset($task->inspection_date)) {
|
||||
// Use Carbon to parse and format the date
|
||||
$task->inspection_date = Carbon::parse($task->inspection_date)->format('d.m.Y');
|
||||
}
|
||||
|
||||
if (empty($task->status)) {
|
||||
$task->status = "Inspection Waiting";
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode_tr($tasks)
|
||||
?>
|
||||
Reference in New Issue
Block a user