From 149bd1165ea2de4ba36fc9b91d46a98c887d7bbe Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 19 May 2026 16:39:11 +0800 Subject: [PATCH] Fix UI configuration block for local agent users --- app/Http/Controllers/BiometricAttendanceController.php | 9 +++++++++ bootstrap/app.php | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/BiometricAttendanceController.php b/app/Http/Controllers/BiometricAttendanceController.php index ff9b164d3..b5d680d81 100644 --- a/app/Http/Controllers/BiometricAttendanceController.php +++ b/app/Http/Controllers/BiometricAttendanceController.php @@ -26,7 +26,16 @@ class BiometricAttendanceController extends Controller $isZktecoSync = !empty($company_setting['isZktecoSync']) && $company_setting['isZktecoSync'] == '1'; $isDirectIP = filter_var($api_urls, FILTER_VALIDATE_IP); + + // Check if any branches are configured for local IP (which the agent uses) + $branches = \App\Models\Branch::whereNotNull('zkteco_ip')->whereIn('created_by', getCompanyAndUsersId())->get(); + $configurationMissing = empty($api_urls) || (!$isDirectIP && (empty($username) || empty($password) || empty($token) || !$isZktecoSync)); + + // If branches have IPs configured, we don't need the global API settings + if ($branches->isNotEmpty()) { + $configurationMissing = false; + } if (!empty($request->start_date) && !empty($request->end_date)) { $start_date = date('Y-m-d H:i:s', strtotime($request->start_date)); diff --git a/bootstrap/app.php b/bootstrap/app.php index 2e3fc6d22..e3adb9687 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -12,8 +12,8 @@ use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( - web: __DIR__.'/../routes/web.php', - commands: __DIR__.'/../routes/console.php', + web: __DIR__ . '/../routes/web.php', + commands: __DIR__ . '/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { @@ -51,6 +51,8 @@ return Application::configure(basePath: dirname(__DIR__)) 'payments/aamarpay/success', 'payments/aamarpay/callback', 'payments/tap/success', + 'api/zkteco/sync', // <-- ADD THIS LINE + 'payments/tap/callback', 'payments/benefit/success', 'payments/benefit/callback',