@extends('customer-service.layout.master')

@section('content')
<div class="wrapper">	<div class="fluid">
	<div class="widget grid2 widgetH"></div>
	<div class="grid8" id="updateS"></div>
	<div class="widget grid2 widgetH"></div>
</div>

<!-- Work Order Details -->
<div class="fluid">
	<form action="" class="main cussPayment" method="post" enctype="multipart/form-data">
		<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="{{$wo->wo}}" readonly required /></span>
					</div>
					<div class="grid4">
						<span class="grid12"><label><b>Appoint Date & Time : </b></label><input type="text" name="date" id="date" value="{{$wo->dateTimeStart}}" readonly required /></span>
					</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="{{$wo->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="{{$contractor->name}}" readonly required /></span>
					</div>
				</div>

				<div class="formRow">
					<div class="grid6">
						<span class="grid12">
							<label><b>Nature of Work / Task <small style="color: red">* </small>:</b></label>
							<select class="styled" name="task" id="task" required>
								<option value="">Choose type of task / nature of work</option>
								<option value="Activation">Activation</option>
								<option value="Rectification" >Rectification</option>
								<option value="Relocation" >Relocation</option>
							</select>
						</span>
					</div>
					<div class="grid6">
						<span class="grid12">
							<span class="grid12"><label><b>PPPOE - Username  : </b></label><input type="text" name="pppoe_username" id="pppoe_username" value=""/></span>
								<!--<label><b>Sub-category ( Ex: broadband / phone ) : </b></label>
								<select class="styled" name="sub_c" id="sub_c">
									<option value="">-</option>
									<option value="Broadband" >Broadband</option>
									<option value="Phone" >Phone</option>
									<option value="Phone" >Broadband & Phone</option>
								</select>-->
							</span>
						</div>
					</div>
					
					<div class="formRow">
						<span class="grid6">
							<label><b>ONU / ONT <small style="color: red">* </small>:</b></label>
							<select class="styled" name="onu_ont" id="onu_ont" required>
								<option value="">Choose Modern Type</option>
								<option value="Calix 801 G" >Calix 801 G</option>
								<option value="Calix 812 G" >Calix 812 G</option>
								<option value="Calix 813 G" >Calix 813 G</option>
								<option value="Calix 813 GV 2" selected>Calix 813 GV 2</option>
								<option value="Calix 844 G" >Calix 844 G</option>
								<option value="Calix 844 E" >Calix 844 E</option>
								<option value="Calix 804 Mesh" >Calix 804 Mesh</option>
								<option value="Core Cess" >Core Cess</option>
								<option value="Zyxell" >Zyxell</option>
								<option value="Huawei - EG8010H" >Huawei - EG8010H</option>
								<option value="Huawei - EG8040H5" >Huawei - EG8040H5</option>
								<option value="Nokia - G010GQ" >Nokia - G010GQ</option>
								<option value="Nokia - G240GE" >Nokia - G240GE</option>
							</select>
						</span>
						
						<span class="grid6">
							<label><b>Router <small style="color: red">* </small>:</b></label>
							<select class="styled" name="router" id="router" required>
								<option value="">Choose Router</option>
								<option value="Tenda AC1200" >Tenda AC1200</option>
								<option value="Cisco AC1200" >Cisco AC1200</option>
								<option value="TPLink AC1200" >TPLink AC1200</option>
								<option value="N/A" selected>N/A</option>
							</select>
						</span>
					</div>
					
					<div class="formRow">
						<span class="grid6">
							<label><b>Phone <small style="color: red">* </small>:</b></label>
							<select class="styled" name="n_phone" id="n_phone" required>
								<option value="">Need Phone?</option>
								<option value="Yes" >Yes</option>
								<option value="No" selected>No</option>
							</select>
						</span>
						
						<span class="grid6" id="noPhone">
							<label><b>No. Phone <small style="color: red">* </small>:</b></label>
							<select class="styled" name="no_phone" id="no_phone">
								<!-- <option value="">Home / Office?</option> -->
								<option value="1">1</option>							</select>
							</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;"></textarea>
							</span>
						</div>

						<div class="formRow noBorderB">
							<div class="grid4">
								<button name="cancel" id="cancel" class="buttonM bRed">Cancel</button>
							</div>
							<div class="grid8">
								<input type="submit" name="updateWk" id="updateWk" value="Update Work Order" class="buttonM bPurple formSubmit">
							</div>
						</div>

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

			<!-- PHP Submit Form -->

			<!-- Customer Details -->
			<form action="" class="main cussPayment" method="POST" enctype="multipart/form-data" id="updateFormR" name="updateFormR">
				<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="{{$customer->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="{{$customer->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="{{$customer->ic}}" required />
							</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="{{$customer->citizen}}" readonly required />
							</div>
							<div class="grid2">
								<label><b>Gender : </b></label>
								<input type="text" name="gender" id="gender"  value="{{$customer->gender}}" readonly required />
							</div>
							<div class="grid2">
								<label><b>Race : </b></label>
								<input type="text" name="race" id="race"  value="{{$customer->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">
								<input type="email" name="email" id="email" value="{{$customer->email}}" required />
							</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="{{$customer->phone1}}" required />
							</div>
							<div class="grid4">
								<label><b>Secondary Number: </b></label>
								<input type="text" name="phone2" id="phone2"  value="{{$customer->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>
									<option value="">Choose building</option>							
								</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="{{$customer->unit_no}}" required />
								</div>
								<div class="grid4">
									<label><b>Street : </b></label>
									<input type="text" name="street" id="street" value="{{$customer->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="{{$customer->city}}" readonly required />
									</span>
									<span class="grid4">
										<label><b>Postcode : </b></label>
										<input type="text" name="postcode" id="postcode" value="{{$customer->postcode}}" readonly required />
									</span>
									<span class="grid4">
										<label><b>State : </b></label>
										<input type="text" name="state" id="state" value="{{$customer->state}}" readonly required />
									</span>
								</div>
								<div class="grid2">&nbsp;</div>
							</div>

							<div class="formRow noBorderB">
								<div class="grid12">
									<input type="text" name="ft" id="ft" value="R" required style="display: none"/>
									<input type="text" name="cid" id="cid" value="5c92f527ded8f6380258f745" required style="display: none"/>
									<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>
			</div>
		</div>
	</div>
@endsection
@section('external_js')
<script>
	$("#task [value='{{$wo->nature_work}}']").attr("selected",true);
	$("#onu_ont [value='{{$wo->onu}}']").attr("selected",true);
	$("#router [value='{{$wo->router}}']").attr("selected",true);
	$("#n_phone [value='{{$wo->need_phone}}']").attr("selected",true);

	$.ajax({
		type: "GET",
		url: "{{url('/CustomerService/wo/building-json')}}",
		data: { },
		dataType: "json",
		success:function(data)
		{
			$.each(data, function (key, entry) {
				$('#building').append($('<option></option>').attr('value', entry.name).text(entry.name));
			});
			$("#building option[value='{{$customer->building}}']").attr("selected","selected");			 
		}
	});
</script>
@endsection