update export excel request log
This commit is contained in:
@@ -137,7 +137,7 @@ class ReportLogController extends Controller
|
||||
*/
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -188,30 +188,34 @@ class ReportLogController extends Controller
|
||||
$provider = Organization::where('id', $row['organization_id'])->first();
|
||||
$documentQty = File::where(['fileable_type' => 'App\Models\RequestLog', 'fileable_id' => $row['id']])->get()->toArray();
|
||||
$parsedDateTime = Carbon::parse($row['created_at']);
|
||||
$parsedDateTime->tz = 'Asia/Jakarta';
|
||||
// $parsedDateTime->tz = 'Asia/Makassar';
|
||||
$formattedDateTime = $parsedDateTime->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
$timeInsertBenefit = RequestLogBenefit::where('request_log_id', $row['id'])->first();
|
||||
|
||||
|
||||
if ($timeInsertBenefit){
|
||||
$created_final_at = Carbon::parse($timeInsertBenefit->created_at);
|
||||
$created_final_at = $created_final_at->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
$durationFinalGl = Helper::differenceTime($timeInsertBenefit->created_at, $row['approved_final_log_at']);
|
||||
} else {
|
||||
$durationFinalGl = 0;
|
||||
$created_final_at = false;
|
||||
}
|
||||
|
||||
$durationGl = Helper::differenceTime($formattedDateTime, $row['submission_date']);
|
||||
|
||||
|
||||
|
||||
if ($row['approved_at']){
|
||||
$durationGl = Helper::differenceTime($formattedDateTime, $row['approved_at']);
|
||||
} else {
|
||||
$durationGl = 0;
|
||||
}
|
||||
|
||||
|
||||
$rowData = [
|
||||
$row['code'], // code
|
||||
$row['member'] ? $row['member']['name'] : '', // name
|
||||
$formattedDateTime ? $formattedDateTime : "-" , // created at
|
||||
$row['submission_date'], // submission date
|
||||
Helper::userName($row['approved_by']), // created by
|
||||
$row['approved_at'] ? $row['approved_at'] : '-', // submission date
|
||||
$row['approved_by'] ? Helper::userName($row['approved_by']) : '-', // created by
|
||||
$created_final_at ? $created_final_at : "-", // fgl create time
|
||||
$row['approved_final_log_at'] ? $row['approved_final_log_at'] : "", // fgl submit time
|
||||
$row['final_log'] == 1 ? Helper::userName($row['approved_final_log_by']) : '-', // fgl create by
|
||||
|
||||
@@ -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) : '-',
|
||||
|
||||
@@ -170,14 +170,17 @@ export default function List() {
|
||||
}
|
||||
|
||||
const handleGetData = (type :string) => {
|
||||
axios.get(`report/logs/export`)
|
||||
.then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
handleClose();
|
||||
handleClose();
|
||||
setImportLoading(true);
|
||||
handleCancelImportButton();
|
||||
axios.get(`report/logs/export`)
|
||||
.then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
setImportLoading(false);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -194,14 +197,15 @@ export default function List() {
|
||||
{!currentImportFileName && (
|
||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
<Button
|
||||
<LoadingButton
|
||||
variant="outlined"
|
||||
startIcon={<UploadIcon />}
|
||||
sx={{ p: 1.8 }}
|
||||
onClick={handleClick}
|
||||
loading={importLoading}
|
||||
>
|
||||
Export
|
||||
</Button>
|
||||
</LoadingButton>
|
||||
<Menu
|
||||
id="import-button"
|
||||
anchorEl={anchorEl}
|
||||
@@ -283,7 +287,7 @@ export default function List() {
|
||||
const response = await axios.get('/report/logs', {
|
||||
params: { ...parameters },
|
||||
});
|
||||
|
||||
|
||||
setDataTableLoading(false);
|
||||
setDataTableData(response.data);
|
||||
};
|
||||
@@ -313,14 +317,14 @@ export default function List() {
|
||||
const { row } = props;
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [loadingApprove, setLoadingApprove] = React.useState(false);
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
|
||||
<TableCell align="left">{row.code}</TableCell>
|
||||
<TableCell align="left">{row.member_name}</TableCell>
|
||||
<TableCell align="left"><Label>{row.created_at ? fDateTimesecond(row.created_at) : '-'}</Label></TableCell>
|
||||
<TableCell align="left"><Label>{fDateTimesecond(row.submission_date)}</Label></TableCell>
|
||||
<TableCell align="left"><Label>{row.submission_date != null ? fDateTimesecond(row.submission_date) : '-'}</Label></TableCell>
|
||||
<TableCell align="left">{row.approved_by}</TableCell>
|
||||
<TableCell align="left"><Label>{row.created_final_at != null ? fDateTimesecond(row.created_final_at) : '-' }</Label></TableCell>
|
||||
<TableCell align="left"><Label>{row.approved_final_log_at ? fDateTimesecond(row.approved_final_log_at) : '-' }</Label></TableCell>
|
||||
|
||||
Reference in New Issue
Block a user