backoffice/application/controllers/pagination/CareRequests.php

60 lines
1.8 KiB
PHP
Executable File

<?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 btn-block treat-demand' data-id='$row->id' data-action='ACCEPT'>".$this->lang->line('accept')."</button>".
"<button class='btn btn-danger btn-block treat-demand' data-id='$row->id' data-action='REJECT'>".$this->lang->line('reject')."</button>";
$insured = $row->user_lastname.' '.$row->user_firstname;
if(isset($row->beneficiary_id)){
$insured = $row->beneficiary_lastname.' '.$row->beneficiary_firstname;
}
$data[] = array($row->request_id , $row->issuer_agent_lastname.' | '.$row->issuer_agent_phone , $insured, $this->lang->line($row->to), $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);
}
}