chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل

نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق».
نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا
`cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules ·
.dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore.

هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً
مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ.

⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا
صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم
توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-27 05:10:29 +03:00
co-authored by Claude Opus 5
commit 92dc6b3641
3654 changed files with 896478 additions and 0 deletions
@@ -0,0 +1,222 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../controller/admin/staff_controller.dart';
class AddStaffPage extends StatelessWidget {
final String role;
const AddStaffPage({super.key, required this.role});
@override
Widget build(BuildContext context) {
final controller = Get.put(StaffController());
controller.selectedRole = role;
final cs = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: cs.surface,
body: Column(
children: [
Container(
padding: const EdgeInsets.fromLTRB(16, 50, 16, 16),
child: Row(
children: [
GestureDetector(
onTap: () => Get.back(),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: cs.outline),
),
child: Icon(Icons.arrow_back_ios_new_rounded, color: cs.onSurfaceVariant, size: 16),
),
),
const SizedBox(width: 12),
Text(role == 'admin' ? "إضافة مدير جديد" : "إضافة موظف خدمة عملاء", style: TextStyle(color: cs.onSurface, fontSize: 18, fontWeight: FontWeight.w700)),
],
),
),
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: Form(
key: controller.formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle("المعلومات الأساسية", cs),
const SizedBox(height: 16),
_buildTextField(
controller: controller.nameController,
label: "الاسم الكامل",
icon: Icons.person_outline,
cs: cs,
),
const SizedBox(height: 16),
_buildTextField(
controller: controller.phoneController,
label: "رقم الهاتف",
icon: Icons.phone_android_outlined,
cs: cs,
keyboardType: TextInputType.phone,
),
const SizedBox(height: 16),
_buildTextField(
controller: controller.emailController,
label: "البريد الإلكتروني",
icon: Icons.email_outlined,
cs: cs,
keyboardType: TextInputType.emailAddress,
),
const SizedBox(height: 16),
_buildTextField(
controller: controller.passwordController,
label: "كلمة المرور",
icon: Icons.lock_outline,
cs: cs,
obscureText: true,
),
const SizedBox(height: 24),
_buildSectionTitle("معلومات إضافية", cs),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: _buildDropdown(
label: "الجنس",
value: controller.selectedGender,
items: ['Male', 'Female'],
onChanged: (val) => controller.selectedGender = val!,
cs: cs,
),
),
const SizedBox(width: 16),
Expanded(
child: _buildTextField(
controller: controller.birthdateController,
label: "تاريخ الميلاد",
icon: Icons.calendar_today_outlined,
cs: cs,
hint: "YYYY-MM-DD",
),
),
],
),
const SizedBox(height: 16),
_buildDropdown(
label: "البلد",
value: controller.selectedCountry,
items: const ['Jordan', 'Syria', 'Egypt'],
onChanged: (val) => controller.selectedCountry = val!,
cs: cs,
),
const SizedBox(height: 40),
GetBuilder<StaffController>(
builder: (controller) => SizedBox(
width: double.infinity,
height: 56,
child: ElevatedButton(
onPressed: controller.isLoading ? null : () => controller.registerStaff(),
style: ElevatedButton.styleFrom(
backgroundColor: cs.primary,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
child: controller.isLoading
? CircularProgressIndicator(color: cs.onPrimary)
: Text(
"حفظ البيانات",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: cs.onPrimary,
),
),
),
),
),
],
),
),
),
),
],
),
);
}
Widget _buildSectionTitle(String title, ColorScheme cs) {
return Text(
title,
style: TextStyle(
color: cs.onSurfaceVariant,
fontSize: 13,
fontWeight: FontWeight.bold,
letterSpacing: 1.2,
),
);
}
Widget _buildTextField({
required TextEditingController controller,
required String label,
required IconData icon,
required ColorScheme cs,
String? hint,
bool obscureText = false,
TextInputType keyboardType = TextInputType.text,
}) {
return Container(
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.outline.withValues(alpha: 0.1)),
),
child: TextFormField(
controller: controller,
obscureText: obscureText,
keyboardType: keyboardType,
style: TextStyle(color: cs.onSurface),
decoration: InputDecoration(
labelText: label,
hintText: hint,
hintStyle: TextStyle(color: cs.onSurface.withValues(alpha: 0.24)),
labelStyle: TextStyle(color: cs.onSurfaceVariant),
prefixIcon: Icon(icon, color: cs.onSurfaceVariant),
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
),
validator: (val) => val == null || val.isEmpty ? "هذا الحقل مطلوب" : null,
),
);
}
Widget _buildDropdown({
required String label,
required String value,
required List<String> items,
required Function(String?) onChanged,
required ColorScheme cs,
}) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.outline.withValues(alpha: 0.1)),
),
child: DropdownButtonFormField<String>(
initialValue: value,
dropdownColor: cs.surfaceContainerHighest,
style: TextStyle(color: cs.onSurface),
decoration: InputDecoration(
labelText: label,
labelStyle: TextStyle(color: cs.onSurfaceVariant),
border: InputBorder.none,
),
items: items.map((e) => DropdownMenuItem(value: e, child: Text(e))).toList(),
onChanged: onChanged,
),
);
}
}
@@ -0,0 +1,173 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../constant/links.dart';
import '../../../controller/functions/crud.dart';
import '../../widgets/snackbar.dart';
class PendingAdminsPage extends StatefulWidget {
const PendingAdminsPage({super.key});
@override
State<PendingAdminsPage> createState() => _PendingAdminsPageState();
}
class _PendingAdminsPageState extends State<PendingAdminsPage> {
final CRUD _crud = CRUD();
bool _isLoading = true;
List _pendingAdmins = [];
@override
void initState() {
super.initState();
_fetchPendingAdmins();
}
Future<void> _fetchPendingAdmins() async {
setState(() => _isLoading = true);
try {
final response = await _crud.post(
link: '${AppLink.server}/Admin/auth/list_pending.php',
);
if (response != 'failure') {
setState(() {
_pendingAdmins = response['message'] ?? [];
});
}
} catch (e) {
mySnackbarError('فشل في جلب البيانات: $e');
} finally {
setState(() => _isLoading = false);
}
}
Future<void> _handleAction(String adminId, String action) async {
try {
final response = await _crud.post(
link: '${AppLink.server}/Admin/auth/approve_admin.php',
payload: {
'admin_id': adminId,
'action': action,
},
);
if (response != 'failure') {
mySnackbarSuccess('تم تنفيذ الإجراء بنجاح');
_fetchPendingAdmins();
}
} catch (e) {
mySnackbarError('حدث خطأ: $e');
}
}
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: cs.surface,
body: Column(
children: [
Container(
padding: const EdgeInsets.fromLTRB(16, 50, 16, 16),
child: Row(
children: [
GestureDetector(
onTap: () => Get.back(),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: cs.outline),
),
child: Icon(Icons.arrow_back_ios_new_rounded, color: cs.onSurfaceVariant, size: 16),
),
),
const SizedBox(width: 12),
Text('طلبات الانضمام المعلقة', style: TextStyle(color: cs.onSurface, fontSize: 18, fontWeight: FontWeight.w700)),
],
),
),
Expanded(
child: _isLoading
? Center(child: CircularProgressIndicator(color: cs.primary))
: _pendingAdmins.isEmpty
? _buildEmptyState(cs)
: _buildList(cs),
),
],
),
);
}
Widget _buildEmptyState(ColorScheme cs) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.person_search_rounded, size: 80, color: cs.outline),
const SizedBox(height: 16),
Text('لا توجد طلبات معلقة حالياً', style: TextStyle(color: cs.onSurfaceVariant)),
],
),
);
}
Widget _buildList(ColorScheme cs) {
return ListView.builder(
padding: const EdgeInsets.all(16),
itemCount: _pendingAdmins.length,
itemBuilder: (context, index) {
final admin = _pendingAdmins[index];
return Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outline),
),
child: Column(
children: [
ListTile(
contentPadding: EdgeInsets.zero,
leading: CircleAvatar(
backgroundColor: cs.outline,
child: Icon(Icons.person, color: cs.primary),
),
title: Text(admin['name'] ?? 'بدون اسم', style: TextStyle(color: cs.onSurface, fontWeight: FontWeight.bold)),
subtitle: Text(admin['phone'] ?? 'بدون رقم', style: TextStyle(color: cs.onSurfaceVariant)),
trailing: Text(
admin['created_at']?.split(' ')[0] ?? '',
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12),
),
),
Divider(color: cs.outline, height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => _handleAction(admin['id'], 'rejected'),
style: TextButton.styleFrom(foregroundColor: cs.error),
child: const Text('رفض'),
),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => _handleAction(admin['id'], 'approved'),
style: ElevatedButton.styleFrom(
backgroundColor: cs.primary,
foregroundColor: cs.onPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text('موافقة', style: TextStyle(fontWeight: FontWeight.bold)),
),
],
),
],
),
);
},
);
}
}