@extends('customer-service.layout.master')
@section('ptitle','Customer Service')
@section('page_title', 'Dashboard')
@section('subpage', 'Graph & Summary Report')
@section('img_profile', asset($user->StaffDetail->user_pic))
@section('login_name', $user->StaffDetail->name )
@section('last_login', $user->last_login_at )

@section('content')
<div class="fluid">
	<div class="widget grid2 widgetH"></div>
	@if(count($errors) > 0)
	<div class="grid8">
		<div class="nNote nFailure">
			@foreach($errors->all() as $error)
			<p>{{$error}}</p>
			@endforeach
		</div>
	</div>
	@endif

	@if(Session::get('error_msg'))
	<div class="grid8">
		<div class="nNote nFailure">
			<p>Email or Password is invalid</p>
		</div>
	</div>
	@elseif(Session::get('success_msg'))
	<div class="grid8">
		<div class="nNote nSuccess">
			<p>{{ session('success_msg') }}</p>
		</div>
	</div>
	@endif
	<div class="widget grid2 widgetH"></div>
</div>

<div class="fluid">
	<form action="{{url('/customer-service/coverage/update-coverage')}}" class="main cussPayment" method="POST" enctype="multipart/form-data">
		<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
		<input type="hidden" name="coverage_id" value="{{$coverage->_id}}">
		<input type="hidden" name="Type" value="{{$coverage->Type}}">
		<fieldset>
			<div class="widget grid2 widgetH"></div>
			<div class="widget grid8">
				<div class="whead"><h6>Update Coverage ({{$coverage->Type}})</h6></div>

				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid2"><label><b>Building Name : </b></label></div>
					<div class="grid6"><input type="text" name="name" id="name" value="{{$coverage->building_name}}" required /></div>
					<div class="grid2">&nbsp;</div>
				</div>

				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid4">
						<label><b>Postcode : </b></label>
						<input type="text" name="postcode" id="postcode" value="{{$coverage->postcode}}" required />
					</div>
					<div class="grid4">
						<label><b>City : </b></label>
						<input type="text" name="city" id="city" value="{{$coverage->city}}" required />
					</div>
					<div class="grid2">&nbsp;</div>
				</div>

				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid2"><label><b>State : </b></label></div>
					<div class="grid6"><input type="text" name="state" id="state" value="{{$coverage->state}}" required /></div>
					<div class="grid2">&nbsp;</div>
				</div>

				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid2"><label><b>Installation Fee : </b></label></div>
					<div class="grid6"><input type="text" name="fee" id="fee" value="{{$coverage->installation_fee}}" required /></div>
					<div class="grid2">&nbsp;</div>
				</div>
				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid2"><label><b>Select Status Building : </b></label></div>
					<div class="grid6">
						<select class="styled" id="status" name="status" style="opacity: 0;">
							<option value="">Please choose status building</option>
							<option value="prelaid">Prelaid</option>
							<option value="non prelaid">Non Prelaid</option>
						</select>
					</div>
					<div class="grid2">&nbsp;</div>
				</div>
				<div class="formRow">
					<div class="grid2">&nbsp;</div>
					<div class="grid2"><label><b>Email (JMB): </b></label></div>
					<div class="grid6"><input type="email" name="jmb" id="jmb" value="{{$coverage->jmb_email}}" /></div>
					<div class="grid2">&nbsp;</div>
				</div>

				<div class="formRow noBorderB" id="sendForm"><input type="submit" value="Update Coverage" class="buttonM bPurple formSubmit" name="submit" id="submit"></div>
			</div>
			<div class="widget grid2 widgetH"></div>
		</fieldset>
	</form>
</div>
@endsection
@section('external_js')
<script>
	$("#status [value='{{$coverage->status_building}}']").attr("selected",true);
</script>
@endsection