Sprint 1: Fix accounts tree empty state, post-save refresh flow, and parent dropdown staleness#3
Draft
Sprint 1: Fix accounts tree empty state, post-save refresh flow, and parent dropdown staleness#3
Conversation
…and select CSS Agent-Logs-Url: https://github.com/moded12/acc3/sessions/8f2da13f-3183-4f93-bc71-76927eddc255 Co-authored-by: moded12 <162719285+moded12@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix account directory screen and account tree display
Sprint 1: Fix accounts tree empty state, post-save refresh flow, and parent dropdown staleness
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openAccountsInline()relied onERP_DATA.accountsinjected by PHP, which is only populated byAccountController— notDashboardControlleror others. Opening دليل الحسابات from any other route always showed "لا توجد حسابات" regardless of DB state. Post-save, awindow.location.reload()in amain.php-definedsaveNewAccount()was silently overriding the erp.js version, resetting context and leaving the parent dropdown stale.Core fixes
openAccountsInline()→ async, always fetches/accounts/list: Decouples the tree from PHP-injected bootstrap data.ERP_DATA.accountsis updated in-place, soopenNewAccountForm()picks up new accounts for the parent<select>without any extra work.saveNewAccount()inmain.php: Replacedwindow.location.reload()with the correct no-reload flow — close form → close accounts window →await openAccountsInline()→alertSuccess(...). Success dialog now appears after the tree is fully rebuilt.saveAccountEdit()inerp.js: Same pattern applied for consistency.openAccounts()inerp.js: Madeasyncso callers canawaitit when needed.Refresh toolbar button: Changed from
location.reload()tocloseWindow('accounts'); openAccounts().CSS
Fixed
#new-account-form selectpadding (2px 30px 2px 8px→2px 4px 2px 24px) — in RTL the dropdown arrow sits on the left, so the large right padding was eating into the visible text area, causing truncation of option labels like "مدين" / "أصول".Flow after this change
New account appears in the parent
<select>on nextopenNewAccountForm()call becauseERP_DATA.accountswas already updated by the precedingopenAccountsInline().Original prompt
نفّذ Sprint 1 كاملًا لمشروع المحاسب الشامل في المستودع moded12/acc3 مع الحفاظ على RTL والمصطلحات العربية وعدم كسر الواجهة الحالية. المطلوب في هذه المرحلة:
السياق الحالي المهم:
الملفات المرجح تعديلها:
نتيجة العمل المطلوبة:
أ) فتح دليل الحسابات فتظهر الشجرة بدل رسالة "لا توجد حسابات" عندما توجد بيانات فعلية.
ب) الضغط على حساب يعرض تفاصيله.
ج) النقر المزدوج يفتح تعديل الحساب.
د) إنشاء حساب رئيسي من نموذج حساب جديد ينجح وتظهر رسالة نجاح مستقرة.
هـ) فتح نموذج حساب جديد مرة أخرى يظهر الحساب الجديد في قائمة الحساب الأب.
و) يمكن لاحقًا إنشاء حساب فرعي تحت الحساب الرئيسي.
اختبارات يفضّل تغطيتها يدويًا داخل PR description:
الحساب الأب: بدون أب
رمز الحساب: 1100
اسم الحساب: الصندوق
الاسم بالإنجليزية: Cash
نوع الحساب: asset
الطبيعة: debit
هل حساب نهائي؟ لا أو نعم حسب منطق الشاشة، لكن يجب أن يكون السلوك متسقًا محاسبيًا
الحساب الأب: الصندوق [1100]
رمز الحساب: 1101
اسم الحساب: الصندوق الرئيسي
الاسم بالإنجليزية: Main Cash
نوع الحساب: asset
الطبيعة: debit
هل حساب نهائي؟ نعم
أنشئ Pull Request جاهزًا بهذه التعديلات، مع الحفاظ على الاستقرار والاعتماد على البنية الحالية للمشروع.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: بدي طريقة ومثال اضافة حسابًا رئيسيًا اعطيني الخطوات ثم خطوات الفرعي + المشكلة ما زالت تظهر debit تظهر مزاحة/مقطوعة
Assistant: ممتاز، الآن الصورة أوضح جدًا.
سنمشي في مسارين معًا:
debitوassetأولًا: كيف تضيف حسابًا رئيسيًا
الحساب الرئيسي = حساب تجميعي، ليس بالضرورة يتم الترحيل عليه مباشرة.
مثال محاسبي ممتاز:
حساب رئيسي: الصندوق
1100الصندوقCashassetdebitالخطوات:
1) افتح:
دليل الحسابات → حساب جديد
2) عبئ الحقول هكذا:
-- بدون أب --1100الصندوقCashassetdebit3) هل حساب نهائي؟
إذا أردته رئيسيًا:
أزل علامة الصح ✅
يعني يصبح:
4) يسمح بالترحيل المباشر؟
إذا هو حساب رئيسي، الأفضل:
وغالبًا النظام عندك يربطها مع checkbox الحساب النهائي
5) الرصيد الافتتاحي
ضع:
0.0006) جانب الرصيد
debit7) اضغط حفظ
ثانيًا: كيف تضيف حسابًا فرعيًا
الفرعي = الحساب الذي غالبًا يتم الترحيل عليه.
مثال:
حساب فرعي تحت الصندوق:
1101الصندوق الرئيسي1102صندوق الفرع1103صندوق المصروفاتالخطوات:
1) افتح:
دليل الحسابات → حساب جديد
2) عبئ الحقول:
الصندوق [1100]1101الصندوق الرئيسيMain Cashassetdebit3) هل حساب نهائي؟
هنا:
لأنه حساب فرعي نهائي
4) الرصيد الافتتاحي
مثلاً:
5000.0005) جانب الرصيد
debit6) اضغط حفظ
مثال جاهز تطبقه الآن
##...
This pull request was created from Copilot chat.