<?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 CustomerAccountOpeningRequests  extends CI_Controller
{
	private $context = null;

	function __construct()
	{
		parent::__construct();

		// Load member model
		$this->load->model('pagination/CustomerAccountOpeningRequests_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 = '<a href="'.$current_url.'?history=customer_account_opening_requests&id='.$row->id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>';


			$data[] = array($row->unique_id , $row->customer_account_type_name, $row->lastname , $row->firstname, $row->phone_number,
				mb_strtoupper($this->lang->line($row->status),'UTF-8'), $row->created_at ,$buttons);

		}

		$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);
	}

}
