<?php
include("access.php");
include("include/admin.class.php");
include("include/conf.class.php");
$userinfo=$cartCore->get_user_info($CARTUSERNAME);
$cartAdminMain->check_grant($userinfo['USER_ID'],$page_name);
$cartCore->get_headder();
$cartCore->view_welcome($userinfo['USERNAME'],$userinfo['IMAGE']);
$cartCore->view_sidebar($userinfo['USER_ID'],$TOKEN_ID);
$cartCore->view_credit($COMPANY_ID,$bk);
if(isset($_POST['check_update'])){
	$cartAdminMain->add_edit_basic_config($userinfo['USERNAME'],$page_name,$_GET['token_id'],$_GET['menu_name']);	
	exit;
}
?>
        <!-- top navigation -->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">
                <a id="menu_toggle"><i class="fa fa-bars"></i></a>
              </div>

              <ul class="nav navbar-nav navbar-right">
              
              
              <?=$cartCore->view_userprofile($userinfo['USER_ID'],$userinfo['USERNAME'],$userinfo['IMAGE'],$TOKEN_ID,$COMPANY_ID,$bk)?>

                <li role="presentation" class="dropdown">
                  <a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="badge bg-green"><?=$cartAdminMain->getMessageCount($userinfo['USERNAME'])?></span>
                  </a>
                  <ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu">
                  <?=$cartAdminMain->getUserMessage($userinfo['USERNAME'])?>
                    <li>
                      <div class="text-center">
                        <a href="message.php?token_id=<?=$TOKEN_ID?>&pid=<?=$cartCore->md5_base64_encode($userinfo['USERNAME'])?>">
                          <strong>See All Alerts</strong>
                          <i class="fa fa-angle-right"></i>
                        </a>
                      </div>
                    </li>
                  </ul>
                </li>
              </ul>
            </nav>
          </div>
        </div>
        <!-- /top navigation -->

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3>
				<?php
                if(isset($_GET['menu_name']) && $_GET['menu_name'] != "")
				{
					echo $cartCore->md5_base64_decode($_GET['menu_name']);
				}
				else
				{
					echo $cartCore->getPageHeading($page_name);
				}
				?>
			</h3>
              </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2><?=$cartCore->getMainPageHeading($page_name)?> 
                    <small><?php
                if(isset($_GET['menu_name']) && $_GET['menu_name'] != "")
				{
					echo $cartCore->md5_base64_decode($_GET['menu_name']);
				}
				else
				{
					echo $cartCore->getPageHeading($page_name);
				}
				?></small></h2>
                
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li> 
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

<?php

	if(isset($_GET['passid']) && $_GET['passid'] != "")
		{		
				$config_id=$cartCore->ClearInput($cartCore->md5_base64_decode($_GET['passid']));
				$get_config_info=$cartAdminMain->get_global_config_for_add($config_id);
				$check_update=true;
				$PASSID=$_GET['passid'];		
		}
		else
		{		
				$get_config_info=$PASSID=NULL;
				$check_update=false;
		}


		if(isset($_GET['success_msg']) && $_GET['success_msg']!="")
		{	
			echo $cartCore->display_sucess_msg($cartCore->md5_base64_decode($_GET['success_msg']));		  
		}
		if(isset($_GET['warning_msg']) && $_GET['warning_msg']!="")
		{	
			echo $cartCore->display_warning_msg($cartCore->md5_base64_decode($_GET['warning_msg']));		  
		}
		
?>


                    <form class="form-horizontal form-label-left" novalidate action="<?=$page_name?>?token_id=<?=$TOKEN_ID?>&menu_name=<?=$_GET['menu_name']?>" method="post">
                     <input type="hidden" name="check_update" value="<?=$check_update?>" />
                     <input type="hidden" name="PASSID" value="<?=$PASSID?>" />
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Title Name <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="TITLE_NAME" required type="text" value="<?=$get_config_info['TITLE_NAME']?>">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company Name <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="COMPANY_NAME" required type="text" value="<?=$get_config_info['COMPANY_NAME']?>">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company Address 1<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="COMPANY_ADDRESS_01" required type="text" value="<?=$get_config_info['COMPANY_ADDRESS_01']?>">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company Address 2</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="COMPANY_ADDRESS_02" type="text" value="<?=$get_config_info['COMPANY_ADDRESS_02']?>">
                        </div>
                      </div>
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company City <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="COMPANY_CITY" required type="text" value="<?=$get_config_info['COMPANY_CITY']?>">
                        </div>
                      </div>
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company Country <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select class="form-control col-md-7 col-xs-12" name="COMPANY_COUNTRY">
                          <?=$cartAdminMain->get_country_by_selected_option($get_config_info['COMPANY_COUNTRY']);?>
                          </select>
                        </div>
                      </div>
   
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Post Code <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" name="COMPANY_POST_CODE" required type="text" value="<?=$get_config_info['COMPANY_POST_CODE']?>">
                        </div>
                      </div> 
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Telephone 01<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="telephone" name="COMPANY_TELEPHONE_01" required data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" value="<?=$get_config_info['COMPANY_TELEPHONE_01']?>">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Telephone 02</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="telephone" name="COMPANY_TELEPHONE_02" data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" value="<?=$get_config_info['COMPANY_TELEPHONE_02']?>">
                        </div>
                      </div>
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Fax</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="telephone" name="COMPANY_FAX" data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" value="<?=$get_config_info['COMPANY_FAX']?>">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Hot Line</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="telephone" name="COMPANY_MOBILE" data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" value="<?=$get_config_info['COMPANY_MOBILE']?>">
                        </div>
                      </div>
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Email 01 <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="email" id="email" name="COMPANY_EMAIL_01" value="<?=$get_config_info['COMPANY_EMAIL_01']?>" required class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Email 02 </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="email" id="email" name="COMPANY_EMAIL_02" value="<?=$get_config_info['COMPANY_EMAIL_02']?>" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="website">Website URL <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="url" id="website" name="COMPANY_WEB_URL" value="<?=$get_config_info['COMPANY_WEB_URL']?>" required placeholder="www.website.com" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Company Currency <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select class="form-control col-md-7 col-xs-12" name="COMPANY_CURRENCY_ID" required>
                          <?=$cartAdminMain->get_currency_by_selected_option($get_config_info['COMPANY_CURRENCY_ID']);?>
                          </select>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="website">Time Zone <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                        <?php if($check_update==true){ echo 'Last Selection: <font color="#990000">'.$get_config_info['COMPANY_TIME_ZONE'].'</font>';} ?>
                           <select class="form-control col-md-7 col-xs-12" name="COMPANY_TIME_ZONE" required>
    					<option value="">Please, select timezone</option>
    					<?php foreach($cartCore->tz_list() as $t) { ?>
      						<option value="<?php print $t['zone'] ?>">
        						<?php print $t['diff_from_GMT'] . ' - ' . $t['zone'] ?>
      							</option>
    						<?php } ?>
  						</select>
                        </div>
                      </div>
                    
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button id="send" type="submit" class="btn btn-success">Submit</button>
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
        <?=$cartCore->get_footer();?>
       
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="../vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="../vendors/nprogress/nprogress.js"></script>
    <!-- validator -->
    <script src="../vendors/validator/validator.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	
  </body>
</html>