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