<?php
$page = 'Product';
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/plugins/morris.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/Backend/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="<?php echo base_url();?>assets/Backend/editor/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="<?php echo base_url();?>assets/Backend/editor/css/froala_editor.min.css" rel="stylesheet" type="text/css">
</head>

<body>

    <div id="wrapper" style="background-color:#222;">

        <!-- Navigation -->
        <?php
		include "include/header.php";
		?>

        <div id="page-wrapper" style="height:1900px;">

            <div class="container-fluid">
		
                <!-- Page Heading -->
               <?php 
			   foreach($sub_product as $sp_row);
			   ?>
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                        Edit Sub Product
                         <div style="float:right">
                            <a href="<?php echo base_url(); ?>app/sub_products/<?php echo $sp_row->p_id;?>" class="btn btn-primary">Back</a>
                           </div>
                        </h1>
                    </div>
                </div>
                
                <!-- /.row -->
                    <form role="form" action="<?php echo base_url(); ?>update/up_sub_product/<?php echo $sp_row->sp_id.'/'.$sp_row->p_id;?>" method="post" enctype="multipart/form-data">
                    
               <div class="row">
                           <div class="col-lg-6">
                            <div class="form-group">
                                <label>Product Type</label>
                                <?php foreach($products as $p_row):
								         if($p_row->p_id == $sp_row->p_id)
										 {
								?>
                                <input type="text" class="form-control" value="<?php echo $p_row->p_name;?>" required name="product_name" readonly>
                                <input type="hidden" value="<?php echo $p_row->p_id;?>" name="p_id"/>
                                <?php } endforeach;?>
                            </div>  
                           <div class="form-group"> 
                                <label>Product Name</label>
                                <input type="text" class="form-control" value="<?php echo $sp_row->sp_name;?>" name="sp_name"/>
                           </div>
                           <div class="form-group"> 
                                <label>Upload Images for Product</label>
                                <input type="file" class="form-control" value="" name="sp_image" id="sp_image" disabled/>
                           </div>
                            <script>
							function display()
							{
						      if ($('#check').is(':checked')) 
							  {
								document.getElementById("sp_image").removeAttribute('disabled');
								//$('#elementsToOperateOn :input').attr('disabled', true);
							  } 
							  else 
							  {
							    
								document.getElementById("sp_image").setAttribute('disabled',true);
								//$('#elementsToOperateOn :input').removeAttr('disabled');
							  }   
							}
							</script>
                           <div class="form-group"> 
                                <input type="checkbox" id="check" name="check" onClick="display();"> Change Profile Image
                           </div>
                           </div>
                           <div class="col-lg-6">
                           <div class="form-group"> 
                           <label>Product Image</label>
                           <img src="<?php echo base_url();?>assets/uploads/sub_products/<?php echo $sp_row->sp_id.'.jpg';?>" width="250px" height="200px" />
                            </div> 
                           </div>
               </div>   
              <div class="row">
                        <div class="col-lg-12">
                         <label>Product Information</label>
                         <textarea class="form-control" id="edit" name="sp_description" rows="25">
                         <?php echo $sp_row->sp_description;?>
                         </textarea>
                         </div>
 			  </div><br><br>				                    
                          <input type="submit" class="btn btn-primary" value="Save Information">
                         <input type="reset" class="btn btn-default">                    
                    </form>
                     </div>
                </div>
            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery Version 1.11.0 -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/jquery-1.11.0.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/addrow.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/bootstrap.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/raphael.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris-data.js"></script>
	<script src="<?php echo base_url(); ?>assets/Backend/editor/js/libs/jquery-1.11.1.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/froala_editor.min.js"></script>
  
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/tables.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/lists.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/colors.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/font_family.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/font_size.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/block_styles.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/media_manager.min.js"></script>
  <script src="<?php echo base_url(); ?>assets/Backend/editor/js/plugins/video.min.js"></script>

  <script>
      $(function(){
        $('#edit').editable({inlineMode: false})
      });
  </script>
</body>

</html>
