Jump to content

[ADD-ON] Disposable Hubs & Statistics Module


Recommended Posts

Disposable Hubs & Statistics Module


Disposable Hubs And Statistics Module for phpVMS v7

 

This module is compatible with the latest dev build as of 12APR2021, there is no need to modify any default files.
Technically all blade files (views/pages or whatever you call them) should work with your template but they are mainly designed for Bootstrap compatible themes (like Disposable Themes, Stisla etc). 

So if something looks weird in your template then you need to edit them.

 

***** Manual Installation Steps 

 

  • Upload contents of the package (or pull/clone from GitHub) to your root/modules/DisposableHubs folder
  • Go to admin section and enable the module, that's all
  • After enabling/disabling modules an app cache cleaning process is necessary (check admin/maintenance)

 

***** Usage

 

If you want to disable module auto links and add your own according to your template, then dashout 2 frontend link registration commands in the Providers\HubsServiceProvider.php file as shown below;
(Two forward slashes will make them disabled.)

 

// $this->moduleSvc->addFrontendLink('Hubs', '/dhubs', 'fas fa-calendar', $logged_in=true);
// $this->moduleSvc->addFrontendLink('Stats & Leaderboard', '/dstats', 'fas fa-cog', $logged_in=true);


Then you can add links to your navbar with below examples;

 

<li>
  <a class="nav-link" href="{{ route('DisposableHubs.hindex') }}">
    <i class="fas fa-paper-plane"></i>
    <span>Hubs</span>
  </a>
</li>

<li>
  <a class="nav-link" href="{{ route('DisposableHubs.dstats') }}">
    <i class="fas fa-calendar-alt"></i>
    <span>Statistics & LeaderBoards</span>
  </a>
</li>

 

Also having a direct link to a specific hub is possible with

 

<li>
  <a class="nav-link" href="{{ route('DisposableHubs.hshow', ['LTFM']) }}">
    <i class="fas fa-calendar-day"></i>
    <span>LTFM Hub</span>
  </a>
</li>

 

(Best way to add links in Laravel structure is to use routes like above, but plain html href="/dhubs/LTFM" is also possible)

 

You are free to edit any of the files as you wish, but please do not expect help/updates for the code you edited (controllers and providers)
I always try to provide info and support but can not fix things you broke ;) Just share your thoughts about any improvements so we can think together before changing things.

 

Enjoy,
Disposable
12.APR.2021


 

  • Thanks 1
Link to post
Share on other sites

Uploading a new version ;) 

 

To fix two errors;

  • Divison By Zero : Occurs when you have a fresh install with no pireps but want to see some stats
  • Editing Blades Not Possible as they should : Provider was looking for a non existing folder, fixed.

 

Now you can copy blades (files placed under modules\DisposableHubs\Resources\views) to your theme (yourtheme\modules\DisposableHubs) and edit there as you are supposed to.

 

And thanks for your kind thoughts, hope you find it usefull and enjoy using.

Link to post
Share on other sites
11 hours ago, lorlandi said:

Only one question, Hub PIREPs shows the total airports flights or only those of the last month.

Regards

 

All 

 

That widget is not designed to use a period, so it will list all your pireps departing/arriving to the airport. I do not remember if i limited it with some max number (like last 50) but if needed we can add a time limiting option to it. ( Widget belongs to DisposableTools module btw, it is not a part of the Hubs module)

Link to post
Share on other sites

Thanks again for your answer, but i have an issue on HUB Details ->HUB PIREPS.

I have 3 Hubs and on click HUB PIREPS this message appears "Nothing To Display!" instead on the flight page (Dashboard), when selecting the same airport like HUB PIREPS, the reports appear without problems.

This issue is for all HUBS. The following photos are from the same airport. First one HUB Pireps from SCEL and the second one on flight page (Dashboard) from SCEL also.

Hub_airport.jpg

airport_stats.jpg

Edited by lorlandi
add information
Link to post
Share on other sites
2 hours ago, lorlandi said:

Thanks again for your answer, but i have an issue on HUB Details ->HUB PIREPS.

I have 3 Hubs and on click HUB PIREPS this message appears "Nothing To Display!" instead on the flight page (Dashboard), when selecting the same airport like HUB PIREPS, the reports appear without problems.

This issue is for all HUBS. The following photos are from the same airport. First one HUB Pireps from SCEL and the second one on flight page (Dashboard) from SCEL also.

 

 

This is really strange ... Technically both pages do use (should use) the same widget (DisposableTools -> AirportPireps) and they do read the same data.

 

Here is what i have , one from hub page for LTAI , second (smaller) one is from airports page for LTAI.

 

hub_ltai.thumb.png.71e5bbf483eefc9e704b6030f1bcdf06.png

 

airport_ltai.png.cc9923c5d08ba3f8b1746503410c145e.png

 

How do you insert your airports to your database ? What i can think of is for example the id of that airport is in lowercase like scel but the icao code is in uppercase like SCEL. And in pireps page , i do use the id with $hub->id , if it is not in proper format (rare but may happen) then hubs page will show No Pireps but in airports page we may be using it like $airport->icao (which will be in proper format).

 

Kind of technical difference but this is the only thing I can think of.

 

Link to post
Share on other sites

Data base is in the correct format (uppercase)  like the screen.

Also i don´t understand.....

Just a last question about the code on Widgets/Airportpireps

 

<?php

namespace Modules\DisposableTools\Widgets;

use App\Contracts\Widget;
use App\Models\Pirep;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;

class AirportPireps extends Widget
{
  protected $config = ['location' => 'ZZZZ'];  ------> That is Correct?

  public function run()
  {
    $pireps = Pirep::where('dpt_airport_id', $this->config['location'])
                ->where('state', PirepState::ACCEPTED)
                ->where('status', PirepStatus::ARRIVED)
                ->orWhere('arr_airport_id', $this->config['location'])
                ->where('state', PirepState::ACCEPTED)
                ->where('status', PirepStatus::ARRIVED)
                ->orderBy('submitted_at', 'desc')
                ->get();

    return view('DisposableTools::airport_pireps', [
      'pireps' => $pireps,
      'config' => $this->config,
      ]);
  }
}

 

-------------------------------------------------------------------------------------------------------------------------------

Any way, for now that issue is not important just a detail. I'll wait for future version and test.

Thanks for your time and work.

 

Regards

Luis

table.jpg

Link to post
Share on other sites
11 hours ago, lorlandi said:


  protected $config = ['location' => 'ZZZZ'];  ------> That is Correct?

 

 

Yes, it is a the default airport code , used only when you do not provide any location to the widget ... Think it like a failsafe protection.


 

@widget('Modules\DisposableTools\Widgets\AirportPireps') <-- Widget used without any config (location), then the ZZZZ is used to prevent errors and/or to provide something as default.

@widget('Modules\DisposableTools\Widgets\AirportPireps', ['location' => 'SCEL']) <-- Widget used with a fixed (manually entered airport) , ZZZZ is not used anymore

@widget('Modules\DisposableTools\Widgets\AirportPireps', ['location' => $hub->id]) <-- Widget used with in a page/view where the $hub and $hub->id is dynamic

@widget('Modules\DisposableTools\Widgets\AirportPireps', ['location' => $hub->icao]) <-- Widget used with in a page/view where the $hub and $hub->icao is dynamic

 

If i can replicate the issue you are facing, i will be more than happy to provide an update/solution but first I really need to replicate it on my end :(

Link to post
Share on other sites

Well i just change in DisposableHubs/Resources/views/show.blade  @widget('Modules\DisposableTools\Widgets\AirportPireps', ['location' => $hub->id])   for this sentence   @widget('AirportPireps', ['location' => $hub->id])  and now it's works good.

 

Also tried changing with above options with the same result "Nothing To Display!" and deleting protected $config = ['location' => 'ZZZZ']; ---->'config' => $this->config, with no changes.

Any way i'll continue looking for some issue by my side.

Thanks a lot again.

 

Regards

Luis

Edited by lorlandi
Link to post
Share on other sites

If you still have old widgets installed @widget('AirportPireps', ['location' => $hub->id]) works. Old widgets do use phpvms core application folders, like app\Widgets, new ones do have their own namespace and folders (like modules\DisposableTools\Widgets) ... 

 

From readme_disposable_tools.txt file

 

Note for old version users:

Please remove the old files from app\Widgets and resources\views\layouts\your_theme\widgets folders after switching your blades to new version.
No need to have the old files installed under phpvms folders
There will be no updates for old versions and future updates to my theme will NOT use old version widgets. 

 

I still do not think that having them will cause any problems 'cause they use different namespaces but using similar widget names may cause some conflicts and they can block each other. So simply to be safe, i suggest disabling/deleting old version widgets if you have the new ones and adjusted your blades according to new widgets.

 

As i tried to explain earlier, that protected config was not your problem, deleting it will cause more problems not solve any.

Link to post
Share on other sites
  • 1 month later...
Posted (edited)
12 hours ago, fullmetalsleeve said:

So, everytime I click on Hubs or My Hub I get:

 

Because one of your hubs (or maybe all of them) does not follow phpVms v7 standards, Country names should use 2 letter ISO country codes (not full names).

 

In your example; United States is NOT a valid ISO country code, it is a name, it should be US.

 

And as a side note, this is not a theme/skin issue but a module issue which has its own topic for support.

Edited by ProAvia
Moved to correct topic 😊
  • Like 1
Link to post
Share on other sites
18 hours ago, DisposableHero said:

 

Because one of your hubs (or maybe all of them) does not follow phpVms v7 standards, Country names should use 2 letter ISO country codes (not full names).

 

In your example; United States is NOT a valid ISO country code, it is a name, it should be US.

 

And as a side note, this is not a theme/skin issue but a module issue which has its own topic for support.

Alrighty, thanks

  • Like 1
  • Thanks 1
Link to post
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...