<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	$sidenav_file=APPPATH.'views/include/sidenav.php';
	require($sidenav_file);	?>
   
    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Product </h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Product</a>
                  </li>
                  <li class="breadcrumb-item active">Product Updation
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Basic form layout section start -->
<section id="basic-form-layouts">
	



	<div class="row justify-content-md-center">
		<div class="col-md-12">
			<div class="card">
				<div class="card-header">
					<h4 class="card-title" id="basic-layout-form-center">Product Updation</h4>
					<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
					<div class="heading-elements">
						<ul class="list-inline mb-0">
							<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
							<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
							<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
							<li><a data-action="close"><i class="ft-x"></i></a></li>
						</ul>
					</div>
				</div>
				<div class="card-content collapse show">
					<div class="card-body">
						<form class="form" enctype="multipart/form-data" autocomplete="off" action="<?php echo site_url('Master/approveProduct'); ?>" method="post">
						<?php foreach($product as $prd) ?>
							<div class="row justify-content-md-center">
								<div class="col-md-4">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Product Name</label>
											<input type="text" class="form-control" id="product_name" name="product_name" value="<?php echo $prd->rname ?>" required placeholder="Product Name">
											<input type="hidden" class="form-control" id="recipe_no" name="recipe_no" value="<?php echo $prd->recipe_no ?>" >
											<input type="hidden" class="form-control" id="branch_name" name="branch_name" value="<?php echo $_SESSION['branch_name']; ?>" >
											<input type="hidden" class="form-control" id="branch_id" name="branch_id" value="<?php echo $_SESSION['branch_id']; ?>" >
											<input type="hidden" class="form-control" id="raised_date" name="raised_date" value="<?php echo $prd->raised_date ?>" >
											<input type="hidden" class="form-control" id="recipe_id" name="recipe_id" value="<?php echo $prd->recipe_id ?>" >
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Yield</label>
											<input type="text" class="form-control" id="yield" name="yield" value="<?php echo $prd->yeild ?>" required placeholder="Yield">
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">UOM</label>
											<input type="text" class="form-control" id="uom" name="uom" value="<?php echo $prd->uom ?>" required placeholder="UOM">
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">SqCode</label>
											<input type="text" class="form-control" id="sqcode" name="sqcode" value="<?php echo $prd->sqcode ?>" placeholder="SqCode">
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">HSN Code</label>
											<input type="text" class="form-control" id="hsn_code" name="hsn_code" value="<?php echo $prd->hsn_code ?>" placeholder="HSN Code">
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Category</label>
											<select name="category" id="category" class="form-control" required>
												<option value="">Select Category</option>
												<?php  foreach($category as $row)
													{
												?>	
														<option <?php if($row->pr_cat_id == $prd->pr_cat_id) echo 'selected="selected"'; ?> value="<?php echo $row->pr_cat_id; ?>"><?php echo $row->pr_cat_name; ?></option>
												<?php
													} 
												?>
											</select>
											<input type="hidden" name="cat_name" id="cat_name" value="<?php echo $row->pr_cat_name; ?>" >
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Recipe Category</label>
											<select name="recipe_cat" id="recipe_cat" class="form-control" required>
												<option value="">Select Category</option>
												<option <?php if($prd->recipe_cat == 'Finished') echo 'selected="selected"'; ?> value="Finished">Finished</option>
												<option <?php if($prd->recipe_cat == 'Semi-Finished') echo 'selected="selected"'; ?> value="Semi-Finished">Semi-Finished</option>
												<option <?php if($prd->recipe_cat == 'Raw-Material') echo 'selected="selected"'; ?> value="Raw-Material">Raw-Material</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Indent to be Raised On</label>
											<select name="raised_on" id="raised_on" class="form-control" >
												<option value="">Select</option>
												<?php  foreach($kitchen as $row)
													{
												?>
													<option <?php if($row->username == $prd->raised_on) echo 'selected="selected"'; ?> value="<?php echo $row->username; ?>"><?php echo $row->username; ?></option>
												<?php
													} 
												?>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Order to Delivery time</label>
											<select id="od_time" name="od_time" class="select2" >
												<option value="">Select</option>
												<?php 
													for($i=2;$i<=24;$i++)
													{
														if(($i%2) == 0)
														{
														?>
															<option <?php if($i == $prd->od_time) echo 'selected="selected"'; ?> value="<?php echo $i; ?> Hours"><?php echo $i; ?> Hours</option>
														<?php
														}
													}
												?>
											</select>
										</div>
									</div>
								</div>
							</div>

							<div class="row justify-content-md-center">
							    <div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Price</label>
											<input type="text" class="form-control" id="tprice" name="tprice" value="<?php echo $prd->total_price ?>" placeholder="Price">
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">GST Rate(%)</label>
											<select name="gst_rate" id="gst_rate" class="form-control select2">
												<option value="">Select Tax</option>
												<?php  foreach($tax as $row)
													{
												?>
													<option <?php if($row->tax_percentage == $prd->tax) echo 'selected="selected"'; ?> value="<?php echo $row->tax_percentage; ?>"><?php echo $row->tax_percentage; ?></option>
												<?php
													} 
												?>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Base Price</label>
											<input type="text" class="form-control" id="base_price" name="base_price" value="<?php echo $prd->price ?>" placeholder="Base Price" readonly >
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Tax Amt</label>
											<input type="text" class="form-control" id="gst" name="gst" value="<?php echo $prd->tax_amount ?>" placeholder="GST" readonly >
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Discount</label>
											<input type="text" class="form-control" id="discount" name="discount" value="<?php echo $prd->discount ?>" placeholder="Discount">
										</div>
									</div>
								</div>
								
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Flavour code</label>
											<input type="text" class="form-control" id="fcode" name="fcode" value="<?php echo $prd->f_code ?>" placeholder="Flavour code">
										</div>
									</div>
								</div>
							</div>
							</br>
							<?php 
							$i = 1;
							$bi = 0;
							foreach($sales_price as $ctr) { ?>
							<div class="row">
								<div class="col-md-1">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1"><?php echo $ctr->branch_code; ?></label>
										</div>
									</div>
								</div>
								<div class="col-md-11">
									<div class="row">
									    <input type="text" class="form-control ctprice col-md-2 comm" id="ctprice" name="ctprice[]" value="<?php echo $ctr->total_price; ?>" placeholder="Total Price">
									    <select name="cgst_rate[]" id="cgst_rate" class="form-control cgst_rate col-md-2">
												<option value="">Select Tax</option>
												<?php  foreach($tax as $cgrow)
													{
												?>
													<option <?php if($cgrow->tax_percentage == $ctr->tax) echo 'selected="selected"'; ?> value="<?php echo $cgrow->tax_percentage; ?>"><?php echo $cgrow->tax_percentage; ?></option>
												<?php
													} 
												?>
										</select>
										<input type="text" class="form-control cbase_price col-md-2 comm" id="cbase_price" name="cbase_price[]" value="<?php echo $ctr->price; ?>" placeholder="Base Price" readonly >
										<input type="text" class="form-control cgst col-md-2 comm" id="cgst" name="cgst[]" value="<?php echo $ctr->tax_amount; ?>" placeholder="GST" readonly >
									<!--	<input type="text" class="form-control cgst_rate col-md-2 comm" id="cgst_rate" name="cgst_rate[]" value="<?php //echo $ctr->tax; ?>" placeholder="GST Rate(%)">-->
										
										<input type="checkbox" class="form-control col-md-2" id="brchk" name="brchk[]" value="<?php echo $bi; ?>" >
										<input type="hidden" class="form-control col-md-2" id="brchk1" name="brchk1[]" value="<?php echo $bi; ?>" >
										<input type="hidden" class="form-control cbranch" id="cbranch" name="cbranch[]" value="<?php echo $ctr->branchname; ?>" placeholder="Branch Name">
										<input type="hidden" class="form-control cbranch_id" id="cbranch_id" name="cbranch_id[]" value="<?php echo $ctr->branch_id; ?>" placeholder="Branch Id">
										<input type="hidden" class="form-control cbranch_code" id="cbranch_code" name="cbranch_code[]" value="<?php echo $ctr->branch_code; ?>" >
										<input type="hidden" class="form-control cbranch_code" id="icbranch_code" name="icbranch_code[]" value="<?php echo $ctr->ibranch_code; ?>" >
										<input type="hidden" class="form-control" id="recipe_price_id" name="recipe_price_id[]" value="<?php echo $ctr->recipe_price_id; ?>" placeholder="Price">
									</div>
								</div>
							</div>
								
							<?php 
							$i++;
							$bi++;
							} ?>
							</br>
							<div class="row">
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Shelf Life</label>
											<select id="s_life" name="s_life" class="select2" >
												<option value="">Select</option>
												<option <?php if($prd->shelf_life == "< 1 Day") echo 'selected="selected"'; ?> value="< 1 Day">< 1 Day</option>
												<option <?php if($prd->shelf_life == "1 Day") echo 'selected="selected"'; ?> value="1 Day">1 Day</option>
												<?php 
													for($i=2;$i<=7;$i++)
													{
													?>
														<option <?php if($i == $prd->shelf_life) echo 'selected="selected"'; ?> value="<?php echo $i; ?> Days"><?php echo $i; ?> Days</option>
													<?php
													}
												?>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Prepared BY</label>
											<select name="prepared" id='prepared' class='select2' >
												<option value="">Select</option>
												<?php  foreach($chef as $row)
													{
												?>
													<option <?php if($row->chef_name == $prd->prepared_by) echo 'selected="selected"'; ?> value="<?php echo $row->chef_name; ?>"><?php echo $row->chef_name; ?></option>
												<?php
													} 
												?>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Effective From</label>
											<input type="text" class="form-control pickadate datepicker" id="effective" name="effective" value="<?php echo $prd->effective_from ?>" required placeholder="Effective From">
										</div>
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Product Image</label>
											<input type="hidden" name="pd_upload1" id="pd_upload1" class="form-control image_file" value="<?php echo $prd->product_image ?>" />
											<input type="file" name="pd_upload" id="pd_upload" accept="image/*" class="form-control image_file" onchange="showMyImage(this)" />
											<input type="hidden" name="fpath" value="<?php echo "https://gsrgroup.biz/inventory_management/" ?>" id="fpath" class="form-control" />
											<?php if($prd->product_image != '') { ?>
											<img id="thumbnil" style="margin-top:14px;height:125px;" src="<?php echo base_url().''.$prd->product_image; ?>"/>
											<?php } else { ?>
											<img id="thumbnil" style="margin-top:14px;height:125px;" src=""/>
											<?php } ?>
										</div>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Combination</label>
											<select name="combination[]" id="combination" class="form-control select2" multiple="multiple" >
												<?php
												$comb_name = array();
												$comb_id = array();
												foreach($combination as $cmb)
												{
													$comb_name[] = $cmb->combination;
													$comb_id[] = $cmb->comb_id;
												}
												$cm = $prd->combination;
												$cmb = explode(",", $cm);
												$cb_count = count($cmb);
												for($j=0;$j<count($comb_name);$j++)
												{
													if(in_array($comb_id[$j],$cmb))
													{
														?>
														<option value="<?php echo $comb_id[$j]?>" selected="selected" ><?php echo $comb_name[$j]?></option>
														<?php
													}
													else
													{
												?>
														<option value="<?php echo $comb_id[$j]?>"><?php echo $comb_name[$j]?></option>
												<?php
													}
												}
											?>
											</select>
										</div>
									</div>
								</div>
							<!--	<div class="col-md-2">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Updated in</label>
											<select id="updated_in" name="updated_in[]" class="select2" multiple="multiple" >
											<?php
											/*	$updated_in = array();
												foreach($counter as $ctr)
												{
													$updated_in[] = $ctr->branch_name;
												}
												//$updated_in = array('CW1','CW2','CW3','CW4');
												$up = $prd->updated_in;
												$upt = explode(",", $up);
												$up_count = count($upt);
												for($j=0;$j<count($updated_in);$j++)
												{
													if(in_array($updated_in[$j],$upt))
													{
														?>
														<option value="<?php echo $updated_in[$j]?>" selected="selected" ><?php echo $updated_in[$j]?></option>
														<?php
													}
													else
													{
												?>
														<option value="<?php echo $updated_in[$j]?>"><?php echo $updated_in[$j]?></option>
												<?php
													}
												} */
											?>
											</select>
										</div>
									</div>
								</div>-->
							</div>
							
							<table style="background-color: #ffffff; filter: alpha(opacity=40); opacity: 0.95;border:1px black solid;">
						        <tr>
						            <th style="padding-top: 22px;">
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Allowed for Santhe</label></br>
            											<input type="radio" <?php if($prd->santhe_sales == 'Yes') echo 'checked="checked"'; ?> name="santhe" id="syes" value="Yes"/>Yes &nbsp;&nbsp;&nbsp;
            											<input type="radio" <?php if($prd->santhe_sales == 'No') echo 'checked="checked"'; ?> name="santhe" id="sno" value="No"/>No
            										</div>
            									</div>
            								</div>
						                </div>
						            </th>
						            <th style="padding-top: 22px;">
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Product Type</label></br>
            											<input type="radio" name="prtype" id="veg" value="1" <?php if($prd->product_type == '1') echo 'checked="checked"'; ?> required />Veg &nbsp;&nbsp;&nbsp;
            											<input type="radio" name="prtype" id="nveg" value="2" <?php if($prd->product_type == '2') echo 'checked="checked"'; ?> />Non-Veg &nbsp;&nbsp;&nbsp;
            											<input type="radio" name="prtype" id="eggtn" value="3" <?php if($prd->product_type == '3') echo 'checked="checked"'; ?> />Eggetarian
            										</div>
            									</div>
            								</div>
						                </div>
						            </th>
						            <th style="padding-top: 22px;">
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Carnival Sale</label></br>
            											<input type="radio" name="carnival" id="cyes" value="1" <?php if($prd->carnival_sale == '1') echo 'checked="checked"'; ?> required />Yes &nbsp;&nbsp;&nbsp;
            											<input type="radio" name="carnival" id="cno" value="0" <?php if($prd->carnival_sale == '0') echo 'checked="checked"'; ?> />No
            										</div>
            									</div>
            								</div>
						                </div>
						            </th>
						        </tr>
						        <tr>
						            <th>
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group" style="margin-top:35px;">
            											<label for="eventInput1">Applicable to Institution Sales</label></br>
            											<input type="radio" <?php if($prd->institution_sales == 'Yes') echo 'checked="checked"'; ?> name="inst_sales" id="iyes" value="Yes"/>Yes &nbsp;&nbsp;&nbsp;
            											<input type="radio" <?php if($prd->institution_sales == 'No') echo 'checked="checked"'; ?> name="inst_sales" id="ino" value="No" />No
            										</div>
            									</div>
            								</div>
						                </div>
						            </th>
						            <th>
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group" style="margin-top:35px;">
            											<label for="eventInput1">Allowed for Special Order</label></br>
            											<input type="radio" <?php if($prd->spl_ord == 'Yes') echo 'checked="checked"'; ?> name="spl_ord" id="yes" value="Yes"/>Yes &nbsp;&nbsp;&nbsp;
            											<input type="radio" <?php if($prd->spl_ord == 'No') echo 'checked="checked"'; ?> name="spl_ord" id="no" value="No"/>No
            										</div>
            									</div>
            								</div>
						                </div>
						            </th>
						            <td></td>
						        </tr>
						        <tr>
						            <td colspan="3" style="padding-top: 30px; font-weight: bold;">
						                <div class="row">
						                    <div class="col-md-4">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Allowed for food delivery platform</label>
            											<br/>
            											<input type="radio" <?php if($prd->food_delivery == 'Yes') echo 'checked="checked"'; ?> name="food_delivery" id="tyes" value="Yes"/>Yes &nbsp;&nbsp;&nbsp;
            											<input type="radio" <?php if($prd->food_delivery == 'No') echo 'checked="checked"'; ?> name="food_delivery" id="tno" value="No"/>No
            										</div>
            									</div>
            								</div>
            								<div class="col-md-2 t_prod_price" style="display:none;">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Price</label>
            											<input class="form-control" type="text" name="ttprice"  id="ttprice" placeholder="Price" value="<?php echo $prd->ttotal_price ?>" >
            										</div>
            									</div>
            								</div>
            								<div class="col-md-2 t_prod_price" style="display:none;">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">GST Rate</label>
            											<select name="tgst_rate" id="tgst_rate" class="form-control select2">
            												<option value="0">Select Tax</option>
            												<?php  foreach($tax as $row)
            													{
            												?>
            													<option <?php if($row->tax_percentage == $prd->ttax) echo 'selected="selected"'; ?> value="<?php echo $row->tax_percentage; ?>"><?php echo $row->tax_percentage; ?></option>
            												<?php
            													} 
            												?>
            											</select>
            										</div>
            									</div>
            								</div>
            								<div class="col-md-2 t_prod_price" style="display:none;">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Base Price</label>
            											<input type="text" name="tbase_price" id="tbase_price" class="form-control" value="<?php echo $prd->tprice ?>" placeholder="Base Price" readonly />
            										</div>
            									</div>
            								</div>
            								<div class="col-md-2 t_prod_price" style="display:none;">
            									<div class="form-body">
            										<div class="form-group">
            											<label for="eventInput1">Tax Amt</label>
            											<input class="form-control" type="text" name="tgst" id="tgst" placeholder="Tax Amt" value="<?php echo $prd->ttax_amount ?>" readonly >
            										</div>
            									</div>
            								</div>
						                </div>
						            </td>
						        </tr>
						    </table>
							
							<div class="row">
							<?php 
							$i = 1;
							foreach($santhe as $st) { ?>
								<input class="form-control" type="hidden" name="st_branch[]"  id="st_branch" value="<?php echo $st->branch_name ?>" readonly >
								<input class="form-control" type="hidden" name="st_branch_id[]"  id="st_branch_id" value="<?php echo $st->branch_id ?>" readonly >
							<?php 
							}
							?>
							<?php 
    							$i = 1;
    							foreach($rcpbranch as $rcpb) { ?>
    								<input class="form-control" type="hidden" name="up_branch[]"  id="up_branch" value="<?php echo $rcpb->branch_id ?>" readonly >
    								<input class="form-control" type="hidden" name="up_brname[]"  id="up_brname" value="<?php echo $rcpb->branch_name ?>" readonly >
							<?php 
							}
							?>
							</div>
							
							</br>
							</br>
							
							<?php if(!empty($recipe_items)) { ?>
							<div class="row">
								<div class="col-md-3">
									<div class="form-group">
										<label >Item Name</label>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<label >UOM</label>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<label >Quantity</label>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<label >Rate</label>
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<label >Price</label>
									</div>
								</div>
							</div>
							<?php } ?>
							<?php foreach($recipe_items as $rc) { ?>
							<div class="row ">
								<div class="col-md-3">
									<div class="form-group">
										<input type="hidden" name="rid" id="rid" value="<?php echo $rc->recipe_id;?>">
											<input type="hidden" name="item_ids[]" value="<?php echo $rc->rc_item_id;?>">
											<input type="text" readonly class="form-control" id="input_1" name="inames[]" value="<?php echo $rc->item_name;?>" Placeholder="Ingredient" > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" readonly class="form-control" id="input_1" name="uoms[]" value="<?php echo $rc->uom;?>" Placeholder="UOM" > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" class="form-control qt"  id="input_1" name="quantitys[]" value="<?php echo $rc->qty;?>" Placeholder="Quantity" readonly > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" readonly class="form-control pr" id="input_1" name="prices[]" value="<?php echo $rc->price;?>" Placeholder="Price"> 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" class="form-control tt"  id="input_1" name="totals[]" value="<?php echo $rc->total;?>" Placeholder="Total" readonly > 
									</div>
								</div>
								
							</div>
							<?php } ?>
							
							<?php if(!empty($sub_recipe_items)) { ?>
							<div class="row">
								<label for="eventInput1">Sub Recipe  </label>
							</div>
							<?php } ?>
							<?php foreach($sub_recipe_items as $src) { ?>
							<div class="row">
								<div class="col-md-3">
									<div class="form-group">
										<input type="hidden" name="sub_item_ids[]" value="<?php echo $src->sub_rc_item_id;?>" >
										<input type="text" readonly class="form-control" id="input_1" name="sub_inames[]" value="<?php echo $src->item_name;?>" Placeholder="Ingredient" > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" readonly class="form-control" id="input_1" name="sub_uoms[]" value="<?php echo $src->uom;?>" Placeholder="UOM" > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" class="form-control qt"  id="input_1" name="sub_quantitys[]" value="<?php echo $src->qty;?>" Placeholder="Quantity" readonly > 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" readonly class="form-control pr" id="input_1" name="sub_prices[]" value="<?php echo $src->price;?>" Placeholder="Price"> 
									</div>
								</div>
								<div class="col-md-2">
									<div class="form-group">
										<input type="text" class="form-control tt"  id="input_1" name="sub_totals[]" value="<?php echo $src->total;?>" Placeholder="Total" readonly > 
									</div>
								</div>
								
							</div>
							<?php } ?>
						
	
					<div class="col-md-2">
						<div class="form-group">
							<input class="form-control" type="text" name="ttl_amt" id="ttl_amt" value="<?php echo $prd->recipe_price; ?>" />
						</div>
					</div>

							
							<div class="form-actions text-center">
							    <?php
								    $user = 'Chef';
    								$q1 = $this->db->query("SELECT * FROM user where username='$user'");
    								foreach($q1->result_array() as $r1)
    								$phone_no = $r1['ph_no'];
								?>
								<input type="hidden" name="ph_no" id="ph_no" value="<?php echo $phone_no ?>" >
								<button type="reset" class="btn btn-warning mr-1">
									<i class="ft-x"></i> Cancel
								</button>
								<button type="submit" class="btn btn-primary" onClick="return product_apprv();">
									<i class="la la-check-square-o" ></i> Approve
								</button>
							</div>
						</form>	

					</div>
				</div>
			</div>
		</div>
	</div>

</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>

    <script>
		$('#category').change(function() {
			var cat_name = $('#category option:selected').text();
			$('#cat_name').val(cat_name);
		});
	</script>
	<script>
	$("#up_branch").change(function(){
        //var branch = $('#branch option:selected').text();
		var branch = $("#up_branch option:selected").map(function () {
			return $(this).text();
		}).get().join(',');
		//alert(branch);
		$('#up_brname').val(branch);
	});
  </script>
  
	<script>
		$('#gst_rate').change(function() {
			var tax = $('#gst_rate').val();
			var tprice = $('#tprice').val();
		
			var tax_div = ((parseFloat(tax)/100)+1);
			var basic = (parseFloat(tprice)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(tprice) - parseFloat(basic)).toFixed(2);
			
			$('#gst').val(tax_amt);
			$('#base_price').val(basic);
			
			//counter calculation
			$('.cgst_rate').val(tax);
			$('.cgst').val(tax_amt);
			$('.cbase_price').val(basic);
		});
	</script>
	<script>
		$('#tprice').keyup(function() {
			var tprice = $('#tprice').val();
			//alert(basic);
			$('.ctprice').val(tprice);
						
			var tax = $('#gst_rate').val();
			if(!($.isNumeric(tax)))
			{
				tax = 0;
			}
			
			var tax_div = ((parseFloat(tax)/100)+1);
			var basic = (parseFloat(tprice)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(tprice) - parseFloat(basic)).toFixed(2);
		
			$('#gst').val(tax_amt);
			$('#base_price').val(basic);
			
			$('.cgst').val(tax_amt);
			$('.cbase_price').val(basic);
		});
	</script>
	<script>
		$('.ctprice').each(function() { $(this).on( {'keyup': function() {
			var tax = $(this).parent().find('.cgst_rate').val();
			//alert(tax);
			var tprice = $(this).parent().find('.ctprice').val();
			var tax_div = ((parseFloat(tax)/100)+1);
		    var basic = (parseFloat(tprice)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(tprice) - parseFloat(basic)).toFixed(2);
			$(this).parent().find('.cgst').val(tax_amt);
			$(this).parent().find('.cbase_price').val(basic);
		}
		})
		})
		
		$('.cgst_rate').each(function() { $(this).on( {'change': function() {
			var tax = $(this).parent().find('.cgst_rate').val();
			var tprice = $(this).parent().find('.ctprice').val();
			var tax_div = ((parseFloat(tax)/100)+1);
		    var basic = (parseFloat(tprice)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(tprice) - parseFloat(basic)).toFixed(2);
			$(this).parent().find('.cgst').val(tax_amt);
			$(this).parent().find('.cbase_price').val(basic);
		}
		})
		})
	</script>
	<script>
		$(document).ready(function() {
		//$("input[name='food_delivery']").click(function() {
			if($('#tyes').is(':checked'))
			{
			//	$('.t_prod_price').show();
				$('.t_prod_price').hide();
			}
			else
			{
				$('.t_prod_price').hide();
			}
		//});
	});
		$("input[name='food_delivery']").click(function() {
			if($('#tyes').is(':checked'))
			{
			//	$('.t_prod_price').show();
				$('.t_prod_price').hide();
			}
			else
			{
				$('.t_prod_price').hide();
			}
		});
		
		$('#ttprice').keyup(function() {
			var tax = $('#tgst_rate').val();
			var price = $('#ttprice').val();
			var tax_div = ((parseFloat(tax)/100)+1);
			var basic = (parseFloat(price)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(price) - parseFloat(basic)).toFixed(2);
			$('#tgst').val(tax_amt);
			$('#tbase_price').val(basic);
		});
		
		$('#tgst_rate').change(function() {
			var tax = $('#tgst_rate').val();
			var price = $('#ttprice').val();
			var tax_div = ((parseFloat(tax)/100)+1);
			var basic = (parseFloat(price)/parseFloat(tax_div)).toFixed(2);
			var tax_amt = (parseFloat(price) - parseFloat(basic)).toFixed(2);
			$('#tgst').val(tax_amt);
			$('#tbase_price').val(basic);
		});
	</script>
	<script>
		function showMyImage(fileInput) {
			var files = fileInput.files;
			for (var i = 0; i < files.length; i++) {           
				var file = files[i];
				var imageType = /image.*/;     
				if (!file.type.match(imageType)) {
					continue;
				}           
				var img=document.getElementById("thumbnil");            
				img.file = file;    
				var reader = new FileReader();
				reader.onload = (function(aImg) { 
					return function(e) { 
						aImg.src = e.target.result; 
					}; 
				})(img);
				reader.readAsDataURL(file);
			}    
		}
	
		$(document).ready(function () {
			$('.image_file').change(function () {
				var val = $(this).val().toLowerCase();
				var regex = new RegExp("(.*?)\.(jpg|png|jpeg|JPG)$");
				if(!(regex.test(val))) {
					$(this).val('');
					//alert('Please select correct file format');
					document.getElementById('errfn2').innerHTML="Please upload only image file";
				} 
			});
		});
	</script>
		
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>