
<div class="form-group row {{ $errors->has('electorates_id') ? 'has-error' : '' }}">
    <label for="electorates_id" class="col-md-2 control-label">เขตเลือกตั้ง</label>
    <div class="col-md-4">
        <select class="form-control" id="electorates_id" name="electorates_id" required>
        	    <option value="" style="display: none;" {{ old('electorates_id', optional($home)->electorates_id ?: '') == '' ? 'selected' : '' }} disabled selected>ระบุ เขตเลือกตั้ง</option>
        	@foreach ($electorates as $key => $electorate)
			    <option value="{{ $key }}" {{ old('electorates_id', optional($home)->electorates_id) == $key ? 'selected' : '' }}>
			    	{{ $electorate }}
			    </option>
			@endforeach
        </select>
        
        {!! $errors->first('electorates_id', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

<div class="form-group row {{ $errors->has('amphurs_id') ? 'has-error' : '' }}">
    <label for="amphurs_id" class="col-md-2 control-label">อำเภอ</label>
    <div class="col-md-4">
        <select class="form-control" id="amphurs_id" name="amphurs_id" onChange="get_tambons(this.value )" required>
        	    <option value="" style="display: none;" {{ old('amphurs_id', optional($home)->amphurs_id ?: '') == '' ? 'selected' : '' }} disabled selected>ระบุ อำเภอ</option>
        	@foreach ($amphurs as $key => $amphur)
			    <option value="{{ $key }}" {{ old('amphurs_id', optional($home)->amphurs_id) == $key ? 'selected' : '' }}>
			    	{{ $amphur }}
			    </option>
			@endforeach
        </select>
        
        {!! $errors->first('amphurs_id', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

<div class="form-group row {{ $errors->has('tambons_id') ? 'has-error' : '' }}">
    <label for="tambons_id" class="col-md-2 control-label">ตำบล</label>
    <div class="col-md-4">
        <select class="form-control" id="tambons_id" name="tambons_id" onChange="get_moobans(this.value )" required>
        	    <option value="" style="display: none;" {{ old('tambons_id', optional($home)->tambons_id ?: '') == '' ? 'selected' : '' }} disabled selected>ระบุ ตำบล</option>
        	@foreach ($tambons as $key => $tambon)
			    <option value="{{ $key }}" {{ old('tambons_id', optional($home)->tambons_id) == $key ? 'selected' : '' }}>
			    	{{ $tambon }}
			    </option>
			@endforeach
        </select>
        
        {!! $errors->first('tambons_id', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

<div class="form-group row {{ $errors->has('moobans_id') ? 'has-error' : '' }}">
    <label for="moobans_id" class="col-md-2 control-label">หมู่บ้าน</label>
    <div class="col-md-4">
        <select class="form-control" id="moobans_id" name="moobans_id" required>
        	    <option value="" style="display: none;" {{ old('moobans_id', optional($home)->moobans_id ?: '') == '' ? 'selected' : '' }} disabled selected>ระบุ หมู่บ้าน</option>
        	@foreach ($moobans as  $mooban)
			    <option value="{{ $mooban ->id}}" {{ old('moobans_id', optional($home)->moobans_id) == $key ? 'selected' : '' }}>
			    	{{ $mooban->name }} หมู่ที่ 	{{ (int) $mooban->moo }}
			    </option>
			@endforeach
        </select>
        
        {!! $errors->first('moobans_id', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

<div class="form-group row {{ $errors->has('address') ? 'has-error' : '' }}">
    <label for="address" class="col-md-2 control-label">บ้านเลขที่</label>
    <div class="col-md-4">
        <input class="form-control" name="address" type="text" id="address" value="{{ old('address', optional($home)->address) }}" maxlength="10" placeholder="ระบุ บ้านเลขที่" required>
        {!! $errors->first('address', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

@php /*
<div class="form-group row {{ $errors->has('users_id') ? 'has-error' : '' }}">
    <label for="users_id" class="col-md-2 control-label">ผู้บันทึกข้อมูล</label>
    <div class="col-md-4">
        <select class="form-control" id="users_id" name="users_id">
        	    <option value="" style="display: none;" {{ old('users_id', optional($home)->users_id ?: '') == '' ? 'selected' : '' }} disabled selected>ระบุ ผู้บันทึกข้อมูล</option>
        	@foreach ($users as $key => $user)
			    <option value="{{ $key }}" {{ old('users_id', optional($home)->users_id) == $key ? 'selected' : '' }}>
			    	{{ $user }}
			    </option>
			@endforeach
        </select>
        
        {!! $errors->first('users_id', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>
*/ @endphp
<div class="form-group row {{ $errors->has('remark') ? 'has-error' : '' }}">
    <label for="remark" class="col-md-2 control-label">หมายเหตุ</label>
    <div class="col-md-4">
        <input class="form-control" name="remark" type="text" id="remark" value="{{ old('remark', optional($home)->remark) }}" maxlength="150" placeholder="ระบุ หมายเหตุ">
        {!! $errors->first('remark', '<p class="form-text text-muted">:message</p>') !!}
    </div>
</div>

