From 53a45ae3990650114876c9a8755cdfa8b5adf391 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 15 May 2024 09:54:45 -0400 Subject: [PATCH] More routes --- app/Config/Routes.php | 7 ++-- app/Controllers/BkoReports.php | 62 ++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 9d6b7c3..8735e2d 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -15,8 +15,11 @@ $routes->post('/digibko/v1/identity/verify_token', 'DigiFiAuth::verifyPostBkoT $routes->get('/digibko/v1/dash', 'BkoDash::bkoDashHome'); -$routes->get('/digibko/v1/loan/started', 'BkoReports::startedApplication'); -$routes->get('/digibko/v1/loan/pending', 'BkoReports::pendingApplication'); +$routes->get('/digibko/v1/loan/started', 'BkoReports::startedApplication'); +$routes->get('/digibko/v1/loan/pending', 'BkoReports::pendingApplication'); +$routes->get('/digibko/v1/loan/ready', 'BkoReports::readyApplication'); +$routes->get('/digibko/v1/loan/approved', 'BkoReports::approvedApplication'); +$routes->get('/digibko/v1/loan/rejected', 'BkoReports::rejectedApplication'); $routes->get('/digibko/v1/dashboard/bvn/recent', 'DigiFiAuth::startBkoToken'); //$routes->get('/digibko/v1/applications/pending', 'BkoReports::pendingApplication'); diff --git a/app/Controllers/BkoReports.php b/app/Controllers/BkoReports.php index 9d4e458..36d6cac 100644 --- a/app/Controllers/BkoReports.php +++ b/app/Controllers/BkoReports.php @@ -26,7 +26,7 @@ class BkoReports extends BaseController a.state,a.country,a.status,a.added, a.updated FROM applications a - LEFT JOIN customers c ON c.uid = a.customer_uid "); + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 1 "); $row = $query->getResult('array'); $data = [ 'call_return' => '100', @@ -45,7 +45,64 @@ class BkoReports extends BaseController a.state,a.country,a.status,a.added, a.updated FROM applications a - LEFT JOIN customers c ON c.uid = a.customer_uid "); + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 1 "); + $row = $query->getResult('array'); + $data = [ + 'call_return' => '100', + 'records' => $row + ]; + return $this->respond($data, 200); + // return $this->respond([], 200); + } + + public function readyApplication() :ResponseInterface + { + //SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications; + $query = $this->db->query("SELECT c.firstname, c.lastname, a.uid,a.loan_amount, + a.payment_month,a.sales_agent,a.gender, + a.marital_status,a.email,a.address, + a.state,a.country,a.status,a.added, + a.updated + FROM applications a + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 2 "); + $row = $query->getResult('array'); + $data = [ + 'call_return' => '100', + 'records' => $row + ]; + return $this->respond($data, 200); + // return $this->respond([], 200); + } + + public function approvedApplication() :ResponseInterface + { + //SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications; + $query = $this->db->query("SELECT c.firstname, c.lastname, a.uid,a.loan_amount, + a.payment_month,a.sales_agent,a.gender, + a.marital_status,a.email,a.address, + a.state,a.country,a.status,a.added, + a.updated + FROM applications a + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 5 "); + $row = $query->getResult('array'); + $data = [ + 'call_return' => '100', + 'records' => $row + ]; + return $this->respond($data, 200); + // return $this->respond([], 200); + } + + public function rejectedApplication() :ResponseInterface + { + //SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications; + $query = $this->db->query("SELECT c.firstname, c.lastname, a.uid,a.loan_amount, + a.payment_month,a.sales_agent,a.gender, + a.marital_status,a.email,a.address, + a.state,a.country,a.status,a.added, + a.updated + FROM applications a + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 7 "); $row = $query->getResult('array'); $data = [ 'call_return' => '100', @@ -56,4 +113,5 @@ class BkoReports extends BaseController } + } \ No newline at end of file