<?php
include("../connection.php");
include("../user.php");
$cur_date = date('Y-m-d H:i:s');
$user = $_SESSION['user'];
$branch_id = $_SESSION['branch_id'];
$ho_access = $_SESSION['ha'];
$branch = $_SESSION['division_name'];
$location = $_SESSION['location'];

$location_det = mysqli_fetch_array(mysqli_query($con, "select location from location_master where id='$branch_id'"));
$location_name = $location_det['location'];
?>
<!doctype html>
<html class="no-js" lang="">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title><?php echo TITLE; ?></title>
	<meta name="description" content="Ela Admin - HTML5 Admin Template">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="apple-touch-icon" href="../images/bluebase.png">
	<link rel="shortcut icon" href="../images/bluebase.png">
	<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->

	<style>
		input {
			text-transform: uppercase;
		}

		textarea {
			text-transform: uppercase;
		}

		select {
			text-transform: uppercase;
		}
	</style>
</head>

<body>
	<div class="col-lg-8">
		<div class="card">
			<div class="card-header">
				<strong>Scrap Stock</strong>
				<a href="scrab.php"><button class="btn btn-primary" style="width:50px;float:right;" onclick=""><i
							class="fa fa-backward"></i></button></a>
			</div>
			<div class="card-body card-block">
				<form method="post" enctype="multipart/form-data" class="form-horizontal" action="scrab_submit.php">
					<?php
					if ($ho_access == "yes") {
						?>
						<div class="row form-group" id="asset_set">
							<div class="col col-md-3"><label for="text-input" class=" form-control-label">Asset
									ID</label></div>
							<div class="col-12 col-md-9">
								<select id="asset_code" name="asset_code" onchange="asse_code(this.value)"
									class="form-control select-search" autocomplete="off">
									<option value="" selected disabled>Select Asset Code</option>
									<?php $asset_id = mysqli_query($con, "SELECT * FROM `asset_master` where status=0");
									while ($asset = mysqli_fetch_array($asset_id)) { ?>
										<option value="<?php echo $asset['id']; ?>">
											<?php echo $asset['description']; ?>
										</option>
									<?php } ?>
								</select>
							</div>
						</div>
					<?php } else { ?>
						<div class="row form-group">
							<div class="col col-md-3"><label for="text-input" class=" form-control-label">Asset
									ID</label></div>
							<div class="col-12 col-md-9">
								<select id="asset_code" name="asset_code" onchange="asse_code(this.value)"
									class="form-control select-search" autocomplete="off">
									<option value="" selected disabled>Select Asset Code</option>
									<?php
									$asset_id = mysqli_query($con, "SELECT * FROM `asset_master` where location='$location' and division='$branch' and status=0");
									while ($asset = mysqli_fetch_array($asset_id)) { ?>
										<option value="<?php echo $asset['id']; ?>">
											<?php echo $asset['category'] . '-' . $asset['category_description']; ?>
										</option>
									<?php } ?>
								</select>
							</div>
						</div>
					<?php } ?>
					<!--<div class="row form-group">-->
					<!--	<div class="col col-md-3"><label for="text-input"-->
					<!--			class="form-control-label">Division</label></div>-->
					<!--	<div class="col-12 col-md-9">-->
					<!--		<input type="text" name="division" id="division" class="form-control" placeholder="Division"-->
					<!--			readonly>-->
					<!--	</div>-->
					<!--</div>-->
					<!--<div class="row form-group">-->
					<!--	<div class="col col-md-3"><label for="text-input"-->
					<!--			class="form-control-label">Department</label></div>-->
					<!--	<div class="col-12 col-md-9">-->
					<!--		<input type="text" name="department" id="department" class="form-control"-->
					<!--			placeholder="Department" readonly>-->
					<!--	</div>-->
					<!--</div>-->
					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input"
								class=" form-control-label">Priority</label></div>
						<div class="col-12 col-md-9">
							<select id="asset_code" name="priority" class="form-control">
								<option selected disabled>Select Priority</option>
								<option value="High">High</option>
								<option value="Medium">Medium</option>
								<option value="Low">Low</option>
							</select>
						</div>
					</div>
					<!--<div class="row form-group">-->
					<!--	<div class="col col-md-3"><label for="text-input" class=" form-control-label">S.NO</label><span-->
					<!--			style="color:red;">*</span></div>-->
					<!--	<div class="col-12 col-md-9"><input type="text" id="fa" name="fa" class="form-control"-->
					<!--			autocomplete="off" placeholder="Enter FA Serial Number" required></div>-->
					<!--</div>-->
					<!--<div class="row form-group">-->
					<!--	<div class="col col-md-3"><label for="text-input" class="form-control-label">No of-->
					<!--			Items</label></div>-->
					<!--	<div class="col-12 col-md-9">-->
					<!--		<input type="number" class="form-control" name="no_of_items" id="no_of_items"-->
					<!--			onchange="quans(this.value)" placeholder="Please Enter Counts" required>-->
					<!--	</div>-->
					<!--</div>-->
					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input" class="form-control-label">Cost</label></div>
						<div class="col-12 col-md-9">
							<input type="number" class="form-control" name="cost" id="cost"
								placeholder="Please Enter Cost">
						</div>
					</div>
					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input" class=" form-control-label">Scrap
								Remarks</label></div>
						<div class="col-12 col-md-9">
							<textarea name="remarks" placeholder="Scrap Remarks" class="form-control"></textarea>
						</div>
					</div>

					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input" class=" form-control-label">Scrab Request By
								Department Manager</label></div>
						<div class="col-12 col-md-9"><input type="text" id="material_request_by"
								name="material_request_by" class="form-control" autocomplete="off"
								placeholder="Enter material_requester Name"></div>
					</div>
					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input" class=" form-control-label">Approved By
								Sr.Facility Manager</label></div>
						<div class="col-12 col-md-9"><input type="text" id="Approved_By_Shift_Engineer"
								name="Approved_By_Shift_Engineer" class="form-control" autocomplete="off"
								placeholder="Enter Shift Engineer Name"></div>
					</div>
					<div class="row form-group">
						<div class="col col-md-3"><label for="text-input" class=" form-control-label">Store
								Incharge</label></div>
						<div class="col-12 col-md-9"><input type="text" id="store_incharge" name="store_incharge"
								class="form-control" autocomplete="off" placeholder="Enter Store Incharge">
						</div>
					</div>


					<div>
						<button type="submit" name="submit" class="btn btn-success"><i class="fa fa-inbox"></i>
							Submit</button>
					</div>
				</form>
			</div>
		</div>
		<div class="clearfix"></div>

		<footer class="site-footer">

		</footer>
	</div>
</body>

</html>
<script>
	// Initialize Select2
	$(document).ready(function () {
		$('.select-search').select2({
			placeholder: "-- SELECT --",  // Optional placeholder text
			allowClear: true                // Optional: allows clearing the selection
		});
	});
</script>
