Jump to content

Message not appearing [SOLVED]


CarlosEduardo2409

Recommended Posts

Hello, I'm trying to customize the JumpSeat of Fltbook from web541. However when I go to select the airport for JumpSeat the price does not appear in the box. http://prntscr.com/gzzgwj (It was to appear where the red place is)

This is my code:

<div class="col-xs-6">
	<p>Cost:</p>
	<div class="input-group">
	   <input type="text" id="jump_purchase_cost" class="form-control" readonly>
	   <span class="input-group-addon"><i class="fa fa-dollar"></i></span>
	</div>
</div>

 

Original code:

<tr>
  <td align="center">Cost:</td>
  <td align="left"><div id="jump_purchase_cost"></div></td>
</tr>

 

Edited by CarlosEduardo2409
Link to comment
Share on other sites

  • Moderators

The original code has something like this too:

<tr>
            <td>Select An Airline:</td>
            <td>
                <select class="search" name="airline">
                    <option value="">All</option>
                    <?php
                        foreach ($airlines as $airline)
                            {echo '<option value="'.$airline->code.'">'.$airline->name.'</option>';}
                    ?>
                </select>
            </td>
        </tr>

Did you remove "class="search"" from the dropdown menu?

Link to comment
Share on other sites

Yes,

 

This is the whole code:

<?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?>
<?php
$pilotid        = Auth::$userinfo->pilotid;
$last_location  = FltbookData::getLocation($pilotid);
$last_name      = OperationsData::getAirportInfo($last_location->arricao);
if(!$last_location) {
  FltbookData::updatePilotLocation($pilotid, Auth::$userinfo->hub);
}
?>

<section class="content-header">
    <h1>Schedule Search</h1>
</section>

<!-- Main content -->
<section class="content">
    <!-- Main row -->
    <div class="row">
        <div class="col-md-12">
        <!-- Left col -->
            <form id="form" action="<?php echo url('/Fltbook');?>" method="post">	
                <div class="nav-tabs-custom">
                    <div class="box box-primary">
		        <div class="box-header with-border">
		            <h3 class="box-title">Schedule Search</h3>
		        </div>
                    <div class="tab-content">
                        <div class="box-body">
                            
                            <p>Select an airline:</p>
                            <div class="form-group">
                                <select name="airline" class="form-control">
                                <option value="">Select All</option>
                                <?php
                                  if(!$airlines) $airlines = array();
                                  foreach ($airlines as $airline) {
                                    echo '<option value="'.$airline->code.'">'.$airline->name.'</option>';
                                  }
                                ?>
                                </select>
                            </div>
                            
                            <p>Select an aircraft type:</p>
                            <div class="form-group">
                                <select name="aircraft" class="form-control">
                                <option value="">Select All</option>
                                <?php
						          $airc = FltbookData::routeaircraft($last_location->arricao);
						          if(!$airc) {
								     echo '<option>No Aircraft Available!</option>';
							      } else {
								     foreach ($airc as $air)
								  {
								  $ai = FltbookData::getaircraftbyID($air->aircraft);
					             ?>
							      <option value="<?php echo $ai->icao ;?>"><?php
							          echo $ai->name ;?></option>
					             <?php
								          }
							       }
                                 ?> 
                                </select>
                            </div>
                            
                            <p>Select arrival airfield:</p>
                            <div class="form-group">
                                <select name="arricao" class="form-control">
                                <option value="">Select All</option>
                                <?php
						          $airs = FltbookData::arrivalairport($last_location->arricao);
						          if(!$airs)
							     {
								      echo '<option>No Airports Available!</option>';
							     } else {
								    foreach ($airs as $air)
								 {
								    $nam = OperationsData::getAirportInfo($air->arricao);
									  echo '<option value="'.$air->arricao.'">'.$air->arricao.' - '.$nam->name.'</option>';
								  }
							      }
                                 ?>
                                </select>
                            </div>
                            
                            <div class="box-footer" align="center">
                            <tr class="form-group">
    	                    <td align="center" colspan="2">
                                <input type="hidden" name="action" value="search" />
                            <a href="<?php echo url('/Fltbook/bids'); ?>"><input type="button" class="btn btn-flat btn-primary" value="Minhas reservas"></a>
                                <input border="0" type="submit" name="submit" value="Buscar Voos" class="btn btn-flat btn-primary">
    	                    </td>
    	                    </tr>
    	                    </div>
    	                    
                        </div>
                        </div>
                        <!-- /.tab-pane -->
                        </div>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- nav-tabs-custom -->
        <!-- /.Left col -->
    </div>
    <!-- /.row (main row) -->
</section>
<!-- /.content -->

<!-- Main content -->
<section class="content">
    <!-- Main row -->
    <div class="row">
        <div class="col-md-12">
        <?php if($settings['search_from_current_location'] == 1) { ?>
            <form action="<?php echo url('/Fltbook/jumpseat');?>" method="post">
                    <div class="box box-primary">
		        <div class="box-header with-border">
		            <h3 class="box-title">Schedule Search</h3>
		        </div>
		        <div class="tab-content">
                    <div class="box-body">
                        
			<p>Destination</p>
			<div id="errors"></div>
			<select onchange="calculate_transfer(this.value)" name="depicao" class="form-control">
				<option selected disabled>Select a airport</option>
                    <?php
                    foreach($airports as $airport) {
                      if($airport->icao == $last_location->arricao) {
                        continue;
                      }
                      echo '<option value="'.$airport->icao.'">'.$airport->icao.' - '.$airport->name.'</option>';
                    }
                    ?>
		 	</select>
		 
		 <br>
		 
		 <div class="col-xs-6">
			<p>Cost:</p>
			<div class="input-group">
			<input type="text" id="jump_purchase_cost" class="form-control" readonly>
			<span class="input-group-addon"><i class="fa fa-dollar"></i></span>
		 	</div>
		 </div>
		 
		 <div class="col-xs-6">
			<p>Distance:</p>
			<div class="input-group">
			<input type="text" id="distance_travelling" class="form-control" readonly>
			<span class="input-group-addon"><i class="fa fa-star-o"></i></span>
		 	</select>
		 	</div>
		 </div>		 
       
       </div>
       		<div class="box-footer" align="center">
                <button type="submit" id="purchase_button" class="btn btn-flat btn-primary" disabled="disabled" form="jumpseat">Purchase Transfer!</button>
            </div>
       </div>
   <input type="hidden" name="cost">
   <input type="hidden" name="airport">
  </form>
  </div>
  </div>
  </section>

<script type="text/javascript">
function calculate_transfer(arricao) {
  var distancediv = $('#distance_travelling')[0];
  var costdiv     = $('#jump_purchase_cost')[0];
  var errorsdiv     = $('#errors')[0];
  errorsdiv.innerHTML = '';
  $.ajax({
    url: baseurl + "/action.php/Fltbook/get_jumpseat_cost",
    type: 'POST',
    data: { depicao: "<?php echo $last_location->arricao; ?>", arricao: arricao, pilotid: "<?php echo Auth::$userinfo->pilotid; ?>" },
    success: function(data) {
      data = $.parseJSON(data);
      console.log(data);
      if(data.error) {
        $("#purchase_button").prop('disabled', true);
        errorsdiv.innerHTML = "<font color='red'>Not enough funds for this transfer!</font>";
      } else {
        $("#purchase_button").prop('disabled', false);
        distancediv.innerHTML = data.distance + "nm";
        costdiv.innerHTML = "$" + data.total_cost;
      }
    },
    error: function(e) {
      console.log(e);
    }
  });
}
</script>
<?php } ?>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...