From 5a85180fdb9b0df5278e6bf5dc1c8f083a167a4c Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Thu, 18 Feb 2021 12:22:55 -0500 Subject: [PATCH] fix --- adminwww/application/controllers/Dash.php | 39 +++++----- adminwww/application/controllers/Practice.php | 77 ++++++++++--------- .../application/models/Practice_model.php | 15 ++++ .../application/views/admin/view_dash.php | 2 +- .../views/admin/view_pendingpractice.php | 64 ++++++++------- .../views/practice/parts/view_pending.php | 39 ++++------ 6 files changed, 125 insertions(+), 111 deletions(-) diff --git a/adminwww/application/controllers/Dash.php b/adminwww/application/controllers/Dash.php index c0a45de..168f00d 100644 --- a/adminwww/application/controllers/Dash.php +++ b/adminwww/application/controllers/Dash.php @@ -8,8 +8,10 @@ class Dash extends Admin_Controller { $this->load->helper('url'); $data = array(); + $this->load->model('Dash_model'); + $data = $this->Dash_model->dashData(); - $data = $this->dashData(); + // $data = $this->dashData(); $this->load->library('table'); $this->table->set_template($this->template); @@ -39,34 +41,29 @@ class Dash extends Admin_Controller { $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_dash', $data); } - private function dashData() { - $data = []; - $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"])); - - return $data; - } - + public function pendingpractice() { - - $case_statement = "(CASE WHEN status=1 THEN 'Pending' WHEN status=0 THEN 'Deleted' WHEN status=3 THEN 'Deleted' WHEN status=5 THEN 'Acive' ELSE 'Unknown' END)"; $data = array(); $data["page_title"] = "Pending Practice"; $this->load->library('table'); $this->table->set_template($this->template); - echo $mysql = "SELECT '' AS process, - '' AS semail, - $case_statement AS status, - practice_name,username,email,added::date from practice_pending ORDER BY id DESC LIMIT 200"; - $data['pending_practice'] = ""; - $query = $this->db->query($mysql); + $this->load->model('Practice_model'); + $query = $this->Practice_model->getPendingPractice(); + $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); + } + + public function practice() { + $data = array(); + $data["page_title"] = "Practice"; + $this->load->library('table'); + $this->table->set_template($this->template); + $this->load->model('Practice_model'); + $query = $this->Practice_model->getPractice(); $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/controllers/Practice.php b/adminwww/application/controllers/Practice.php index e4ba0d0..39dec42 100644 --- a/adminwww/application/controllers/Practice.php +++ b/adminwww/application/controllers/Practice.php @@ -4,52 +4,48 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Practice extends Admin_Controller { - - public function index() { $this->load->helper('url'); $data = array(); - $this->load->library('table'); - $this->table->set_template($this->template); + $this->load->library('table'); + $this->table->set_template($this->template); - $data['recent_members'] = ""; - $mysql = "SELECT id,username,firstname,lastname,added::date,loc,last_login,acc_link FROM members ORDER by id DESC LIMIT 15"; - $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')); - $data['recent_members'] = $this->table->generate($query); + $data['recent_members'] = ""; + $mysql = "SELECT id,username,firstname,lastname,added::date,loc,last_login,acc_link FROM members ORDER by id DESC LIMIT 15"; + $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')); + $data['recent_members'] = $this->table->generate($query); - $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' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px')); - $data['recent_practice'] = $this->table->generate($query); + $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' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px')); + $data['recent_practice'] = $this->table->generate($query); - $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 7"; - $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')); - $data['pending_practice'] = $this->table->generate($query); + $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')); + $data['pending_practice'] = $this->table->generate($query); - $this->renderAdminPage('view_dash', $data); - + $this->renderAdminPage('view_dash', $data); } - - public function pendingpractice(){ + public function pendingpractice() { $data = array(); $data["page_title"] = "Pending Practice"; $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"; @@ -60,7 +56,7 @@ class Practice extends Admin_Controller { $this->renderAdminPage('view_pendingpractice', $data); } - public function pendingusers(){ + public function pendingusers() { $data = array(); $data["page_title"] = "Pending Members"; $this->load->library('table'); @@ -71,29 +67,35 @@ class Practice extends Admin_Controller { //$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')); $data['recent_members'] = $this->table->generate($query); $this->renderAdminPage('view_pendingusers', $data); - } public function resendEmail() { $data['pending_practice_id'] = trim($this->input->get('pending_practice_id')); - echo "Sending ".$data['pending_practice_id']; - - // return false; + echo "Sending " . $data['pending_practice_id']; + + // return false; } public function viewPendingPractice() { - - $data = array(); - $data['pending_practice_id'] = $this->uri->segment(3); - $data['page_title'] = "Pending Practice - ".$data['pending_practice_id']; - $mysql = "SELECT * FROM practice_pending WHERE id = ".$data['pending_practice_id']; + $data = array(); + $data['pending_practice_id'] = $this->uri->segment(3); + $data['page_title'] = "Pending Practice - " . $data['pending_practice_id']; + + $mysql = "SELECT * FROM practice_pending WHERE id = " . $data['pending_practice_id']; $query = $this->db->query($mysql); $this->renderPracticePage('view_pending_practice', $data); + } + public function selectPendingPractice() { + $data = []; + $pending_practice_id = $data['pending_practice_id'] = trim($this->input->get('pending_practice_id')); + $this->load->model('Practice_model'); + $data = $this->Practice_model->loadPendingPractice($pending_practice_id); + $this->load->view('practice/parts/view_pending.php', $data); } protected function renderPracticePage($page_name, $data) { @@ -101,10 +103,11 @@ class Practice extends Admin_Controller { $this->load->view('practice/' . $page_name, $data); $this->load->view('template/secure_footer', $data); } + protected function renderAdminPage($page_name, $data) { - $this->load->view('template/secure_header', $data); - $this->load->view('admin/' . $page_name, $data); - $this->load->view('template/secure_footer', $data); + $this->load->view('template/secure_header', $data); + $this->load->view('admin/' . $page_name, $data); + $this->load->view('template/secure_footer', $data); } } diff --git a/adminwww/application/models/Practice_model.php b/adminwww/application/models/Practice_model.php index 5ae821f..ebd5f45 100644 --- a/adminwww/application/models/Practice_model.php +++ b/adminwww/application/models/Practice_model.php @@ -26,4 +26,19 @@ class Practice_model extends CI_Model { return $query = $this->db->query($mysql); } + /* + mermsemr_dev=> SELECT * FROM practice_pending WHERE id = 1 AND status = 1; + id | firstname | lastname | practice_name | email | username | password | status | added | loc + ----+-----------+----------+---------------+---------------------+----------+----------+--------+----------------------------+----------- + 1 | Olu | Amey | Testing | works@chiefsoft.com | ses66181 | | 1 | 2020-12-19 10:40:57.740114 | 10.0.0.15 + (1 row) + */ + + public function loadPendingPractice($pending_practice_id) { + $data = []; + $mysql = "SELECT * FROM practice_pending WHERE id = $pending_practice_id AND status = 1"; + $data = $this->db->query($mysql)->result_array(); + return $data[0]; + } + } diff --git a/adminwww/application/views/admin/view_dash.php b/adminwww/application/views/admin/view_dash.php index 10b99ab..a86c3b6 100644 --- a/adminwww/application/views/admin/view_dash.php +++ b/adminwww/application/views/admin/view_dash.php @@ -301,7 +301,7 @@ } function selectPendingPractice(pending_practice_id) { - // alert(pending_practice_id); + alert(pending_practice_id); $('#transp_detail').html('Processing...'); // $('#acc' + pending_practice_id).prop('disabled', true); diff --git a/adminwww/application/views/admin/view_pendingpractice.php b/adminwww/application/views/admin/view_pendingpractice.php index c904739..e352172 100644 --- a/adminwww/application/views/admin/view_pendingpractice.php +++ b/adminwww/application/views/admin/view_pendingpractice.php @@ -1,37 +1,43 @@ -
-
+
+
-
- -
-
- -
-
+
+ +
+
+ +
+
-
-
-
-
-
-
-

Details

-
- -
-
-
- -
-
-
-
- +
+
+
+
+
+
+
+

Details

+
-
- +
+
+
+
+
+ +
+ +
+
+ + + +
+ + + \ No newline at end of file diff --git a/adminwww/application/views/practice/parts/view_pending.php b/adminwww/application/views/practice/parts/view_pending.php index f22b849..183aae9 100644 --- a/adminwww/application/views/practice/parts/view_pending.php +++ b/adminwww/application/views/practice/parts/view_pending.php @@ -1,7 +1,11 @@ + +
-

Simple Form

+

Practice Name :

@@ -9,50 +13,39 @@
- +
- +
- + placeholder="Username" />
- + placeholder="Email" />
- +
- + placeholder="added" />
+ +
- -
- -
-
-
-
- - -
-
-
- + +       +