Fix UI configuration block for local agent users

This commit is contained in:
2026-05-19 16:39:11 +08:00
parent 7f92eff3eb
commit 149bd1165e
2 changed files with 13 additions and 2 deletions

View File

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