Fix #126 Move all the intercome related features under a toggle

This commit is contained in:
Timothée Jaussoin 2023-10-05 17:02:08 +02:00
parent ab6aa88b3c
commit c477973d84
14 changed files with 124 additions and 114 deletions

View file

@ -41,7 +41,8 @@ WEB_PANEL=true # Fully enable/disable the web panels
NEWSLETTER_REGISTRATION_ADDRESS= # Address to contact when a user wants to register to the newsletter NEWSLETTER_REGISTRATION_ADDRESS= # Address to contact when a user wants to register to the newsletter
PUBLIC_REGISTRATION=true # Toggle to enable/disable the public registration forms PUBLIC_REGISTRATION=true # Toggle to enable/disable the public registration forms
PHONE_AUTHENTICATION=true # Toggle to enable/disable the SMS support, requires public registration PHONE_AUTHENTICATION=true # Toggle to enable/disable the SMS support, requires public registration
DEVICES_MANAGEMENT=false # Toggle to enable/disable the devices management support DEVICES_MANAGEMENT=false # Toggle to enable/disable the devices management supporttrue
INTERCOM_FEATURES=false # Toggle to enable/disable the intercom related features
TERMS_OF_USE_URL= # A URL pointing to the Terms of Use TERMS_OF_USE_URL= # A URL pointing to the Terms of Use
PRIVACY_POLICY_URL= # A URL pointing to the Privacy Policy PRIVACY_POLICY_URL= # A URL pointing to the Privacy Policy

View file

@ -51,8 +51,6 @@ class AccountTypeController extends Controller
$accountType->key = $request->get('key'); $accountType->key = $request->get('key');
$accountType->save(); $accountType->save();
$request->session()->flash('success', 'Type successfully created');
return redirect()->route('admin.account.type.index'); return redirect()->route('admin.account.type.index');
} }
@ -78,8 +76,6 @@ class AccountTypeController extends Controller
$accountType->key = $request->get('key'); $accountType->key = $request->get('key');
$accountType->save(); $accountType->save();
$request->session()->flash('success', 'Type successfully updated');
return redirect()->route('admin.account.type.index'); return redirect()->route('admin.account.type.index');
} }
@ -95,8 +91,6 @@ class AccountTypeController extends Controller
$type = AccountType::findOrFail($typeId); $type = AccountType::findOrFail($typeId);
$type->delete(); $type->delete();
$request->session()->flash('success', 'Type successfully destroyed');
Log::channel('events')->info('Web Admin: Account type deleted', ['type' => $type->key]); Log::channel('events')->info('Web Admin: Account type deleted', ['type' => $type->key]);
return redirect()->route('admin.account.type.index'); return redirect()->route('admin.account.type.index');

View file

@ -22,6 +22,7 @@ return [
'newsletter_registration_address' => env('NEWSLETTER_REGISTRATION_ADDRESS', ''), 'newsletter_registration_address' => env('NEWSLETTER_REGISTRATION_ADDRESS', ''),
'phone_authentication' => env('PHONE_AUTHENTICATION', true), 'phone_authentication' => env('PHONE_AUTHENTICATION', true),
'public_registration' => env('PUBLIC_REGISTRATION', true), 'public_registration' => env('PUBLIC_REGISTRATION', true),
'intercom_features' => env('INTERCOM_FEATURES', false),
'devices_management' => env('DEVICES_MANAGEMENT', false), 'devices_management' => env('DEVICES_MANAGEMENT', false),
'web_panel' => env('WEB_PANEL', true), 'web_panel' => env('WEB_PANEL', true),

View file

@ -113,6 +113,10 @@ pre {
color: var(--second-7); color: var(--second-7);
} }
em {
font-style: italic;
}
pre { pre {
overflow: auto; overflow: auto;
background-color: var(--second-8); background-color: var(--second-8);

View file

@ -1,9 +1,12 @@
@extends('layouts.main', ['grid' => true]) @extends('layouts.main', ['grid' => true])
@section('breadcrumb')
<li class="breadcrumb-item active" aria-current="page">
API Key
</li>
@endsection
@section('content') @section('content')
<header>
<h1><i class="material-icons-outlined">dashboard</i> Dashboard</h1>
</header>
<div class="large"> <div class="large">
<h2><i class="material-icons-outlined">key</i>API Key</h2> <h2><i class="material-icons-outlined">key</i>API Key</h2>

View file

@ -102,6 +102,10 @@ The deletion of an account is definitive, all the database related data (passwor
### Create, edit and delete account types ### Create, edit and delete account types
@if (config('app.intercom_features') == false)
*The feature is not enabled on this instance.*
@endif
An adminisator can create, edit and delete account types. Those can be used to categorize accounts in clients, they are often used for Internet of Things related devices. An adminisator can create, edit and delete account types. Those can be used to categorize accounts in clients, they are often used for Internet of Things related devices.
## Statistics ## Statistics

View file

@ -20,7 +20,7 @@
@endif @endif
<form method="POST" <form method="POST"
action="{{ $action->id ? route('admin.account.acton.update', [$action->account->id, $action->id]) : route('admin.account.action.store') }}" action="{{ $action->id ? route('admin.account.acton.update', [$action->account->id, $action->id]) : route('admin.account.action.store', $account->id) }}"
accept-charset="UTF-8"> accept-charset="UTF-8">
@method($action->id ? 'put' : 'post') @method($action->id ? 'put' : 'post')
@csrf @csrf

View file

@ -203,53 +203,55 @@
</p> </p>
@endif @endif
<h2>Actions</h2> @if(config('app.intercom_features'))
<h2>Actions</h2>
@if ($account->dtmf_protocol)
<table class="table">
<tbody>
@foreach ($account->actions as $action)
<tr>
<th scope="row">{{ $action->key }}</th>
<td>{{ $action->code }}</td>
<td>
<a class="btn"
href="{{ route('admin.account.action.edit', [$account, $action->id]) }}">Edit</a>
<a class="btn"
href="{{ route('admin.account.action.delete', [$account, $action->id]) }}">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<a class="btn" href="{{ route('admin.account.action.create', $account) }}">Add</a>
@else
<p>To manage actions, you must configure the DTMF protocol in the account settings.</p>
@endif
<h2>Types</h2>
@if ($account->dtmf_protocol)
<table class="table"> <table class="table">
<tbody> <tbody>
@foreach ($account->actions as $action) @foreach ($account->types as $type)
<tr> <tr>
<th scope="row">{{ $action->key }}</th> <th scope="row">{{ $type->key }}</th>
<td>{{ $action->code }}</td>
<td> <td>
<a class="btn" <form method="POST"
href="{{ route('admin.account.action.edit', [$account, $action->id]) }}">Edit</a> action="{{ route('admin.account.account_type.destroy', [$account, $type->id]) }}"
<a class="btn" accept-charset="UTF-8">
href="{{ route('admin.account.action.delete', [$account, $action->id]) }}">Delete</a> @csrf
@method('delete')
<input class="btn" type="submit" value="Delete">
</form>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
<a class="btn" href="{{ route('admin.account.action.create', $account) }}">Add</a> <a class="btn" href="{{ route('admin.account.account_type.create', $account) }}">Add</a>
@else
<p>To manage actions, you must configure the DTMF protocol in the account settings.</p>
@endif @endif
<h2>Types</h2>
<table class="table">
<tbody>
@foreach ($account->types as $type)
<tr>
<th scope="row">{{ $type->key }}</th>
<td>
<form method="POST"
action="{{ route('admin.account.account_type.destroy', [$account, $type->id]) }}"
accept-charset="UTF-8">
@csrf
@method('delete')
<input class="btn" type="submit" value="Delete">
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
<a class="btn" href="{{ route('admin.account.account_type.create', $account) }}">Add</a>
@endif @endif
@endsection @endsection

View file

@ -13,6 +13,12 @@
<i class="material-icons-outlined">publish</i> <i class="material-icons-outlined">publish</i>
Import Accounts Import Accounts
</a> </a>
@if(config('app.intercom_features'))
<a class="btn btn-secondary" href="{{ route('admin.account.type.index') }}">
<i class="material-icons-outlined">category</i>
Types
</a>
@endif
<a class="btn" href="{{ route('admin.account.create') }}"> <a class="btn" href="{{ route('admin.account.create') }}">
<i class="material-icons-outlined">add_circle</i> <i class="material-icons-outlined">add_circle</i>
New Account New Account

View file

@ -4,9 +4,12 @@
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{{ route('admin.account.index') }}">Accounts</a> <a href="{{ route('admin.account.index') }}">Accounts</a>
</li> </li>
<li class="breadcrumb-item active" aria-current="page"> <li class="breadcrumb-item">
<a href="{{ route('admin.account.type.index') }}">Types</a> <a href="{{ route('admin.account.type.index') }}">Types</a>
</li> </li>
<li class="breadcrumb-item active" aria-current="page">
@if ($type->id)Edit @else Create @endif
</li>
@endsection @endsection
@section('content') @section('content')

View file

@ -1,44 +1,42 @@
@extends('layouts.main') @extends('layouts.main')
@section('breadcrumb') @section('breadcrumb')
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{{ route('admin.account.index') }}">Accounts</a> <a href="{{ route('admin.account.index') }}">Accounts</a>
</li> </li>
<li class="breadcrumb-item" aria-current="page"> <li class="breadcrumb-item" aria-current="page">
<a href="{{ route('admin.account.type.index') }}">Types</a> <a href="{{ route('admin.account.type.index') }}">Types</a>
</li> </li>
@endsection @endsection
@section('content') @section('content')
<header>
<h1><i class="material-icons-outlined">category</i> Types</h1>
<a class="btn oppose" href="{{ route('admin.account.type.create') }}">
<i class="material-icons-outlined">add</i>
New Type
</a>
</header>
<div class="row mb-2"> <table class="table">
<div class="col-sm"> <thead>
<a class="btn btn-success float-right" href="{{ route('admin.account.type.create') }}">Create</a>
<h2>Types</h2>
</div>
</div>
<table class="table">
<thead>
<tr>
<th>Key</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach ($types as $type)
<tr> <tr>
<td> <th>Key</th>
{{ $type->key }} <th></th>
</td>
<td>
<a class="btn" href="{{ route('admin.account.type.edit', [$type->id]) }}">Edit</a>
<a class="btn" href="{{ route('admin.account.type.delete', [$type->id]) }}">Delete</a>
</td>
</tr> </tr>
@endforeach </thead>
<tbody>
</tbody> @foreach ($types as $type)
</table> <tr>
<td>
@endsection {{ $type->key }}
</td>
<td>
<a class="btn" href="{{ route('admin.account.type.edit', [$type->id]) }}">Edit</a>
<a class="btn btn-secondary" href="{{ route('admin.account.type.delete', [$type->id]) }}">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection

View file

@ -59,7 +59,7 @@
@hasSection('breadcrumb') @hasSection('breadcrumb')
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('account.dashboard') }}">Home</a></li> <li class="breadcrumb-item"><a href="{{ route('account.dashboard') }}">Dashboard</a></li>
@yield('breadcrumb') @yield('breadcrumb')
</ol> </ol>
</nav> </nav>

View file

@ -1,8 +0,0 @@
@hasSection('breadcrumb')
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('account.dashboard') }}">Home</a></li>
@yield('breadcrumb')
</ol>
</nav>
@endif

View file

@ -166,21 +166,32 @@ if (config('app.web_panel')) {
Route::post('handle', 'handle')->name('handle'); Route::post('handle', 'handle')->name('handle');
}); });
Route::name('type.')->prefix('types')->controller(AccountTypeController::class)->group(function () { if (config('app.intercom_features')) {
Route::get('/', 'index')->name('index'); Route::name('type.')->prefix('types')->controller(AccountTypeController::class)->group(function () {
Route::get('create', 'create')->name('create'); Route::get('/', 'index')->name('index');
Route::post('/', 'store')->name('store'); Route::get('create', 'create')->name('create');
Route::get('{type_id}/edit', 'edit')->name('edit'); Route::post('/', 'store')->name('store');
Route::put('{type_id}', 'update')->name('update'); Route::get('{type_id}/edit', 'edit')->name('edit');
Route::get('{type_id}/delete', 'delete')->name('delete'); Route::put('{type_id}', 'update')->name('update');
Route::delete('{type_id}', 'destroy')->name('destroy'); Route::get('{type_id}/delete', 'delete')->name('delete');
}); Route::delete('{type_id}', 'destroy')->name('destroy');
});
Route::name('account_type.')->prefix('{account}/types')->controller(AccountAccountTypeController::class)->group(function () { Route::name('account_type.')->prefix('{account}/types')->controller(AccountAccountTypeController::class)->group(function () {
Route::get('create', 'create')->name('create'); Route::get('create', 'create')->name('create');
Route::post('/', 'store')->name('store'); Route::post('/', 'store')->name('store');
Route::delete('{type_id}', 'destroy')->name('destroy'); Route::delete('{type_id}', 'destroy')->name('destroy');
}); });
Route::name('action.')->prefix('{account}/actions')->controller(AccountActionController::class)->group(function () {
Route::get('create', 'create')->name('create');
Route::post('/', 'store')->name('store');
Route::get('{action_id}/edit', 'edit')->name('edit');
Route::put('{action_id}', 'update')->name('update');
Route::get('{action_id}/delete', 'delete')->name('delete');
Route::delete('{action_id}', 'destroy')->name('destroy');
});
}
Route::name('contact.')->prefix('{account}/contacts')->controller(AccountContactController::class)->group(function () { Route::name('contact.')->prefix('{account}/contacts')->controller(AccountContactController::class)->group(function () {
Route::get('create', 'create')->name('create'); Route::get('create', 'create')->name('create');
@ -199,15 +210,6 @@ if (config('app.web_panel')) {
Route::get('/', 'show')->name('show'); Route::get('/', 'show')->name('show');
Route::post('/', 'edit')->name('edit'); Route::post('/', 'edit')->name('edit');
}); });
Route::name('action.')->prefix('{account}/actions')->controller(AccountActionController::class)->group(function () {
Route::get('create', 'create')->name('create');
Route::post('/', 'store')->name('store');
Route::get('{action_id}/edit', 'edit')->name('edit');
Route::put('{action_id}', 'update')->name('update');
Route::get('{action_id}/delete', 'delete')->name('delete');
Route::delete('{action_id}', 'destroy')->name('destroy');
});
}); });
Route::name('contacts_lists.')->prefix('contacts_lists')->controller(ContactsListController::class)->group(function () { Route::name('contacts_lists.')->prefix('contacts_lists')->controller(ContactsListController::class)->group(function () {