<script src="assets/js/king-table.js"></script>
<div class="col-lg-12 ">
	
	
	<ul class="breadcrumb">
		<li><i class="fa fa-home"></i><a href="/home" class="home">Home</a></li>
		<li><a class="View">View Customer </a></li>
		<li class="active"> Customer Update </li>
	</ul>
</div><br>
<!-- main -->
<div class="content">
	
	<div class="main-content">
		<!-- DATA EXPORT -->
		<div class="widget widget-table">
			<div class="widget-header">
				<h3><i class="fa fa-user"></i> Edit Customer</h3> <em> - Add Customer records</em>
				<div class="btn-group widget-header-toolbar">
					<a class="btn-borderless btn-focus clickme" href="SellerView" title="Focus" ><i class="fa fa-eye"></i></a>
					<!--<a href="#" title="Expand/Collapse" class="btn-borderless btn-toggle-expand"><i class="fa fa-chevron-up"></i></a>
					<a href="#" title="Remove" class="btn-borderless btn-remove"><i class="fa fa-times"></i></a>-->
				</div>
			</div>
			<div class="widget-content">
				<?php /* <form id="frmmain" method="POST" action={{route('seller.store')}} name="frmmain" data-parsley-validate novalidate> */ ?>
				
				<form id="frmmain" name="frmmain" data-parsley-validate novalidate>
					
					{!! csrf_field() !!}
					<div class="alert  alert-info " >
						<ul><li class="fa fa-cog  fa-1x fa-fw"></li>Kindly enter Seller Details..</ul>
					</div>						
					<div class="alert alert-success print-success-msg" style="display:none">
						<ul></ul>
					</div>	
					<div class="alert alert-danger print-error-msg" style="display:none">
						<ul></ul>
					</div>
					
					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">  
							<div class="form-group">
								<label for="multiselect1">Company Name*</label>
                                <select name="compname" id="compname" class="form-control" required>
									<option value="{{$custData->cmp_id}}">{{$custData->cmp_id}}</option>
								</select>
								<small class="text-danger" id="errcompname"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Seller Type*</label>
                                <select name="custtype" id="custtype" class="form-control" required>                                   
                                    <option value="{{$custData->cst_type}}">{{$custData->cst_type}}</option>
                                    <option value="Seller">Seller</option>
									<option value="Buyer & Seller">Buyer & Seller</option>
								</select>
								<small class="text-danger" id="errcusttype"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Seller name*</label>
								<input type="text" name="customername" id="customername" class="form-control" value="{{$custData->cst_name}}">
								<input type="hidden" name="cst_id" id="cst_id" class="form-control" value="{{$custData->cst_id}}">
								<small class="text-danger" id="errcustomername"></small>
							</div>
							<div class="form-group">
								<label>Address</label>
								<textarea class="form-control" name="address" id="address" rows="5" cols="30" >{{$custData->cst_address}}</textarea>
								<small class="text-danger" id="erraddress" ></small>
							</div>
							<div class="form-group">
								<label for="text-input1">City</label>
								<input type="text" name="city" id="city" class="form-control" value="{{$custData->cst_city}}" >
								<small class="text-danger" id="errcity"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">State</label>
								<input type="text" name="state" id="state" class="form-control"value="{{$custData->cst_state}}" >
								<small class="text-danger" id="errstate"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Country</label>
								<input type="text" name="country" id="country" class="form-control" value="{{$custData->cst_country}}" >
								<small class="text-danger" id="errcountry"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Website</label>
								<input type="text" name="wwwweb" id="wwwweb" class="form-control" value="{{$custData->cst_www}}">
								<small class="text-danger" id="errcountry"></small>
							</div>
							
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>
					
					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">
							<div class="form-group">
								<label for="text-input1">Contact No. 1*</label>
								<input type="text" name="contact1" id="contact1" class="form-control" value="{{$custData->cst_contact1}}" >
								<small class="text-danger" id="errcontact1"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Contact No. 2</label>
								<input type="text" name="contact2" id="contact2" class="form-control" value="{{$custData->cst_contact2}}" >
								<small class="text-danger" id="errcontact2"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Email ID</label>
								<input type="text" name="emailid" id="emailid" class="form-control"value="{{$custData->cst_email}}" >
								<small class="text-danger" id="erremailid"></small>
							</div>
							<div class="form-group">
								<label>Bank Account detail</label>
								<textarea class="form-control" name="bankacct" id="bankacct" rows="5" cols="30" >{{$custData->cst_bankdetail}}</textarea>
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label>Note (Any note)</label>
								<textarea class="form-control" name="description" id="description" rows="5" cols="30" >{{$custData->cst_note }}</textarea>
								<small class="text-danger" id="errdescription" ></small>
							</div>
							<div class="form-group">
								<label for="multiselect1">Status*</label>
								<br/>
                                <select name="status" id="status" class="form-control" required>
                                    <option value="{{$custData->cst_status  }}">{{$custData->cst_status  }}</option>
                                    <option value="Active">Active</option>
                                    <option value="Inactive">Inactive</option>
								</select>
								<small class="text-danger" id="errstatus"></small>
							</div>
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>
					<div class="col-md-12">
						<div class="form-group">
							<center><button class="btn btn-primary updateCustomer">Submit</button></center>
						</div>
					</div>                        
				</form>
				
			</div>
		</div>
		<!-- END DATA EXPORT -->
		
	</div>
</div>
<!-- /main -->


<script type="application/javascript">
	$('.updateCustomer').click(function(e)
	{
	e.preventDefault();
	   $.ajax({
				type: "POST",
				url:"/customerUpdate",
				data: $('#frmmain').serialize(),
				success: function (data) 
				{
				   $('#sideMenu').load('customerView');
				}
			});
	});
	
	
	
	function printErrorMsg (msg) {
		$(".alert-info").css('display','none');
		$(".print-success-msg").css('display','none');
		$(".print-error-msg").find("ul").html('');
		$(".print-error-msg").css('display','block');
		$(".print-error-msg").find("ul").append('<li class="fa fa-times-circle fa-1x fa-fw"></li>'+msg);
	}
	
	function printSuccessMsg (msg) {
		$(".alert-info").css('display','none');
		$(".print-error-msg").css('display','none');
		$(".print-success-msg").find("ul").html('');
		$(".print-success-msg").css('display','block');
		$(".print-success-msg").find("ul").append('<li class="fa fa-check  fa-1x fa-fw"></li>'+msg);
	}
</script>
<script>
	$(document).ready(function(){
		$.ajax({
            type: "GET",
            url:"/Sellergetcompany",
            dataType: "json",
            success: function (data) {
                $.each(data,function(i,obj)
                {
					var div_data="<option value="+obj.cmp_id+">"+obj.cmp_name+ "  (" +obj.cmp_type+")</option>";	
					$(div_data).appendTo('#compname'); 
				});  
			}
		});
	});
	
</script>		
<script>
	
	$('.clickme').click(function(e)
	{
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href'));
	});
	
	
	$('.cust').click(function(e)
	{
		e.preventDefault();
		$('#sideMenu').load('customerView');
	});
	
	$('.View').click(function(e)
	{
		$('#sideMenu').load('customerView');
	});
</script>		  