<?php  
$pageTitle = 'Settings';
$actUrl = 'admin/settings/site_settings';
$arrConfigs = $this->admin_model->getSiteConfigs(); 
if($arrConfigs) {
	foreach($arrConfigs as $rw) {
		$configRow[$rw['configName']] = $rw['configValue'];
	}
}

$errMsg = $this->session->flashdata('errMsg');
?>
<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  <meta name="description" content="">
  <meta name="author" content="">
  <title><?php echo $pageTitle;?> - ACP - <?php echo site_name() ; ?></title>
  
 <?php $this->load->view('admin/ap_top'); ?>
 
<script type="text/javascript">
    
    function  validateForm(){
        clrErr();
    	$errStaus = false;
       	if(validateFormFields('site_name','Please enter the Site name.',''))$errStaus=true;
    	if(validateFormFields('site_email','Please enter the Site Email.','validEmail'))$errStaus=true;
    	if(validateFormFields('site_from_email','Please enter the Site From Email.','validEmail'))$errStaus=true;
    	if(validateFormFields('site_support_email','Please enter the Site Support Email.','validEmail'))$errStaus=true;
    	
    	if($errStaus) {
    		return false;
    	} else {
    	return true;		
    	}
    }
</script>
 
  </head>
 

<body>
     
    <div class="wrapper" >
        <?php $this->load->view('admin/navbar'); ?>
            
		<div class="main-panel" style="background-color: #DEE2E6;height: auto;">
		    <div class="content">
				<div class="page-inner">
					<div class="page-header">
						<h4 class="page-title"><?php echo $pageTitle ; ?></h4>
						<ul class="breadcrumbs">
							<li class="nav-home">
								<a href="<?php echo base_url('admin/dashboard');?>">
									<i class="flaticon-home"></i>
								</a>
							</li>
							<li class="separator">
								<i class="flaticon-right-arrow"></i>
							</li>
							<li class="nav-item">
								<a href="#"><?php echo $pageTitle; ?></a>
							</li>
						</ul>
					</div>
                    
                    <div class="row">
						        <div class="col-md-12">
    							<div class="card">
    								<div class="card-header">
    									<h4 class="card-title">Common Settings</h4>
    								</div>
    								
    								<!--notifiactions-->
        							<div class="container" id="">
                                        <?php 
                                 		$errMsg = validation_errors('* ');
                                		if(empty($errMsg)){ $errMsg = $this->session->flashdata('errMsg');  }
                                		$warningMsg = $this->session->flashdata('warningMsg');
                                		$successMsg = $this->session->flashdata('successMsg');
                                		if(isset($errMsg) && !empty($errMsg)){ echo showMessage($errMsg,'error'); }  
                                		if(isset($warningMsg) && !empty($warningMsg)){ echo showMessage($warningMsg,'warning'); }
                                		if(isset($successMsg) && !empty($successMsg)){ echo showMessage($successMsg,'success'); }
                                	?>
                                    </div>
    								
    								<div class="card-body">
    								    
    							       <?php echo form_open_multipart( $actUrl,array('name' => 'accAgrmtFrm', 'id' => 'accAgrmtFrm', 'onSubmit' => 'return validateForm()') ) ; ?>
    										        
        										    <div class="form-group form-inline" id="div_site_name">
        												<label for="inlineinput" class="col-md-2 col-form-label"> Site name <span style="color:red;">&nbsp;*</span></label>
        												<div class="col-md-6 p-0" >
        												    <?php   
        												        $data = array( 'name' => 'site_name','value' => set_value('site_name',isset($configRow['site_name'])?$configRow['site_name']:''), 
        												        'id' => 'site_name',  'placeholder'   => 'Site Name', 'class' => 'form-control input-full required', );
                                     						    echo form_input($data);
                                        					?>
        													<small class="form-text text-muted text-danger err_msg" id="err_site_name"></small>
        												</div>
        											</div>
        											
        											<div class="form-group form-inline" id="div_site_email">
        												<label for="inlineinput" class="col-md-2 col-form-label"> Site Email <span style="color:red;">&nbsp;*</span></label>
        												<div class="col-md-6 p-0">
        												        <?php   
        												            $data = array( 'name' => 'site_email','value' => set_value('site_email',isset($configRow['site_email'])?$configRow['site_email']:''), 
        												            'id' => 'site_email',  'placeholder'   => 'name@email.com', 'class' => 'form-control input-full required', );
                                         						    echo form_input($data);
                                    					        ?>
    														<small class="form-text text-muted text-danger err_msg" id="err_site_email"></small>
        												</div>
        											</div>
        											
        											<div class="form-group form-inline" id="div_site_from_email">
        												<label for="inlineinput" class="col-md-2 col-form-label">Site From Email <span style="color:red;">&nbsp;*</span></label>
        												<div class="col-md-6 p-0">
        												        <?php   
        												            $data = array( 'name' => 'site_from_email','value' => set_value('site_from_email',isset($configRow['site_from_email'])?$configRow['site_from_email']:''), 
        												            'id' => 'site_from_email',  'placeholder'   => 'No-reply', 'class' => 'form-control input-full required', );
                                         						    echo form_input($data);
                                            					?>
        													<small class="form-text text-muted text-danger err_msg" id="err_site_from_email"></small>
        												</div>
        											</div>
        											
        											<div class="form-group form-inline" id="div_site_support_email">
        												<label for="inlineinput" class="col-md-2 col-form-label">Site Support Email <span style="color:red;">&nbsp;*</span></label>
        												<div class="col-md-6 p-0">
    												        	<?php   $data = array( 'name' => 'site_support_email','value' => set_value('site_support_email',isset($configRow['site_support_email'])?$configRow['site_support_email']:''), 
    												        	'id' => 'site_support_email',  'placeholder'   => 'Support Email', 'class' => 'form-control input-full required', );
 						                                            echo form_input($data);
 						                                        ?>
        													<small class="form-text text-muted text-danger err_msg" id="err_site_support_email"></small>
        												</div>
        											</div>
        											
        											<div class="form-group form-inline" id="div_site_phone">
        												<label for="inlineinput" class="col-md-2 col-form-label">Site Phone</label>
        												<div class="col-md-6 p-0">
												                <?php   
    												                $data = array( 'name' => 'site_phone','value' => set_value('site_phone',isset($configRow['site_phone'])?$configRow['site_phone']:''),  
    												                'id' => 'site_phone',  'placeholder'   => 'Phone', 'class' => 'form-control input-full ', );
                                         						    echo form_input($data);
                                					            ?>
        													<small class="form-text text-muted text-danger err_msg" id="err_site_phone"></small>
        												</div>
        											</div>
                                                    
                                                    <br>
        											<div class="form-group form-inline">
            												<label for="inlineinput" class="col-md-2 col-form-label "></label>
            												<div class="col-md-6 p-0">
            												    <?php
            												       $data = array( 'name' => 'settingBtn','value' => 'true', 'id' => 'settingBtn',  'type' => 'submit','content' => 'Submit', 'class' => 'btn btn-success',   );
                                                 				   echo form_button($data);
                                                     			?>
            												</div>
            										</div>
    								        <?php echo form_close(); ?>
    								</div>
    							</div>
    						</div>
					        </div>
                
				</div>
			</div>
		    <!--<footer class="footer">-->
			    <?php //footer();?>
			<!--</footer>-->
		</div>
	</div>
 
 </body>
</html>
