fixed error pages

This commit is contained in:
denisdulici 2019-12-26 10:53:50 +03:00
parent ef95a33648
commit 6f7d94e676
11 changed files with 374 additions and 341 deletions

View File

@ -2,7 +2,6 @@
namespace App\Http\ViewComposers;
use Auth;
use App\Utilities\Updater;
use Illuminate\View\View;
use App\Traits\Modules as RemoteModules;
@ -21,11 +20,11 @@ class Header
{
$user = user();
$bills = [];
$invoices = [];
$notifications = 0;
$invoices = $bills = [];
$updates = $notifications = 0;
$company = null;
if (!empty($user)) {
// Get customer company
if ($user->can('read-client-portal')) {
$company = (object) [
@ -56,6 +55,7 @@ class Header
$updates = count(Updater::all());
$this->loadSuggestions();
}
$view->with([
'user' => $user,

View File

@ -19,7 +19,7 @@ class Notifications
public function compose(View $view)
{
// No need to add suggestions in console
if (app()->runningInConsole() || !env('APP_INSTALLED')) {
if (app()->runningInConsole() || !env('APP_INSTALLED') || !user()) {
return;
}

View File

@ -26,6 +26,7 @@ class Suggestions
$modules = false;
if (user()) {
$path = Route::current()->uri();
if ($path) {
@ -35,7 +36,7 @@ class Suggestions
$suggestion_modules = $suggestions->modules;
foreach ($suggestion_modules as $key => $module) {
$installed = Module::where('company_id', '=', session('company_id'))->where('alias', '=', $module->alias)->first();
$installed = Module::where('company_id', session('company_id'))->where('alias', $module->alias)->first();
if ($installed) {
unset($suggestion_modules[$key]);
@ -49,6 +50,7 @@ class Suggestions
}
}
}
}
$view->with(['suggestion_modules' => $modules]);
}

View File

@ -2,23 +2,22 @@
return [
'forbidden_access' => 'Forbidden Access',
'error_page' => 'Error Page',
'page_not_found' => 'Page Not Found',
'body' => [
'forbidden_access' => 'Oops! Forbidden Access.',
'error_page' => 'Oops! Something went wrong.',
'page_not_found' => 'Oops! Page not found.',
'title' => [
'403' => 'Oops! Forbidden Access',
'404' => 'Oops! Page not found',
'500' => 'Oops! Something went wrong',
],
'messages' => [
'forbidden_access' => 'You can not access this page.
Meanwhile, you may <a href=":link">return to dashboard</a>.',
'error_page' => 'We will work on fixing that right away.
Meanwhile, you may <a href=":link">return to dashboard</a>.',
'page_not_found' => 'We could not find the page you were looking for.
Meanwhile, you may <a href=":link">return to dashboard</a>.',
'header' => [
'403' => '403 Forbidden',
'404' => '404 Not Found',
'500' => '500 Internal Server Error',
],
'message' => [
'403' => 'You can not access this page.',
'404' => 'We could not find the page you were looking for.',
'500' => 'We will work on fixing that right away.',
],
];

View File

@ -1,16 +1,16 @@
@extends('layouts.admin')
@extends('layouts.error')
@section('title', trans('errors.forbidden_access'))
@section('title', trans('errors.title.403'))
@section('content')
<div class="card">
<div class="card-header">
<h2 class="mb-0 text-warning">403 Forbidden</h2>
<h2 class="mb-0 text-danger"><i class="fa fa-exclamation-triangle text-danger"></i>&nbsp;&nbsp;{{ trans('errors.header.403') }}</h2>
</div>
<div class="card-body">
<h3><i class="fa fa-exclamation-triangle text-danger"></i> {{ trans('errors.body.forbidden_access') }}</h3>
<p>{{ trans('errors.message.403') }}</p>
<p>{!! trans('errors.messages.forbidden_access', ['link' => url('/') ]) !!}</p>
<a href="{{ url('/') }}" class="btn btn-success header-button-top"><span class="fa fa-tachometer-alt"></span> &nbsp;{{ trans('general.go_to', ['name' => trans('general.dashboard')]) }}</a>
</div>
</div>
@endsection

View File

@ -1,16 +1,16 @@
@extends('layouts.admin')
@extends('layouts.error')
@section('title', trans('errors.page_not_found'))
@section('title', trans('errors.title.404'))
@section('content')
<div class="card">
<div class="card-header">
<h2 class="mb-0 text-yellow">404 Not Found</h2>
<h2 class="mb-0 text-warning"><i class="fa fa-exclamation-triangle text-warning"></i>&nbsp;&nbsp;{{ trans('errors.header.404') }}</h2>
</div>
<div class="card-body">
<h3><i class="fa fa-exclamation-triangle text-yellow"></i> {{ trans('errors.body.page_not_found') }}</h3>
<p>{{ trans('errors.message.404') }}</p>
<p>{!! trans('errors.messages.page_not_found', ['link' => url('/')]) !!}</p>
<a href="{{ url('/') }}" class="btn btn-success header-button-top"><span class="fa fa-tachometer-alt"></span> &nbsp;{{ trans('general.go_to', ['name' => trans('general.dashboard')]) }}</a>
</div>
</div>
@endsection

View File

@ -1,16 +1,17 @@
@extends('layouts.admin')
@extends('layouts.error')
@section('title', trans('errors.error_page'))
@section('title', trans('errors.title.500'))
@section('content')
<div class="card">
<div class="card-header">
<h2 class="mb-0 text-danger">500 Internal Server Error</h2>
<h2 class="mb-0 text-danger"><i class="fa fa-exclamation-triangle text-danger"></i>&nbsp;&nbsp;{{ trans('errors.header.500') }}</h2>
</div>
<div class="card-body">
<h3><i class="fa fa-exclamation-triangle text-danger"></i> {{ trans('errors.body.error_page') }}</h3>
<p>{{ trans('errors.message.500') }}</p>
<p>{!! trans('errors.messages.error_page', ['link' => url('/') ]) !!}</p>
<a href="{{ url('/') }}" class="btn btn-success header-button-top"><span class="fa fa-tachometer-alt"></span> &nbsp;{{ trans('general.go_to', ['name' => trans('general.dashboard')]) }}</a>
</div>
</div>
@endsection

View File

@ -0,0 +1,31 @@
<html lang="{{ app()->getLocale() }}">
@include('partials.admin.head')
<body class="g-sidenav-show g-sidenav-pinned">
@stack('body_start')
<div class="main-content" id="panel">
<div id="main-body">
@include('partials.admin.header')
<div class="container-fluid content-layout mt--6">
@include('partials.admin.content')
@include('partials.admin.footer')
</div>
</div>
</div>
@stack('body_end')
@include('partials.admin.scripts')
</body>
</html>

View File

@ -1,5 +1,5 @@
@stack('header_start')
<div id="header" class="header pb-6">
<div id="header" class="header pb-6">
<div class="container-fluid content-layout">
<div class="header-body">
<div class="row py-4 align-items-center">
@ -27,5 +27,5 @@
</div>
</div>
</div>
</div>
</div>
@stack('header_end')

View File

@ -1,8 +1,8 @@
@stack('navbar_start')
<nav class="navbar navbar-top navbar-expand navbar-dark border-bottom">
<nav class="navbar navbar-top navbar-expand navbar-dark border-bottom">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
@if (user()->can('read-common-search'))
@permission('read-common-search')
<form class="navbar-search navbar-search-light form-inline mb-0" id="navbar-search-main" autocomplete="off">
<div id="global-search" class="form-group mb-0 mr-sm-3">
<div class="input-group input-group-alternative input-group-merge">
@ -34,7 +34,7 @@
<span aria-hidden="true">×</span>
</button>
</form>
@endif
@endpermission
<ul class="navbar-nav align-items-center ml-md-auto">
<li class="nav-item d-xl-none">
@ -53,7 +53,7 @@
</a>
</li>
@if (user()->can(['create-incomes-invoices', 'create-incomes-revenues', 'create-incomes-customers', 'create-expenses-bills', 'create-expenses-payments', 'create-expenses-vendors']))
@permission(['create-incomes-invoices', 'create-incomes-revenues', 'create-incomes-customers', 'create-expenses-bills', 'create-expenses-payments', 'create-expenses-vendors'])
<li class="nav-item dropdown">
<a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus"></i>
@ -248,5 +248,5 @@
</ul>
</div>
</div>
</nav>
</nav>
@stack('navbar_end')

View File

@ -1,5 +1,5 @@
@stack('header_start')
<div id="header" class="header pb-6">
<div id="header" class="header pb-6">
<div class="container-fluid content-layout">
<div class="header-body">
<div class="row py-4 align-items-center">
@ -17,5 +17,5 @@
</div>
</div>
</div>
</div>
</div>
@stack('header_end')