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

class Checkout extends MY_Controller {

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

	}
	public function index($page = ''){


		

		$data['GeneralSettings'] = GeneralSettings();


		// print_r($data['GeneralSettings']); die();
		if (!empty($this->session->userdata('logged_in')) && $this->session->userdata('logged_in') == 1) {
			
			$data['page'] = 'Services';
			$data['title'] = 'Checkout';
			$data['userDetails'] =  getUserDetails()->data[0];
			$data['nakshtra_data'] = getNakshtra()['data'];
			$data['gotra_data'] = getGotra()['data'];


			if ($page == 'sponsor') {
				$data['session_data'] = 'sponsor_cart';
				$data['redirect_url'] = 'puja-sponsorship';
			}else if($page == 'service'){
				$data['session_data'] = 'service_cart';
				$data['redirect_url'] = 'services';
			}else if ($page == 'events'){
				$data['session_data'] = 'child_events';
			}

			$this->load->view('services/checkout',$data);


		}else{
			redirect(base_url());
		}
	}

	public function PayLaterCheckout(){
		$data['GeneralSettings'] = GeneralSettings();


		// print_r($data['GeneralSettings']); die();
		if (!empty($this->session->userdata('logged_in')) && $this->session->userdata('logged_in') == 1) {
			
			$data['page'] = 'Services';
			$data['title'] = 'Checkout';
			$data['userDetails'] =  getUserDetails()->data[0];
			$data['nakshtra_data'] = getNakshtra()['data'];
			$data['gotra_data'] = getGotra()['data'];
			// $preferredLanguage = getPreferredLanguage();
			
			// $data['preferredLanguage'] = $preferredLanguage->data;
			$data['PriestData'] = getPriest()->data;

			$data['session_data'] = 'paylater_service_cart';
			$data['redirect_url'] = 'services/payLater';
			

			$this->load->view('services/paylater-checkout',$data);


		}else{
			redirect(base_url());
		}
	}

}
