Add care request panel in validating agent

This commit is contained in:
Djery-Tom 2022-02-01 11:58:25 +01:00
parent 5c141c459a
commit 781939975d
12 changed files with 580 additions and 270 deletions

View File

@ -346,107 +346,17 @@ class NanoHealthController extends CI_Controller
public function saveHealthCareSheet($type = 'consultation')
{
if($this->isLogged()) {
if (isset($_POST)) {
$url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/'.$type;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.NANO_SANTE_SERVICE_TOKEN,
'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en'
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = new \stdClass();
foreach ($_POST as $key => $value){
$body->{$key} = $value;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
if ($result) {
echo $result;
} else {
echo json_encode(['status' => 500]);
}
}
}
echo $this->makeRequest('POST','/health-care-sheets/'.$type, $_POST);
}
public function updateHealthCareSheet($id)
{
if($this->isLogged()) {
if (isset($_POST)) {
$url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/'.$id;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.NANO_SANTE_SERVICE_TOKEN,
'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en'
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = new \stdClass();
foreach ($_POST as $key => $value){
$body->{$key} = $value;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
if ($result) {
echo $result;
} else {
echo json_encode(['status' => 500]);
}
}
}
echo $this->makeRequest('PUT','/health-care-sheets/'.$id, $_POST);
}
public function calculateHealthCareSheetPerformancesAmount()
{
if($this->isLogged()) {
if (isset($_POST)) {
$url = NANO_SANTE_SERVICE_URL.'/health-care-sheets/performances-amount';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.NANO_SANTE_SERVICE_TOKEN,
'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en'
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = new \stdClass();
foreach ($_POST as $key => $value){
$body->{$key} = $value;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
if ($result) {
echo $result;
} else {
echo json_encode(['status' => 500]);
}
}
}
echo $this->makeRequest('POST','/health-care-sheets/performances-amount', $_POST);
}
public function getHealthCareSheets()
@ -515,6 +425,41 @@ class NanoHealthController extends CI_Controller
}
}
public function treatCareRequest(){
echo $this->makeRequest('PUT','/authorizations-care-requests', $_POST);
}
private function makeRequest($method , $path , $request_body){
if($this->isLogged()) {
$url = NANO_SANTE_SERVICE_URL.$path;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.NANO_SANTE_SERVICE_TOKEN,
'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en'
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = new \stdClass();
foreach ($request_body as $key => $value){
$body->{$key} = $value;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
if ($result) {
return $result;
}
}
return json_encode(['status' => 500]);
}
private function isLogged()
{
if (!$this->session->userdata('email')) {

View File

@ -6,20 +6,50 @@ class ValidatingDoctor extends CI_Controller
public function __construct()
{
parent::__construct();
$this->load->model('nano_credit_model');
$this->load->model('nano_health_model');
}
public function index(){
// if ($this->isLogged()){
public function index()
{
if ($this->isLogged()){
$data['active'] = "dashboard";
$this->load->view('nano_health/validating_doctor/header', $data);
$this->load->view('nano_health/validating_doctor/dashboard', $data);
$this->load->view('footer');
// }
$data['network_id'] = $data['id_network'] = $this->session->userdata('network_id');
if ($this->input->get('history')) {
$this->historique($this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $data);
}else{
$data['count_d_traite'] = $this->nano_health_model->getCountCareRequests(null,$this->session->userdata('agent_id'), 'ACCEPTED');
$data['count_d_no_traite'] = $this->nano_health_model->getCountCareRequests($data['network_id'], null, 'UNDER_VALIDATION');
$data['count_d_no_canceled'] = $this->nano_health_model->getCountCareRequests(null,$this->session->userdata('agent_id'), 'REJECTED');
$this->load->view('nano_health/validating_doctor/header', $data);
$this->load->view('nano_health/validating_doctor/dashboard', $data);
$this->load->view('footer');
}
}
}
private function isLogged(){
private function historique($startDate, $endDate,$type , $data)
{
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
if ($type == 'care-requests')
$data['active'] = 'care_requests';
$this->load->view('nano_health/validating_doctor/header', $data);
if ($type == 'care-requests')
$this->load->view('nano_health/validating_doctor/care_requests');
$this->load->view('footer');
}
private function isLogged()
{
if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');

View File

@ -0,0 +1,55 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
use Brick\Money\Context\AutoContext;
use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\Money;
class CareRequests extends CI_Controller
{
private $context = null;
function __construct()
{
parent::__construct();
// Load member model
$this->load->model('pagination/CareRequests_model', 'model');
}
function getLists()
{
$data = $row = array();
// Fetch member's records
$witData = $this->model->getRows($_POST);
$i = $_POST['start'];
$current_url = $_POST['currentURL'];
foreach ($witData as $row) {
$buttons = "<button class='btn btn-success treat-demand' style='margin-right: 10px;' data-id='$row->id' data-action='ACCEPT'>".$this->lang->line('accept')."</button>".
"<button class='btn btn-danger treat-demand' data-id='$row->id' data-action='REJECT'>".$this->lang->line('reject')."</button>";
$data[] = array($row->request_id , $row->user_lastname.' '.$row->user_firstname , $row->user_phone, $row->act_code , $row->act_name,
mb_strtoupper($this->lang->line($row->state),'UTF-8'), $row->created_at , $row->state === 'UNDER_VALIDATION' ? $buttons : null);
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->model->countAll($_POST),
"recordsFiltered" => $this->model->countFiltered($_POST),
"data" => $data,
);
// Output to JSON format
echo json_encode($output);
}
}

View File

@ -856,4 +856,8 @@ $lang['invoice_id'] = "Invoice ID";
$lang['generate_qr_code'] = "Generate QR code";
$lang['display_qr_code'] = "Display QR code";
$lang['insured_phone'] = "Insured phone";
$lang['care_requests_history'] = "Care request history";
$lang['no_demand'] = "No requests";
$lang['request_id'] = "Request ID";
$lang['export_request_list'] = "Export request list";
?>

View File

@ -867,4 +867,8 @@ $lang['invoice_id'] = "ID de la facture";
$lang['generate_qr_code'] = "Génerer le QR code";
$lang['display_qr_code'] = "Afficher le QR code";
$lang['insured_phone'] = "Téléphone de l'assuré";
$lang['care_requests_history'] = "Historique des demandes de soins";
$lang['no_demand'] = "Aucune demande";
$lang['request_id'] = "ID de la demande";
$lang['export_request_list'] = "Exporter la liste des demandes";
?>

View File

@ -136,4 +136,16 @@ class Nano_health_model extends CI_Model
return [$insuredAmount, $insurerAmount];
}
public function getCountCareRequests($network_id , $validating_agent_id, $state){
$query = $this->db->from('nh_infos_authorization_of_care_requests')->where('state',$state);
if(!empty($validating_agent_id)){
$query = $query->where('validating_agent_id', $validating_agent_id);
}
if(!empty($network_id)){
$query = $query->where('network_id', $network_id);
}
return $query->count_all_results();
}
}

View File

@ -0,0 +1,109 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class CareRequests_model extends CI_Model
{
function __construct()
{
// Set table name
$this->table = 'nh_infos_authorization_of_care_requests';
// Set orderable column fields
$this->column_order = array('request_id','user_lastname','act_code', 'act_name', 'state', 'created_at', null);
// Set searchable column fields
$this->column_search = array('request_id','user_lastname','act_code', 'act_name', 'state', 'created_at');
// Set default order
$this->order = array('created_at' => 'desc');
}
/*
* Fetch members data from the database
* @param $_POST filter data based on the posted parameters
*/
public function getRows($postData)
{
$this->_get_datatables_query($postData);
if ($postData['length'] != -1) {
$this->db->limit($postData['length'], $postData['start']);
}
$query = $this->db->get();
return $query->result();
}
/*
* Count all records
*/
public function countAll($postData)
{
$this->db->from($this->table);
if(!empty($postData['id_network'])){
$this->db->where('network_id', $postData['id_network']);
}
if(!empty($postData['network_agent_id'])){
$this->db->where('network_agent_id', $postData['network_agent_id']);
}
return $this->db->count_all_results();
}
/*
* Count records based on the filter params
* @param $_POST filter data based on the posted parameters
*/
public function countFiltered($postData)
{
$this->_get_datatables_query($postData);
$query = $this->db->get();
return $query->num_rows();
}
/*
* Perform the SQL queries needed for an server-side processing requested
* @param $_POST filter data based on the posted parameters
*/
private function _get_datatables_query($postData)
{
$this->db->from($this->table);
if(!empty($postData['id_network'])){
$this->db->where('network_id', $postData['id_network']);
}
if(!empty($postData['network_agent_id'])){
$this->db->where('network_agent_id', $postData['network_agent_id']);
}
if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) {
$this->db->where('created_at >=', date('Y-m-d', strtotime($postData['startDate'])));
$this->db->where('created_at <', date('Y-m-d', strtotime($postData['endDate']. "+1 day")));
}
$i = 0;
// loop searchable columns
foreach ($this->column_search as $item) {
// if datatable send POST for search
if ($postData['search']['value']) {
// first loop
if ($i === 0) {
// open bracket
$this->db->group_start();
$this->db->like($item, $postData['search']['value']);
} else {
$this->db->or_like($item, $postData['search']['value']);
}
// last loop
if (count($this->column_search) - 1 == $i) {
// close bracket
$this->db->group_end();
}
}
$i++;
}
if (isset($postData['order'])) {
$this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']);
} else if (isset($this->order)) {
$order = $this->order;
$this->db->order_by(key($order), $order[key($order)]);
}
}
}

View File

@ -110,13 +110,13 @@
} ?>">
<a href="<?= base_url('Agent?history=insurance-health_care_sheets') ?>">
<i class="fa fa-money"></i>
<span><?php echo $this->lang->line('health_care_sheets'); ?></span>
<span><?= $this->lang->line('health_care_sheets'); ?></span>
</a>
</li>
<li class="<?php if ($active == "wallet_invoices") {echo "active";} ?>">
<a href="<?php echo base_url('Agent?history=insurance-invoices') ?>">
<a href="<?= base_url('Agent?history=insurance-invoices') ?>">
<i class="fa fa-file-text"></i>
<span><?php echo $this->lang->line('invoices'); ?></span>
<span><?= $this->lang->line('invoices'); ?></span>
</a>
</li>
<?php }?>

View File

@ -229,7 +229,7 @@
<p><?= $this->lang->line('percentage_insured') ?></p>
</div>
<div class="icon">
<i class="fa fa-info"></i>
<i class="fa fa-money"></i>
</div>
</div>
</div>
@ -241,7 +241,7 @@
<p><?= $this->lang->line('percentage_insurer') ?></p>
</div>
<div class="icon">
<i class="fa fa-info"></i>
<i class="fa fa-money"></i>
</div>
</div>
</div>

View File

@ -0,0 +1,242 @@
<!-- DataTables -->
<link rel="stylesheet"
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<?php
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $this->lang->line('care_requests_history') ?>
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
<div class="info-box-content">
<span class="info-box-text"><?= $this->lang->line('Période') ?> </span>
<span class="info-box-number">
<input id="picker"
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
data-category="<?= isset($category) ? $category : null ?>"
type="text" name="daterange"
data-lang="<?= $this->session->userdata('site_lang') ?>"
value="<?= ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
</span>
<span> Format : <?= $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?= $this->lang->line('export_request_list') ?></h3>
<div class="box-tools">
</div>
</div>
<div class="box-body" style="overflow-x:auto;">
<table id="requests" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'><?=$this->lang->line('request_id')?></th>
<th><?=$this->lang->line('one_insured')?></th>
<th><?=$this->lang->line('Contact')?></th>
<th><?= $this->lang->line('act_code') ?></th>
<th><?= $this->lang->line('act') ?></th>
<th><?= $this->lang->line('state') ?></th>
<th>Date </th>
<th align='center'>Action</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- SlimScroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script>
$(function () {
const lang = $('#picker').data('lang');
const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
var table = $('#requests').DataTable({
// Processing indicator
"processing": true,
"language": {
"processing": "<?= $this->lang->line('loading') ?>",
"emptyTable" : "<?= $this->lang->line('no_demand') ?>"
},
// DataTables server-side processing mode
"serverSide": true,
// Initial no order.
"order": [],
// Load data from an Ajax source
"ajax": {
"url": "<?= base_url('pagination/CareRequests/getLists'); ?>",
"data":{
"startDate" : "<?= $startDate?>",
"endDate" : "<?= $endDate?>",
"id_network" : "<?= $id_network ?? null ?>",
"currentURL" : "<?= current_url()?>"
},
"type": "POST"
},
"aaSorting": [[6, "desc"]],
"columnDefs": [{
"targets": [6],
// "orderable": false,
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
}],
dom: 'Bfrtip',
"buttons": [
'pageLength',
{
"extend": 'excelHtml5',
title: "<?= $this->lang->line('care_requests_history') ?>",
},
{
extend: 'csvHtml5',
title: "<?= $this->lang->line('care_requests_history') ?>",
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: "<?= $this->lang->line('care_requests_history') ?>",
trim: false,
"action": newexportaction
},
// 'colvis'
]
});
table.buttons().container()
.appendTo('#example_wrapper .col-sm-6:eq(0)');
});
</script>
<script type="text/javascript">
var startDate;
var endDate;
$(function () {
const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
const id_network = "<?= $id_network ?? null ?>";
const ne = "<?=$network_agent_id ?? null ?>"
$('input[name="daterange"]').daterangepicker({
opens: 'left',
autoUpdateInput: false,
locale: {
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
cancelLabel: 'Clear'
}
}, function (start, end, label) {
const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD');
if(category)
window.location = "<?= current_url()?>" + "?history=care-requests" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=care-requests" + "&d=" + debut + "&f=" + fin;
});
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
if(category)
window.location = "<?= current_url()?>" + "?history=care-requests";
else
window.location = "<?= current_url()?>" + "?id="+id_network+"&history=care-requests";
});
});
$("#requests").on('click', ".treat-demand", function () {
let action = $(this).data('action');
let id = $(this).data('id');
$.ajax({
url: '<?= base_url('NanoHealthController/treatCareRequest')?>',
type: 'POST',
dataType: 'json',
data: {
"action": action,
"validating_agent_id": "<?= $this->session->userdata('agent_id') ?>",
"request_id": id,
},
success: function (data) {
// console.log('data',data);
if(data.status === 200){
Swal.fire({
icon: 'success',
title: data.response,
text:"<?= $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
}
});
});
</script>

View File

@ -1,9 +1,9 @@
<!-- Date Picker -->
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<!-- Daterange picker -->
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
<!-- ChartJS -->
<script src="<?php echo base_url('bower_components/Chart.js/Chart.js') ?>"></script>
<script src="<?= base_url('bower_components/Chart.js/Chart.js') ?>"></script>
<?php
$month = time();
@ -20,93 +20,19 @@
** Simple User Treatment
**/
// $date = date("Y");
//
// $demandes_data[] = '';
// $demandes_data =array();
// for ($i = 1; $i <= 12; $i++) {
// $demandes_query_mounth = $this->db->query("SELECT demande_id FROM info_demandeCredits
// WHERE MONTH(dateAjout) = '".$months[$i-1]."' AND YEAR(dateAjout) = ".$years[$i-1]."
// AND codeParrain='".$this->session->userdata('member_code')."'"
// );
// $demandes_data[] = $demandes_query_mounth->num_rows();
// }
//
// $demandes_query = $listdem;
//
// if($demandes_query!=false){
// $demandes=$demandes_query->num_rows();
// // Count networks for simple users
// $array_simple = array();
// $num = 0;
// if ($demandes > 0) {
// foreach($demandes_query->result() as $row) {
// $num++;
// $array_simple[] = $row->codeMembre;
// }
//
// $vals_simple = array_count_values($array_simple);
// //echo 'No. of NON Duplicate Items: '.count($vals_simple).'<br><br>';
// //print_r($vals_simple);
// $pieChart2 = array();
// foreach(array_keys($vals_simple) as $paramName2) {
// $color2 = dechex(rand(0x000000, 0xFFFFFF));
// $trash2 = array("value" => $vals_simple[$paramName2],
// "color" => "#".$color2,
// "highlight" => "#".$color2,
// "label" => $paramName2);
//
// $pieChart2[]= $trash2;
//
// }
// }
// }else{
$pieChart2 = array();
// }
$date = date("Y");
/**
** Geolocated User Treatment
**/
// $users_geolocated_query = $list_geolocated_users;
// // Geolocated Users by month replace 2016 by NOW()
// $users_geolocated_data[] = '';
// $users_geolocated_data =array();
// for ($i = 1; $i <= 12; $i++) {
// $users_geolocated_query_january = $this->db->query("SELECT agent_id FROM super_infos
// WHERE MONTH(date_created) = '".$months[$i-1]."' AND YEAR(date_created) = ".$years[$i-1]."
// AND category='geolocated' AND code_parrain='".$this->session->userdata('member_code')."'");
// $users_geolocated_data[] = $users_geolocated_query_january->num_rows();
// }
//
// if($users_geolocated_query!=false){
//
// $users_geolocated=$users_geolocated_query->num_rows();
// //$users_geolocated_query = json_encode($users_geolocated_query->result());
// // Counts network for geolocated users
// $array_geolocated = array();
// $num = 0;
// if ($users_geolocated > 0) {
// foreach($users_geolocated_query->result() as $row) {
// $num++;
// $array_geolocated[] = date("M", strtotime($row->date_created));
// }
// $vals_geolocated = array_count_values($array_geolocated);
// //echo 'No. of NON Duplicate Items: '.count($vals_geolocated).'<br><br>';
// //print_r($vals_geolocated);
// $pieChart = array();
// foreach(array_keys($vals_geolocated) as $paramName) {
// $color = dechex(rand(0x000000, 0xFFFFFF));
// $trash = array("value" => $vals_geolocated[$paramName],
// "color" => "#".$color,
// "highlight" => "#".$color,
// "label" => $paramName);
//
// $pieChart[]= $trash;
// }
// }
// }else{
// $pieChart = array();
// }
$demandes_data[] = '';
$demandes_data =array();
for ($i = 1; $i <= 12; $i++) {
$demandes_query_mounth = $this->db->query("SELECT id FROM nh_infos_authorization_of_care_requests
WHERE MONTH(created_at) = '".$months[$i-1]."' AND YEAR(created_at) = ".$years[$i-1]."
AND network_id='".$network_id."'"
);
$demandes_data[] = $demandes_query_mounth->num_rows();
}
$pieChart = array();
?>
<div class="content-wrapper">
@ -114,8 +40,8 @@
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('validating_doctor'); ?>
<small><?php echo $this->lang->line('Tableau de bord'); ?></small>
<?= $this->lang->line('validating_doctor'); ?>
<small><?= $this->lang->line('Tableau de bord'); ?></small>
</h1>
</section>
@ -126,42 +52,39 @@
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<h3><?php echo $count_d_traite ?? 0;?></h3>
<h3><?= $count_d_traite ?? 0;?></h3>
<p><?php echo $this->lang->line('accepted_care_requests'); ?></p>
<p><?= $this->lang->line('accepted_care_requests'); ?></p>
</div>
<div class="icon">
<i class="ion ion-checkmark-circled"></i>
</div>
<a href="<?php echo base_url('Superviseur_dash/getDemandes') ?>" class="small-box-footer"><?php echo $this->lang->line("Plus d'informations"); ?><i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-md-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-orange">
<div class="inner">
<h3><?php echo $count_d_no_traite ?? 0;?></h3>
<h3><?= $count_d_no_traite ?? 0;?></h3>
<p><?php echo $this->lang->line('not_treated_care_requests'); ?></p>
<p><?= $this->lang->line('not_treated_care_requests'); ?></p>
</div>
<div class="icon">
<i class="ion ion-alert-circled"></i>
</div>
<a href="<?php echo base_url('Superviseur_dash/getDemandes') ?>" class="small-box-footer"><?php echo $this->lang->line("Plus d'informations"); ?> <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-md-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3><?php echo $count_d_no_canceled ?? 0;?></h3>
<h3><?= $count_d_no_canceled ?? 0;?></h3>
<p><?php echo $this->lang->line("cancelled_care_requests"); ?></p>
<p><?= $this->lang->line("cancelled_care_requests"); ?></p>
</div>
<div class="icon">
<i class="ion ion-close-circled"></i>
</div>
<a href="#" data-toggle="modal" data-target="#modal-default2" class="small-box-footer"><?php echo $this->lang->line("Plus d'informations"); ?> <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
@ -169,7 +92,7 @@
<!-- BAR CHART -->
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('care_requests'); ?></h3>
<h3 class="box-title"><?= $this->lang->line('care_requests'); ?></h3>
</div>
<div class="box-body">
<div class="chart">
@ -181,20 +104,6 @@
<!-- /.box -->
</div>
<!-- /.col -->
<div class="col-xs-6">
<!-- DONUT CHART -->
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('care_requests'); ?></h3>
</div>
<div class="box-body" id="chartAd">
<canvas id="pieChart" style="height:250px"></canvas>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
<!-- /.row -->
</section>
@ -203,67 +112,67 @@
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- jQuery UI 1.11.4 -->
<script src="<?php echo base_url('bower_components/jquery-ui/jquery-ui.min.js') ?>"></script>
<script src="<?= base_url('bower_components/jquery-ui/jquery-ui.min.js') ?>"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- Morris.js charts -->
<script src="<?php echo base_url('bower_components/raphael/raphael.min.js') ?>"></script>
<script src="<?= base_url('bower_components/raphael/raphael.min.js') ?>"></script>
<!-- Sparkline -->
<script src="<?php echo base_url('bower_components/jquery-sparkline/dist/jquery.sparkline.min.js') ?>"></script>
<script src="<?= base_url('bower_components/jquery-sparkline/dist/jquery.sparkline.min.js') ?>"></script>
<!-- jvectormap -->
<script src="<?php echo base_url('plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') ?>"></script>
<script src="<?php echo base_url('plugins/jvectormap/jquery-jvectormap-world-mill-en.js') ?>"></script>
<script src="<?= base_url('plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') ?>"></script>
<script src="<?= base_url('plugins/jvectormap/jquery-jvectormap-world-mill-en.js') ?>"></script>
<!-- jQuery Knob Chart -->
<script src="<?php echo base_url('bower_components/jquery-knob/dist/jquery.knob.min.js') ?>"></script>
<script src="<?= base_url('bower_components/jquery-knob/dist/jquery.knob.min.js') ?>"></script>
<!-- daterangepicker -->
<script src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<!-- datepicker -->
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<!-- Bootstrap WYSIHTML5 -->
<script src="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') ?>"></script>
<script src="<?= base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<!-- ChartJS -->
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
<script src="<?= base_url('bower_components/chart.js/Chart.js') ?>"></script>
<script >
var Pie = '<?php echo json_encode($pieChart) ?>';
if(Pie==='[]'){
var select = document.getElementById('chartAd');
$(select.children).hide();
$(select).append("<p><?php echo $this->lang->line('Aucune adhesion'); ?></p>");
}else{
Pie = JSON.parse(Pie);
}
//var Pie = '<?//= json_encode($pieChart) ?>//';
//if(Pie==='[]'){
// var select = document.getElementById('chartAd');
// $(select.children).hide();
// //$(select).append("<p><?////= $this->lang->line('Aucune adhesion'); ?>////</p>");
//}else{
// Pie = JSON.parse(Pie);
//}
var Pie2 = '<?php echo json_encode($pieChart2) ?>';
if(Pie2==='[]') {
var select = document.getElementById('chartDem');
$(select.children).hide();
$(select).append("<p><?php echo $this->lang->line('Aucune demande'); ?></p>");
}else{
Pie2 = JSON.parse(Pie2);
}
//var Pie2 = '<?//= json_encode($pieChart2) ?>//';
//if(Pie2==='[]') {
// var select = document.getElementById('chartDem');
// $(select.children).hide();
// $(select).append("<p><?//= $this->lang->line('Aucune demande'); ?>//</p>");
//}else{
// Pie2 = JSON.parse(Pie2);
//}
var areaChartData = {
labels : <?php echo json_encode($label_months) ?>,
labels : <?= json_encode($label_months) ?>,
datasets: [
{
label : 'Electronics',
@ -273,18 +182,18 @@
pointStrokeColor : '#ffa200',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: <?php echo json_encode($users_geolocated_data) ?>
},
{
label : 'Digital Goods',
fillColor : 'rgba(0, 187, 255, 1)',
strokeColor : 'rgba(0, 187, 255, 1)',
pointColor : '#00bbff',
pointStrokeColor : 'rgba(0, 187, 255, 1)',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(0, 187, 255, 1)',
data : <?php echo json_encode($demandes_data) ?>
}
data: <?= json_encode($demandes_data) ?>
},
//{
// label : 'Digital Goods',
// fillColor : 'rgba(0, 187, 255, 1)',
// strokeColor : 'rgba(0, 187, 255, 1)',
// pointColor : '#00bbff',
// pointStrokeColor : 'rgba(0, 187, 255, 1)',
// pointHighlightFill : '#fff',
// pointHighlightStroke: 'rgba(0, 187, 255, 1)',
// data : <?//= json_encode($demandes_data) ?>
//}
]
};
@ -309,4 +218,4 @@
});
</script>
<!-- Page script -->
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script>
<script src="<?= base_url('dist/js/custom.js') ?>"></script>

View File

@ -117,8 +117,8 @@
</a>
</li>
<li class="<?php if($active=="geolocated"){echo "active ";} ?>">
<a href="#" data-toggle="modal" data-target="#modal-default">
<li class="<?php if($active=="care_requests"){echo "active ";} ?>">
<a href="<?= base_url('ValidatingDoctor?history=care-requests') ?>">
<i class="fa fa-medkit"></i>
<span><?= $this->lang->line('care_requests'); ?></span>
</a>