From d22f5a1d5daab1ca16724585c1ffb4d34d99a959 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 29 Mar 2026 13:29:51 +0000 Subject: [PATCH] update cities --- api/cities.php | 20 ++- cookies.txt | 5 + includes/layout/footer.php | 2 +- includes/layout/header.php | 2 +- includes/pages/hr_attendance.php | 48 +++---- includes/pages/hr_dashboard.php | 44 +++---- includes/pages/hr_leaves.php | 62 ++++----- lang.php | 210 +++++++++++++++++++++---------- queue_display.php | 2 +- 9 files changed, 248 insertions(+), 147 deletions(-) create mode 100644 cookies.txt diff --git a/api/cities.php b/api/cities.php index 0d02c92..7013cb5 100644 --- a/api/cities.php +++ b/api/cities.php @@ -11,16 +11,28 @@ if ($method === 'POST') { $input = json_decode(file_get_contents('php://input'), true) ?? $_POST; $action = $input['action'] ?? ''; - if ($action === 'add_city') { - $name_en = $input['name_en'] ?? ''; - $name_ar = $input['name_ar'] ?? ''; + if ($action === 'add' || $action === 'add_city') { + $name_en = $input['name_en'] ?? $input['name'] ?? ''; + $name_ar = $input['name_ar'] ?? $input['name'] ?? ''; if ($name_en && $name_ar) { try { $stmt = $db->prepare("INSERT INTO cities (name_en, name_ar) VALUES (?, ?)"); $stmt->execute([$name_en, $name_ar]); $id = $db->lastInsertId(); - echo json_encode(['success' => true, 'id' => $id, 'name_en' => $name_en, 'name_ar' => $name_ar]); + + $lang = $_SESSION['lang'] ?? 'en'; + + echo json_encode([ + 'success' => true, + 'id' => $id, + 'name_en' => $name_en, + 'name_ar' => $name_ar, + 'city' => [ + 'id' => $id, + 'name' => ($lang === 'ar' && !empty($name_ar)) ? $name_ar : $name_en + ] + ]); } catch (Exception $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); } diff --git a/cookies.txt b/cookies.txt new file mode 100644 index 0000000..5cbb0d2 --- /dev/null +++ b/cookies.txt @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +127.0.0.1 FALSE / FALSE 0 PHPSESSID hvh0shk5nt5h4nbcfvo601cpjc diff --git a/includes/layout/footer.php b/includes/layout/footer.php index 8ae6a24..d937bf4 100644 --- a/includes/layout/footer.php +++ b/includes/layout/footer.php @@ -76,7 +76,7 @@ diff --git a/includes/layout/header.php b/includes/layout/header.php index eaf14f5..fba8612 100644 --- a/includes/layout/header.php +++ b/includes/layout/header.php @@ -280,7 +280,7 @@ $site_favicon = !empty($site_settings['company_favicon']) ? $site_settings['comp