From adabb52f3f46ef1b65e91220d6769884ac1d82c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?=
Date: Mon, 7 Aug 2023 15:10:32 +0000
Subject: [PATCH] Move Device controller to the admin panel
---
.../AccountDeviceController.php} | 25 +++--
flexiapi/app/Services/AccountService.php | 1 -
flexiapi/composer.lock | 106 +++++++++---------
flexiapi/public/css/form.css | 7 ++
.../views/account/dashboard.blade.php | 6 -
.../views/account/devices/delete.blade.php | 28 -----
.../views/account/devices/index.blade.php | 33 ------
.../account/documentation_markdown.blade.php | 2 +-
.../account/account_type/create.blade.php | 4 +-
.../account/action/create_edit.blade.php | 4 +-
.../admin/account/action/delete.blade.php | 6 +-
.../admin/account/contact/delete.blade.php | 6 +-
.../views/admin/account/create_edit.blade.php | 9 +-
.../views/admin/account/delete.blade.php | 2 +-
.../admin/account/device/delete.blade.php | 29 +++++
.../admin/account/device/index.blade.php | 56 +++++++++
.../views/admin/account/index.blade.php | 9 +-
.../admin/account/type/create_edit.blade.php | 2 +-
.../views/admin/account/type/delete.blade.php | 6 +-
.../views/admin/account/type/index.blade.php | 2 +-
.../contacts_list/contacts/add.blade.php | 16 +--
.../admin/contacts_list/create_edit.blade.php | 2 +-
.../admin/contacts_list/delete.blade.php | 2 +-
.../views/admin/contacts_list/index.blade.php | 7 +-
.../resources/views/parts/terms.blade.php | 16 +--
flexiapi/routes/web.php | 14 +--
26 files changed, 220 insertions(+), 180 deletions(-)
rename flexiapi/app/Http/Controllers/{Account/DeviceController.php => Admin/AccountDeviceController.php} (62%)
delete mode 100644 flexiapi/resources/views/account/devices/delete.blade.php
delete mode 100644 flexiapi/resources/views/account/devices/index.blade.php
create mode 100644 flexiapi/resources/views/admin/account/device/delete.blade.php
create mode 100644 flexiapi/resources/views/admin/account/device/index.blade.php
diff --git a/flexiapi/app/Http/Controllers/Account/DeviceController.php b/flexiapi/app/Http/Controllers/Admin/AccountDeviceController.php
similarity index 62%
rename from flexiapi/app/Http/Controllers/Account/DeviceController.php
rename to flexiapi/app/Http/Controllers/Admin/AccountDeviceController.php
index 1ba8273..478300d 100644
--- a/flexiapi/app/Http/Controllers/Account/DeviceController.php
+++ b/flexiapi/app/Http/Controllers/Admin/AccountDeviceController.php
@@ -17,44 +17,47 @@
along with this program. If not, see .
*/
-namespace App\Http\Controllers\Account;
+namespace App\Http\Controllers\Admin;
+use App\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Libraries\FlexisipConnector;
-class DeviceController extends Controller
+class AccountDeviceController extends Controller
{
- public function index(Request $request)
+ public function index(Request $request, Account $account)
{
$connector = new FlexisipConnector;
return view(
- 'account.devices.index',
+ 'admin.account.device.index',
[
- 'devices' => $connector->getDevices($request->user()->identifier)
+ 'account' => $account,
+ 'devices' => $connector->getDevices($account->identifier)
]
);
}
- public function delete(Request $request, string $uuid)
+ public function delete(Request $request, Account $account, string $uuid)
{
$connector = new FlexisipConnector;
return view(
- 'account.devices.delete',
+ 'admin.account.device.delete',
[
- 'device' => $connector->getDevices($request->user()->identifier)
+ 'account' => $account,
+ 'device' => $connector->getDevices($account->identifier)
->where('uuid', $uuid)->first()
]
);
}
- public function destroy(Request $request)
+ public function destroy(Request $request, Account $account)
{
$connector = new FlexisipConnector;
- $connector->deleteDevice($request->user()->identifier, $request->get('uuid'));
+ $connector->deleteDevice($account->identifier, $request->get('uuid'));
- return redirect()->route('account.device.index');
+ return redirect()->route('admin.account.device.index');
}
}
diff --git a/flexiapi/app/Services/AccountService.php b/flexiapi/app/Services/AccountService.php
index 3a9fc32..3f6e385 100644
--- a/flexiapi/app/Services/AccountService.php
+++ b/flexiapi/app/Services/AccountService.php
@@ -52,7 +52,6 @@ class AccountService
$rules = [];
$rules['password'] = 'confirmed';
$rules['email'] = 'confirmed';
- $rules['privacy'] = 'accepted';
$rules['terms'] = 'accepted';
if ($this->api) {
diff --git a/flexiapi/composer.lock b/flexiapi/composer.lock
index 9c0ee84..40d4c9a 100644
--- a/flexiapi/composer.lock
+++ b/flexiapi/composer.lock
@@ -1516,16 +1516,16 @@
},
{
"name": "guzzlehttp/promises",
- "version": "2.0.0",
+ "version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
- "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6"
+ "reference": "111166291a0f8130081195ac4556a5587d7f1b5d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6",
- "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d",
+ "reference": "111166291a0f8130081195ac4556a5587d7f1b5d",
"shasum": ""
},
"require": {
@@ -1579,7 +1579,7 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
- "source": "https://github.com/guzzle/promises/tree/2.0.0"
+ "source": "https://github.com/guzzle/promises/tree/2.0.1"
},
"funding": [
{
@@ -1595,20 +1595,20 @@
"type": "tidelift"
}
],
- "time": "2023-05-21T13:50:22+00:00"
+ "time": "2023-08-03T15:11:55+00:00"
},
{
"name": "guzzlehttp/psr7",
- "version": "2.5.0",
+ "version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "b635f279edd83fc275f822a1188157ffea568ff6"
+ "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6",
- "reference": "b635f279edd83fc275f822a1188157ffea568ff6",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77",
+ "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77",
"shasum": ""
},
"require": {
@@ -1695,7 +1695,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
- "source": "https://github.com/guzzle/psr7/tree/2.5.0"
+ "source": "https://github.com/guzzle/psr7/tree/2.6.0"
},
"funding": [
{
@@ -1711,7 +1711,7 @@
"type": "tidelift"
}
],
- "time": "2023-04-17T16:11:26+00:00"
+ "time": "2023-08-03T15:06:02+00:00"
},
{
"name": "guzzlehttp/uri-template",
@@ -1799,16 +1799,16 @@
},
{
"name": "laravel/framework",
- "version": "v9.52.12",
+ "version": "v9.52.14",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
- "reference": "8bfd22be79f437fa335e70692e4e91ff40ce561d"
+ "reference": "5366a9035100f858589e1b43bbcb134ffcc81a73"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/framework/zipball/8bfd22be79f437fa335e70692e4e91ff40ce561d",
- "reference": "8bfd22be79f437fa335e70692e4e91ff40ce561d",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/5366a9035100f858589e1b43bbcb134ffcc81a73",
+ "reference": "5366a9035100f858589e1b43bbcb134ffcc81a73",
"shasum": ""
},
"require": {
@@ -1993,7 +1993,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2023-07-26T13:20:55+00:00"
+ "time": "2023-08-02T14:58:02+00:00"
},
{
"name": "laravel/serializable-closure",
@@ -2466,26 +2466,26 @@
},
{
"name": "league/mime-type-detection",
- "version": "1.11.0",
+ "version": "1.13.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git",
- "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd"
+ "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd",
- "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd",
+ "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96",
+ "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
- "php": "^7.2 || ^8.0"
+ "php": "^7.4 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^0.12.68",
- "phpunit/phpunit": "^8.5.8 || ^9.3"
+ "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0"
},
"type": "library",
"autoload": {
@@ -2506,7 +2506,7 @@
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
- "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0"
+ "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0"
},
"funding": [
{
@@ -2518,7 +2518,7 @@
"type": "tidelift"
}
],
- "time": "2022-04-17T13:12:02+00:00"
+ "time": "2023-08-05T12:09:49+00:00"
},
{
"name": "monolog/monolog",
@@ -2908,20 +2908,20 @@
},
{
"name": "nette/utils",
- "version": "v4.0.0",
+ "version": "v4.0.1",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
- "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e"
+ "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/utils/zipball/cacdbf5a91a657ede665c541eda28941d4b09c1e",
- "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e",
+ "url": "https://api.github.com/repos/nette/utils/zipball/9124157137da01b1f5a5a22d6486cb975f26db7e",
+ "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e",
"shasum": ""
},
"require": {
- "php": ">=8.0 <8.3"
+ "php": ">=8.0 <8.4"
},
"conflict": {
"nette/finder": "<3",
@@ -2929,7 +2929,7 @@
},
"require-dev": {
"jetbrains/phpstorm-attributes": "dev-master",
- "nette/tester": "^2.4",
+ "nette/tester": "^2.5",
"phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.9"
},
@@ -2989,9 +2989,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
- "source": "https://github.com/nette/utils/tree/v4.0.0"
+ "source": "https://github.com/nette/utils/tree/v4.0.1"
},
- "time": "2023-02-02T10:41:53+00:00"
+ "time": "2023-07-30T15:42:21+00:00"
},
{
"name": "nikic/php-parser",
@@ -5571,16 +5571,16 @@
},
{
"name": "sebastian/global-state",
- "version": "5.0.5",
+ "version": "5.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2"
+ "reference": "bde739e7565280bda77be70044ac1047bc007e34"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2",
- "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34",
+ "reference": "bde739e7565280bda77be70044ac1047bc007e34",
"shasum": ""
},
"require": {
@@ -5623,7 +5623,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
- "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5"
+ "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6"
},
"funding": [
{
@@ -5631,7 +5631,7 @@
"type": "github"
}
],
- "time": "2022-02-14T08:28:10+00:00"
+ "time": "2023-08-02T09:26:13+00:00"
},
{
"name": "sebastian/lines-of-code",
@@ -8601,16 +8601,16 @@
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
- "version": "v3.8.1",
+ "version": "v3.8.2",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
- "reference": "aff3235fecb4104203b1e62c32239c56530eee32"
+ "reference": "56a2dc1da9d3219164074713983eef68996386cf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/aff3235fecb4104203b1e62c32239c56530eee32",
- "reference": "aff3235fecb4104203b1e62c32239c56530eee32",
+ "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/56a2dc1da9d3219164074713983eef68996386cf",
+ "reference": "56a2dc1da9d3219164074713983eef68996386cf",
"shasum": ""
},
"require": {
@@ -8669,7 +8669,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
- "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.8.1"
+ "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.8.2"
},
"funding": [
{
@@ -8681,7 +8681,7 @@
"type": "github"
}
],
- "time": "2023-02-21T14:21:02+00:00"
+ "time": "2023-07-26T04:57:49+00:00"
},
{
"name": "composer/pcre",
@@ -9010,31 +9010,31 @@
},
{
"name": "mockery/mockery",
- "version": "1.6.4",
+ "version": "1.6.5",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
- "reference": "d1413755e26fe56a63455f7753221c86cbb88f66"
+ "reference": "68782e943f9ffcbc72bda08aedabe73fecb50041"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/mockery/mockery/zipball/d1413755e26fe56a63455f7753221c86cbb88f66",
- "reference": "d1413755e26fe56a63455f7753221c86cbb88f66",
+ "url": "https://api.github.com/repos/mockery/mockery/zipball/68782e943f9ffcbc72bda08aedabe73fecb50041",
+ "reference": "68782e943f9ffcbc72bda08aedabe73fecb50041",
"shasum": ""
},
"require": {
"hamcrest/hamcrest-php": "^2.0.1",
"lib-pcre": ">=7.0",
- "php": ">=7.4,<8.3"
+ "php": ">=7.3"
},
"conflict": {
"phpunit/phpunit": "<8.0"
},
"require-dev": {
- "phpunit/phpunit": "^8.5 || ^9.3",
+ "phpunit/phpunit": "^8.5 || ^9.6.10",
"psalm/plugin-phpunit": "^0.18.4",
"symplify/easy-coding-standard": "^11.5.0",
- "vimeo/psalm": "^5.13.1"
+ "vimeo/psalm": "^4.30"
},
"type": "library",
"autoload": {
@@ -9091,7 +9091,7 @@
"security": "https://github.com/mockery/mockery/security/advisories",
"source": "https://github.com/mockery/mockery"
},
- "time": "2023-07-19T15:51:02+00:00"
+ "time": "2023-08-06T00:30:34+00:00"
},
{
"name": "nunomaduro/collision",
diff --git a/flexiapi/public/css/form.css b/flexiapi/public/css/form.css
index 8310cfd..397e2c3 100644
--- a/flexiapi/public/css/form.css
+++ b/flexiapi/public/css/form.css
@@ -26,6 +26,7 @@ p .btn {
.oppose {
float: right;
+ text-align: right;
}
.btn[disabled] {
@@ -251,6 +252,12 @@ input[type=number].digit {
margin-right: 1rem;
}
+input::-webkit-outer-spin-button,
+input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
input[type=checkbox] {
accent-color: var(--main-5);
}
diff --git a/flexiapi/resources/views/account/dashboard.blade.php b/flexiapi/resources/views/account/dashboard.blade.php
index d1adea7..6992944 100644
--- a/flexiapi/resources/views/account/dashboard.blade.php
+++ b/flexiapi/resources/views/account/dashboard.blade.php
@@ -26,12 +26,6 @@
@endif
Change my current account phone
- @if (config('app.devices_management') == true)
-
- laptop
- Manage my devices
-
- @endif
lock
diff --git a/flexiapi/resources/views/account/devices/delete.blade.php b/flexiapi/resources/views/account/devices/delete.blade.php
deleted file mode 100644
index 880a9d4..0000000
--- a/flexiapi/resources/views/account/devices/delete.blade.php
+++ /dev/null
@@ -1,28 +0,0 @@
-@extends('layouts.main')
-
-@section('breadcrumb')
-
- Devices
-
-Delete
-@endsection
-
-@section('content')
-
-Device deletion
-
-Are you sure you want to delete the following device?
-
- User Agent: {{ $device->user_agent }}
-
-
-
-{!! Form::open(['route' => 'account.device.destroy', 'method' => 'delete']) !!}
-
-{!! Form::hidden('uuid', $device->uuid) !!}
-
-{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
-{!! Form::close() !!}
-
-
-@endsection
\ No newline at end of file
diff --git a/flexiapi/resources/views/account/devices/index.blade.php b/flexiapi/resources/views/account/devices/index.blade.php
deleted file mode 100644
index 645e90a..0000000
--- a/flexiapi/resources/views/account/devices/index.blade.php
+++ /dev/null
@@ -1,33 +0,0 @@
-@extends('layouts.main')
-
-@section('breadcrumb')
-Devices
-@endsection
-
-@section('content')
-
-
-
-
- User Agent
-
-
-
-
- @foreach ($devices as $device)
-
- {{ $device->user_agent }}
-
-
- Delete
-
-
-
- @endforeach
-
-
-
-
-@endsection
\ No newline at end of file
diff --git a/flexiapi/resources/views/account/documentation_markdown.blade.php b/flexiapi/resources/views/account/documentation_markdown.blade.php
index 9ef7291..a71936a 100644
--- a/flexiapi/resources/views/account/documentation_markdown.blade.php
+++ b/flexiapi/resources/views/account/documentation_markdown.blade.php
@@ -68,7 +68,7 @@ Your account can be deleted from the panel using the @if (config('app.web_panel'
*The feature is not enabled on this instance.*
@endif
-From the @if (config('app.web_panel'))[devices management panel]({{ route('account.device.index') }}) @else devices management panel @endif you will be able to list and delete the devices attached to your SIP address.
+From the @if (config('app.web_panel'))[devices management panel]({{ route('admin.account.device.index') }}) @else devices management panel @endif an admin will be able to list and delete the devices attached to a SIP account.
# Admin panel
diff --git a/flexiapi/resources/views/admin/account/account_type/create.blade.php b/flexiapi/resources/views/admin/account/account_type/create.blade.php
index c93daf5..738745f 100644
--- a/flexiapi/resources/views/admin/account/account_type/create.blade.php
+++ b/flexiapi/resources/views/admin/account/account_type/create.blade.php
@@ -1,10 +1,10 @@
@extends('layouts.main')
@section('breadcrumb')
-
+
Accounts
-
+
{{ $account->identifier }}
diff --git a/flexiapi/resources/views/admin/account/action/create_edit.blade.php b/flexiapi/resources/views/admin/account/action/create_edit.blade.php
index dcf67a6..1b9201f 100644
--- a/flexiapi/resources/views/admin/account/action/create_edit.blade.php
+++ b/flexiapi/resources/views/admin/account/action/create_edit.blade.php
@@ -1,10 +1,10 @@
@extends('layouts.main')
@section('breadcrumb')
-
+
Accounts
-
+
{{ $account->identifier }}
diff --git a/flexiapi/resources/views/admin/account/action/delete.blade.php b/flexiapi/resources/views/admin/account/action/delete.blade.php
index 72fefa0..8e644a3 100644
--- a/flexiapi/resources/views/admin/account/action/delete.blade.php
+++ b/flexiapi/resources/views/admin/account/action/delete.blade.php
@@ -1,13 +1,13 @@
@extends('layouts.main')
@section('breadcrumb')
-
+
Accounts
-
+
{{ $action->account->identifier }}
-
+
Actions
Delete
diff --git a/flexiapi/resources/views/admin/account/contact/delete.blade.php b/flexiapi/resources/views/admin/account/contact/delete.blade.php
index 4fc3dd9..e4a2b3a 100644
--- a/flexiapi/resources/views/admin/account/contact/delete.blade.php
+++ b/flexiapi/resources/views/admin/account/contact/delete.blade.php
@@ -1,13 +1,13 @@
@extends('layouts.main')
@section('breadcrumb')
-
+
Accounts
-
+
{{ $account->identifier }}
-
+
Contacts
Delete
diff --git a/flexiapi/resources/views/admin/account/create_edit.blade.php b/flexiapi/resources/views/admin/account/create_edit.blade.php
index 72ecb24..1256e2a 100644
--- a/flexiapi/resources/views/admin/account/create_edit.blade.php
+++ b/flexiapi/resources/views/admin/account/create_edit.blade.php
@@ -1,7 +1,7 @@
@extends('layouts.main')
@section('breadcrumb')
-
+
Accounts
Edit
@@ -19,6 +19,13 @@
Updated on {{ $account->updated_at->format('d/m/Y') }}
+
+ @include('parts.tabs', [
+ 'items' => [
+ route('admin.account.edit', $account->id, ['type' => 'messages']) => 'Information',
+ route('admin.account.device.index', $account->id, ['type' => 'accounts']) => 'Devices',
+ ],
+ ])
@else