Skip to content

Commit

Permalink
patch on installation process and messages. improvements around pendi…
Browse files Browse the repository at this point in the history
…ng configurations info
  • Loading branch information
xaviqv committed Jan 14, 2018
1 parent 8c58dd9 commit de06729
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 53 deletions.
18 changes: 13 additions & 5 deletions src/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
namespace PanicHD\PanicHD\Controllers;

use App\Http\Controllers\Controller;
use PanicHD\PanicHD\Models;
use PanicHD\PanicHD\Models\Agent;
use PanicHD\PanicHD\Models\Category;
use PanicHD\PanicHD\Models\Ticket;

class DashboardController extends Controller
{
public function __construct()
{
$this->middleware('PanicHD\PanicHD\Middleware\EnvironmentReadyMiddleware');
}

public function index($indicator_period = 2)
{
$tickets_count = Ticket::count();
if(Models\Agent::count() == 0
or Models\Category::count() == 0
or Models\Priority::count() == 0
or Models\Status::count() == 0){

// Show pending configurations message
return redirect()->route('panichd.install.index');
}

// Load Dashboard info

$tickets_count = Ticket::count();
$open_tickets_count = Ticket::whereNull('completed_at')->count();
$closed_tickets_count = $tickets_count - $open_tickets_count;

Expand Down
62 changes: 38 additions & 24 deletions src/Controllers/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use PanicHD\PanicHD\Models;
use PanicHD\PanicHD\Models\Agent;
use PanicHD\PanicHD\Models\Category;
use PanicHD\PanicHD\Models\Setting;
Expand All @@ -32,18 +33,22 @@ public function __construct()

public function index()
{
if (session()->has('current_status') and session('current_status') == 'installed'){
return view('panichd::install.status', [
'title' => trans('panichd::install.just-installed'),
'description' => trans('panichd::install.installed-package-options'),
'options' => [
'<a href="'.route(Setting::grab('admin_route').'.category.index').'">'.trans('panichd::install.package-link-categories').'</a>',
'<a href="'.route(Setting::grab('main_route').'.index').'">'.trans('panichd::install.package-link-new-ticket').'</a>',
]
]);
if (session()->has('current_status')){
switch (session('current_status')){
case 'installed':
return view('panichd::install.status', [
'title' => trans('panichd::install.just-installed'),
'description' => trans('panichd::install.installed-package-description', ['panichd' => url('panichd/')])
]);
break;
case 'upgraded':
return view('panichd::install.status', [
'title' => trans('panichd::install.upgrade-done')
]);
break;
}
}else{
$inactive_migrations = $this->inactiveMigrations();
$inactive_settings = $this->inactiveSettings();

if (count($this->migrations_tables) == count($inactive_migrations)
|| in_array('2017_12_25_222719_update_panichd_priorities_add_position', $this->inactiveMigrations())
Expand All @@ -52,24 +57,33 @@ public function index()

$inactive_migrations = $this->inactiveMigrations();
return view('panichd::install.index', compact('inactive_migrations'));
}elseif($inactive_settings and count($inactive_settings) > 0){
}else{
$inactive_settings = $this->inactiveSettings();

// Panic Help Desk requires an upgrade
if (Agent::isAdmin()){
return view('panichd::install.upgrade', compact('inactive_migrations', 'inactive_settings'));
if($inactive_settings and count($inactive_settings) > 0){
// Panic Help Desk requires an upgrade
if (Agent::isAdmin()){
return view('panichd::install.upgrade', compact('inactive_migrations', 'inactive_settings'));
}else{
return view('panichd::install.status', [
'title' => trans('panichd::install.package-requires-update'),
'description' => trans('panichd::install.package-requires-update-info'),
]);
}

}elseif(Models\Agent::count() != 0
and Models\Category::count() != 0
and Models\Priority::count() != 0
and Models\Status::count() != 0){
// Panic Help Desk is OK: Redirect to dashboard
return redirect()->route('dashboard');
}else{
return view('panichd::install.status', [
'title' => trans('panichd::install.package-requires-update'),
'description' => trans('panichd::install.package-requires-update-info'),
// Panic Help Desk requires some configuration to allow ticket creation
return view('panichd::install.configurations_pending', [
'title' => trans('panichd::install.pending-settings'),
'description' => trans('panichd::install.pending-settings-description'),
]);
}

}else{
// Panic Help Desk status is OK: Show package status info
return view('panichd::install.status', [
'title' => trans('panichd::install.package-status-ok'),
'description' => '',
]);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/Translations/ca/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@
'optional-quickstart-data' => 'Afegir paràmetres d\'inici ràpid:<ul><li>Inclou prioritats i estats bàsics i una categoria de tiquets.</li><li>El teu compte d\'usuari s\'afegirà com a agent a la categoria creada.</li><li>Tots son modificables després de la instal·lació.</li></ul>',
'install-now' => 'Instal·lar ara!',

'just-installed' => 'Felicitats! Ja tens <b>instal·lat i configurat</b> Panic Help Desk.',
'installed-package-options' => 'A partir d\'ara pots accedir quan vulguis a :panichd per controlar l\'estat de la llibreria. Altres accions que pots fer ara:',
'package-link-categories' => 'Administrar les categories de tiquets',
'package-link-new-ticket' => 'Crear un nou tiquet',
'just-installed' => 'Felicitats! Ja tens Panic Help Desk <b>instal·lat i configurat</b>.',
'installed-package-description' => 'A partir d\'ara pots accedir quan vulguis a <a href=":panichd">:panichd</a> per controlar l\'estat de la llibreria.',
'continue-to-main-menu' => 'Continuar al menú principal',

'package-requires-update' => 'Panic Help Desk requereix <b>configurar una actualització</b>',
'package-requires-update-info' => 'L\'Administrador ha instal·lat una actualització de Panic Help Desk però no ha acabat de configurar-la. Si us plau espera que el procés hagi acabat',

'status-out-of-date' => '<b>Estat actual: Fora de línia</b> fins que s\'instal·li la darrera actualització',
'about-to-update' => 'Aquest és el <b>menú d\'actualització</b> de Panic Help Desk',
'about-to-update-description' => 'Once you click on the "Upgrade now" button, the following changes are going to be done:',
'about-to-update-description' => 'Un cop facis clic al botó "Actualitzar ara", es farà els següents canvis:',
'all-tables-migrated' => 'No hi ha actualitzacions pendents de la base de dades així que no s\'executarà cap migració.',

'choose-public-folder-action' => 'Has fet modificacions als fitxers del directori "public/vendor/panichd"? Vols fer-ne una còpia de seguretat?',
'public-folder-destroy' => 'No (Opció recomanada)',
'public-folder-backup' => 'Si. Fer còpia de seguretat del directori abans de copiar els fitxers nous',

'upgrade-now' => 'Upgrade now!',
'upgrade-now' => 'Actualitzar ara!',

'upgrade-done' => 'L\'actualització ha acabat correctament.',

'package-status-ok' => 'La llibreria està correctament configurada',
'pending-settings' => 'Encara hi ha alguna <b>configuració pendent</b>',
'pending-settings-description' => 'Abans de poder afegir nous tiquets, t\'has d\'assegurar que tens almenys un estat, prioritat, categoria i un agent que hi estigui assignat.',

'master-template-file' => 'fitxer de plantilla mestra',
'master-template-other-path' => 'Una altra ruta d\'accés al fitxer de plantilla mestra',
'master-template-other-path-ex' => 'ex. views/layouts/app.blade.php',
'migrations-to-be-installed' => 'S\'instal·laran aquestes migracions:',

'another-file' => 'un altre arxiu',
'upgrade' => 'Actualització de la versió de Panic Help Desk',
'settings-to-be-installed' => 'S\'instal·laran aquests ajustos:',
Expand Down
13 changes: 6 additions & 7 deletions src/Translations/en/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
'optional-quickstart-data' => 'Add quickstart configuration:<ul><li>Add essential priorities, statuses and a new category.</li><li>Current user will be added as an agent on that category.</li><li>All of them are editable after installation.</li></ul>',
'install-now' => 'Install now!',

'just-installed' => 'Congratulations! You have Panic Help Desk <b>installed and configured</b>.',
'installed-package-options' => 'From now you may access whenever you want to :panichd to control package status. Some actions you may do now are:',
'package-link-categories' => 'Manage ticket categories',
'package-link-new-ticket' => 'Create a new ticket',
'just-installed' => 'Congratulations! You have <b>installed and configured</b> Panic Help Desk.',
'installed-package-description' => 'From now you may access whenever you want to <a href=":panichd">:panichd</a> to control package status.',
'continue-to-main-menu' => 'Continue to main menu',

'package-requires-update' => 'Panic Help Desk requires to <b>configure an upgrade</b>',
'package-requires-update-info' => 'The administrator has installed a Panic Help Desk upgrade but has not finished configuring it. Please wait until the process has ended',
Expand All @@ -35,17 +34,17 @@
'public-folder-destroy' => 'No (Recommended option)',
'public-folder-backup' => 'Yes. Make a directory backup before copying the new files',


'upgrade-now' => 'Upgrade now!',

'upgrade-done' => 'The upgrade has finished correctly',

'package-status-ok' => 'The package is correctly configured',
'pending-settings' => 'There are still some <b>configurations pending</b>',
'pending-settings-description' => 'Before you can add new tickets, you must ensure that you have at least one status, priority, category and an agent assigned to it.',

'master-template-file' => 'Master template file',
'master-template-other-path' => 'Other path to the master template file',
'master-template-other-path-ex' => 'ex. views/layouts/app.blade.php',
'migrations-to-be-installed' => 'These migrations will be installed:',

'another-file' => 'another File',
'upgrade' => 'Panic Help Desk version upgrade', // New v0.2.3
'settings-to-be-installed' => 'These settings will be installed:', // New v0.2.3
Expand Down
18 changes: 18 additions & 0 deletions src/Views/install/configurations_pending.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@extends($master)

@section('page')
{{ trans('panichd::admin.index-title') }}
@stop

@include('panichd::shared.common')

@section('content')
<div class="panel panel-default">
<div class="panel-heading"><h3>{!! $title !!}</h3></div>
<div class="panel-body">
@if(isset($description))
<p>{!! $description !!}</p>
@endif
</div>
</div>
@stop
16 changes: 8 additions & 8 deletions src/Views/install/status.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@extends('panichd::install.partials.html')

@section('content')
<!--<h3>{{ trans('panichd::install.initial-setup') }}</h3>-->
<h3 style="margin: 0.8em 1em 0.8em 0em;">{!! $title !!}</h3>
<p>{{ $description }}</p>
@if (isset($options) && is_array($options))
<ul>
@foreach($options as $opt)
<li>{!! $opt !!}</li>
@endforeach
</ul>
@if(isset($description))
<p>{!! $description !!}</p>
@endif
{!! link_to_route(
'dashboard',
isset($button_text) ? $button_text : trans('panichd::install.continue-to-main-menu'), null,
['class' => 'btn btn-lg btn-primary',
'style' => 'margin: 2em 0em 0em 0em;'])
!!}
@stop
3 changes: 2 additions & 1 deletion src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
'as' => $admin_route.'.dashboard.indicator',
'uses' => 'PanicHD\PanicHD\Controllers\DashboardController@index',
]);
Route::get($admin_route_path, 'PanicHD\PanicHD\Controllers\DashboardController@index');
Route::get($admin_route_path, 'PanicHD\PanicHD\Controllers\DashboardController@index')
->name('dashboard');

//Ticket statuses admin routes (ex. http://url/tickets-admin/status)
Route::resource("$admin_route_path/status", 'PanicHD\PanicHD\Controllers\StatusesController', [
Expand Down

0 comments on commit de06729

Please sign in to comment.