@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="wrapper">	
	<div class="fluid">
		<div class="widget grid2 widgetH"></div>
		<div class="widget grid8 widgetH">
			<!-- for validation errors -->
			@if(count($errors) > 0)
			<div class="nNote nFailure">
				@foreach($errors->all() as $error)
				<p>{{$error}}</p>
				@endforeach
			</div>
			@endif
			@if(session()->has('success_msg'))
			<div class="nNote nSuccess">
				<p>{!! session()->get('success_msg') !!}</p>
			</div>
			@elseif(Session::get('error_msg'))
			<div class="nNote nFailure">
				<p>{!! session()->get('error_msg') !!}</p>
			</div>
			@endif
		</div>
		<div class="widget grid2 widgetH"></div>
	</div>

	<div class="fluid">
		<form action="{{ url('/customer-service/team/edit-contractor') }}" class="main cussPayment" method="POST" enctype="multipart/form-data">
			<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			<input type="hidden" name="contractor_id" value="{{ $contractor->_id }}">
			<fieldset>
				<div class="widget grid2 widgetH"></div>
				<div class="widget grid8">
					<div class="whead"><h6>Edit Contractor's Detail ( {{ $contractor->StaffDetail->name }} )</h6></div>

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

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>NRIC : </b></label></div>
						<div class="grid6"><input type="text" name="ic" id="ic"  value="{{ $contractor->StaffDetail->ic }}" required /></div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid4">
							<label><b>Email : </b></label> 
							<input type="email" name="email" id="email" value="{{ $contractor->StaffDetail->email }}" required />
						</div>
						<div class="grid4">
							<label><b>Phone No. : </b></label>
							<input type="text" name="phone" id="phone" required  value="{{ $contractor->StaffDetail->phone }}"/>
							<small style="color: red"></small>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Company / Vendor : </b></label></div>
						<div class="grid6">
							<select class="styled" id="vendor" name="vendor" required>
								<option value=''>Please Select Company</option>
								@foreach($company as $c)
									@if($c->_id == $contractor->StaffDetail->company_id )
									<option value='{{ $c->_id }}' selected="">{{ $c->name }}</option>
									@else
									<option value='{{ $c->_id }}'>{{ $c->name }}</option>
									@endif
								@endforeach
							</select>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>
						
					<div class="formRow noBorderB" id="sendForm"><input type="submit" value="Edit Contractor" class="buttonM bPurple formSubmit" name="submit" id="submit"></div>
				</div>
				<div class="widget grid2 widgetH"></div>
			</fieldset>
		</form>
	</div>
</div>
@endsection

@section('external_js')
@endsection