<?php
defined('BASEPATH') or exit('No direct script access allowed');



class Home extends CI_Controller
{

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

    public function index()
    {
        $data['ParkingArea'] = [];
        if (!empty(@$this->uri->segment('1'))) {
            // $data['ParkingArea'] = getParkingAreaAnalytics($this->uri->segment('1'), date('Y-m-d'));
            $this->load->view('index', $data);
        } else {
            $this->load->view('index', $data);
        }
    }
    public function ParkingDetails()
    {
        $this->load->view('ParkingDetails');
    }

    public function saveLocation()
    {
        $lat = $this->input->post('latitude');
        $long = $this->input->post('longitude');
        $clientCode = $this->input->post('clientCode');
        // $this->session->set_userdata([
        //     'latitude' => $lat,
        //     'longitude' => $long
        // ]);

       $ParkingArea= getParkingAreaAnalytics($clientCode, date('Y-m-d'),$lat,$long);
        echo json_encode($ParkingArea);
    }
}
