<?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">Products</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="#">Products</a>
                  </li>
                  <li class="breadcrumb-item active">Products List
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Zero configuration table -->
<section id="configuration">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Products List</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 card-dashboard">
                       
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered dataex-html5-export">
                                <thead>
                                    <tr>
                                        <th>Sl No</th>
                                        <th>Category</th>
                                        <th>Product Name</th>
                                        <th>Recipe Category</th>
										<th>Action</th>
										<?php //require($thead_file); ?>
                                    </tr>
                                </thead>
                                <tbody>
								 <?php
									$count =1;
									foreach($products as $record)
									{
								?>
                                    <tr>
                                        <td><?php echo $count;?></td>
                                        <td><?php echo $record->pr_cat_name ?></td>
                                        <td><?php echo $record->rname ?></td>
                                        <td><?php echo $record->recipe_cat ?></td>
										<td><a href="<?php echo site_url('Eshanya/productEdit/'. $record->recipe_id . '/' . $record->recipe_no); ?>" class="btn btn-sm btn-info">Update</a>
										<?php if($record->rstatus == 'Enabled') { ?>
											<a href="#medlist" class="grid-form-dialog-btn btn btn-sm btn-info pr_status" onclick="javascript:load_marks(<?php echo $record->recipe_no; ?>,'Disabled')">Disable</a>
										<?php } else { ?>
											<a href="#medlist" class="grid-form-dialog-btn btn btn-sm btn-info pr_status" onclick="javascript:load_marks(<?php echo $record->recipe_no; ?>,'Enabled')">Enable</a>
										<?php } ?>
										</td>
									</tr>
                                    
                                   <?php
								  $count++;
								}
							?>
                                </tbody>
                              
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!--/ Zero configuration table -->



<!--/ Language - Comma decimal place table -->

        </div>
      </div>
    </div>
    <!-- END: Content-->

   <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
  <script>
	$('.param_check').each(function() { $(this).on( {'click contextmenu': function() {
		//contextmenu
		var i = $(this).data('value');
		var anchor = $("a");
		var anchorTarget = $(this).parent().find('.parmetre').val();
		var link = $(this).attr('href');
		$(this).attr("href", link + anchorTarget);
		location.reload();
	}
	})
	})
  </script>
  
  <script>
function load_marks(pno,status)
{
	$('#pr_no').val(pno);
	$('#status').val(status);
}
</script>
<div class="grid-form-dialog" id="" title="Enable/Disable">
	<div class="container">
	<form  action="" class="uk-form-stacked"  method="post" autocomplete="off">
		<div class="row">
			<div class="col-md-4">
				<div class="form-body">
					<div class="form-group">
						<label for="eventInput1">Effective From</label>
						<input type="text" class="form-control date-picker" id="effective_date" name="effective_date" required placeholder="Effective From">
						<input type="hidden" class="form-control" id="pr_no" name="pr_no" value="" >
						<input type="hidden" class="form-control" id="status" name="status" value="" >
					</div>
				</div>
			</div>
		</div>
		<div class=" text-right">
			<button type="reset" class="btn btn-warning mr-1">
				<i class="ft-x"></i> Reset
			</button>
			<button type="submit" id="sub" name="sub" class="btn btn-primary">
				<i class="la la-check-square-o"></i> Save
			</button>
		</div>
	</form>
	</div>
</div>

 <script>
	$('#sub').click(function() {
		var effective = $('#effective_date').val();
		var pr_no = $('#pr_no').val();
		var pr_status = $('#status').val();
		if(effective == '')
		{
			alert("Please Enter Effective Date");
			return false;
		}
		else
		{
			$.ajax({
				type: "POST",
				dataType:'json',
				data : { pr_no : pr_no, pr_status : pr_status, effective : effective },
				url: "<?php echo base_url();?>index.php/Eshanya/change_product_status",
				success: function(dataz) { 
					setInterval(function(){
							window.location.reload(true);
						}, 200);
				}
			});
		}
	});
</script>
<script type="text/javascript">
	$(function() {
		$('.date-picker').datepicker({
			changeMonth: true,
			changeYear: true,
			showButtonPanel: true,
			dateFormat: 'dd-mm-yy',
		/*	onClose: function(dateText, inst) {
				$(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
			}*/
		});
	});	
</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>