 <?php

	defined('BASEPATH') or exit('No Direct Script is Allowed');

class GenralController extends CI_Controller
	    {
		    function __construct(){
                parent::__construct();
                    if(!$this->session->id){
                    redirect(site_url('admin/login'));
                }
            }
            
            public function index(){
                $data['banners'] = $this->db->where('banner_status', '1')->order_by('banner_title', 'ASC')->get('tbl_banner')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/banner',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            public function add(){
                 @mkdir('./uploads/banner/');
				$config['upload_path'] = './uploads/banner/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['banner_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('banner_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'banner_title' => $this->input->post('banner_title'),
						'banner_subtitle' => $this->input->post('banner_subtitle'),
						'banner_description' => $this->input->post('banner_description'),
						'banner_image' => $mainimagefilename,
					);
				$this->db->insert('tbl_banner', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            public function edit(){
                $this->db->where('banner_id', $this->input->get('bid'));
				$data['bannerE'] = $this->db->get('tbl_banner')->row();
				$data['banners'] = $this->db->where('banner_status', '1')->order_by('banner_title', 'ASC')->get('tbl_banner')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/banner',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function update(){
                  if(!empty($_FILES['banner_image']['name'])){
            @mkdir('./uploads/banner/');
			    $config['upload_path'] = './uploads/banner/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['banner_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('banner_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'banner_title' => $this->input->post('banner_title'),
						'banner_subtitle' => $this->input->post('banner_subtitle'),
						'banner_description' => $this->input->post('banner_description'),
						'banner_image' => $mainimagefilename,
						'banner_status' => $this->input->post('banner_status'),
					);
						$this->db->where('banner_id', $this->input->post('banner_id'));
						$this->db->update('tbl_banner', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'banner_title' => strtoupper($this->input->post('banner_title')),
						'banner_subtitle' => strtoupper($this->input->post('banner_subtitle')),
						'banner_description' => strtoupper($this->input->post('banner_description')),
						'banner_status' => $this->input->post('banner_status'),
					);
						$this->db->where('banner_id', $this->input->post('banner_id'));
						$this->db->update('tbl_banner', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }}
           
            public function delete(){
                $this->db->where('banner_id', $this->input->get('bid'));
			    $this->db->delete('tbl_banner');
				redirect('admin/banner');
               
            }
            
            public function partners(){
                $data['partners'] = $this->db->where('partners_status', '1')->order_by('partners_title', 'ASC')->get('tbl_partners')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/partners',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            public function partners_add(){
                 @mkdir('./uploads/partner/');
				$config['upload_path'] = './uploads/partner/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['partners_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('partners_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'partners_title' => strtoupper($this->input->post('partners_title')),
						'partners_image' => $mainimagefilename,
					);
				$this->db->insert('tbl_partners', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            public function partners_edit(){
                $this->db->where('partners_id', $this->input->get('bid'));
				$data['partnerE'] = $this->db->get('tbl_partners')->row();
				$data['partners'] = $this->db->where('partners_status', '1')->order_by('partners_title', 'ASC')->get('tbl_partners')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/partners',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function partners_update(){
                  if(!empty($_FILES['partners_image']['name'])){
            @mkdir('./uploads/partner/');
			    $config['upload_path'] = './uploads/partner/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['partners_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('partners_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'partners_title' => strtoupper($this->input->post('partners_title')),
                        'partners_image' => $mainimagefilename,
						'partners_status' => $this->input->post('partners_status'),
					);
						$this->db->where('partners_id', $this->input->post('partners_id'));
						$this->db->update('tbl_partners', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'partners_title' => strtoupper($this->input->post('partners_title')),
						'partners_status' => $this->input->post('partners_status'),
					);
						$this->db->where('partners_id', $this->input->post('partners_id'));
						$this->db->update('tbl_partners', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }}
           
            public function partners_delete(){
                $this->db->where('partners_id', $this->input->get('bid'));
			    $this->db->delete('tbl_partners');
				redirect('admin/partners');
               
            }    
      
            public function about(){
                $this->db->where('about_id', 1);
				$data['aboutE'] = $this->db->get('tbl_aboutus')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/about',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function about_update()
                {
                    $about_id = $this->input->post('about_id');
                    $existing_image = $this->input->post('existing_image');
                    $existing_himage = $this->input->post('existing_himage');
                
                    $image_name = $existing_image;
                    $himage_name = $existing_himage;
                
                    // Upload about_image if provided
                    if (!empty($_FILES['about_image']['name'])) {
                        @mkdir('./uploads/about/', 0755, true);
                
                        $config['upload_path'] = './uploads/about/';
                        $config['allowed_types'] = 'gif|jpg|png|jpeg';
                        $config['file_name'] = strtolower($_FILES['about_image']['name']);
                
                        $this->load->library('upload', $config);
                        $this->upload->initialize($config);
                
                        if ($this->upload->do_upload('about_image')) {
                            $upload_data = $this->upload->data();
                            $image_name = $upload_data['file_name'];
                        }
                    }
                
                    // Upload about_himage if provided
                    if (!empty($_FILES['about_himage']['name'])) {
                        @mkdir('./uploads/about/', 0755, true);
                
                        $config['upload_path'] = './uploads/about/';
                        $config['allowed_types'] = 'gif|jpg|png|jpeg';
                        $config['file_name'] = strtolower($_FILES['about_himage']['name']);
                
                        $this->load->library('upload', $config);
                        $this->upload->initialize($config);
                
                        if ($this->upload->do_upload('about_himage')) {
                            $upload_data = $this->upload->data();
                            $himage_name = $upload_data['file_name'];
                        }
                    }
                
                    // Prepare update data
                    $data = array(
                        'about_title'       => strtoupper($this->input->post('about_title')),
                        'about_subtitle'    => $this->input->post('about_subtitle'),
                        'about_clients'     => $this->input->post('about_clients'),
                        'about_member'      => $this->input->post('about_member'),
                        'about_description' => $this->input->post('about_description'),
                        'about_hdescription'=> $this->input->post('about_hdescription'),
                        'about_image'       => $image_name,
                        'about_himage'      => $himage_name,
                    );
                
                    $this->db->where('about_id', $about_id);
                    $query = $this->db->update('tbl_aboutus', $data);
                
                    if ($query) {
                        $this->session->set_flashdata('success', 'Updated successfully.');
                    } else {
                        $this->session->set_flashdata('error', 'Error updating.');
                    }
                
                    redirect('admin/about-us');
                }

            public function testimonial(){
                $data['testimonials'] = $this->db->where('testimonial_status', '1')->get('tbl_testimonial')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/testimonial',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            public function testimonial_add(){
                 @mkdir('./uploads/testimonial/');
				$config['upload_path'] = './uploads/testimonial/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['testimonial_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('testimonial_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'testimonial_name' =>$this->input->post('testimonial_name'),
						'testimonial_position' => $this->input->post('testimonial_position'),
						'testimonial_description' => $this->input->post('testimonial_description'),
						'testimonial_image' => $mainimagefilename,
					);
				$this->db->insert('tbl_testimonial', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            public function testimonial_edit(){
                $this->db->where('testimonial_id', $this->input->get('bid'));
				$data['testimonialE'] = $this->db->get('tbl_testimonial')->row();
				$data['testimonials'] = $this->db->where('testimonial_status', '1')->get('tbl_testimonial')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/testimonial',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function testimonial_update(){
                  if(!empty($_FILES['testimonial_image']['name'])){
            @mkdir('./uploads/testimonial/');
			    $config['upload_path'] = './uploads/testimonial/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['testimonial_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('testimonial_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'testimonial_name' => $this->input->post('testimonial_name'),
						'testimonial_position' => $this->input->post('testimonial_position'),
						'testimonial_description' => $this->input->post('testimonial_description'),
						'testimonial_status' => $this->input->post('testimonial_status'),
						'testimonial_image' => $mainimagefilename,
						
					);
						$this->db->where('testimonial_id', $this->input->post('testimonial_id'));
						$this->db->update('tbl_testimonial', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'testimonial_name' => $this->input->post('testimonial_name'),
						'testimonial_position' => $this->input->post('testimonial_position'),
						'testimonial_description' => $this->input->post('testimonial_description'),
						'testimonial_status' => $this->input->post('testimonial_status'),
					);
						$this->db->where('testimonial_id', $this->input->post('testimonial_id'));
						$this->db->update('tbl_testimonial', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }}
           
            public function testimonial_delete(){
                $this->db->where('testimonial_id', $this->input->get('bid'));
			    $this->db->delete('tbl_testimonial');
				redirect('admin/testimonial');
               
            }  
            
            public function awards(){
                $data['awards'] = $this->db->where('awards_status', '1')->order_by('awards_title', 'ASC')->get('tbl_awards')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/awards',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            public function awards_add(){
                 @mkdir('./uploads/award/');
				$config['upload_path'] = './uploads/award/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['awards_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('awards_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'awards_title' => $this->input->post('awards_title'),
						'awards_image' => $mainimagefilename,
					);
				$this->db->insert('tbl_awards', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            public function awards_edit(){
                $this->db->where('awards_id', $this->input->get('bid'));
				$data['awardE'] = $this->db->get('tbl_awards')->row();
				$data['awards'] = $this->db->where('awards_status', '1')->order_by('awards_title', 'ASC')->get('tbl_awards')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/awards',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function awards_update(){
                  if(!empty($_FILES['awards_image']['name'])){
            @mkdir('./uploads/award/');
			    $config['upload_path'] = './uploads/award/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['awards_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('awards_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'awards_title' => $this->input->post('awards_title'),
                        'awards_image' => $mainimagefilename,
						'awards_status' => $this->input->post('awards_status'),
					);
						$this->db->where('awards_id', $this->input->post('awards_id'));
						$this->db->update('tbl_awards', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'awards_title' => $this->input->post('awards_title'),
						'awards_status' => $this->input->post('awards_status'),
					);
						$this->db->where('awards_id', $this->input->post('awards_id'));
						$this->db->update('tbl_awards', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
                    }
                
            }
           
            public function awards_delete(){
                $this->db->where('awards_id', $this->input->get('bid'));
			    $this->db->delete('tbl_awards');
				redirect('admin/awards');
               
            }      
            
            
            public function director(){
                $data['directors'] = $this->db->where('director_status', '1')->get('tbl_director')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/director-message',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            public function director_add(){
                 @mkdir('./uploads/director/');
				$config['upload_path'] = './uploads/director/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['director_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('director_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'director_name' => $this->input->post('director_name'),
						'director_position' => $this->input->post('director_position'),
						'director_description' => $this->input->post('director_description'),
						'director_image' => $mainimagefilename,
					);
				$this->db->insert('tbl_director', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            public function director_edit(){
                $this->db->where('director_id', $this->input->get('bid'));
				$data['directorE'] = $this->db->get('tbl_director')->row();
				$data['directors'] = $this->db->where('director_status', '1')->get('tbl_director')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/director-message',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function director_update(){
                  if(!empty($_FILES['director_image']['name'])){
            @mkdir('./uploads/director/');
			    $config['upload_path'] = './uploads/director/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['director_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('director_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'director_name' => $this->input->post('director_name'),
						'director_position' => $this->input->post('director_position'),
						'director_description' => $this->input->post('director_description'),
						'director_status' => $this->input->post('director_status'),
						'director_image' => $mainimagefilename,
						
					);
						$this->db->where('director_id', $this->input->post('director_id'));
						$this->db->update('tbl_director', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'director_name' => $this->input->post('director_name'),
						'director_position' => $this->input->post('director_position'),
						'director_description' => $this->input->post('director_description'),
						'director_status' => $this->input->post('director_status'),
					);
						$this->db->where('director_id', $this->input->post('director_id'));
						$this->db->update('tbl_director', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }
                
            }
           
            public function director_delete(){
                $this->db->where('director_id', $this->input->get('bid'));
			    $this->db->delete('tbl_director');
				redirect('admin/director');
               
            } 
            
            public function whychoose_edit(){
                $this->db->where('whychoose_id', 1);
				$data['whychooseE'] = $this->db->get('tbl_whychoose')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/whychoose',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function whychoose_update(){
                  if(!empty($_FILES['whychoose_image']['name'])){
            @mkdir('./uploads/whychoose/');
			    $config['upload_path'] = './uploads/whychoose/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['whychoose_image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('whychoose_image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'whychoose_title' => $this->input->post('whychoose_title'),
					
						'whychoose_description1' => $this->input->post('whychoose_description1'),
						'whychoose_description2' => $this->input->post('whychoose_description2'),
						'whychoose_description3' => $this->input->post('whychoose_description3'),
						'whychoose_description4' => $this->input->post('whychoose_description4'),
						'whychoose_point1' => $this->input->post('whychoose_point1'),
						'whychoose_point2' => $this->input->post('whychoose_point2'),
						'whychoose_point3' => $this->input->post('whychoose_point3'),
						'whychoose_point4' => $this->input->post('whychoose_point4'),
						'whychoose_image' => $mainimagefilename,
						
					);
						$this->db->where('whychoose_id', $this->input->post('whychoose_id'));
						$this->db->update('tbl_whychoose', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
					    'whychoose_title' => $this->input->post('whychoose_title'),
					
						'whychoose_description1' => $this->input->post('whychoose_description1'),
						'whychoose_description2' => $this->input->post('whychoose_description2'),
						'whychoose_description3' => $this->input->post('whychoose_description3'),
						'whychoose_description4' => $this->input->post('whychoose_description4'),
						'whychoose_point1' => $this->input->post('whychoose_point1'),
						'whychoose_point2' => $this->input->post('whychoose_point2'),
						'whychoose_point3' => $this->input->post('whychoose_point3'),
						'whychoose_point4' => $this->input->post('whychoose_point4'),
					);
						$this->db->where('whychoose_id', $this->input->post('whychoose_id'));
						$this->db->update('tbl_whychoose', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }}
           
             
            
            
        public function process(){
                $this->db->where('id', 1);
				$data['processE'] = $this->db->get('tbl_process')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/process',$data);
			        $this->load->view('backend/global/footer');
            } 
            
            public function process_update(){
                $abou_id = $this->input->post('id');
                $data = array(
						'title' => $this->input->post('title'),
						'title1' => $this->input->post('title1'),
						'desc1' => $this->input->post('desc1'),
						'title2' => $this->input->post('title2'),
						'desc2' => $this->input->post('desc2'),
						'title3' => $this->input->post('title3'),
						'desc3' => $this->input->post('desc3'),
						'title4' => $this->input->post('title4'),
						'desc4' => $this->input->post('desc4'),
						'project' => $this->input->post('project'),
						'caption' => $this->input->post('caption'),
						
					);
					    $this->db->where('id', $abou_id);
                        $query = $this->db->update('tbl_process', $data);
                    
                        if ($query) {
                            $this->session->set_flashdata('success', 'Updated successfully.');
                        } else {
                            $this->session->set_flashdata('error', 'Error updating.');
                        }
                        redirect('admin/process');
            }   
            
            
            
        public function faq(){
                $data['faqs'] = $this->db->where('faq_status', '1')->get('tbl_faq')->result();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/faq',$data);
                    $this->load->view('backend/global/footer');
            } 
            
            
        public function faq_add(){
                $data = array(
						'faq_question' => $this->input->post('faq_question'),
						'faq_answer' => $this->input->post('faq_answer'),
				    );
				$this->db->insert('tbl_faq', $data);
					if($data){
						echo json_encode(['msg' => 'Inserted']);
						exit;
					}else{
						echo json_encode(['msg' => 'error']);
						exit;
					}
                
            } 
            
            
        public function faq_edit(){
                $this->db->where('faq_id', $this->input->get('bid'));
				$data['faqE'] = $this->db->get('tbl_faq')->row();
				$data['faqs'] = $this->db->where('faq_status', '1')->get('tbl_faq')->result();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/faq',$data);
			        $this->load->view('backend/global/footer');
            }
            
            
        public function faq_update(){
                $data = array(
						'faq_question' => $this->input->post('faq_question'),
						'faq_answer' => $this->input->post('faq_answer'),
						'faq_status' => $this->input->post('faq_status'),
					);
						$this->db->where('faq_id', $this->input->post('faq_id'));
						$this->db->update('tbl_faq', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            
                
            } 
            
            
        public function faq_delete(){
                $this->db->where('faq_id', $this->input->get('bid'));
			    $this->db->delete('tbl_faq');
				redirect('admin/faq');
               
            } 
            
            
        public function home_whychoose(){
                $this->db->where('id', 1);
				$data['hwhychooseE'] = $this->db->get('tbl_hwhychoose')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/home_whychoose',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function home_whychoose_update(){
                  if(!empty($_FILES['image']['name'])){
            @mkdir('./uploads/whychoose/');
			    $config['upload_path'] = './uploads/whychoose/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'title' => $this->input->post('title'),
						'subtitle' => $this->input->post('subtitle'),
						'description' => $this->input->post('description'),
						'process1' => $this->input->post('process1'),
						'process2' => $this->input->post('process2'),
						'process3' => $this->input->post('process3'),
						'process4' => $this->input->post('process4'),
						'process5' => $this->input->post('process5'),
						'image' => $mainimagefilename,
						
					);
						$this->db->where('id', $this->input->post('id'));
						$this->db->update('tbl_hwhychoose', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
               
            }else{
                $data = array(
						'title' => $this->input->post('title'),
						'subtitle' => $this->input->post('subtitle'),
						'description' => $this->input->post('description'),
						'process1' => $this->input->post('process1'),
						'process2' => $this->input->post('process2'),
						'process3' => $this->input->post('process3'),
						'process4' => $this->input->post('process4'),
						'process5' => $this->input->post('process5'),
					);
						$this->db->where('id', $this->input->post('id'));
						$this->db->update('tbl_hwhychoose', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
            }
                
            }
            
            
        public function mission_edit(){
                $this->db->where('id', 1);
				$data['missionE'] = $this->db->get('tbl_mission')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/mission',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function mission_update(){
                $data = array(
						'mission_title' => $this->input->post('mission_title'),
						'mission_description' => $this->input->post('mission_description'),
						'vision_title' => $this->input->post('vision_title'),
						'vision_description' => $this->input->post('vision_description'),
						'value_title' => $this->input->post('value_title'),
						'value_description' => $this->input->post('value_description'),
						
					);
						$this->db->where('id', $this->input->post('id'));
						$this->db->update('tbl_mission', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
                
            }    
            
            
        public function home_process(){
                $this->db->where('hprocess_id', 1);
				$data['hprocessE'] = $this->db->get('tbl_homeprocess')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/home_process',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function home_process_update(){
                $data = array(
						'title1' => $this->input->post('title1'),
						'count1' => $this->input->post('count1'),
						'desc1' => $this->input->post('desc1'),
						'title2' => $this->input->post('title2'),
						'count2' => $this->input->post('count2'),
						'desc2' => $this->input->post('desc2'),
						'title3' => $this->input->post('title3'),
						'count3' => $this->input->post('count3'),
						'desc3' => $this->input->post('desc3'),
						'title4' => $this->input->post('title4'),
						'count4' => $this->input->post('count4'),
						'desc4' => $this->input->post('desc4'),
					
						
					);
						$this->db->where('hprocess_id', $this->input->post('hprocess_id'));
						$this->db->update('tbl_homeprocess', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
                
            } 
               
               
               
        public function benefits(){
                $this->db->where('id', 1);
				$data['hprocessE'] = $this->db->get('tbl_benefits')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/home_benefit',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function benefits_update(){
                $data = array(
                        'title' => $this->input->post('title'),
						'title1' => $this->input->post('title1'),
						'desc1' => $this->input->post('desc1'),
						'title2' => $this->input->post('title2'),
						'desc2' => $this->input->post('desc2'),
						'title3' => $this->input->post('title3'),
						'desc3' => $this->input->post('desc3'),
						'title4' => $this->input->post('title4'),
						'desc4' => $this->input->post('desc4'),
						'sub_title' => $this->input->post('sub_title'),
						'caption' => $this->input->post('caption'),
					
						
					);
						$this->db->where('id', $this->input->post('id'));
						$this->db->update('tbl_benefits', $data);
							if($data){
								echo json_encode(['msg' => 'updated']);
								exit;
							}else{
								echo json_encode(['msg' => 'error']);
								exit;
							}
                
            }   
            
        public function we_help(){
                $this->db->where('id', 1);
                $data['wehelpE'] = $this->db->get('tbl_we_help')->row();
                $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();	
                    $this->load->view('backend/global/header',$user);
                    $this->load->view('backend/global/menu');
                    $this->load->view('backend/genral/we_help',$data);
                    $this->load->view('backend/global/footer');
            } 
            
        public function we_help_update(){
                
                $abou_id = $this->input->post('id');
                 if(!empty($_FILES['image']['name'])){
            @mkdir('./uploads/whychoose/');
			    $config['upload_path'] = './uploads/whychoose/';
				$config['allowed_types'] = 'gif|jpg|png|jpeg';
				$this->load->library('upload', $config);
				$config['file_name'] = strtolower($_FILES['image']['name']);
				$this->upload->initialize($config);
				$this->upload->do_upload('image');
				$upload_data    = $this->upload->data();
				$mainimagefilename  = $upload_data['file_name'];
                $data = array(
						'title' => $this->input->post('title'),
						'description' => $this->input->post('description'),
						'image' => $mainimagefilename,
						
					);
						 $this->db->where('id', $abou_id);
                        $query = $this->db->update('tbl_we_help', $data);
                    
                        if ($query) {
                            $this->session->set_flashdata('success', 'Updated successfully.');
                        } else {
                            $this->session->set_flashdata('error', 'Error updating.');
                        }
                        redirect('admin/we-help');
               
            }else{
                $data = array(
					   'title' => $this->input->post('title'),
						'description' => $this->input->post('description'),
					);
						 $this->db->where('id', $abou_id);
                        $query = $this->db->update('tbl_we_help', $data);
                    
                        if ($query) {
                            $this->session->set_flashdata('success', 'Updated successfully.');
                        } else {
                            $this->session->set_flashdata('error', 'Error updating.');
                        }
                        redirect('admin/we-help');
            }
                
            }  
            
            
            
            
            
        public function terms_conditions(){
                $this->db->where('id', 1);
				$data['termsE'] = $this->db->get('tbl_termcondition')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/terms-conditions',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function terms_conditions_update(){
                $abou_id = $this->input->post('id');
                $data = array(
						'title' => $this->input->post('title'),
						'description' => $this->input->post('description'),
						
						
					);
					    $this->db->where('id', $abou_id);
                        $query = $this->db->update('tbl_termcondition', $data);
                    
                        if ($query) {
                            $this->session->set_flashdata('success', 'Updated successfully.');
                        } else {
                            $this->session->set_flashdata('error', 'Error updating.');
                        }
                        redirect('admin/terms-conditions');
            } 
            
            
             public function privacy_policy(){
                $this->db->where('id', 1);
				$data['privacyE'] = $this->db->get('tbl_privacy')->row();
		        $this->db->where('adm_id', $this->session->id);
			    $user['data'] = $this->db->get('tbl_admin')->row();		
                    $this->load->view('backend/global/header',$user);
		            $this->load->view('backend/global/menu');
		            $this->load->view('backend/genral/privacy-policy',$data);
			        $this->load->view('backend/global/footer');
            } 
            
        public function privacy_policy_update(){
                $abou_id = $this->input->post('id');
                $data = array(
						'title' => $this->input->post('title'),
						'description' => $this->input->post('description'),
						
						
					);
					    $this->db->where('id', $abou_id);
                        $query = $this->db->update('tbl_privacy', $data);
                    
                        if ($query) {
                            $this->session->set_flashdata('success', 'Updated successfully.');
                        } else {
                            $this->session->set_flashdata('error', 'Error updating.');
                        }
                        redirect('admin/privacy-policy');
            }  
            
            
            
            
	        
	    
	        
	        
	 }
	    