<?php include("header.php"); ?>

		<div class="container-fluid">
			<div class="animated fadeIn">
				<div class="row">
					<div class="col-lg-6">
						
						<div class="card">
							<div class="card-header">
								Web Items
							</div>
							<div class="card-body">
						
								<form method="post" action="" id="web-item-form" enctype="multipart/form-data">
									
									<?php
									if(isset($errMSG)) {
										?>
										<div class="form-group">
											<div class="alert alert-<?php echo ($errTyp = "success") ? "success" : $errTyp; ?>">
												<span><?php echo $errMSG; ?></span>
											</div>
										</div>
										<?php
									}
									?>
									<div class="row">
										<div class="col-lg-3">
											<div class="form-group">
												<label>Unit ID</label>
												<input type="text" name="unit_id" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Item ID</label>
												<input type="text" name="item_id" class="form-control">
											</div>
										</div>
										<div class="col-lg-6">
											<div class="form-group">
												<label>Item Name</label>
												<input type="text" name="item_name" class="form-control">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-4">
											<div class="form-group">
												<label>Alt Name</label>
												<input type="text" name="alt_name" class="form-control">
											</div>
										</div>
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item Unit Price</label>
												<input type="text" name="item_unit_price" class="form-control">
											</div>
										</div>
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item Final Price</label>
												<input type="text" name="item_final_price" class="form-control">
											</div>
										</div>
									</div>
									<div class="form-group">
										<label>Item Short Description</label>
										<textarea name="short_desc" class="form-control" rows="5"></textarea>
									</div>
									<div class="form-group">
										<label>Item Long Description</label>
										<textarea name="long_desc" class="form-control" rows="5"></textarea>
									</div>
									<div class="row">
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item Is Active?</label>
												<select name="is_active" class="form-control">
													<option value="1" selected>Yes</option>
													<option value="0">No</option>
												</select>
											</div>
										</div>
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item In Stock?</label>
												<select name="in_stock" class="form-control">
													<option value="1" selected>Yes</option>
													<option value="0">No</option>
												</select>
											</div>
										</div>
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item Is Recommended?</label>
												<select name="item_rec" class="form-control">
													<option value="1" selected>Yes</option>
													<option value="0">No</option>
												</select>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-4">
											<div class="form-group">
												<label>Item Is Default?</label>
												<select name="item_default" class="form-control">
													<option value="1" selected>Yes</option>
													<option value="0">No</option>
												</select>
											</div>
										</div>
										<div class="col-lg-8">
											<div class="form-group">
												<label>Item Image Url</label>
												<input type="file" name="image_url" class="form-control">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-6">
											<div class="form-group">
												<label>Item Tags</label>
												<input type="text" name="item_tags" class="form-control">
											</div>
										</div>
										<div class="col-lg-6">
											<div class="form-group">
												<label>Item Taxes</label>
												<input type="text" name="item_taxes" class="form-control">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-3">
											<div class="form-group">
												<label>Item Charges</label>
												<input type="text" name="item_charges" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Item Cat Type</label>
												<input type="text" name="item_cat_type" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Group Name</label>
												<input type="text" name="group_name" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Item Cat Type ID</label>
												<input type="text" name="type_id" class="form-control">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="col-lg-3">
											<div class="form-group">
												<label>Has Groups?</label>
												<input type="text" name="has_groups" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Groups ID</label>
												<input type="text" name="groups_id" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>KOT Comments</label>
												<input type="text" name="kot_comment" class="form-control">
											</div>
										</div>
										<div class="col-lg-3">
											<div class="form-group">
												<label>Is Item Updated?</label>
												<input type="text" name="item_update" class="form-control">
											</div>
										</div>
									</div>
									<div class="form-group">
										<button type="submit" name="submit" class="btn btn-primary px-4">Submit</button>
									</div>
									
								</form>
								
							</div>
						</div>
						
					</div>
				</div>
			</div>
		</div>
		
<?php include("footer.php"); ?>

<script>
$(document).ready(function(){
	$('#web-item-form').submit(function(e){
		
		e.preventDefault(); // Prevent Default Submission
		
		$.ajax({
			url: 'web_items_submit.php',
			type: 'POST',
			data: $(this).serialize() 
		})
		.done(function(data){
			console.log(data);
		})
		.fail(function(){
			
		});
	});
});
</script>