Jump to content

FltbookSystem issue


MrDalle

Recommended Posts

hey folks!

im working rnw on the new Virtual Airline System for FSCloud.

I want to build in web541 Version of his FLTbook System. I moved al the files created the all entries. Page is working but when i try to book a flight the window where you can chose the plane pops up but always close immediately. I didn't changed the code or styled anything..

Im using the php branch ( https://github.com/web541/FltbookSystem/tree/php ) and phpvms 5.5.2

Hope you can help!

ps: is this fltbooking system working with smartCARS ?

Link to comment
Share on other sites

  • Moderators

I would ask this directly from the developer for support and FBS doesn't have anything to do with your ACAR software unless it uses FBS for booking the flight.

PS: There might be a chance your browser's blocking popups or you have some kind of a popup blocker add-on installed.

Edited by parkho
Link to comment
Share on other sites

I believe you're trying to say that the pop-up window (modal) doesn't stay open, is this correct?

If so, go into core/templates/Fltbook/search_results.php page and find this at the top

<script type="text/javascript" src="<?php echo SITE_URL;?>/lib/js/bootstrap.js"></script>

And replace it with this (if you already have bootstrap referenced in your master template)

<script type="text/javascript>
 // Clear Modal On Hide
 // ===================
// no cache data loaded to modal popup (by default it's cached)
$('body').on('hidden.bs.modal', '.modal', function (event) {
  $(this).removeData('bs.modal');
});

$(document).on("hidden.bs.modal", function (e) {
 $(e.target).removeData("bs.modal").find(".modal-content").empty();
});
</script>

If that doesn't work, try removing one of the $(document) or $('body') sections and see if it works.

And that should work (clears the bootstrap modal cache on exit which isn't done automatically).

And to get it to work with smartCARS, there is a specific line in their code which you have to add (can't remember off the top of my head) but it was something to do with the bidding of the flights and setting the aircraft to the aircraftid in a foreach or something, might be better to ask the developer of smartCARS.

Beware that some of the code is a bit messy to work with phpVMS (can be re-written, but don't have time atm) but it does work if done the right way.

Link to comment
Share on other sites

Working like charm now! thanks!! :) im using a modified version of the "CrewCenter" skin so it was that double bootstrap which couses errors..

Do i need to install Parkhos fuel Calculator to get this working too?...

- https://github.com/parkho/FuelCalculator.V1.2

i wrote to TFDI design and they told me so long the bids are added into the "standard" phpvms page (/index.php/schedules/bids) it will also show up in the smartCARS client.

Edited by MrDalle
Link to comment
Share on other sites

Working like charm now! thanks!! :) im using a modified version of the "CrewCenter" skin so it was that double bootstrap which couses errors..

Do i need to install Parkhos fuel Calculator to get this working too?...

- https://github.com/p...Calculator.V1.2

i wrote to TFDI design and they told me so long the bids are added into the "standard" phpvms page (/index.php/schedules/bids) it will also show up in the smartCARS client.

np :P

In regards to the fuel calculator, that is not needed to operate this module due to the "wacky" code going one, but if you want something more decent, then you could merge the two.

If thats what TFDI said, then you should be fine, as said before, can't remember the change (if any) I had to make.

Link to comment
Share on other sites

  • 2 weeks later...

The module is working fine but cant handle a big database.. i had to remove it couse of 505 erorrs or dealing with loading times over 1min.. Im now using a modified Schedule Search Module so our pilots can also book flights on our Website.

ps: smartCars Bids are working with WEB541 and Parkhos version! :)

Edited by MrDalle
Link to comment
Share on other sites

  • 1 month later...
  • Moderators
1 hour ago, web541 said:

Can you explain more about this issue please.

Well for example... If I went since SCEL to SCSE with an A319 (CC-AJG), the aircraft (CC-AJG) must be in SCSE, but when I go to book a flight, the aircraft still appear in SCEL and in all flights and aiport of the airline.

Link to comment
Share on other sites

  • 7 months later...

I've never tried it before as it is not what the module is designed to do, but I guess a few edits can be made. I don't have time to do it at the moment (I'll post when I can), but you'd have to change the schedule_searchform.php file to allow all aircraft to show in the dropdown, make a data.class function to fetch all aircraft types then remove some code in the Fltbook.php file to allow the aircraft to be parsed.

After that's done, it should work fine.

 

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I am also using this great module, I just love it. Only one problem, or you cant call it a problem.

The dropdown list items are taking about a minute to load, which will cause the site responds very slowly.

Do you have any idea on how to fix this?

 

Kindly regards,

 

Rick

Link to comment
Share on other sites

15 hours ago, ncd200 said:

Hello,

I am also using this great module, I just love it. Only one problem, or you cant call it a problem.

The dropdown list items are taking about a minute to load, which will cause the site responds very slowly.

Do you have any idea on how to fix this?

 

Kindly regards,

 

Rick

Which dropdown lists (all of them)? Also, how many airports and aircraft types (so not every registration, but each type e.g. B738, B744) do you have in your database? I have a feeling it's loading in way too much information for it to handle, and it may be easier to transform them into text boxes, but just confirm the questions above first.

Link to comment
Share on other sites

On 11-9-2017 at 11:20 PM, web541 said:

Which dropdown lists (all of them)? Also, how many airports and aircraft types (so not every registration, but each type e.g. B738, B744) do you have in your database? I have a feeling it's loading in way too much information for it to handle, and it may be easier to transform them into text boxes, but just confirm the questions above first.

found the problem, it was in my airport list.

As vacentral is down and the system is unable to fetch airports i have installed a list found here.

I am removing many airports from this list now, allready 8000 now.

Now the site loads faster.

 

 

Thanks for the help

Link to comment
Share on other sites

  • 1 month later...

@ncd200

Go into core/templates/Fltbook/search_results.php page and find this at the top

<script type="text/javascript" src="<?php echo SITE_URL;?>/lib/js/bootstrap.js"></script>

And replace it with this (if you already have bootstrap referenced in your master template)

<script type="text/javascript>
 // Clear Modal On Hide
 // ===================
// no cache data loaded to modal popup (by default it's cached)
$('body').on('hidden.bs.modal', '.modal', function (event) {
  $(this).removeData('bs.modal');
});

$(document).on("hidden.bs.modal", function (e) {
 $(e.target).removeData("bs.modal").find(".modal-content").empty();
});
</script>

 

This answer is here in the topic, in the same topic, just go up

Edited by CarlosEduardo2409
Link to comment
Share on other sites

Ohh, thousand pardons, had not seen. Silly questions, did you insert the sql into your database? What version is your php and phpVMS? Are you using Fltbook version 2? Is the file right? Ex: php or tpl

Can you take a photo of what is showing up and put your file confirmbid.php here to see?

And another silly question, in that code that I spoke up to change you corrected an error that was missing a quote in <script type="text/javascript>?

Edited by CarlosEduardo2409
Link to comment
Share on other sites

I have installed the sql, I am using the php version. 

My code from the schedule_results is allmost default now cause of a clean install after trying everything.

I have removed one line that was causing errors with my template. 

Quote

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
 

 

Quote

<div class="app-content content container-fluid">
      <div class="content-wrapper">
        <div class="content-header row">
        </div>
        <section id="basic-alerts">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Avaiable flights</h4>
                    <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
                    <div class="heading-elements">
                        <ul class="list-inline mb-0">
                            <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
                            <li><a data-action="reload"><i class="icon-reload"></i></a></li>
                            <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
                            <li><a data-action="close"><i class="icon-cross2"></i></a></li>
                        </ul>
                    </div>
                </div>
                <div class="card-body collapse in">
                    <div class="card-block">


<?php
$pilotid = Auth::$userinfo->pilotid;
$last_location     = FltbookData::getLocation($pilotid);
$last_name = OperationsData::getAirportInfo($last_location->arricao);
?>
<!-- Bootstrap - Latest compiled and minified CSS -->

<!-- Pagination => Enable it via the module settings -->
<?php if($settings['pagination_enabled'] == 1) { ?>
<style>
div.dataTables_paginate {
  float: right;
    margin-top: -25px;
}
div.dataTables_length {
    float: left;
    margin: 0;
}
div.dataTables_filter {
    float: right;
    margin: 0;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script type="text/javascript" src="<?php echo fileurl('lib/js/jquery.dataTables.js');?>"></script>
<script type="text/javascript" src="<?php echo fileurl('lib/js/datatables.js');?>"></script>
<script type="text/javascript" src="<?php echo fileurl('lib/js/dataTables.bootstrap.min.js');?>"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
  $('#schedules_table').dataTable( {
  "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ]
} )});
</script>
<?php } ?>
<!-- Latest compiled and minified JavaScript - Modified to clear modal on data-dismiss -->
<script type="text/javascript" src="<?php echo SITE_URL; ?>/lib/js/bootstrap.js"></script>
<br />

<table id="schedules_table" class="table" width="100%">
<?php
if(!$allroutes) {
    echo '<tr><td align="center">No flights found!</td></tr>';
} else {
?>
<thead>
    <tr id="tablehead">
        <th>Airline</th>
        <th>Flight Number</th>
        <th>Origin</th>
        <th>Destination</th>
        <th>Aircraft</th>
        <th>Options</th>
        <?php if($settings['show_details_button'] == 1) { ?>
        <th style="display: none;">Details</th>
        <?php } ?>
    </tr>
</thead>
<tbody>
<?php
foreach($allroutes as $route) {
    if($settings['disabled_ac_sched_show'] == 0) {
        # Disable 'fake' aircraft to get hide a lot of schedules at once
        $aircraft = FltbookData::getAircraftByID($route->aircraftid);
        if($aircraft->enabled != 1) {
            continue;
        }
    }

    if(Config::Get('RESTRICT_AIRCRAFT_RANKS') == 1 && Auth::LoggedIn()) {
        if($route->aircraftlevel > Auth::$userinfo->ranklevel) {
            continue;
        }
    }
?>
<tr style="height: 12px; font-size: 14px; font-weight: normal;">
    <td width="16.5%" valign="middle"><img src="<?php echo SITE_URL; ?>/lib/images/airlinelogos/<?php echo $route->code;?>.png" alt="<?php echo $route->code;?>"></td>
    <td width="16.5%" align="center" valign="middle"><?php echo $route->code . $route->flightnum?></td>
    <td width="16.5%" align="center" valign="middle"><?php echo $route->depicao ;?></td>
    <td width="16.5%" align="center" valign="middle"><?php echo $route->arricao ;?></td>
    <td width="16.5%" valign="middle"><?php echo $route->aircraft ;?>
        <div class="vertical-align-text pull-right" style="padding-left: 6px;">
        <div class="font-small pull-right"><?php echo $route->flighttime; ?>h</div>
        <div class="font-small"><?php echo round($route->distance, 0, PHP_ROUND_HALF_UP); ?>nm</div>
    </div>
  </td>
  <td width="16.5%" align="center" valign="middle">
     <?php if($settings['show_details_button'] == 1) { ?>
     <input type="button" value="Details" class="btn btn-warning" onclick="$('#details_<?php echo $route->flightnum;?>').toggle()">
     <?php } ?>
     <?php
     $aircraft = OperationsData::getAircraftInfo($route->aircraftid);
     $acbidded = FltbookData::getBidByAircraft($aircraft->id);
     $check    = SchedulesData::getBidWithRoute(Auth::$userinfo->pilotid, $route->code, $route->flightnum);

    if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) {
         echo '<div class="btn btn-danger btn-sm disabled">Booked</div>';
     } elseif($check) {
         echo '<div class="btn btn-danger btn-sm disabled">Booked</div>';
     } else {
         echo '<a data-toggle="modal" href="'.SITE_URL.'/action.php/Fltbook/confirm?id='.$route->id.'&airline='.$route->code.'&aicao='.$route->aircrafticao.'" data-target="#confirm" class="btn btn-success btn-md">Book</a>';
     }
     ?>
  </td>
<?php if($settings['show_details_button'] == 1) { ?>
<td colspan="6" id="details_<?php echo $route->flightnum; ?>" style="display: none;" width="100%">
    <table class="table table-striped">
        <tr>
            <th align="center" bgcolor="black" colspan="6"><font color="white">Flight Briefing</font></th>
        </tr>
        <tr>
            <td>Departure:</td>
            <td colspan="2"><strong>
                <?php
                $name = OperationsData::getAirportInfo($route->depicao);
                echo "{$name->name}";
                ?></strong>
            </td>
            <td>Arrival:</td>
            <td colspan="2"><strong>
                <?php
                $name = OperationsData::getAirportInfo($route->arricao);
                echo "{$name->name}";
                ?></strong>
            </td>
        </tr>
        <tr>
            <td>Aircraft</td>
            <td colspan="2"><strong>
                <?php
                $plane = OperationsData::getAircraftByName($route->aircraft);
                echo $plane->fullname;
                ?></strong>
            </td>
            <td>Distance:</td>
            <td colspan="2"><strong><?php echo $route->distance.Config::Get('UNITS'); ?></strong></td>
        </tr>
        <tr>
            <td>Dep Time:</td>
            <td colspan="2"><strong><font color="red"><?php echo $route->deptime?> UTC</font></strong></td>
            <td>Arr Time:</td>
            <td colspan="2"><strong><font color="red"><?php echo $route->arrtime?> UTC</font></strong></td>
        </tr>
        <tr>
            <td>Altitude:</td>
            <td colspan="2"><strong><?php echo $route->flightlevel; ?> ft</strong></td>
            <td>Duration:</td>
            <td colspan="2">
                <font color="red">
                <strong>
                <?php
                $dist = $route->distance;
                $speed = 440;
                $app = $speed / 60;
                $flttime = round($dist / $app,0) + 20;
                $hours = intval($flttime / 60);
                $minutes = (($flttime / 60) - $hours) * 60;

                if($hours > "9" AND $minutes > "9") {
                    echo $hours.':'.$minutes ;
                } else {
                    echo '0'.$hours.':0'.$minutes ;
                }
                ?> Hrs
                </strong>
            </font>
            </td>
        </tr>
        <tr>
            <td>Days:</td>
            <td colspan="2"><strong><?php echo Util::GetDaysLong($route->daysofweek); ?></strong></td>
            <td>Price:</td>
            <td colspan="2"><strong>$<?php echo $route->price ;?>.00</strong></td>
        </tr>
        <tr>
            <td>Flight Type:</td>
            <td colspan="2"><strong>
            <?php
            if($route->flighttype == "P") {
                echo 'Passenger';
            } elseif($route->flighttype == "C") {
                echo 'Cargo';
            } elseif($route->flighttype == "H") {
                echo 'Charter';
            } else {
                echo 'Passenger';
            }
            ?>
            </strong></td>
            <td>Times Flown</td>
            <td colspan="2"><strong><?php echo $route->timesflown ;?></strong></td>
        </tr>
         
    </table>
</td>
<?php } ?>
</tr>
<div class="modal fade" id="confirm">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
      </div>
    </div>
  </div>
</div>
<?php
/* END OF ONE TABLE ROW */
}
}
?>
</tbody>
</table>
</div>
<hr>
<center><a href="<?php echo url('/Fltbook') ;?>"><input type="submit" class="btn btn-primary" name="submit" value="Back to Flight Booking" ></a></center></div>
<br />

 

Link to comment
Share on other sites

negative sir,

Posted below is my confirm bid

 

Quote

<style>
.sharp {
    border-radius: 0;
    margin-left: 3px;
    margin-right: 3px;
}
</style>
<div class="container-fluid">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title">Confirm Booking</h4>
    </div>
    <div class="modal-body">
      <h3>Select Aircraft Registration</h3>
    <form action="<?php echo url('/Fltbook/addbid'); ?>" method="post">
        <select class="form-control" name="aircraftid" id="aircraftid">
            <option value="" selected disabled>Select Your Aircraft</option>
            <?php
            $allaircraft = FltbookData::getAllAircraftFltbook($airline, $aicao);
            foreach($allaircraft as $aircraft) {
                # If Aircraft is disabled, remove it from the list
                if($settings['disabled_ac_allow_book'] == 1) {
                    if($aircraft->enabled != 1) {
                        continue;
                    }
                }
                # If Aircraft is has been booked, remove it from the list
                if($settings['show_ac_if_booked'] == 0) {
                    $acbidded = FltbookData::getBidByAircraft($aircraft->id);
                    if($acbidded) { continue; }
                }

                $icaoairline = "{$aircraft->icao}{$airline}";
                if($aircraft->registration == $icaoairline) {
                    echo '';
                } else {
                    echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->registration.' - '.$aircraft->icao.' - '.$aircraft->name.'</option>';
                }
            }
            ?>
        </select>
          <hr />
          <input type="hidden" name="routeid" value="<?php echo $routeid; ?>" />
          <input type="submit" name="submit" class="btn btn-success" value="Book" />
          <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
    </form>
  </div>
</div>
 

 

Link to comment
Share on other sites

12 hours ago, ncd200 said:

Ok another problem.

Also I have now the problem that the popup for aircraft selection dissappears directly.

I have tried to use the options given above but I can't figure it out.

I know it is a js problem.

Any ideas?

Rick

So it opens, but it closes immediately before you see anything (small white flash)?

Are you using phpVMS 5.5.x & fltbook version 2? Also, are you using bootstrap in your skin?

If so, try replacing this line

https://github.com/web541/phpVMS-FltbookSystem-v2/blob/master/core/templates/fltbook/search_results.php#L38

with this

<script type="text/javascript>
 // Clear Modal On Hide
 // ===================
// no cache data loaded to modal popup (by default it's cached)
$('body').on('hidden.bs.modal', '.modal', function (event) {
  $(this).removeData('bs.modal');
});
</script>

Only that one. Sometimes there are conflicts if you are already using bootstrap in your site.

Link to comment
Share on other sites

I must take a look tomorrow. But maybe I can fix it. I just found out there are also modals integrated in my template. So if I change the code from the modal. Maybe that works. Don't know but it is worth the try.

 

I want this flight booking working cause it is the best I know of.

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...