Fix the Smart Caller Log function

This commit is contained in:
Jan_Hill 2024-12-26 02:33:40 +01:00
parent 1d80e682dc
commit 42188ad599
12 changed files with 155 additions and 118 deletions

View File

@ -1,66 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

View File

@ -5,6 +5,10 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Caller_DB;
use App\Models\CallerLog_DB;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Collection;
class SmartController extends Controller
{
@ -25,16 +29,11 @@ class SmartController extends Controller
return view('smart.caller', compact('callers'));
}
public function caller_log()
{
$caller_logs = CallerLog_DB::paginate(15);
$caller_logs->getCollection()->transform(function ($log) {
$caller = Caller_DB::where('created_by', $log->created_by)->first();
$log->token_by = $caller ? $caller->created_by : null;
return $log;
});
return view('smart.caller_log', compact('caller_logs'));
}
public function caller_log(Request $request)
{
$caller_logs = CallerLog_DB::all();
return view('smart.caller_log', compact('caller_logs'));
}
}

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "NCORE_Smart_Firewall",
"name": "ncore",
"lockfileVersion": 3,
"requires": true,
"packages": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +1,24 @@
{
"node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff": {
"file": "assets/bootstrap-icons-BOrJxbIo.woff",
"src": "node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff"
},
"node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2": {
"file": "assets/bootstrap-icons-BtvjY1KL.woff2",
"src": "node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2"
},
"resources/css/app.css": {
"file": "assets/app-CqUG6m1s.css",
"file": "assets/app-DnpBOEVG.css",
"src": "resources/css/app.css",
"isEntry": true
},
"resources/js/app.js": {
"file": "assets/app-DtpE_s0N.js",
"file": "assets/app-C2Oom3im.js",
"name": "app",
"src": "resources/js/app.js",
"isEntry": true
"isEntry": true,
"css": [
"assets/app-BaVkx4tQ.css"
]
}
}

View File

@ -199,14 +199,12 @@
</tr>
</thead>
<tbody>
@php
$counter = 1;
@endphp
@foreach($caller_logs as $caller)
<tr>
<td class="px-6 py-4 whitespace-nowrap">{{ $counter++ }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ $caller->caller_name }}</td>
<td class="px-6 py-4 whitespace-nowrap">
@foreach($caller_logs as $index => $caller)
<td class="px-6 py-4 whitespace-nowrap">{{ $index + 1 }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
{{ $caller->caller_name }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
@if ( $caller->status === "success" )
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300">
{{ $caller->status }}
@ -226,7 +224,10 @@
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
{{ $caller->token_by }}
<button onclick="toggleToken({{ $index }})" class="text-blue-500 hover:underline flex items-center">
<i class="bi bi-eye mr-2"></i> <span id="toggle-text-{{ $index }}">Show Token</span>
</button>
<span id="token-{{ $index }}" class="hidden">{{ $caller->token_by }}</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
@ -257,6 +258,17 @@
"responsive": true
});
});
function toggleToken(index) {
const tokenElement = document.getElementById(`token-${index}`);
const toggleText = document.getElementById(`toggle-text-${index}`);
if (tokenElement.style.display === 'inline') {
tokenElement.style.display = 'none';
toggleText.textContent = 'Show Token';
} else {
tokenElement.style.display = 'inline';
toggleText.textContent = 'Hide Token';
}
}
</script>
<script>