Introduzione base per template Blade

This commit is contained in:
Dasc3er 2021-01-04 11:21:16 +01:00
parent 38f57ed6e0
commit 5c10363b6f
7 changed files with 617 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Test extends Controller
{
//
public function index(){
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class EnsureCalendarPeriod
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$request_period = [
'period_start' => $request->query('period_start'),
'period_end' => $request->query('period_end'),
];
// Calendario
// Periodo di visualizzazione
if (!empty($request_period['period_start'])) {
session(null, $request_period);
}
// Dal 01-01-yyy al 31-12-yyyy
elseif (session('period_start') === null) {
session(null, [
'period_start' => date('Y').'-01-01',
'period_end' => date('Y').'-12-31',
]);
}
return $next($request);
}
}

View File

@ -0,0 +1,317 @@
@extends('layouts.base')
@section('js')
<script>
search = [];
@foreach($search as $key => $value)
search.push("search_{{ $key }}");
search["search_{{ $key }}"] = "{{ $value }}";
@endforeach
globals = {
rootdir: '{{ base_url() }}',
id_module: '{{ id_module }}',
id_record: '{{ id_record }}',
is_mobile: {{ intval(isMobile()) }},
cifre_decimali: '{{ setting('Cifre decimali per importi') }}',
timestamp_format: "{{ formatter()->getTimestampPattern() }}",
date_format: "{{ formatter()->getDatePattern() }}",
time_format: "{{ formatter()->getTimePattern() }}",
decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}",
thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}",
currency: "{{ currency() }}",
search: search,
translations: {
"day": "{{ __('Giorno') }}",
"week": "{{ __('Settimana') }}",
"month": "{{ __('Mese') }}",
"today": "{{ __('Oggi') }}",
"firstThreemester": "{{ __('I trimestre') }}",
"secondThreemester": "{{ __('II trimestre') }}",
"thirdThreemester": "{{ __('III trimestre') }}",
"fourthThreemester": "{{ __('IV trimestre') }}",
"firstSemester": "{{ __('I semestre') }}",
"secondSemester": "{{ __('II semestre') }}",
"thisMonth": "{{ __('Questo mese') }}",
"lastMonth": "{{ __('Mese scorso') }}",
"thisYear": "{{ __("Quest'anno") }}",
"lastYear": "{{ __('Anno scorso') }}",
"apply": "{{ __('Applica') }}",
"cancel": "{{ __('Annulla') }}",
"from": "{{ __('Da') }}",
"to": "{{ __('A') }}",
"custom": "{{ __('Personalizzato') }}",
"delete": "{{ __('Elimina') }}",
"deleteTitle": "{{ __('Sei sicuro?') }}",
"deleteMessage": "{{ __('Eliminare questo elemento?') }}",
"errorTitle": "{{ __('Errore') }}",
"errorMessage": "{{ __("Si è verificato un errore nell'esecuzione dell'operazione richiesta") }}",
"close": "{{ __('Chiudi') }}",
"filter": "{{ __('Filtra') }}",
"long": "{{ __('La ricerca potrebbe richiedere del tempo') }}",
"details": "{{ __('Dettagli') }}",
"waiting": "{{ __('Impossibile procedere') }}",
"waiting_msg": "{{ __('Prima di proseguire devi selezionare alcuni elementi!') }}",
'hooksExecuting': "{{ __('Hooks in esecuzione') }}",
'hookExecuting': '{{ __('Hook "_NAME_" in esecuzione') }}',
'hookMultiple': "{{ __('Hai _NUM_ notifiche') }}",
'hookSingle': "{{ __('Hai 1 notifica') }}",
'hookNone': "{{ __('Nessuna notifica') }}",
'singleCalendar': {{ __("E' presente un solo periodo!") }}",
ajax: {
"missing": {
"title": "{{ __('Errore') }}",
"text": "{{ __('Alcuni campi obbligatori non sono stati compilati correttamente') }}",
},
"error": {
"title": "{{ __('Errore') }}",
"text": "{{ __('Errore durante il salvataggio del record') }}",
}
},
password: {
"wordMinLength": "{{ __('La password è troppo corta') }}",
"wordMaxLength": "{{ __('La password è troppo lunga') }}",
"wordInvalidChar": "{{ __('La password contiene un carattere non valido') }}",
"wordNotEmail": "{{ __('Non usare la tua e-mail come password') }}",
"wordSimilarToUsername": "{{ __('La password non può contenere il tuo nome') }}",
"wordTwoCharacterClasses": "{{ __('Usa classi di caratteri diversi') }}",
"wordRepetitions": "{{ __('La password contiene ripetizioni') }}",
"wordSequences": "{{ __('La password contiene sequenze') }}",
"errorList": "{{ __('Attenzione') }}:",
"veryWeak": "{{ __('Molto debole') }}",
"weak": "{{ __('Debole') }}",
"normal": "{{ __('Normale') }}",
"medium": "{{ __('Media') }}",
"strong": "{{ __('Forte') }}",
"veryStrong": "{{ __('Molto forte') }}",
},
datatables: {
"emptyTable": "{{ __('Nessun dato presente nella tabella') }}",
"info": "{{ __('Vista da _START_ a _END_ di _TOTAL_ elementi') }}",
"infoEmpty": "{{ __('Vista da 0 a 0 di 0 elementi') }}",
"infoFiltered": "({{ __('filtrati da _MAX_ elementi totali') }})",
"infoPostFix": "",
"lengthMenu": "{{ __('Visualizza _MENU_ elementi') }}",
"loadingRecords": " ",
"processing": "{{ __('Elaborazione') }}...",
"search": "{{ __('Cerca') }}:",
"zeroRecords": "{{ __('La ricerca non ha portato alcun risultato') }}.",
"paginate": {
"first": "{{ __('Inizio') }}",
"previous": "{{ __('Precedente') }}",
"next": "{{ __('Successivo') }}",
"last": "{{ __('Fine') }}"
},
},
},
locale: '{{ app()->getLocale() }}',
full_locale: '{{ app()->getLocale() }}',
start_date: '{{ session('period_start') }}',
start_date_formatted: '{{ dateFormat(session('period_start')) }}',
end_date: '{{ session('period_end') }}',
end_date_formatted: '{{ dateFormat(session('period_end')) }}',
ckeditorToolbar: [
["Undo","Redo","-","Cut","Copy","Paste","PasteText","PasteFromWord","-","Scayt", "-","Link","Unlink","-","Bold","Italic","Underline","Superscript","SpecialChar","HorizontalRule","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Styles","Format","Image","Table", "TextColor", "BGColor" ],
],
order_manager_id: '{{ module('Stato dei serivizi')['id'] }}',
tempo_attesa_ricerche: {{ setting('Tempo di attesa ricerche in secondi') }},
restrict_summables_to_selected: {{ setting('Totali delle tabelle ristretti alla selezione') }},
select_url: "{{ route('ajax-select') }}",
dataload_url: "{{ route('ajax-dataload', ['module_id' => '|module_id|']) }}",
dataload_url_plugin: "{{ route('ajax-dataload', ['module_id' => '|module_id|', 'reference_id' => '|reference_id|']) }}",
ajax_set_url: "{{ route('ajax-session') }}",
ajax_array_set_url: "{{ route('ajax-session-array') }}",
messages_url: "{{ route('messages') }}",
hooks: {
list: "{{ route('hooks') }}",
lock: "{{ route('hook-lock', ['hook_id' => '|id|']) }}",
execute: "{{ route('hook-execute', ['hook_id' => '|id|', 'token' => '|token|']) }}",
response: "{{ route('hook-response', ['hook_id' => '|id|']) }}",
}
};
</script>
@if (setting('Abilita esportazione Excel e PDF'))
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
@endif
@endsection
@section('body')
<div class="wrapper">
<header class="main-header">
<a href="https://www.openstamanager.com" class="logo" title="{{ __("Il gestionale open source per l'assistenza tecnica e la fatturazione") }}" target="_blank">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini">{{ __("OSM") }}</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg">
{{ __('OpenSTAManager') }}
</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">{{ __('Mostra/nascondi menu') }}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<!-- Navbar Left Menu -->
@php($not_current_year = session('period_start') != date('Y').'-01-01' || session('period_end') != date('Y').'-12-31')
<div class="navbar-left hidden-xs">
<ul class="nav navbar-nav hidden-xs">
<li><a href="#" id="daterange" class="{{ $not_current_year ? 'calendar-wrong' : '' }}" role="button">
<i class="fa fa-calendar" style="color:inherit"></i> <i class="fa fa-caret-down" style="color:inherit"></i>
</a></li>
<li><a class="{{ $not_current_year ? 'calendar-wrong' : '' }}" style="background:inherit;cursor:default;">
{{ dateFormat(session('period_start')) }} - {{ dateFormat(session('period_end')) }}
</a></li>
</ul>
</div>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown notifications-menu" >
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span id="hooks-label" class="label label-warning">
<span id="hooks-loading"><i class="fa fa-spinner fa-spin"></i></span>
<span id="hooks-notified"></span>
<span id="hooks-counter" class="hide">0</span>
<span id="hooks-number" class="hide">0</span>
</span>
</a>
<ul class="dropdown-menu">
<li class="header"><span class="small" id="hooks-header"></span></li>
<li><ul class="menu" id="hooks">
</ul></li>
</ul>
</li>
<li><a href="#" onclick="window.print()" class="tip" title="{{ __('Stampa') }}">
<i class="fa fa-print"></i>
</a></li>
<li><a href="{{ base_url() }}/{{ record_id ? __('editor.php?id_record=' ~ record_id ~ '&' : 'controller.php?' }}id_module={{ module_id }}" class="tip btn-warning" title="{{ 'Base') }}">
<i class="fa fa-fast-backward"></i>
</a></li>
<li><a href="{{ route('bug') }}" class="tip" title="{{ __('Segnalazione bug') }}">
<i class="fa fa-bug"></i>
</a></li>
<li><a href="{{ route('logs') }}" class="tip" title="{{ __('Log accessi') }}">
<i class="fa fa-book"></i>
</a></li>
<li><a href="{{ route('info') }}" class="tip" title="{{ __('Informazioni') }}">
<i class="fa fa-info"></i>
</a></li>
<li><a href="{{ route('logout') }}" onclick="sessionStorage.clear()" class="bg-red tip" title="{{ __('Esci') }}">
<i class="fa fa-power-off"></i>
</a></li>
</ul>
</div>
</nav>
</header>
<aside class="main-sidebar"><!-- sidebar-dark-primary elevation-4 -->
<section class="sidebar">
<!-- Sidebar user panel -->
<a href="{{ route('user') }}" class="user-panel text-center info" style="height: 60px">
<div class="text-center mt-2">
@if (auth()->user()->photo)
<img src="{{ base_url() }}{{ auth()->user()->photo }}" class="profile-user-img img-fluid img-circle" alt="{{ auth()->user()->username }}" />
@else
<i class="fa fa-user-circle-o fa-5x"></i>
@endif
</div>
<h3 class="profile-username text-center" style="width: 100%; padding-top: 10px;">
{{ auth()->user()->username }}
</h3>
<p class="text-center" id="datetime"></p>
</a>
<!-- Form di ricerca generale -->
<div class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" id="supersearch" placeholder="{{ __('Cerca') }}..."/>
<span class="input-group-btn">
<button class="btn btn-flat" id="search-btn" name="search" type="submit" ><i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
<ul class="sidebar-menu"><!-- class="nav nav-pills nav-sidebar nav-sidebar nav-child-indent flex-column" data-widget="treeview" role="menu" data-accordion="true" -->
{{ main_menu|raw }}
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Right side column. Contains the navbar and content of the page -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="container-fluid">
@section('content')
</div>
</section>
</div>
<footer class="main-footer">
<a class="hidden-xs" href="https://www.openstamanager.com" title="{{ __("Il gestionale open source per l'assistenza tecnica e la fatturazione") }}" target="_blank"><strong>{{ __('OpenSTAManager') }}</strong></a>
<span class="pull-right hidden-xs">
<strong>{{ __('Versione') }}:</strong> {{ Update::getVersion() }}
<small class="text-muted">({{ Update::getRevision() ?: __('In sviluppo') }})</small>
</span>
</footer>
<div id="modals"></div>
<script>
function closeModal(element) {
let modal = $(element).closest(".modal");
modal.fadeOut("slow", function() {
if ($("#modals").children().length <= 1){
$("body").removeClass("modal-open");
$(".modal-backdrop").remove();
}
modal.remove();
});
}
$(document).ready(function() {
// Toast
alertPush();
// Hooks
startHooks();
// Abilitazione del cron autonoma
$.get(globals.rootdir + "/cron.php");
});
</script>
</div>
@endsection

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>@yield('title') - {{ __('OpenSTAManager') }}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="robots" content="noindex,nofollow">
<link href="{{ base_url() }}/assets/img/favicon.png" rel="icon" type="image/x-icon" />
<link rel="manifest" href="{{ base_url() }}/manifest.json">
<!--link rel="stylesheet" type="text/css" media="all" href="{{ base_url() }}{{ asset('/css/app.css') }}"/>
<link rel="stylesheet" type="text/css" media="all" href="{{ base_url() }}{{ asset('/css/style.css') }}"/>
<link rel="stylesheet" type="text/css" media="all" href="{{ base_url() }}{{ asset('/css/themes.css') }}"/>
<link rel="stylesheet" type="text/css" media="print" href="{{ base_url() }}{{ asset('/css/print.css') }}"/>
<script type="text/javascript" charset="utf-8" src="{{ base_url() }}{{ asset('/js/manifest.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ base_url() }}{{ asset('/js/vendor.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ base_url() }}{{ asset('/js/app.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ base_url() }}{{ asset('/js/base.js') }}"></script--->
@foreach (AppLegacy::getAssets()['css'] as $css)
<link rel="stylesheet" type="text/css" media="all" href="{{ $css }}"/>
@endforeach
@foreach (AppLegacy::getAssets()['print'] as $css)
<link rel="stylesheet" type="text/css" media="print" href="{{ $css }}"/>
@endforeach
@foreach (AppLegacy::getAssets()['js'] as $script)
<script type="text/javascript" charset="utf-8" src="{{ $script }}"></script>
@endforeach
<script>
var globals = {
content_was_modified: false,
rootdir: '{{ base_url() }}',
timestamp_format: "{{ formatter()->getTimestampPattern() }}",
date_format: "{{ formatter()->getDatePattern() }}",
time_format: "{{ formatter()->getTimePattern() }}",
decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}",
thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}",
locale: '{{ app()->getLocale() }}',
full_locale: '{{ app()->getLocale() }}',
translations: {
password: {
"wordMinLength": "{{ __('La password è troppo corta') }}",
"wordMaxLength": "{{ __('La password è troppo lunga') }}",
"wordInvalidChar": "{{ __('La password contiene un carattere non valido') }}",
"wordNotEmail": "{{ __('Non usare la tua e-mail come password') }}",
"wordSimilarToUsername": "{{ __('La password non può contenere il tuo nome') }}",
"wordTwoCharacterClasses": "{{ __('Usa classi di caratteri diversi') }}",
"wordRepetitions": "{{ __('La password contiene ripetizioni') }}",
"wordSequences": "{{ __('La password contiene sequenze') }}",
"errorList": "{{ __('Attenzione') }}:",
"veryWeak": "{{ __('Molto debole') }}",
"weak": "{{ __('Debole') }}",
"normal": "{{ __('Normale') }}",
"medium": "{{ __('Media') }}",
"strong": "{{ __('Forte') }}",
"veryStrong": "{{ __('Molto forte') }}",
},
},
messages_url: "{{ route('messages') }}",
};
</script>
@yield('css')
@yield('js')
</head>
<body class="skin-{{ AppLegacy::getConfig() ? 'default' : 'default' }} @yield('body_class')">
<!-- Loader principale -->
<div id="main_loading">
<div>
<i class="fa fa-cog fa-spin text-danger"></i>
</div>
</div>
<!-- Loader secondario -->
<div id="mini-loader" style="display:none;">
<div></div>
</div>
<!-- Loader senza overlay -->
<div id="tiny-loader" style="display:none;"></div>
@yield('body')
</body>
</html>

View File

@ -0,0 +1,19 @@
@extends('layouts.base')
@section('body_class')bg-light@endsection
@section('body')
@yield('before_content')
<div class="box box-outline box-center-large @yield('box_class')">
<div class="box-header text-center">
@yield('box_header')
</div>
<div class="box-body">
@yield('content')
</div>
</div>
@yield('after_content')
@endsection

View File

@ -0,0 +1,86 @@
@extends('layouts.base')
@section('body_class', 'hold-transition login-page')
@section('title', __("Login"))
@section('body')
<div class="login-box">
<div class="login-logo">
<a href="//openstamanager.com" target="_blank">
<img src="{{ base_url() }}/assets/img/full_logo.png" style="max-width: 360px">
</a>
</div>
<form novalidate action="" method="post">
<div class="box">
<div class="box-body login-box-body">
<h4 class="login-box-msg">{{ __('Accedi') }}</h4>
{[ "type": "text", "name": "username", "autocomplete": "username", "placeholder": "{{ __('Username') }}", "value": "{{ old('username') }}", "icon-before": "<i class=\"fa fa-user\"></i>", "required": 1 ]}
<div class="mb-3" style="margin-bottom: 1rem !important;"></div>
{[ "type": "password", "name": "password", "autocomplete": "current-password", "placeholder": "{{ __('Password') }}", "icon-before": "<i class=\"fa fa-lock\"></i>" ]}
<div class="mb-3" style="margin-bottom: 1rem !important;"></div>
<div class="text-right">
<a href="{{ base_url() }}/reset.php">{{ __('Dimenticata la password?') }}</a>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-warning btn-block">{{ __('Accedi') }}</button>
</div>
</div>
</form>
</div>
@endsection
@section('before_content')
@if (Update::isBeta())
<div class="clearfix">&nbsp;</div>
<div class="alert alert-warning alert-dismissable col-md-6 col-md-push-3 text-center fade in">
<i class="fa fa-warning"></i> <b>{{ __('Attenzione!') }}</b> {{ __('Stai utilizzando una versione <b>non stabile</b> di OSM.') }}
<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
</div>
@endif
@if (false)
<div class="box box-outline box-danger box-center" id="brute">
<div class="box-header text-center">
<h3 class="box-title">{{ __('Attenzione') }}</h3>
</div>
<div class="box-body text-center">
<p>{{ __('Sono stati effettuati troppi tentativi di accesso consecutivi!') }}</p>
<p>{{ __('Tempo rimanente (in secondi)') }}: <span id="brute-timeout">{{ brute.timeout + 1 }}</span></p>
</div>
</div>
<script>
$(document).ready(function(){
$(".login-box").fadeOut();
brute();
});
function brute() {
var value = parseFloat($("#brute-timeout").html()) - 1;
$("#brute-timeout").html(value);
if(value > 0){
setTimeout("brute()", 1000);
} else{
$("#brute").fadeOut();
$(".login-box").fadeIn();
}
}
</script>
@endif
@if (flash()->getMessage('error') !== null)
<script>
$(document).ready(function(){
$(".login-box").effect("shake");
});
</script>
@endif
@endsection

View File

@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\LegacyController;
use App\Http\Controllers\Test;
use Illuminate\Support\Facades\Route;
/*
@ -17,3 +18,47 @@ use Illuminate\Support\Facades\Route;
Route::get('/test', function () {
return view('welcome');
});
Route::get('/login', function () {
return view('user.login');
});
// Messaggi flash
Route::get('/messages', [Test::class, 'index'])
->name('messages');
// Hooks
Route::prefix('hook')->group(function () {
Route::get('/list', [Test::class, 'index'])
->name('hooks');
Route::get('/lock/{hook_id:[0-9]+}', [Test::class, 'index'])
->name('hook-lock');
Route::get('/execute/{hook_id:[0-9]+}/{token}', [Test::class, 'index'])
->name('hook-execute');
Route::get('/response/{hook_id:[0-9]+}', [Test::class, 'index'])
->name('hook-response');
});
// Informazioni su OpenSTAManager
Route::get('/info', [Test::class, 'index'])
->name('info');
// Segnalazione bug
Route::get('/bug', [Test::class, 'index'])
->name('bug');
Route::post('/bug', [Test::class, 'index']);
// Log di accesso
Route::get('/logs', [Test::class, 'index'])
->name('logs');
// Informazioni sull'utente
Route::get('/user', [Test::class, 'index'])
->name('user');
Route::get('/password', [Test::class, 'index'])
->name('user-password');
Route::post('/password', [Test::class, 'index']);