From 46ede2f1cf4d9a73694147e3315170f391da0a45 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Thu, 18 Feb 2021 12:51:55 -0500 Subject: [PATCH] fix --- adminwww/application/controllers/Dash.php | 2 +- adminwww/application/controllers/Practice.php | 8 +++++++ .../application/models/Practice_model.php | 22 +++++++++++++++---- .../application/views/admin/dash_scripts.php | 19 ++++++++++++++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/adminwww/application/controllers/Dash.php b/adminwww/application/controllers/Dash.php index 168f00d..c0bb1c1 100644 --- a/adminwww/application/controllers/Dash.php +++ b/adminwww/application/controllers/Dash.php @@ -64,7 +64,7 @@ class Dash extends Admin_Controller { $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')); + $this->table->set_heading(array('data' => 'Process', 'style' => 'width:50px'), '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 39dec42..2b9d699 100644 --- a/adminwww/application/controllers/Practice.php +++ b/adminwww/application/controllers/Practice.php @@ -98,6 +98,14 @@ class Practice extends Admin_Controller { $this->load->view('practice/parts/view_pending.php', $data); } + public function selectPractice() { + $data = []; + $practice_id = $data['practice_id'] = trim($this->input->get('practice_id')); + $this->load->model('Practice_model'); + $data = $this->Practice_model->loadPractice($practice_id); + $this->load->view('practice/parts/view_practice.php', $data); + } + protected function renderPracticePage($page_name, $data) { $this->load->view('template/secure_header', $data); $this->load->view('practice/' . $page_name, $data); diff --git a/adminwww/application/models/Practice_model.php b/adminwww/application/models/Practice_model.php index ebd5f45..f98f158 100644 --- a/adminwww/application/models/Practice_model.php +++ b/adminwww/application/models/Practice_model.php @@ -17,11 +17,10 @@ class Practice_model extends CI_Model { } public function getPractice() { - $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)"; - $mysql = "SELECT '' AS process, - '' AS semail, + $case_statement = "(CASE WHEN status=1 THEN 'Active' WHEN status=0 THEN 'Deleted' WHEN status=3 THEN 'Deleted' WHEN status=5 THEN 'Acive' ELSE 'Unknown' END)"; + $mysql = "SELECT '' AS process, $case_statement AS status, - practice_name,username,email,added::date from practice_pending ORDER BY id DESC LIMIT 200"; + name,username,email,added::date FROM practice ORDER BY id DESC LIMIT 200"; $data['pending_practice'] = ""; return $query = $this->db->query($mysql); } @@ -41,4 +40,19 @@ class Practice_model extends CI_Model { return $data[0]; } + /* + mermsemr_dev=> SELECT * FROM practice; + id | name | firstname | lastname | email | phone | username | password | added | loc | last_login | status +----+---------------------------+-----------+----------+--------------------------+------------+----------+----------------------------------+---------------------------+----------+------------+-------- + 1 | University Hospital Space | Sanya | Ameye | ses66181+merms@gmail.com | 6784564356 | sameye | d0fbea2563b377ea7074bced45c88dcb | 2019-03-03 21:35:51.48451 | 10.0.0.1 | | 1 +(1 row) + + */ + + public function loadPractice($practice_id) { + $data = []; + $mysql = "SELECT * FROM practice WHERE id = $practice_id "; + $data = $this->db->query($mysql)->result_array(); + return $data[0]; + } } diff --git a/adminwww/application/views/admin/dash_scripts.php b/adminwww/application/views/admin/dash_scripts.php index 7be24b4..4776b20 100644 --- a/adminwww/application/views/admin/dash_scripts.php +++ b/adminwww/application/views/admin/dash_scripts.php @@ -28,7 +28,20 @@ return false; } - + function selectPractice(practice_id) { + // alert(pending_practice_id); + + $('#transp_detail').html('Processing...'); + // $('#acc' + pending_practice_id).prop('disabled', true); + $.ajax({ + url: "/practice/selectPractice?proc=PROCESS&practice_id=" + practice_id + }).done(function (data) { + $('#transp_detail').html(data); + // $('#acc' + pending_practice_id).prop('disabled', false); + }); + return false; + } + function resendEmail(pending_practice_id) { // alert(pending_practice_id); @@ -44,4 +57,6 @@ } // --> - \ No newline at end of file + + +