<?php

namespace App\Controllers;

use App\Controllers\BaseController;
use CodeIgniter\HTTP\ResponseInterface;

use App\Models\ConfigsModel;

class ConfigsController extends BaseController
{
    public function index()
    {
        //
    }

    public function __construct()
    {
        helper(["url", "form", "session", "epscolor"]);
        $this->epsconfig_lib = new \App\Libraries\EpsConfig_Lib();

        $this->configs = new ConfigsModel();  
    }


    public function add_tasa()
    {
        if ($this->request->getPost()) {
            $id = '1';
            $tasa = formato_uppercase($this->request->getVar('tasa'));

            $data1 = [
                "tasa" => $tasa
            ];
            $update = $this->configs->update($id, $data1);

            $mensaje = array('mensaje' => 'Tasa Actualizada');
            $success = array('success' => 'add_ok');
            $data = array ('data' => $data1);

            $response = array_merge($data, $mensaje, $success);
        }
        echo json_encode($response);
    }
}
