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

@@ -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