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

class About_Temple extends MY_Controller
{

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

	public function About_temple()
	{
		$data['page'] = 'ABOUT-TEMPLE';
		$data['title'] = 'ABOUT-TEMPLE';
		$this->load->view('about_temple', $data);
	}
	public function About_Founders()
	{
		$data['page'] = 'ABOUT-FOUNDERS';
		$data['title'] = 'ABOUT-FOUNDERS';
		$this->load->view('about-temple-founders', $data);
	}

	public function About_committee()
	{
		$data['page'] = 'ABOUT-COMMITTEE';
		$data['title'] = 'ABOUT-COMMITTEE';

		$data['committee'] = getCommitteeBOD();

		$this->load->view('about_committee', $data);
	}

	public function Siddha_prabha()
	{
		$data['page'] = 'SIDDHA-PRABHA';
		$data['title'] = 'SIDDHA-PRABHA';

		// $data['committee'] = getCommitteeBOD();

		$this->load->view('siddha-prabha', $data);
	}


	public function Books()
	{


		$json_data = json_encode([
			"componentConfig" => [
				"query" => [
					"aspectType" => "menu",
					"menuCategory" => "TEMPLE SHOP",
					"status" => "ACTIVE",
					"refDataCode" => "BOOKS"
				],
				"moduleName" => "Temple Shop",
				"aspectType" => "menu",
				"collectionType" => "Business",
				"userName" => "vaapadmin3230",
				"productID" => ApiBaseUrl()['productID'],
				"clientID" => ApiBaseUrl()['clientID'],
				"skip" => 0,
				"next" => 1000
			]
		]);
		$data['page'] = 'BOOKS';
		$data['title'] = 'BOOKS';

		$data['bookList'] = getFilterData($json_data);

		$this->load->view('books', $data);
	}


	public function bookAddCart()
	{
		if ($this->input->post()) {
			// echo "<pre>";
			// var_dump($this->input->post());die();
			$this->session->set_userdata('books_cart', $this->input->post());

			$cartList = $this->session->userdata('books_cart');

			
		}


		$response = array(
			'status' => '1',
			'message' => "Success"
		);
		echo json_encode($response);
	}
	
	
	public function book_delete_cart_row()
	{
		$row_id 	= $this->input->post('row_id');
		$selected_date 	= $this->input->post('selected_date');

		$cart_items = $this->session->userdata('books_cart');
		$total_price = $cart_items['totalPrice'];
		$row_price = 0;

	

		foreach ($cart_items['ids'] as $key => $id) {
			if ($id == $row_id) {

			
					unset($cart_items['ids'][$key]);
					unset($cart_items['qty'][$key]);
					unset($cart_items['serviceName'][$key]);
					unset($cart_items['description'][$key]);
					unset($cart_items['serviceAmount'][$key]);
					unset($cart_items['image'][$key]);
					// unset($cart_items['startDate'][$key]);
					// unset($cart_items['date'][$key]);
					unset($cart_items['zeroAllowInd'][$key]);
					unset($cart_items['carryOutPrice'][$key]);
					unset($cart_items['menuCategory'][$key]);
					unset($cart_items['carryout'][$key]);
					unset($cart_items['serviceCategory'][$key]);
					unset($cart_items['serviceType'][$key]);
					unset($cart_items['serviceAmount'][$key]);
					// unset($cart_items['time'][$key]);
					unset($cart_items['totalAmount'][$key]);
					unset($cart_items['day'][$key]);
					
				
				break;
			}
		}

		foreach ($cart_items as $cart_key => &$cart_value) {
			if($cart_key !='totalPrice'){
			if (is_array($cart_value)) {
				$cart_value = array_values($cart_value);
			}
		}
		}

		$total_price = $total_price - $row_price;
		// echo $total_price; die();

		$cart_items['totalPrice'] = $total_price;
		$this->session->set_userdata('books_cart', $cart_items);
		echo json_encode(array('status' => 'success'));
	}
	public function Executive_committee()
	{
		$data['page'] = 'EXECUTIVE-COMMITTEE';
		$data['title'] = 'EXECUTIVE-COMMITTEE';

		// $data['committee'] = getCommitteeBOD();

		$this->load->view('executive_committee', $data);
	}
	public function About_deity()
	{
		$data['deities_data'] = getWebSyncsData('Diety', 'Diety Directory', '');

		$data['page'] = 'ABOUT-DEITY';
		$data['title'] = 'ABOUT-DEITY';
		$this->load->view('about_deity', $data);
	}

	public function About_priest()
	{
		$data['page'] = 'ABOUT-PRIEST';
		$data['title'] = 'ABOUT-PRIEST';
		$data['priest_data'] = getPriest();
		$this->load->view('about_priest', $data);
	}
	public function Education()
	{
		$data['page'] = 'EDUCATION';
		$data['title'] = 'EDUCATION';
		// $data['education_data'] = getEducation();   
		$this->load->view('education', $data);
	}

	public function All_classes()
	{
		$data['page'] = 'All-CLASSES';
		$data['title'] = 'All-CLASSES';
		// $data['education_data'] = getEducation();   
		$this->load->view('all_classes', $data);
	}

	public function Language_classes()
	{
		$data['page'] = 'LANGUAGE-CLASSES';
		$data['title'] = 'LANGUAGE-CLASSES';
		// $data['education_data'] = getEducation();   
		$this->load->view('language_classes', $data);
	}

	public function Land_donors()
	{
		$data['page'] = 'Land-Donors';
		$data['title'] = 'Land-Donors';
		$this->load->view('land_donors', $data);
	}
	public function Board_of_regents()
	{
		$data['page'] = 'Board-Of-Regents';
		$data['title'] = 'Board-Of-Regents';
		$this->load->view('board_of_regents', $data);
	}
	public function Temple_etiquette_and_visits()
	{
		$data['page'] = 'Temple-Etiquette-And-Visits';
		$data['title'] = 'Temple-Etiquette-And-Visits';
		$this->load->view('temple-etiquette-and-visits', $data);
	}
	public function Jain_singh()
	{
		$data['page'] = 'Jain-Singh';
		$data['title'] = 'Jain-Singh';
		$this->load->view('Jain-Singh', $data);
	}
	public function Shirdi_sai_satsang()
	{
		$data['page'] = 'Shirdi-Sai-Satsang';
		$data['title'] = 'Shirdi-Sai-Satsang';
		$this->load->view('Shirdi-Sai-Satsang', $data);
	}

	public function contact_us()
	{
		$data['page'] = 'CONTACT-US';
		$data['title'] = 'CONTACT-US';
		$this->load->view('contact_us', $data);
	}

	public function General_reference()
	{
		$data['page'] = 'GENERAL-REFERENCE';
		$data['title'] = 'ABOUT-REFERENCE';
		$this->load->view('general_reference', $data);
	}
	public function PrayerBooks()
	{
		$data['page'] = 'BHAJAN LYRICS';
		$data['title'] = 'BHAJAN LYRICS';
		$this->load->view('bhajan-lyrics', $data);
	}


	public function PrasadBhogPolicy()
	{
		$data['page'] = 'PRASAD BHOG POLICY';
		$data['title'] = 'PRASAD BHOG POLICY';

		$this->load->view('prasad-bhog-policy', $data);
	}
	

	public function lalithaananda_naatha(){
		$data['page'] = 'LALITHAANANDA-NAATHA';
		$data['title'] = 'LALITHAANANDA-NAATHA';
		$this->load->view('lalithaananda_naatha',$data);
	}

	public function swamiji(){
		$data['page'] = 'SWAMIJI';
		$data['title'] = 'SWAMIJI';
		$this->load->view('swamiji',$data);
	}

	public function mathaji(){
		$data['page'] = 'MATHAJI';
		$data['title'] = 'MATHAJI';
		$this->load->view('mathaji',$data);
	}
}
