<script type="text/javascript">
function validate_restaurant(){

	
	
	
	if($("#name").val()==''){
		$("#msg_restaurant_error_message").html('Please enter name');
		$("#name").addClass('jquery_err');
		$("#name").focus();
		return false;
	}else{
		$("#msg_restaurant_error_message").html('');
		$("#name").removeClass('jquery_err');
	}
	
	
	
}



</script>
<!-- Content (Right Column) -->

<div id="content" class="box">
  <h1> Restaurant &raquo; Add Restaurant</h1>
  <?php if(isset($successMsg) && $successMsg!=''){ ?>
  <p class="msg done"><?php echo $successMsg; ?></p>
  <?php } ?>
  <?php if(isset($failedMsg) && $failedMsg!=''){ ?>
  <p class="msg error"><?php echo $failedMsg; ?></p>
  <?php } ?>
  <form action="" method="post" id="restaurantFrm" name="restaurantFrm" onsubmit="return validate_restaurant();" enctype="multipart/form-data">
    <?php if(isset($_REQUEST['id']) && $_REQUEST['id']!=''){ ?>
    <input type="hidden" id="id" name="id" value="<?php echo $restaurantDetail->id ?>" >
    <?php } ?>
    <!-- Login -->
    
    <p class="nomt"> <span class="smaller low message" id="msg_restaurant_error_message" style="font-weight:bold;">&nbsp;</span> </p>
    <div id="tab01" class="eng_tab">
      <fieldset>
        <legend>Basic Details</legend>
        <p class="nomt">
          <label for="inp-01" class="req">Full Name*:</label>
          <br />
          <input type="text" size="50" name="name" id="name" value="<?php echo $restaurantDetail->name; ?>" class="input-text-02" />
          <br/>
          <span class="smaller low message" id="msg_name">&nbsp;</span> </p>
          
         
        
        <p class="nomt">
          <label for="inp-01" class="req">Contact No*:</label>
          <br />
          <input type="text" name="contact_no" id="contact_no" class="input-text-02" value="<?php echo $restaurantDetail->contact_no; ?>" size="50" />
          <br/>
          <span class="smaller low message" id="msg_contact_no">&nbsp;</span> </p>
          
          
          <p class="nomt">
          <label for="inp-01" class="req">Address:</label>
          <br />
           <input type="text" name="address" id="address" class="input-text-02" value="<?php echo $restaurantDetail->address; ?>" size="50" />
          <br/>
          <span class="smaller low message" id="msg_address">&nbsp;</span> </p>
          
          
          <p class="nomt">
      <label for="inp-01" class="req">Restaurant Image :</label>
      <br />
      <input type="file" name="profile_image" id="profile_image" class="input-text-02"   />
      <?php if($restaurantDetail->profile_image!='' && file_exists(DIR_UPLOAD_BANNER.$restaurantDetail->profile_image)) {?>
      <img src="<?php echo DIR_UPLOAD_BANNER_SHOW.$restaurantDetail->profile_image ?>" width="100"/>
      <input type="hidden" id="uploaded_file" name="uploaded_file" value="<?php echo $restaurantDetail->profile_image;  ?>" />
      <?php } ?>
      <br/>
      <span class="smaller low message" id="msg_gallery_banner">&nbsp;</span> </p>
          <p class="nomb">
          <label for="inp-03" class="req">Added By :</label>
          <br />
          <select id="added_by" name="added_by" class="input-text-02">
          <?php foreach($userList as $user){ 
		    $userType = ($user->type == 1) ? 'Listener' : 'Restaurant Owner';
			?>
             <option value="<?php echo $user->id;?>" <?php if($restaurantDetail->added_by == $user->id){ echo 'selected="selected"';}?> ><?php echo  $user->name; echo " ( $userType )";?> </option>
          <?php } ?>
          </select>
          <br/>
          <span class="smaller low message" id="msg_status">&nbsp;</span> </p>
          
          
        <p class="nomb">
          <label for="inp-03" class="req">Status :</label>
          <br />
          <select id="status" name="status" class="input-text-02">
            <option value="0" <?php echo ($restaurantDetail->status==0) ? "selected='selected'" : "" ?>>Inactive</option>
            <option value="1" <?php echo (!isset($restaurantDetail->status) || $restaurantDetail->status==1) ? "selected='selected'" : "" ?>>Active</option>
          </select>
          <br/>
          <span class="smaller low message" id="msg_status">&nbsp;</span> </p>
      </fieldset>
    </div>
    <?php if(isset($restaurantDetail->id) && $restaurantDetail->id!=''){ ?>
    <p>
      <input type="submit" value="Edit Restaurant" id="submit" name="submit" class="input-submit" />
    </p>
    <?php }else{ ?>
    <p>
      <input type="submit" value="Add Restaurant" id="submit" name="submit" class="input-submit" />
    </p>
    <?php } ?>
    <input type="button" value="Cancel" id="cancel" name="cancel" class="input-submit" onclick="javascript:window.location='restaurantlist.php'" />
  </form>
</div>
<!-- /content --> 
