From 1de526d74c079215ef498842fec10bc15a3d8e43 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Wed, 17 Feb 2021 15:33:04 -0500 Subject: [PATCH] fix --- adminwww/application/controllers/Dash.php | 29 +++++++++++++++++-- .../application/views/admin/view_dash.php | 16 +++++----- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/adminwww/application/controllers/Dash.php b/adminwww/application/controllers/Dash.php index b5da8a7..7239f33 100644 --- a/adminwww/application/controllers/Dash.php +++ b/adminwww/application/controllers/Dash.php @@ -9,6 +9,8 @@ class Dash extends Admin_Controller { $this->load->helper('url'); $data = array(); + $data = $this->dashData(); + $this->load->library('table'); $this->table->set_template($this->template); @@ -23,7 +25,7 @@ class Dash extends Admin_Controller { $mysql = "SELECT '' AS View,name,username,email,added,last_login from practice ORDER BY id DESC LIMIT 7"; $data['recent_practice'] = ""; $query = $this->db->query($mysql); - $this->table->set_heading(array('data' => 'View', 'style' => 'width:50px'),'Practice Name', 'Username', 'Email', 'Added','Last logn'); + $this->table->set_heading(array('data' => 'View', 'style' => 'width:50px'), 'Practice Name', 'Username', 'Email', 'Added', 'Last logn'); $data['recent_practice'] = $this->table->generate($query); @@ -41,6 +43,28 @@ class Dash extends Admin_Controller { $this->renderAdminPage('view_dash', $data); } + private function dashData() { + $data = []; + + + + //$query = $this->db->query("SELECT count(*) FROM members WHERE acc_link IS NULL AND status = 1")->num_rows(); + // $query = $this->db->query(" SELECT count(*) FROM members WHERE acc_link IS NOT NULL AND status = 1")->num_rows(); + + $data["new_patient"] = $this->db->query("SELECT id FROM members WHERE acc_link IS NULL AND status = 1")->num_rows(); + $data["establish_pateint"] = $this->db->query(" SELECT id FROM members WHERE acc_link IS NOT NULL AND status = 1")->num_rows(); + $data['deleted_users'] = $this->db->query(" SELECT id FROM members WHERE status <> 1")->num_rows(); + + $data["new_patient_percent"] = ceil(100 * $data["establish_pateint"] / ($data["establish_pateint"] + $data["new_patient"])); + $data["establish_pateint_percent"] = ceil(100 * $data["new_patient"] / ($data["establish_pateint"] + $data["new_patient"])); + + + // $data["new_patient"] = $this->db->query("SELECT id FROM members WHERE acc_link IS NULL AND status = 1")->num_rows(); + //$data["establish_pateint"] = $this->db->query(" SELECT id FROM members WHERE acc_link IS NOT NULL AND status = 1")->num_rows(); + + return $data; + } + public function pendingpractice() { $data = array(); @@ -48,13 +72,14 @@ class Dash extends Admin_Controller { $this->load->library('table'); $this->table->set_template($this->template); - $mysql = "SELECT '' AS process, + $mysql = "SELECT '' AS process, '' AS semail, status, practice_name,username,email,added::date from practice_pending ORDER BY id DESC LIMIT 20"; $data['pending_practice'] = ""; $query = $this->db->query($mysql); //$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px')); + $this->table->set_heading(array('data' => 'Process', 'style' => 'width:50px'), 'Resend Email', 'Status', 'Practice Name', 'Username', 'Email', array('data' => 'Date Added', 'style' => 'width:40px')); $data['pending_practice'] = $this->table->generate($query); $this->renderAdminPage('view_pendingpractice', $data); } diff --git a/adminwww/application/views/admin/view_dash.php b/adminwww/application/views/admin/view_dash.php index 3ad18c1..10b99ab 100644 --- a/adminwww/application/views/admin/view_dash.php +++ b/adminwww/application/views/admin/view_dash.php @@ -12,11 +12,11 @@
-

45%

+

%

New Patients
-

55%

+

%

Establish Patients
@@ -28,8 +28,8 @@
-

45.8k

- Pending Users +

+ Establish Users
@@ -39,8 +39,8 @@
-

65.4k

- New Users +

+ New Users/Patients
@@ -50,7 +50,7 @@
-

78.2k

+

Deleted Users
@@ -61,7 +61,7 @@
-

65.3k

+

Active Users