<?php 

	class Home extends CI_Controller
	{
		public function index()
		{
			$data['tentang'] = $this->Datamodel->tampilData('tentang_aplikasi')->result();
			$data['banner'] = $this->Datamodel->tampilData('banner_slider')->result();
			$data['paket'] = $this->Datamodel->paket_where('paket')->result();
			$data['ketpaket'] = $this->Datamodel->paket_not_where('paket')->result();
			$data['promo'] = $this->Datamodel->tampilData('promo')->result();
			$data['galeri'] = $this->Datamodel->tampilData('galeri')->result();
			$data['faq'] = $this->Datamodel->tampilData('faq')->result();
			$data['blog'] = $this->Datamodel->getWithLimit('blog', 'created_at', 'DESC', 3)->result();

			$this->load->view('template/header', $data);
			$this->load->view('home', $data);
			$this->load->view('template/footer', $data);
		}
		public function kontak()
		{
			$data['tentang'] = $this->Datamodel->tampilData('tentang_aplikasi')->result();
			$data['banner'] = $this->Datamodel->tampilData('banner_slider')->result();
			$data['paket'] = $this->Datamodel->paket_where('paket')->result();
			$data['ketpaket'] = $this->Datamodel->paket_not_where('paket')->result();
			$data['promo'] = $this->Datamodel->tampilData('promo')->result();
			$data['galeri'] = $this->Datamodel->tampilData('galeri')->result();
			$data['faq'] = $this->Datamodel->tampilData('faq')->result();

			$this->load->view('template/header', $data);
			$this->load->view('kontak', $data);
		}
		public function pemesanan()
		{
			$nama = $this->input->post('nama');
			$hp = $this->input->post('hp');
			$pemesanan = $this->input->post('pemesanan');
	
			$data =	array(
				'nama' => $nama,
				'nomor_handphone' => $hp,
				'rencana' => $pemesanan
			);
			$token = base64_encode($nama);
			
			$this->Datamodel->tambahData($data,'pemesanan');
			$this->session->set_flashdata('pesan', '<div class="alert alert-success alert-dismissible fade show" role="alert">Data Berhasil Ditambahkan !
							</div>');

			redirect('Home/kontak');
		}
	}

?>