This commit is contained in:
Olusesan Ameye
2021-02-18 12:22:55 -05:00
parent 44b8b38cc2
commit 5a85180fdb
6 changed files with 125 additions and 111 deletions
+18 -21
View File
@@ -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 '<button type=\"button\" class=\"btn btn-warning\" onclick=\"approvePractice('||id||');\">Process</button>' AS process,
'<button type=\"button\" class=\"btn btn-danger\" onclick=\"resendEmail('||id||');\">Email</button>' 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);