<?php $phone = ''; ?>
<div class="row-fluid">
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12" style="height:330px;">
				<form>
					<div class="row-fluid" style="<?php if( $this->id_admin ){ echo 'display:none'; } ?>">
						<div class="span12">
							<div class="span4">
								<strong>Choose an admin/driver</strong>
							</div>
							<div class="span7">
								<select id="form-make-call-admin" name="form-make-call-admin" class="chosen-select">
									<option value=""></option>
									<?php foreach( $this->admins as $admin ) {
										if( $this->id_admin == $admin->id_admin ){
											$phone = $admin->phone;
										}
										?>
									<option phone="<?php echo $admin->phone ?>" value="<?php echo $admin->id_admin; ?>"><?php echo $admin->name; ?> <?php if( $admin->community != '' ) { echo ' - ' . $admin->community; }; ?></option>
									<?php } ?>
								</select>
								<br/><br/>
							</div>
						</div>
					</div>
					<div class="row-fluid" style="<?php if( $this->id_admin ){ echo 'display:none'; } ?>">
						<div class="span12" style="text-align:center;">
						- or -
						</div>
					</div>
					<div class="row-fluid">
						<div class="span12">
							<div class="span4">
								<strong>Phone number</strong>
							</div>
							<div class="span7">
								<input type="text" value="<?php echo $phone; ?>" name="form-make-call-phone" id="form-make-call-phone"/>
								<br/><br/>
							</div>
						</div>
					</div>
					<div class="row-fluid">
						<div class="span12">
							<hr/>
						</div>
					</div>

<!--					<div class="row-fluid">-->
<!--						<div class="span12">-->
<!--							<div class="span4">-->
<!--								<strong>Are you calling to</strong>-->
<!--							</div>-->
<!--							<div class="span7">-->
<!--								<select id="form-make-call-to" name="form-make-call-to" class="chosen-select">-->
<!--									<option value="customer">customer</option>-->
<!--									<option --><?php //if( $this->id_admin ){ echo 'selected="selected"'; } ?><!-- value="driver">driver</option>-->
<!--									<option value="restaurant">restaurant</option>-->
<!--								</select>-->
<!--								<br/><br/>-->
<!--							</div>-->
<!--						</div>-->
<!--					</div>-->
					<div class="row-fluid">
						<div class="span12">
							<div class="span4"></div>
							<div class="span7">
								<i class="icon-spinner icon-spin form-make-call-spin" style="display:none;"></i>
								<button type="button" onclick="makeCall.start();" class="form-make-call-button btn btn-green"><i class="icon-phone"></i>&nbsp;Call </button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$( function(){
	$( '.chosen-select' ).select2();
	$( '#form-make-call-admin' ).change( function( event ) {
		var option = $( '#form-make-call-admin option:selected' );
		$( '#form-make-call-phone' ).val( option.attr( 'phone' ) );
	} );
} );
</script>