New columns added in endorsment request table : GWM
This commit is contained in:
parent
0a36997305
commit
92b4287e13
@ -134,6 +134,7 @@ $routes->group('api', ['filter' => 'appSignature'], function ($routes) {
|
||||
$routes->get('endorsement/endorsementList', 'EndorsementController::endorsementList');
|
||||
$routes->post('endorsement/createEndorsement', 'EndorsementController::createEndorsement');
|
||||
$routes->post('endorsement/updateEndorsement', 'EndorsementController::updateEndorsement');
|
||||
$routes->get('endorsement/downloadDndorsementCompletionFile', 'EndorsementController::downloadDndorsementCompletionFile');
|
||||
|
||||
//dashboard
|
||||
$routes->get('dashboard/managerDashboard', 'DashboardController::managerDashboard');
|
||||
|
||||
@ -198,6 +198,10 @@ class EndorsementController extends ResourceController
|
||||
'endorsement_no' => $reqData['endorsement_no'] ?? $endorsement['endorsement_no'],
|
||||
'status' => $reqData['status'] ,
|
||||
'endorsement_completion_file' => $uploadedCompletionFile,
|
||||
'contact_person' => $reqData['contact_person'] ,
|
||||
'financia_or_non_financial' => $reqData['financia_or_non_financial'] ,
|
||||
'endorsement_premium' => $reqData['endorsement_premium'] ,
|
||||
'pending_days' => $reqData['pending_days'] ,
|
||||
'updated_by' => $reqData['updated_by'] ?? null,
|
||||
];
|
||||
|
||||
@ -225,6 +229,39 @@ class EndorsementController extends ResourceController
|
||||
}
|
||||
|
||||
|
||||
public function downloadDndorsementCompletionFile()
|
||||
{
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
if (!$id) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'ID is required'], 200);
|
||||
}
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->EndorsementModel->find($id);
|
||||
|
||||
if (!$fileRecord) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File not found'], 200);
|
||||
}
|
||||
|
||||
$filePath = WRITEPATH . 'uploads/endorsement/' . $fileRecord['endorsement_completion_file'];
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File missing on server'], 200);
|
||||
}
|
||||
|
||||
// Force file download
|
||||
return $this->response->download($filePath, null);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -26,6 +26,10 @@ class EndorsementModel extends Model
|
||||
'status',
|
||||
'endorsement_file_name',
|
||||
'endorsement_completion_file',
|
||||
'contact_person',
|
||||
'financia_or_non_financial',
|
||||
'endorsement_premium',
|
||||
'pending_days',
|
||||
'created_at',
|
||||
'updated_by',
|
||||
'updated_at',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user