<?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_make_product_details($userinfo['USERNAME'],$page_name,$_GET['token_id'],$_GET['menu_name'],$COMPANY_ID);	
	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']);
					$menu_name=$_GET['menu_name'];
				}
				else
				{
					echo $cartCore->getPageHeading($page_name);
					$menu_name=$cartCore->md5_base64_encode($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['item_id']) && $_GET['item_id'] != "")
		{		
				$product_id=$cartCore->ClearInput($cartCore->md5_base64_decode($_GET['item_id']));
				$fetch_product_detials=$cartCore->fetch_product_details_by_product_id($product_id);
				$check_update=true;		
		}
		else
		{		
				$fetch_product_detials=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=<?=$menu_name?>" method="post" name="myform" onSubmit="document.myform.descr.value = $('#editor-one').html()">
                     <input type="hidden" name="check_update" value="<?=$check_update?>" />
                     <?php if(isset($_GET['item_id'])){?><input type="hidden" name="PRODUCT_ID" value="<?=$_GET['item_id']?>" /><?php } ?>

                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Product 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="PRODUCT_NAME" required type="text" value="<?=$fetch_product_detials['PRODUCT_NAME']?>" required>
                        </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>
    <!-- bootstrap-progressbar -->
    <script src="../vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="../vendors/iCheck/icheck.min.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="../vendors/moment/min/moment.min.js"></script>
    <script src="../vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
    <!-- bootstrap-wysiwyg -->
    <script src="../vendors/bootstrap-wysiwyg/js/bootstrap-wysiwyg.min.js"></script>
    <script src="../vendors/jquery.hotkeys/jquery.hotkeys.js"></script>
    <script src="../vendors/google-code-prettify/src/prettify.js"></script>
    <!-- jQuery Tags Input -->
    <script src="../vendors/jquery.tagsinput/src/jquery.tagsinput.js"></script>
    <!-- Switchery -->
    <script src="../vendors/switchery/dist/switchery.min.js"></script>
    <!-- Select2 -->
    <script src="../vendors/select2/dist/js/select2.full.min.js"></script>
    <!-- Parsley -->
    <script src="../vendors/parsleyjs/dist/parsley.min.js"></script>
    <!-- Autosize -->
    <script src="../vendors/autosize/dist/autosize.min.js"></script>
    <!-- jQuery autocomplete -->
    <script src="../vendors/devbridge-autocomplete/dist/jquery.autocomplete.min.js"></script>
    <!-- starrr -->
    <script src="../vendors/starrr/dist/starrr.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	
  </body>
</html>