update export excel request log

This commit is contained in:
Linksehat Staging Server
2024-01-31 14:52:04 +07:00
parent 932b20eba6
commit 7e56fb4b77
3 changed files with 41 additions and 28 deletions

View File

@@ -27,6 +27,7 @@ class ReportLogResource extends JsonResource
$provider = Organization::where('id', $this->organization_id)->first();
$documentQty = File::where(['fileable_type' => 'App\Models\RequestLog', 'fileable_id' => $this->id])->get()->toArray();
$parsedDateTime = Carbon::parse($this->created_at);
// $parsedDateTime->tz = 'Asia/Makassar';
$formattedDateTime = $parsedDateTime->format('Y-m-d H:i:s');
$timeInsertBenefit = RequestLogBenefit::where('request_log_id', $this->id)->first();
@@ -39,15 +40,19 @@ class ReportLogResource extends JsonResource
$created_final_at = null;
}
$durationGl = Helper::differenceTime($formattedDateTime, $this->submission_date);
if ($this->approved_at){
$durationGl = Helper::differenceTime($formattedDateTime, $this->approved_at);
} else {
$durationGl = 0;
}
$data = [
'id' => $this->id,
'code' => $this->code,
'created_at' => $formattedDateTime,
'created_final_at' => $created_final_at,
'submission_date' => $this->submission_date,
'submission_date' => $this->approved_at ? $this->approved_at : null,
'approved_by' => Helper::userName($this->approved_by),
'approved_final_log_at' => $this->approved_final_log_at,
'approved_final_log_by' => $this->final_log == 1 ? Helper::userName($this->approved_final_log_by) : '-',