@extends('contractor.layout.master')
@section('ptitle','Contractor')
@section('page_title', 'Work Order')
@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="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>
	<!-- Work Order Details -->
	<div class="fluid">
		<form action="{{ url('/contractor/update-work-order-detail') }}" class="main cussPayment" method="POST" enctype="multipart/form-data">
			<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			<input type="hidden" name="work_order" value="{{ $form->WorkOrder->wo }}" required/>
			<fieldset>
				<div class="widget grid2 widgetH"></div>
				<div class="widget grid8">
					<div class="whead"><h6>Work Order's Detail</h6></div>
					
					<div class="formRow">
						<div class="grid4">
							<span class="grid12"><label><b>Work Order ID : </b></label><input type="text" name="wo" id="wo" value="{{ $form->WorkOrder->wo }}" readonly required /></span>
						</div>
						<div class="grid4">
							@if($form->WorkOrder->dateTimeStart != '') 
								<span class="grid12"><label><b>Appoint Date : </b></label><input type="text" name="date" id="date" value="{{ date('d/m/Y', strtotime($form->WorkOrder->dateTimeStart))}}" readonly="" required=""></span>
							@else
								<span class="grid12"><label><b>Appoint Date : </b></label><input type="text" name="date" id="date" value="{{ $form->WorkOrder->dateTimeStart}}" readonly="" required=""></span>
							@endif
						</div>
						<div class="grid4">
							@if($form->WorkOrder->dateTimeStart != '') 
								<span class="grid12"><label><b>Appoint Time : </b></label><input type="text" name="time" id="time" value="{{ date('h:i A', strtotime($form->WorkOrder->dateTimeStart))}}" readonly="" required=""></span>
							@else
								<span class="grid12"><label><b>Appoint Time : </b></label><input type="text" name="time" id="time" value="{{ $form->WorkOrder->dateTimeStart}}" readonly="" required=""></span>
							@endif
						</div>
                    </div>
					
					<div class="formRow">
						<div class="grid6">
							<span class="grid12"><label><b>Work Order Current Status : </b></label><input type="text" name="status" id="status" value="{{ $form->WorkOrder->status}}" readonly required /></span>
						</div>
						<div class="grid6">
							<span class="grid12"><label><b>Assign to Contractor : </b></label><input type="text" name="contractor" id="contractor" value="{{ $company->name }}" readonly required /></span>
						</div>
                    </div>
					
					<div class="formRow">
						<div class="grid6">
							<span class="grid12">
								<span class="grid12"><label><b>Nature of Work / Task  : </b></label><input type="text" name="nature_work" id="nature_work" value="{{ $form->WorkOrder->nature_work }}" readonly required /></span>
							</span>
						</div>
						<div class="grid6">
							<span class="grid12"><label><b>PPPOE - Username : </b></label><input type="text" name="pppoe_username" id="pppoe_username" value="{{ $form->WorkOrder->pppoe_username }}" readonly required /></span>
						</div>
                    </div>
					
					<div class="formRow">
						<span class="grid6">
							<span class="grid12"><label><b>ONU / ONT : </b></label><input type="text" name="onu_ont" id="onu_ont" value="{{ $form->WorkOrder->onu }}" readonly required /></span>
						</span>
						
						<span class="grid6">
							<span class="grid12"><label><b>Router : </b></label><input type="text" name="router" id="router" value="{{ $form->WorkOrder->router }}" readonly required /></span>
						</span>
                    </div>
					
					<div class="formRow">
						<span class="grid6">
							<span class="grid12"><label><b>Phone : </b></label><input type="text" name="n_phone" id="n_phone" value="{{ $form->WorkOrder->n_phone }}" readonly required /></span>
						</span>
						
						<span class="grid6" id="noPhone">
							<span class="grid12"><label><b>No. Phone : </b></label><input type="text" name="no_phone" id="no_phone" value="{{ $form->WorkOrder->no_phone }}" readonly required /></span>
						</span>
                    </div>
					
					<div class="formRow">
						<span class="grid12"><label><b>Assign to Installer : </b></label><input type="text" name="no_phone" id="no_phone" value="{{ $installer }}" readonly required /></span>
                    </div>

					<div class="formRow">
						<span class="grid12">
							<label><b>Remarks : </b></label>
							<textarea rows="3" cols="" name="remark" id="remark" class="auto" style="overflow: hidden; word-wrap: break-word; resize: horizontal; height: 70px;" readonly="">{{ $form->WorkOrder->remarks_custservice }}</textarea>
						</span>
                    </div>
					
				</div>
				<div class="widget grid2 widgetH"></div>
			</fieldset>
		</form>

		@if($form->type_application == 'R')
		<form action="{{ url('/contractor/update-customer-detail') }}" class="main cussPayment" method="POST" enctype="multipart/form-data" id="updateFormR" name="updateFormR">
			<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			<input type="hidden" name="subscriber_id" value="{{ $form->Subscriber->subscriber_id }}" required/>
			<fieldset>
				<div class="widget grid2 widgetH"></div>
				<div class="widget grid8">
					<div class="whead"><h6>Customer's Details</h6></div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Type Application : </b></label></div>
						<div class="grid6"><input type="text" name="app" id="app" value="{{ $form->type_application }}" readonly required /></div>
						<div class="grid2">&nbsp;</div>
					</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="name" id="name" value="{{ $form->Subscriber->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">
							@if($form->Subscriber->ic == "<b>Package Development</b>") { ?>
								<input type="text" name="ic" id="ic"  value="{{ $form->Subscriber->ic }}" readonly />
							@else
								<input type="text" name="ic" id="ic"  value="{{ $form->Subscriber->ic }}" required />
							@endif
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid3">&nbsp;</div>
						<div class="grid2">
							<label><b>Citizen : </b></label>
							<input type="text" name="citizen" id="citizen"  value="{{ $form->Subscriber->citizen }}" readonly required />
						</div>
						<div class="grid2">
							<label><b>Gender : </b></label>
							<input type="text" name="gender" id="gender"  value="{{ $form->Subscriber->gender }}" readonly required />
						</div>
						<div class="grid2">
							<label><b>Race : </b></label>
							<input type="text" name="race" id="race"  value="{{ $form->Subscriber->race }}" readonly required />
						</div>
						<div class="grid3">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Email : </b></label></div>
						<div class="grid6">
							@if($form->Subscriber->email == "<b>Package Development</b>")
								<input type="text" name="email" id="email" value="{{ $form->Subscriber->email }}" readonly />
							@else
								<input type="email" name="email" id="email" value="{{ $form->Subscriber->email }}" required />
							@endif
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid4">
							<label><b>Primary Number : </b></label>
							<input type="text" name="phone1" id="phone1" value="{{ $form->Subscriber->phone1 }}" required />
						</div>
						<div class="grid4">
							<label><b>Secondary Number: </b></label>
							<input type="text" name="phone2" id="phone2"  value="{{ $form->Subscriber->phone2 }}"/>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Building : </b></label></div>
						<div class="grid6">
							<select class="styled" name="building" id="building" required>
								@foreach ($coverage as $c)
									@if($c->building_name == $form->Subscriber->building_name)
										<option value='{{$c->building_name}}' selected>{{$c->building_name}}</option>
									@else {
										<option value='{{$c->building_name}}'>{{$c->building_name}}</option>
									@endif
								@endforeach
							</select>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid4">
							<label><b>Unit No : </b></label>
							<input type="text" name="unit_no" id="unit_no" value="{{ $form->Subscriber->unit_no }}" required />
						</div>
						<div class="grid4">
							<label><b>Street : </b></label>
							<input type="text" name="street" id="street" value="{{ $form->Subscriber->street }}" />
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid8">
							<span class="grid4">
								<label><b>City : </b></label>
								<input type="text" name="city" id="city" value="{{ $form->Subscriber->city }}" readonly required />
							</span>
							<span class="grid4">
								<label><b>Postcode : </b></label>
								<input type="text" name="postcode" id="postcode" value="{{ $form->Subscriber->postcode }}" readonly required />
							</span>
							<span class="grid4">
								<label><b>State : </b></label>
								<input type="text" name="state" id="state" value="{{ $form->Subscriber->state }}" readonly required />
							</span>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow noBorderB">
						<div class="grid12">
							<input type="submit" name="update" id="update" class="buttonM bBlue formSubmit" value="Update Customer's Details">
						</div>
					</div>
					
				</div>
				<div class="widget grid2 widgetH"></div>
			</fieldset>
		</form>
		 @elseif($form->type_application == 'B')
		<form action="{{ url('/contractor/update-customer-detail') }}" class="main cussPayment" method="POST" enctype="multipart/form-data" id="updateFormB" name="updateFormB">
			<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
			<input type="hidden" name="subscriber_id" value="{{ $form->Subscriber->subscriber_id }}" required/>
			<!-- Company Details-->
			<fieldset>
				<div class="widget grid2 widgetH"></div>
				<div class="widget grid8">
					<div class="whead"><h6>Company's Details</h6></div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Type Application : </b></label></div>
						<div class="grid6"><input type="text" name="app" id="app" value="{{ $form->type_application }}" readonly required /></div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid8">
							<span class="grid4">
								<label><b>Company Registration Number : </b></label>
								<input type="text" name="company_reg" id="company_reg" value="{{ $form->Subscriber->company_reg }}" required />
							</span>
							<span class="grid4">
								<label><b>Company Contact Number : </b></label>
								<input type="text" name="company_num" id="company_num" value="{{ $form->Subscriber->company_num }}" required />
							</span>
							<span class="grid4">
								<label><b>Company Fax Number: </b></label>
								<input type="text" name="company_fax" id="company_fax" value="{{ $form->Subscriber->fax }}" />
							</span>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Company Name : </b></label></div>
						<div class="grid6"><input type="text" name="company_name" id="company_name" value="{{ $form->Subscriber->company_num }}" required /></div>
						<div class="grid2">&nbsp;</div>
					</div>
					
					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Company Address : </b></label></div>
						<div class="grid6"><textarea rows="3" cols="" name="address" id="address" class="auto" style="overflow: hidden; word-wrap: break-word; resize: horizontal; height: 70px;" required>{{ $form->Subscriber->street }}</textarea></div>
						<div class="grid2">&nbsp;</div>
					</div>

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

				</div>
				<div class="widget grid2 widgetH"></div>
			</fieldset>

			<!-- Customer Details-->
			<fieldset>
				<div class="widget grid2 widgetH"></div>
				<div class="widget grid8">
					<div class="whead"><h6>Technical Contact Person</h6></div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Name : </b></label></div>
						<div class="grid6"><input type="text" name="name" id="name"  value="{{ $form->Subscriber->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="{{ $form->Subscriber->ic }}" /></div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Designation : </b></label></div>
						<div class="grid6"><input type="text" name="designation" id="designation" value="{{ $form->Subscriber->designation }}" required /></div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid2"><label><b>Email : </b></label></div>
						<div class="grid6"><input type="email" name="email" id="email" value="{{ $form->Subscriber->email }}" /></div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow">
						<div class="grid2">&nbsp;</div>
						<div class="grid4">
							<label><b>Primary Number : </b></label>
							<input type="text" name="phone1" id="phone1" value="{{ $form->Subscriber->phone1 }}" required />
						</div>
						<div class="grid4">
							<label><b>Secondary Number: </b></label>
							<input type="text" name="phone2" id="phone2"  value="{{ $form->Subscriber->phone2 }}"/>
						</div>
						<div class="grid2">&nbsp;</div>
					</div>

					<div class="formRow noBorderB">
						<div class="grid12">
							<input type="submit" name="update" id="update" class="buttonM bBlue formSubmit" value="Update Customer's Details">
						</div>
					</div>
					
				</div>
				<div class="widget grid2 widgetH"></div>
			</fieldset>
		</form>
		@endif
	</div>
</div>
@endsection