<section role="main" class="content-body">
					<header class="page-header">
						<h2>Add To Store</h2>
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="<?php echo base_url();?>admin">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Add Product to Store</span></li>
							</ol>
						</div>
					</header>
                    	<div class="row">
                            <div class="col-md-12">
                            <section class="panel">
                                <header class="panel-heading">
                                    <h2 class="panel-title">Add <b><?php echo $prod->title;?></b> to Your Stores</h2>
                                </header>
                                <div class="panel-body">
                                    <form action="<?php echo base_url();?>admin/add_to_store_submit" method="post">
                                    <input type="hidden" name="pid" value="<?php echo $this->uri->segment(3);?>" />
                                    <div class="row">
                                    <div class="col-md-7">
                                    <img style="width:100px;" class="img img-responsive pull-left" src="<?php echo base_url();?>assets/images/products/<?php echo $prod->img;?>" alt="">
                                    <h3><?php echo $prod->title;?></h3><hr/>
                                    <div class="form-group">
                                        <h5 class="text-success"><b>Add Your Own Short Title/Description</b></h5>
                                        <input type="text" name="title" class="form-control">
                                    </div>
                                    <div class="form-group" style="width:40%;">
                                        <label>Pack/Price Type</label>
                                        <select class="form-control" required name="ptype" id="ptype">
                                            <option value="">Pack/Price Type</option>
                                            <option value="Normal" selected>Normal</option>
                                            <option value="Variant">Variant</option>
                                        </select>
                                    </div>
                                    <div class="row" id="Normal">
                                        <div class="col-md-3">
                                            <label for="price">PurchasePrice</label>
                                            <input type="text" class="form-control" name="pur_price"  />
                                        </div>
                                        <div class="col-md-3">
                                            <label for="price">Price</label>
                                            <input type="text" class="form-control" name="nprice"  />
                                        </div>
                                        <div class="col-md-3">
                                            <label for="price">Offer Price</label>
                                            <input type="text" class="form-control" name="noprice" />
                                        </div>
                                        <div class="col-md-3">
                                            <label for="price">Qty</label>
                                            <input type="number" class="form-control" name="nqty" />
                                        </div>
                                    </div>
                                    <div id="Variant" style="display:none;">
                                    <br/>
                                    <table class="table table-bordered table-hover" id="tab_logic">
                                                <thead><tr><th>#</th><th>Pack</th><th>Price</th><th>OfferPrice</th><th>Qty</th></tr></thead>
                                                <tbody>
                                                    <tr id='addr0'>
                                                        <td>1</td>
                                                        <td><input type="text" name='pack[]'  placeholder='1 kg' class="form-control"/></td>
                                                        <td><input type="text" name='price[]' placeholder='100' class="form-control"/></td>
                                                        <td><input type="text" name='oprice[]' placeholder='80' class="form-control"/></td>
                                                        <td><input type="text" name='qty[]' placeholder='10' class="form-control"/></td>
                                                    </tr>
                                                    <tr id='addr1'></tr>
                                                </tbody>
                                            </table>  
    <a id="add_row" class="btn btn-success btn-xs pull-left">Add Row</a><a id='delete_row' class="pull-right btn-xs btn btn-danger">Delete Row</a><hr/>
    </div><br/>
    <button type="submit" class="btn btn-primary">Add</button>
                                    </div>
                                    <div class="col-md-5">
                                    	<h5 class="text-success">Store Availability</h5>
                                    	<table class="table table-bordered table-condensed">
                                        	<tr><th>S.No.</th><th>Store</th><th>Available</th></tr>
                                            <?php $i=1;foreach($stores as $s){?>
                                            <tr><td><?php echo $i;?></td>
                                            	<td><b><?php echo $s->store_name;?></b><br/><?php echo $s->st_address.' '.$s->city_name.' '.$s->state_name.' '.$s->st_pincode;?></td>
                                                <td><input type="checkbox" name="stores[]" value="<?php echo $s->store_id.'-'.$s->city_id;?>" />
                                            <?php $i++;}?>
                                        </table>	
                                    </div>
                                    </div>
                                    </form>
                                </div>
                            </section>
                            </div>
                        </div>
				</section>
			</div>
		</section>
         <script>
					$(document).ready(function(){
							var i=1;
     $("#add_row").click(function(){
      $('#addr'+i).html("<td>"+ (i+1) +"</td><td><input name='pack[]' type='text' placeholder='1 kg' class='form-control input-md'  /> </td><td><input  name='price[]' type='text' placeholder='100'  class='form-control input-md'></td><td><input  name='oprice[]' type='text' placeholder='80'  class='form-control input-md'></td><td><input  name='qty[]' type='text' placeholder='10'  class='form-control input-md'></td>");

      $('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
      i++; 
  });
     $("#delete_row").click(function(){
    	 if(i>1){
		 $("#addr"+(i-1)).html('');
		 i--;
		 }
	 });
					});
					</script>
		<!-- Vendor -->
        <script>
	$(document).ready(function(){
		$("#ptype").change(function(){//alert("asdf");
			var ptype=$(this).val();
			if(ptype=="Normal"){
				$("#Normal").show();
				$("#Variant").hide();	
			}
			if(ptype=="Variant"){
				$("#Normal").hide();
				$("#Variant").show();	
			}
		});
	});
</script>
	<script src="<?php echo base_url();?>admin_assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/magnific-popup/magnific-popup.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Specific Page Vendor -->
		<script src="<?php echo base_url();?>admin_assets/vendor/select2/select2.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.init.js"></script>


		<!-- Examples -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.default.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.row.with.details.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.tabletools.js"></script>
</body>
</html>