Update: 2026-05-07 23:24:12

This commit is contained in:
Hamza-Ayed
2026-05-07 23:24:12 +03:00
parent 80f3d257b0
commit 51d1d42f75
6 changed files with 173 additions and 15 deletions

View File

@@ -49,6 +49,46 @@ class AddCompanyView extends StatelessWidget {
keyboardType: TextInputType.number,
isDark: isDark,
),
Obx(() {
if (controller.isSuperAdmin.value) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 16),
const Text('المكتب المحاسبي التابعة له', style: TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
if (controller.isLoadingTenants.value)
const CircularProgressIndicator()
else
Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
color: isDark ? Colors.white.withValues(alpha: 0.05) : Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: isDark ? Colors.white24 : Colors.grey.shade300),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: controller.selectedTenantId.value,
isExpanded: true,
dropdownColor: isDark ? const Color(0xFF1E1E2E) : Colors.white,
items: controller.tenants.map((tenant) {
return DropdownMenuItem<String>(
value: tenant['id'],
child: Text(tenant['name'] ?? 'مكتب غير معروف'),
);
}).toList(),
onChanged: (val) {
if (val != null) controller.selectedTenantId.value = val;
},
),
),
),
],
);
}
return const SizedBox.shrink();
}),
const SizedBox(height: 40),
SizedBox(
width: double.infinity,

View File

@@ -112,8 +112,14 @@ class CompaniesManagementView extends StatelessWidget {
children: [
_buildDetailChip(Icons.numbers, company['tax_identification_number'] ?? 'غير محدد', isDark),
const SizedBox(width: 8),
if (company['is_jofotara_connected'] == true || company['is_jofotara_connected'] == 1)
if (company['is_jofotara_connected'] == true || company['is_jofotara_connected'] == 1) ...[
_buildDetailChip(Icons.link, 'مرتبطة بجوفوتارا', isDark, color: const Color(0xFF10B981)),
const SizedBox(width: 8),
],
if (company['tenant_name'] != null)
Expanded(
child: _buildDetailChip(Icons.account_balance, company['tenant_name'], isDark, color: Colors.blueAccent),
),
],
),
const SizedBox(height: 12),