<?php include "common/user_log.php"; ?>

  <!DOCTYPE html>
  <html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sampathbay</title>
    <!-- Place favicon.ico in the root directory -->
   <link rel="shortcut icon" type="image/x-icon" href="../img/S_favicon.ico">   
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="dist/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="dist/css/ionicons.min.css">
    <!-- daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="plugins/iCheck/all.css">
    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
    <!-- Bootstrap time Picker -->
    <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="plugins/select2/select2.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
     folder instead of downloading all of them to reduce the load. -->
     <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
     <link rel="stylesheet" href="bootstrap-sweetalert/lib/sweet-alert.css" />
     <link href="assets/editor.css" type="text/css" rel="stylesheet"/>


     <!-- requird value -->
     <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
     <link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
     <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
     <script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>

     <!--  End requird value -->

   </head>
   <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <header class="main-header">
        <!-- Logo -->
        <a href="home.php" class="logo">
          <!-- mini logo for sidebar mini 50x50 pixels -->
          <span class="logo-mini"><img src="img/logo_mini.png" width="50"></span>
          <!-- logo for regular state and mobile devices -->
          <span class="logo-lg"><b><img src="img/logo.png" width="200"></b></span>
        </a>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
          <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="logo-lg">
             &nbsp;&nbsp;<font face="Lucida Sans Unicode, Lucida Grande, sans-serif">Sampathbay</font></span>
           </a>

           <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">

              <li class="dropdown user user-menu">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <img src="dist/img/user2-160x160.png" class="user-image" alt="User Image">
                  <span class="hidden-xs"><?php //echo $name; ?></span>
                </a>
                <ul class="dropdown-menu">
                  <li class="user-header">
                    <img src="dist/img/user2-160x160.png" class="img-circle" alt="User Image">
                    <p>
                      Sampathbay
                    </p>
                  </li>
                  <li class="user-footer">
                    <div class="pull-left">

                    </div>
                    <div class="pull-right">
                      <a href="distroy.php" class="btn btn-default btn-flat">Sign out</a>
                    </div>
                  </li>
                </ul>
              </li>
              <li>
                <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
              </li>
            </ul>
          </div>
        </nav>
      </header>
      <aside class="main-sidebar">
        <section class="sidebar">

          <?php include "common/sidebar.php"; ?> 

        </section>
      </aside>

      <div class="content-wrapper">
        <section class="content-header">
          <h1>
            Page Content Customize
          </h1>
          
          <ol class="breadcrumb">
            <li><a href="home.php"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="page_content_customize.php">Page Content Customize</a></li>
          </ol>
        </section>

        <section class="content">

          <div class="box box-info"> 
            <div class="box-header with-border"> 
              <h3 class="box-title">Todays Offer</h3>
            </div>

            <div class="box-body"> 

              <div class="form-group">
                <div class="form-group">
                  <textarea id="txt_today" ></textarea>

                  <textarea style="display: none;" id="txt_h_today" name="des"></textarea>
                </div>
              </div>

              <div class="box-footer">
                <button class="btn btn-primary" id="btn_sub_today">SUBMIT</button>
              </div>

            </div>
          </div>

        </section>


        <section class="content">

          <div class="box box-info"> 
            <div class="box-header with-border"> 
              <h3 class="box-title">Same Day Delivery</h3>
            </div>

            <div class="box-body"> 

              <div class="form-group">
                <div class="form-group">
                  <textarea id="txt_same" ></textarea>

                  <textarea style="display: none;" id="txt_h_same" name="des"></textarea>
                </div>
              </div>

              <div class="box-footer">
                <button class="btn btn-primary" id="btn_sub_same">SUBMIT</button>
              </div>

            </div>
          </div>

        </section>

        <section class="content">

          <div class="box box-info"> 
            <div class="box-header with-border"> 
              <h3 class="box-title">International Delivery</h3>
            </div>

            <div class="box-body"> 

              <div class="form-group">
                <div class="form-group">
                  <textarea id="txt_int" ></textarea>

                  <textarea style="display: none;" id="txt_h_int" name="des"></textarea>
                </div>
              </div>

              <div class="box-footer">
                <button class="btn btn-primary" id="btn_sub_int">SUBMIT</button>
              </div>

            </div>
          </div>

        </section>

      </div>
    </div>

    <footer class="main-footer"> 
      <div class="pull-right hidden-xs">

      </div> <strong>Copyright &copy; Sampathbay</strong> All rights reserved.
    </footer>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Create the tabs -->
      <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
        <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
        <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
      </ul>
      <!-- Tab panes -->
      <div class="tab-content">
        <!-- Home tab content -->
        <div class="tab-pane" id="control-sidebar-home-tab">





        </div><!-- /.tab-pane -->


      </div><!-- /.tab-pane -->
    </div>
  </aside><!-- /.control-sidebar -->
      <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
       <div class="control-sidebar-bg"></div>
     </div><!-- ./wrapper -->

     <!-- Modal -->
     <div class="modal fade" id="myModal" role="dialog">
      <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title" id="test_id">Edit Main Catagory</h4>
          </div>
          <div class="modal-body">

            <div class="form-group"> 
              <label>Select Category:<font color="#FF0000"><strong>*</strong></font></label>
              <!-- <select class="form-control select2" name="cat_id" id="main_cats" style="width: 100%;"><option>Test</option></select> -->
              <select class="form-control" id="cat_main_up"> <option>Select Main Catagory...</option> </select>
              <span id="up_cat_val_msg" style="color: red; display: none">*Select Main Category name</span>
            </div>

            <div class="form-group">
              <button style="display: none" id="id_holder"></button>
              <label>Category:<font color="#FF0000"><strong>*</strong></font></label>
              <input type="text" class="form-control" id="txt_up_sub_cat" placeholder="Enter Category Name...">
              <span id="up_subcat_val_msg" style="color: red; display: none">*Enter Sub Category name</span>
            </div>

          <!-- <div class="form-group">
            <label>Description:</label>
            <textarea style="width: 100%; height: 100px;" id="up_sub_descrip" name="up_sub_descrip"></textarea>
          </div> -->

          <div class="form-group">
           <div class="form-group">
             <label>Description</label>
             <textarea class="form-control" id="up_sub_descrip"></textarea>
             <textarea style="display: none;" id="txt_itm_up" name="des2"></textarea>
           </div>
         </div>

         <div class="form-group">
          <button type="button" class="btn btn-primary" id="update_cat">Update</button>
        </div>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- Select2 -->
<script src="plugins/select2/select2.full.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- InputMask -->
<script src="plugins/input-mask/jquery.inputmask.js"></script>
<script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!-- date-range-picker -->
<script src="plugins/daterangepicker/moment.min.js"></script>
<script src="plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>
<!-- SlimScroll 1.3.0 -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- iCheck 1.0.1 -->
<script src="plugins/iCheck/icheck.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<script src="bootstrap-sweetalert/lib/sweet-alert.min.js"></script>
<!-- Page script -->
<script src="assets/editor.js"></script>

<script>
  $(document).ready(function() {
    $("#txt_today").Editor();
    $("#txt_same").Editor();
    $("#txt_int").Editor();

    <?php

    $txt_today_file = 'upload/page_content/txt_today.txt';
    $txt_today = '';
    
    if (file_exists($txt_today_file)) {
      $myfile = fopen($txt_today_file, "r");

      $itm_dis = fgets($myfile);

      $txt_today = $itm_dis;
    }

    $txt_same_file = 'upload/page_content/txt_same.txt';
    $txt_same = '';
    
    if (file_exists($txt_same_file)) {
      $myfile = fopen($txt_same_file, "r");

      $itm_dis = fgets($myfile);

      $txt_same = $itm_dis;
    }

    $txt_int_file = 'upload/page_content/txt_int.txt';
    $txt_int = '';
    
    if (file_exists($txt_int_file)) {
      $myfile = fopen($txt_int_file, "r");

      $itm_dis = fgets($myfile);

      $txt_int = $itm_dis;
    }

    ?>

    $('#txt_today').Editor("setText", '<?php echo $txt_today; ?>');
    $('#txt_same').Editor("setText", '<?php echo $txt_same; ?>');
    $('#txt_int').Editor("setText", '<?php echo $txt_int; ?>');
  });
</script>


<script>

  $("#btn_sub_today").click(function(){
    add_txt_today();
  });

  function add_txt_today(){
    var txt_today = $('#txt_today').Editor("getText");

    $.post('function/page_content_customize_fun.php', {'txt_today': 'data' ,txt_today : txt_today}, function (data) {
      if (data.status="ok") {
        swal({
          title: "Added!",
          text: "Successfully Updated!",
          type: "success",
          confirmButtonText: "OK"
        },
        function (isConfirm) {
          if (isConfirm) {
            window.location.href = "page_content_customize.php";
          }
        });
      }else{
        swal("Oops...", "Something went wrong!", "warning");
      }
    }, "json");
  }

  $("#btn_sub_same").click(function(){
    add_txt_same();
  });

  function add_txt_same(){
    var txt_same = $('#txt_same').Editor("getText");

    $.post('function/page_content_customize_fun.php', {'txt_same': 'data' ,txt_same : txt_same}, function (data) {
      if (data.status="ok") {
        swal({
          title: "Added!",
          text: "Successfully Updated!",
          type: "success",
          confirmButtonText: "OK"
        },
        function (isConfirm) {
          if (isConfirm) {
            window.location.href = "page_content_customize.php";
          }
        });
      }else{
        swal("Oops...", "Something went wrong!", "warning");
      }
    }, "json");
  }

  $("#btn_sub_int").click(function(){
    add_txt_int();
  });

  function add_txt_int(){
    var txt_int = $('#txt_int').Editor("getText");

    $.post('function/page_content_customize_fun.php', {'txt_int': 'data' ,txt_int : txt_int}, function (data) {
      if (data.status="ok") {
        swal({
          title: "Added!",
          text: "Successfully Updated!",
          type: "success",
          confirmButtonText: "OK"
        },
        function (isConfirm) {
          if (isConfirm) {
            window.location.href = "page_content_customize.php";
          }
        });
      }else{
        swal("Oops...", "Something went wrong!", "warning");
      }
    }, "json");
  }

</script>

<script>
  $(function () {
    $("#example1").DataTable();
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false
    });
  });
</script>
</body>
</html>
