<!--
added by Hafiyyan 07/06/2014
Post Item Page
-->
  <div class="row-fluid">
	<div class="span13">
		<div id="alert">
		</div>
		<h4>Registrasi Barang</h4><br>
		
		<?php
		$attributes = array(
						'id' => 'form',
		);
		echo form_open_multipart('item_controller/posting_item', $attributes);
		?>
		
		<table>
				<colgroup>
					<col width="75px" align="left"/>
					<col width="20px" />
					<col width="120px" />
				</colgroup>
				<tr>
					<td>
						Nama <span class="text-error">*</span>
					</td>
					<td>
					:
					</td>
					<td>
						<?php
							$data = array(
									'type' => 'text',
									'class' => 'input-large',
									'placeholder' => 'Nama Barang',
									'name' => 'nama_barang',
									'maxlength' => '30',
									'required' => 'required',
							);
							echo form_input($data);
						?>
					</td>
				</tr>
				<tr>
					<td>
						Kategori <span class="text-error">*</span>
					</td>
					<td>
					:
					</td>
					<td>
						<select name="kategori" class="input-medium" required>
						<?php
							foreach($categories as $row)
							{ 
							  echo '<option value="'.$row->category.'">'.$row->content.'</option>';
							}
						?>
						</select> 
					</td>
				</tr>
				<tr>
					<td>
						Foto 
					</td>
					<td>
					:
					</td>
					<td>
						<input name="item_image" size="40" type="file" />
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>
						<input type="checkbox" name="blur" value="1" >&nbsp;Blur
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>
						<input type="checkbox" name="scratch" value="1">&nbsp;Scratch
					</td>
				</tr>
				<tr>
					<td>
						Daerah <span class="text-error">*</span>
					</td>
					<td>
					:
					</td>
					<td> 
						<input type="text" id="us2-address" name="location" style="width: 200px" required/> Radius: <input type="text" id="us2-radius" required/>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
					:
					</td>
					<td>
						<div id="us2" style="width: 500px; height: 400px;"></div>				
						<input type="hidden" name="loc_lat" id="us2-lat"/>
						<input type="hidden" name="loc_lon" id="us2-lon"/>
					</td>
				</tr>
				<tr>
					<td>
						Status <span class="text-error">*</span>
					</td>
					<td>
					:
					</td>
					<td>
						<select name="status" class="input-medium" required>
						<?php
							foreach($status as $row)
							{ 
							  echo '<option value="'.$row->status.'">'.$row->content.'</option>';
							}
						?>
						</select> 
					</td>
				</tr>
				<tr>
					<td>
						Captcha <span class="text-error">*</span>
					</td>
					<td>
					:
					</td>
					<td>
						<?php echo $this->gotcha->GetCaptcha();?>
					</td>
				</tr>
				<tr>
					<td colspan="3" align="right">
						<hr>
					</td>
				</tr>
				<tr>
					<td colspan="3" align="right">
						<input type="submit" class="btn btn-primary" name="btnRegister" value="Register"/>
					</td>
				</tr>
		</table>
		
		<?php echo form_close(); ?>
		
	</div>
</div>


<script src="<?= base_url().$this->config->item("bootstrap_js")?>/jquery-2.0.1.min.js"></script>
<!--script
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false">
</script-->
<script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false&libraries=places&language=id'></script>
<script src="<?= base_url().$this->config->item("bootstrap_js")?>/locationpicker.jquery.js"></script>

<script>
/*
$('#somecomponent').locationpicker({
	location: {latitude: 46.15242437752303, longitude: 2.7470703125},
	radius: 300
	});*/
	
$('#us2').locationpicker({
location: {latitude: -6.870790309146874, longitude: 107.5722499089843},	
radius: 300,
inputBinding: {
	radiusInput: $('#us2-radius'),
	locationNameInput: $('#us2-address') ,
	latitudeInput: $('#us2-lat'),
    longitudeInput: $('#us2-lon')	
},
enableAutocomplete: true,
onchanged: function(currentLocation, radius, isMarkerDropped) {
	//alert("Location changed. New location (" + currentLocation.latitude + ", " + currentLocation.longitude + ")");
	$('#us2-lat').val(currentLocation.latitude);
	$('#us2-lon').val(currentLocation.longitude);
}
});		
</script>


