diff --git a/api/cities.php b/api/cities.php new file mode 100644 index 0000000..0d02c92 --- /dev/null +++ b/api/cities.php @@ -0,0 +1,36 @@ +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]); + } catch (Exception $e) { + echo json_encode(['success' => false, 'error' => $e->getMessage()]); + } + } else { + echo json_encode(['success' => false, 'error' => 'Missing fields']); + } + } else { + echo json_encode(['success' => false, 'error' => 'Invalid action']); + } + exit; +} + +echo json_encode(['success' => false, 'error' => 'Invalid request method']); diff --git a/db/migrations/20260306_create_services_module.sql b/db/migrations/20260306_create_services_module.sql new file mode 100644 index 0000000..7bc346c --- /dev/null +++ b/db/migrations/20260306_create_services_module.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS services ( + id INT AUTO_INCREMENT PRIMARY KEY, + name_en VARCHAR(255) NOT NULL, + name_ar VARCHAR(255) NOT NULL, + department_id INT NOT NULL, + price DECIMAL(10, 2) NOT NULL DEFAULT 0.00, + is_active TINYINT(1) NOT NULL DEFAULT 1, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + FOREIGN KEY (department_id) REFERENCES departments(id) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/includes/layout/footer.php b/includes/layout/footer.php index e8bfc8f..dfba574 100644 --- a/includes/layout/footer.php +++ b/includes/layout/footer.php @@ -58,15 +58,21 @@