Installing and managing modules from admin panel (#847)

This commit is contained in:
Yash Govekar
2020-10-19 19:40:28 +05:30
committed by GitHub
parent ca220f1cdf
commit 5803487d51
92 changed files with 1259 additions and 669 deletions

View File

@@ -6,7 +6,7 @@
"active": 1,
"order": 0,
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider",
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\AppServiceProvider",
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\EventServiceProvider",
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\RouteServiceProvider"
],

View File

@@ -1,6 +1,6 @@
<?php
namespace $NAMESPACE$;
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
@@ -16,7 +16,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
protected $namespace = '$MODULE_NAMESPACE$\$MODULE$\Http\Controllers';
protected $namespace = '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers';
/**
* Called before routes are registered.

View File

@@ -1,5 +1,7 @@
@extends('$LOWER_NAME$::layouts.frontend')
@section('title', '$STUDLY_NAME$')
@section('content')
<h1>Hello World</h1>

View File

@@ -1,4 +1,4 @@
@foreach (session('flash_notification', collect())->toArray() as $message)
@foreach (session('flash_notification', collect()) as $message)
@if ($message['overlay'])
@include('flash::modal', [
'modalClass' => 'flash-modal',

View File

@@ -74,6 +74,10 @@
<li><a href="{!! url('/admin/pages') !!}"><i class="pe-7s-note"></i>pages/links</a></li>
@endability
@ability('admin', 'modules')
<li><a href="{!! url('/admin/modules') !!}"><i class="pe-7s-box2"></i>Modules Manager</a></li>
@endability
@ability('admin', 'maintenance')
<li><a href="{{ url('/admin/maintenance') }}"><i class="pe-7s-tools"></i>maintenance</a></li>
@endability

View File

@@ -0,0 +1,37 @@
@extends('admin.app')
@section('title', "Add Module")
@section('content')
<div class="card border-blue-bottom">
<div class="content">
<h5>Please note that : </h5>
<ul>
<li>Module Folder must be on top level of the zip.</li>
<li>Name of the zip must be exactly equal to the name of the module folder inside.</li>
</ul>
<h5>Module Zip Structure : </h5>
<ul>
<li>
ModuleName.zip
</li>
<ul>
<li>ModuleName Folder</li>
<ul>
<li>Config</li>
<li>Console</li>
<li>...</li>
</ul>
</ul>
</ul>
<hr>
<form method="post" action="{{route('admin.modules.store')}}" enctype="multipart/form-data">
@csrf
<div class="form-group">
<label>Module File : </label>
<input type="file" name="module_file" class="form-control" />
</div>
<button class="btn btn-success" type="submit">Add Module</button>
</form>
<hr>
</div>
</div>
@endsection

View File

@@ -0,0 +1,35 @@
@extends('admin.app')
@section('title', "Edit " . $module->name)
@section('content')
<div class="card border-blue-bottom">
<div class="content">
<h5>Change Module Status : </h5>
{{Form::open(['route' => ['admin.modules.update', $module->id]])}}
<div class="form-group">
{{Form::label('Enabled ?')}}
{{Form::checkbox('enabled', '', $module->enabled)}}
</div>
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
{{Form::close()}}
<hr>
<h5>Delete Module</h5>
<div class="row">
<div class="col-lg-6">
{{Form::open(['route' => ['admin.modules.destroy', $module->id], 'method' => 'delete'])}}
<div class="form-group">
Type in <b>{{strtoupper($module->name)}}</b> to Delete :
{{Form::text('verify', '', ['class' => 'form-control', 'required' => 'required'])}}
</div>
{{ Form::button('Delete', ['type' => 'submit', 'class' => 'btn btn-danger']) }}
{{Form::close()}}
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,79 @@
@extends('admin.app')
@section('title', "Modules Manager")
@section('actions')
<li>
<a href="{{ route('admin.modules.create') }}">
<i class="ti-plus"></i>
Add New</a>
</li>
@endsection
@section('content')
<div class="card border-blue-bottom">
<div class="content">
<div class="row">
<div class="col-lg-12">
<h5>Installed Modules</h5>
<hr>
<table class="table table-bordered table-primary">
<thead>
<th>Module</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
@forelse($modules as $module)
<tr>
<td>{{$module->name}}</td>
<td>
@if($module->enabled == 1)
Enabled
@else
Disabled
@endif
</td>
<td>
<a class="btn btn-primary" href="{{ route('admin.modules.edit', $module->id) }}">Edit Module</a>
<a class="btn btn-danger" href="/admin/{{ strtolower($module->name) }}">View Admin Module</a>
<a class="btn btn-success" target="_blank" href="/{{ strtolower($module->name) }}">View Frontend Module</a>
</td>
</tr>
@empty
<tr>
<td colspan="3" class="text-center">
No Modules Installed Yet!
</td>
</tr>
@endforelse
</tbody>
</table>
@if($new_modules)
<h5>Not Installed Modules</h5>
<hr>
<table class="table table-bordered table-primary">
<thead>
<th>Module</th>
<th>Status</th>
<th>Actions</th>
</thead>
<tbody>
@foreach($new_modules as $module)
<tr>
<td>{{ $module }}</td>
<td>Disabled</td>
<td>
{{Form::open(['route' => ['admin.modules.enable']])}}
{{ Form::hidden('name', $module) }}
{{ Form::button('Activate Module', ['type' => 'submit', 'class' => 'btn btn-success']) }}
{{Form::close()}}
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title') - installer</title>
<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
name='viewport'/>
<meta name="base-url" content="{!! url('') !!}">
<meta name="api-key" content="{!! Auth::check() ? Auth::user()->api_key: '' !!}">
<meta name="csrf-token" content="{!! csrf_token() !!}">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/bootstrap.min.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/now-ui-kit.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/installer/css/vendor.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/styles.css') }}" rel="stylesheet"/>
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<style>
.table tr:first-child td {
border-top: 0px;
}
@yield('css')
</style>
</head>
<body class="login-page" style="background: #067ec1;">
<div class="page-header clear-filter">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto content-center">
<div class="p-10" style="padding: 10px 0;">
<div class="row">
<div class="col-4">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style="" alt=""/>
</div>
<div class="col-8 text-right">
<h4 class="text-white mb-0 mr-0 ml-0" style="margin-top: 5px;">@yield('title')</h4>
</div>
</div>
</div>
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-body">
@include('system.importer.flash.message')
@yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
<script src="{{ public_mix('/assets/global/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/app.js') }}"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>
hljs.configure({languages: ['sh']});
$(document).ready(function () {
$(".select2").select2();
$('pre code').each(function (i, block) {
hljs.fixMarkup(block);
hljs.highlightBlock(block);
});
});
</script>
@yield('scripts')
</body>
</html>

View File

@@ -0,0 +1,20 @@
@extends('system.importer.app')
@section('title', 'Import Completed!')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'importer.complete', 'method' => 'GET']) }}
<h4>Installer Completed!</h4>
<p>Edit the <span class="code">config.php</span> to fill in some additional settings. </p>
<p>Click the button to proceed to the login screen!</p>
<p style="text-align: right">
{{ Form::submit('Import Complete! Continue to Log-In >>',
['class' => 'btn btn-success'])
}}
</p>
{{ Form::close() }}
</div>
@endsection

View File

@@ -0,0 +1,8 @@
<div class="alert alert-{{ $status }}" role="alert">
<div class="container">
<div class="alert-icon">
<i class="now-ui-icons ui-1_bell-53"></i>
</div>
{{ $message }}
</div>
</div>

View File

@@ -0,0 +1,9 @@
@extends('system.importer.app')
@section('title', 'Import Error!')
@section('content')
<div style="align-content: center;">
<h4>Error!</h4>
<p class="text-danger">{{ $error }}</p>
</div>
@endsection

View File

@@ -0,0 +1,6 @@
@if($errors->has($field))
<p class="text-danger" style="margin-top: 10px;">{{ $errors->first($field) }}</p>
{{--<div class="alert alert-danger" role="alert" style="margin-top: 10px;">
{{ $errors->first($field) }}
</div>--}}
@endif

View File

@@ -0,0 +1,11 @@
@foreach (session('flash_notification', collect())->toArray() as $message)
<div class="alert alert-danger" role="alert">
<div class="container">
<div class="alert-icon">
<i class="now-ui-icons ui-2_like"></i>
</div>
{{ $message['message'] }}
</div>
</div>
@endforeach
{{ session()->forget('flash_notification') }}

View File

@@ -0,0 +1,129 @@
@extends('system.importer.app')
@section('title', 'Import Configuration')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'importer.config', 'method' => 'POST']) }}
<table class="table">
<tr>
<td colspan="2">
<h4>IMPORTANT NOTES</h4>
<ul>
<li>The first user's password (admin) will be "admin". Please change it after logging in</li>
<li>User passwords will be reset and they will need to use "Forgot Password" to reset it</li>
<li>If you have more than 1000 PIREPs or flights, it's best to use the command-line importer!
<a href="{{ docs_link('importing_legacy') }}" target="_blank">Click here</a> to
see the documentation of how to use it.
</li>
<li><strong>THIS WILL WIPE OUT YOUR EXISTING DATA</strong> - this is required to make sure that things like
pilot IDs match up
</li>
</ul>
</td>
</tr>
<tr>
<td colspan="2">
<h4>Database Config</h4>
<p>Enter the database information for your legacy phpVMS installation</p>
</td>
</tr>
<tbody id="mysql_settings">
<tr>
<td>Database Host</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_host', '127.0.0.1', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Port</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_port', '3306', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Name</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_name', 'phpvms', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database User</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_user', null, ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Password</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_pass', null, ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right;">
{{ Form::submit('Test Database Credentials', ['class' => 'btn btn-info', 'id' => 'dbtest_button']) }}
</td>
</tr>
</tbody>
<tr>
<td>Database Prefix</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_prefix', 'phpvms_', ['class' => 'form-control']) }}
<p>Prefix of the tables, if you're using one</p>
</div>
</td>
</tr>
</table>
<div id="dbtest"></div>
<p style="text-align: right">
{{ Form::submit('Start Importer >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
</div>
@endsection
@section('scripts')
<script>
$(document).ready(() => {
$("#dbtest_button").click((e) => {
e.preventDefault();
const opts = {
method: 'POST',
url: '/importer/dbtest',
data: {
_token: "{{ csrf_token() }}",
db_conn: 'mysql',
db_host: $("input[name=db_host]").val(),
db_port: $("input[name=db_port]").val(),
db_name: $("input[name=db_name]").val(),
db_user: $("input[name=db_user]").val(),
db_pass: $("input[name=db_pass]").val(),
},
};
phpvms.request(opts).then(response => {
$("#dbtest").html(response.data);
});
});
});
</script>
@endsection

View File

@@ -0,0 +1,156 @@
@extends('system.importer.app')
@section('title', 'Import Configuration')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'importer.complete', 'method' => 'POST']) }}
<table class="table" width="25%">
<tr>
<td colspan="2"><h4>Running Importer</h4></td>
</tr>
<tr>
<td colspan="2">
<div class="progress">
<div id="progress" class="progress-bar" style="width: 0%"></div>
</div>
<div>
<p id="message" style="margin-top: 7px;"></p>
<p id="error" class="text-danger" style="margin-top: 7px;"></p>
</div>
</td>
</tr>
</table>
<p style="text-align: right">
{{ Form::submit('Complete Import', [
'id' => 'completebutton',
'class' => 'btn btn-success'
]) }}
</p>
{{ Form::close() }}
</div>
@endsection
@section('scripts')
<script>
const manifest = {!!json_encode($manifest) !!};
/**
* Run each step of the importer
*/
async function startImporter() {
let current = 1;
const total_steps = manifest.length;
/**
* Update the progress bar
*/
const setProgress = (current, message) => {
const percent = Math.round(current / total_steps * 100);
$("#progress").css("width", `${percent}%`);
$("#message").text(message);
};
/**
* Sleep for a given interval
*/
const sleep = (timeout) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, timeout);
});
};
const setError = (error) => {
let message = '';
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
message = error.response.data.message;
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
message = error.request;
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
message = error.message;
}
$("#error").text(`Error processing, check the logs: ${message}`);
console.log(error.config);
};
/**
* Call the endpoint as a POST
*/
const runStep = async function (stage) {
setProgress(current, stage.message);
try {
return await phpvms.request({
method: 'post',
url: '/importer/run',
data: {
importer: stage.importer,
start: stage.start,
}
});
} catch (e) {
if (e.response.status === 504) {
const err = $("#error");
console.log('got timeout, retrying');
err.text(`Timed out, attempting to retry`);
// await sleep(5000);
const val = await runStep(stage);
err.text('');
return val;
}
setError(e);
throw e;
}
};
let errors = false;
const complete_button = $("#completebutton");
complete_button.hide();
for (let stage of manifest) {
console.log(`Running ${stage.importer} step ${stage.start}`);
try {
await runStep(stage);
} catch (e) {
errors = true;
break;
}
current++;
}
if (!errors) {
$("#message").text('Done!');
complete_button.show();
}
}
$(document).ready(() => {
startImporter();
});
</script>
@endsection

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title') - installer</title>
<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
name='viewport'/>
<meta name="base-url" content="{!! url('') !!}">
<meta name="api-key" content="{!! Auth::check() ? Auth::user()->api_key: '' !!}">
<meta name="csrf-token" content="{!! csrf_token() !!}">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/bootstrap.min.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/now-ui-kit.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/installer/css/vendor.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/styles.css') }}" rel="stylesheet"/>
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<style>
.table tr:first-child td {
border-top: 0px;
}
@yield('css')
</style>
</head>
<body class="login-page" style="background: #067ec1;">
<div class="page-header clear-filter">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto content-center">
<div class="p-10" style="padding: 10px 0;">
<div class="row">
<div class="col-4">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style="" alt=""/>
</div>
<div class="col-8 text-right">
<h4 class="text-white mb-0 mr-0 ml-0" style="margin-top: 5px;">@yield('title')</h4>
</div>
</div>
</div>
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-body">
@include('system.installer.flash.message')
@yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
<script src="{{ public_mix('/assets/global/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/app.js') }}"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>
hljs.configure({languages: ['sh']});
$(document).ready(function () {
$(".select2").select2();
$('pre code').each(function (i, block) {
hljs.fixMarkup(block);
hljs.highlightBlock(block);
});
});
</script>
@yield('scripts')
</body>
</html>

View File

@@ -0,0 +1,11 @@
@extends('system.installer.app')
@section('content')
<h2>phpVMS already installed!</h2>
<p>phpVMS has already been installed! Please remove the modules/Installer folder.</p>
{{ Form::open(['url' => '/', 'method' => 'get']) }}
<p style="text-align: right">
{{ Form::submit('Go to your site >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,6 @@
@if($errors->has($field))
<p class="text-danger" style="margin-top: 10px;">{{ $errors->first($field) }}</p>
{{--<div class="alert alert-danger" role="alert" style="margin-top: 10px;">
{{ $errors->first($field) }}
</div>--}}
@endif

View File

@@ -0,0 +1,19 @@
@if (session()->has('flash_notification.message'))
@if (session()->has('flash_notification.overlay'))
@include('flash::modal', [
'modalClass' => 'flash-modal',
'title' => session('flash_notification.title'),
'body' => session('flash_notification.message')
])
@else
<div class="alert
alert-{{ session('flash_notification.level') }}
{{ session()->has('flash_notification.important') ? 'alert-important' : '' }}">
@if(session()->has('flash_notification.important'))
<button type="button" class="close" data-dismiss="alert">&times;</button>
@endif
{{ session('flash_notification.message') }}
</div>
@endif
@endif

View File

@@ -0,0 +1,8 @@
<div class="alert alert-{{ $status }}" role="alert">
<div class="container">
<div class="alert-icon">
<i class="now-ui-icons ui-1_bell-53"></i>
</div>
{{ $message }}
</div>
</div>

View File

@@ -0,0 +1,11 @@
@extends('system.installer.app')
@section('title', 'Install phpVMS')
@section('content')
<h3 class="text-center">Click on <b>Start</b> to Continue</h3>
{{ Form::open(['route' => 'installer.step1post', 'method' => 'post']) }}
<p style="text-align: right">
{{ Form::submit('Start >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,64 @@
@extends('system.installer.app')
@section('title', 'Requirements Check')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'installer.step2', 'method' => 'GET']) }}
<table class="table" width="25%">
<tr>
<td colspan="2"><h4>php version</h4></td>
</tr>
<tr>
<td>PHP Version: {{ $php['version'] }}</td>
<td style="text-align:right;">
@if($php['passed'] === true)
<span class="badge badge-success">OK</span>
@else
<span class="badge badge-danger">Failed</span>
@endif
</td>
</tr>
<tr>
<td colspan="2"><h4>PHP Extensions</h4></td>
</tr>
@foreach($extensions as $ext)
<tr>
<td>{{ $ext['ext'] }}</td>
<td style="text-align:right;">
@if($ext['passed'] === true)
<span class="badge badge-success">OK</span>
@else
<span class="badge badge-danger">Failed</span>
@endif
</td>
</tr>
@endforeach
<tr>
<td colspan="2">
<h4>Directory Permissions</h4>
<p>Make sure these directories have read and write permissions</p>
</td>
</tr>
@foreach($directories as $dir)
<tr>
<td>{{ $dir['dir'] }}</td>
<td style="text-align:right;">
@if($dir['passed'] === true)
<span class="badge badge-success">OK</span>
@else
<span class="badge badge-danger">Failed</span>
@endif
</td>
</tr>
@endforeach
</table>
@if($passed === true)
<p style="text-align: right">
{{ Form::submit('Database Setup >>', ['class' => 'btn btn-success']) }}
</p>
@endif
{{ Form::close() }}
</div>
@endsection

View File

@@ -0,0 +1,161 @@
@extends('system.installer.app')
@section('title', 'Database Setup')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'installer.envsetup', 'method' => 'POST']) }}
<table class="table" width="25%">
<tr>
<td colspan="2"><h4>Site Config</h4></td>
</tr>
<tr>
<td>Site Name</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'site_name', 'phpvms', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Site URL</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'site_url', Request::root(), ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td colspan="2">
<h4>Database Config</h4>
<p>Enter the target database information</p>
</td>
</tr>
<tr>
<td><p>Database Type</p></td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::select('db_conn', $db_types, null, ['class' => 'form-control', 'id' => 'db_conn']) }}
</div>
</td>
</tr>
<tbody id="mysql_settings" class="settings_panel">
<tr>
<td>Database Host</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_host', '127.0.0.1', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Port</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_port', '3306', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Name</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_name', 'phpvms', ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database User</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_user', null, ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td>Database Password</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_pass', null, ['class' => 'form-control']) }}
</div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right;">
{{ Form::submit('Test Database Credentials', ['class' => 'btn btn-info', 'id' => 'dbtest_button']) }}
</td>
</tr>
</tbody>
<tbody id="sqlite_settings" class="settings_panel">
</tbody>
<tr>
<td>Database Prefix</td>
<td style="text-align:center;">
<div class="form-group">
{{ Form::input('text', 'db_prefix', '', ['class' => 'form-control']) }}
<p>Set this if you're sharing the database with another application.</p>
</div>
</td>
</tr>
</table>
<div id="dbtest"></div>
<p style="text-align: right">
{{ Form::submit('Setup Database >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
</div>
@endsection
@section('scripts')
<script>
function changeForm(selected) {
$("tbody.settings_panel").hide();
$("tbody#" + selected + "_settings").show();
}
$(document).ready(() => {
const selValue = $("#db_conn option:selected").text();
changeForm(selValue);
$("#db_conn").change((e) => {
const selValue = $("#db_conn option:selected").text();
changeForm(selValue);
});
$("#dbtest_button").click((e) => {
e.preventDefault();
const opts = {
method: 'POST',
url: '/install/dbtest',
data: {
_token: "{{ csrf_token() }}",
db_conn: 'mysql',
db_host: $("input[name=db_host]").val(),
db_port: $("input[name=db_port]").val(),
db_name: $("input[name=db_name]").val(),
db_user: $("input[name=db_user]").val(),
db_pass: $("input[name=db_pass]").val(),
},
};
phpvms.request(opts).then(response => {
$("#dbtest").html(response.data);
});
})
});
</script>
@endsection

View File

@@ -0,0 +1,19 @@
@extends('system.installer.app')
@section('title', 'Database Setup Completed')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'installer.step3', 'method' => 'GET']) }}
<pre class="lang-sh">
<code class="lang-sh">
{{--<code class="language-bash">--}}
{{ $console_output }}
</code>
</pre>
<p style="text-align: right">
{{ Form::submit('Continue >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
</div>
@endsection

View File

@@ -0,0 +1,119 @@
@extends('system.installer.app')
@section('title', 'User Setup')
@section('content')
<div class="row">
<div class="col-md-12">
<div style="align-content: center;">
{{ Form::open(['route' => 'installer.usersetup', 'method' => 'POST']) }}
<table class="table" width="25%">
<tr>
<td colspan="2" style="text-align: right">
<a href="{{ route('importer.index') }}">Importing from a legacy install?</a>
</td>
</tr>
<tr>
<td colspan="2"><h4>Airline Information</h4></td>
</tr>
<tr>
<td><p>Airline ICAO</p></td>
<td>
<div class="form-group">
{{ Form::input('text', 'airline_icao', null, ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'airline_icao'])
</div>
</td>
</tr>
<tr>
<td><p>Airline Name</p></td>
<td>
<div class="form-group">
{{ Form::input('text', 'airline_name', null, ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'airline_name'])
</div>
</td>
</tr>
<tr>
<td><p>Airline Country</p></td>
<td>
<div class="form-group">
{{ Form::select('airline_country', $countries, null, ['class' => 'form-control select2' ]) }}
@include('system.installer.flash/check_error', ['field' => 'airline_country'])
</div>
</td>
</tr>
<tr>
<td colspan="2"><h4>First User</h4></td>
</tr>
<tr>
<td><p>Name</p></td>
<td>
<div class="form-group">
{{ Form::input('text', 'name', null, ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'name'])
</div>
</td>
</tr>
<tr>
<td><p>Email</p></td>
<td>
<div class="form-group">
{{ Form::input('text', 'email', null, ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'email'])
</div>
</td>
</tr>
<tr>
<td><p>Password</p></td>
<td>
{{ Form::password('password', ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'password'])
</td>
</tr>
<tr>
<td width="40%"><p>Password Confirm</p></td>
<td>
{{ Form::password('password_confirmation', ['class' => 'form-control']) }}
@include('system.installer.flash/check_error', ['field' => 'password_confirmation'])
</td>
</tr>
<tr>
<td colspan="2"><h4>Options</h4></td>
</tr>
<tr>
<td><p>Analytics</p></td>
<td>
<div class="form-group">
{{ Form::hidden('telemetry', 0) }}
{{ Form::checkbox('telemetry', 1, true, ['class' => 'form-control']) }}
<br/>
<p>
Allows collection of analytics. They won't identify you, and helps us to track
the PHP and database versions that are used, and help to figure out problems
and slowdowns when vaCentral integration is enabled.
</p>
</div>
</td>
</tr>
</table>
<div id="dbtest"></div>
<p style="text-align: right">
{{ Form::submit('Complete Setup >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,20 @@
@extends('system.installer.app')
@section('title', 'Installation Completed!')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'installer.complete', 'method' => 'GET']) }}
<h4>Installer Completed!</h4>
<p>Edit the <span class="code">config.php</span> to fill in some additional settings. </p>
<p>Click the button to proceed to the login screen!</p>
<p style="text-align: right">
{{ Form::submit('Install Complete! Continue to Log-In >>',
['class' => 'btn btn-success'])
}}
</p>
{{ Form::close() }}
</div>
@endsection

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title') - installer</title>
<link rel="shortcut icon" type="image/png" href="{{ public_asset('/assets/img/favicon.png') }}"/>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
name='viewport'/>
<meta name="base-url" content="{!! url('') !!}">
<meta name="api-key" content="{!! Auth::check() ? Auth::user()->api_key: '' !!}">
<meta name="csrf-token" content="{!! csrf_token() !!}">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/bootstrap.min.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/now-ui-kit.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/installer/css/vendor.css') }}" rel="stylesheet"/>
<link href="{{ public_asset('/assets/frontend/css/styles.css') }}" rel="stylesheet"/>
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<style>
.table tr:first-child td {
border-top: 0px;
}
@yield('css')
</style>
</head>
<body class="login-page" style="background: #067ec1;">
<div class="page-header clear-filter">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-8 ml-auto mr-auto content-center">
<div class="p-10" style="padding: 10px 0;">
<div class="row">
<div class="col-4">
<img src="{{ public_asset('/assets/img/logo_blue_bg.svg') }}" width="135px" style="" alt=""/>
</div>
<div class="col-8 text-right">
<h4 class="text-white mb-0 mr-0 ml-0" style="margin-top: 5px;">@yield('title')</h4>
</div>
</div>
</div>
<div class="card card-login card-plain" style="background: #FFF">
<div class="card-body">
@include('system.updater.flash.message')
@yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{--<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>--}}
<script src="{{ public_mix('/assets/global/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/vendor.js') }}"></script>
<script src="{{ public_mix('/assets/installer/js/app.js') }}"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>
hljs.configure({languages: ['sh']});
$(document).ready(function () {
$(".select2").select2();
$('pre code').each(function (i, block) {
hljs.fixMarkup(block);
hljs.highlightBlock(block);
});
});
</script>
@yield('scripts')
</body>
</html>

View File

@@ -0,0 +1,12 @@
@extends('system.updater.app')
@section('title', 'Update phpVMS')
@section('content')
<h2>phpvms updater</h2>
<p>Click run to complete the update to version {{ $version }}</p>
{{ Form::open(['route' => 'update.update_download', 'method' => 'post']) }}
<p style="text-align: right">
{{ Form::submit('Run >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,6 @@
@if($errors->has($field))
<p class="text-danger" style="margin-top: 10px;">{{ $errors->first($field) }}</p>
{{--<div class="alert alert-danger" role="alert" style="margin-top: 10px;">
{{ $errors->first($field) }}
</div>--}}
@endif

View File

@@ -0,0 +1,11 @@
@foreach (session('flash_notification', collect())->toArray() as $message)
<div class="alert alert-danger" role="alert">
<div class="container">
<div class="alert-icon">
<i class="now-ui-icons ui-2_like"></i>
</div>
{{ $message['message'] }}
</div>
</div>
@endforeach
{{ session()->forget('flash_notification') }}

View File

@@ -0,0 +1,12 @@
@extends('system.updater.app')
@section('title', 'Update phpVMS')
@section('content')
<h2>phpvms updater</h2>
<p>Press continue to check if there are any updates available.</p>
{{ Form::open(['route' => 'update.step1post', 'method' => 'post']) }}
<p style="text-align: right">
{{ Form::submit('Start >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,13 @@
@extends('system.updater.app')
@section('title', 'Update phpVMS')
@section('content')
<h2>phpvms updater</h2>
<p>It seems like you're up to date!</p>
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
<p style="text-align: right">
{{ Form::submit('Complete >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,12 @@
@extends('system.updater.app')
@section('title', 'Update phpVMS')
@section('content')
<h2>phpvms updater</h2>
<p>Click run to complete the update!.</p>
{{ Form::open(['route' => 'update.run_migrations', 'method' => 'post']) }}
<p style="text-align: right">
{{ Form::submit('Run >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,18 @@
@extends('system.updater.app')
@section('title', 'Update Completed')
@section('content')
<div style="align-content: center;">
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
<pre class="lang-sh">
<code class="lang-sh">
{{ $console_output }}
</code>
</pre>
<p style="text-align: right">
{{ Form::submit('Complete >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
</div>
@endsection

View File

@@ -0,0 +1,13 @@
@extends('system.updater.app')
@section('title', 'Update Completed')
@section('content')
<h2>phpvms updater</h2>
<p>Update completed!.</p>
{{ Form::open(['route' => 'update.complete', 'method' => 'GET']) }}
<p style="text-align: right">
{{ Form::submit('Finish >>', ['class' => 'btn btn-success']) }}
</p>
{{ Form::close() }}
@endsection