<?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" ng-app="prodreq" ng-controller="prrequest" >
      <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">Daily Stock Update</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="#">Daily Stock Update</a>
                  </li>
                  <li class="breadcrumb-item active">Stock Update
                  </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">Stock Update</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" autocomplete="off" action="<?php echo site_url('Stock_update/addStStock');?>" method="post">
							<div class="row justify-content-md-center">
								<?php
								if(!empty($cdept)) {
								foreach($cdept as $dept) ?>
								<div class="col-md-5 mleft">
									<div class="form-body">
										<div class="form-group">
										<?php $cur_date = date("d-m-Y"); 
										$branch_id = $_SESSION['branch_id'];
										$branch_name = $_SESSION['branch_name'];
										$full_name = $_SESSION['full_name']; ?>
											<label for="eventInput1">Date</label>
											<input class="form-control" type="text" name="trans_date" id="trans_date" value="<?php echo $cur_date ?>" readonly >
											<input class="form-control" type="hidden" name="dept_name" id="dept_name" value="<?php echo $dept->access_username; ?>" readonly >
											<input class="form-control" type="hidden" name="to_branch" id="to_branch" value="<?php echo $dept->access_branch; ?>" readonly >
											<input type="hidden" name="dept1" id="dept1" class="form-control" />
											<input type="hidden" id="branch_id" class="form-control"  name="branch_id" value="<?php echo $branch_id;?>">
											<input type="hidden" id="branch_name" class="form-control"  name="branch_name" value="<?php echo $branch_name;?>">
											<input type="hidden" id="full_name" class="form-control"  name="full_name" value="<?php echo $full_name;?>">
										</div>
									</div>
								</div>
								<?php } ?>
							</div>
							
							<div class="row justify-content-md-right">
								<table class="table" >
									<thead>
										<tr>
											<th>Item Name</th>
											<th>UOM</th>
											<th>Qty</th>
										</tr>
									</thead>
									<tbody>
										<tr ng-repeat="item in items">
											<td>{{item.iname}}</td>
											<td>{{item.uom}}</td>
											<td style="width:203px;">
												<input class="form-control" type="hidden" name="product_name[]" id="product_name" value={{item.iname}} readonly />
												<input class="form-control" type="hidden" name="item_type[]" id="item_type" value="Finished Product"  readonly />
												<input class="form-control" type="hidden" value={{item.cat_id}} name="cat_id[]" id="cat_id" readonly />
												<input class="form-control" type="hidden" value={{item.flavour}} name="flavour[]" id="flavour" readonly />
												<input class="form-control" type="hidden" value={{item.f_code}} name="f_code[]" id="f_code" readonly />
												<input class="form-control" type="hidden" value={{item.uom}} name="uom[]" id="uom" readonly />
												<input class="form-control" type="text" ng-model="item.qty" name="quantity[]"  id="quantity" placeholder="Req Qty" />
												<input class="form-control batch_no" type="hidden" name="remarks[]" id="remarks" Placeholder="Remarks"/>
												<input class="form-control" type="hidden" value={{item.id}} name="item_id[]" id="item_id" readonly />
												<input class="form-control" type="hidden" value={{item.rno}} name="recipe_no[]" id="recipe_no" readonly />
												<input class="form-control" type="hidden" value={{item.pr_stk}} name="pr_stock[]" id="pr_stock" readonly />
											</td>
										</tr>
									</tbody>
								</table>
							</div>

							<div class="form-actions text-center">
								<button type="reset" class="btn btn-warning mr-1">
									<i class="ft-x"></i> Cancel
								</button>
								<button type="submit" class="btn btn-primary">
									<i class="la la-check-square-o"></i> Save
								</button>
								
							</div>
						</form>	
						<!--	<button class="btn btn-warning mr-1" onclick="return alert('Updated Successfully')">Update</button> -->
					</div>
				</div>
			</div>
			<br/>
		</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>
		var mainApp = angular.module('prodreq', ['ngStorage']);

		mainApp.controller('prrequest', ['$scope', '$http', function ($scope, $http) {
					
			$scope.dept = '0';
			$scope.cat = '0';
			var branch_id1 = angular.element(document.getElementById("branch_id"));
			$scope.branch_id = branch_id1.val();
			//fetch data
			console.log($scope.branch_id);
						
			$http({
				method: 'post',
				url: '<?php echo base_url(); ?>index.php/Stock_update/fetchProduct',
				headers: {'Content-Type': 'application/json'},
				data: JSON.stringify({branch_id:$scope.branch_id})
			}).then(function successCallback(response) {
				$scope.items = response.data;
				console.log(response.data);
			});
			
		}]);
	</script>
	
	<script>
		$(window).on('beforeunload', function () {
			//$("input[type=submit], input[type=button]").prop("disabled", "disabled");
			$("input[type=submit]").prop("disabled", "disabled");
			$("#submit").css("background-color","#dcdcdc");
		});
	</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>