سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 17:00 UTC
fix: stabilize commercial document workspace
Davood Mehraban committed
Oct 7, 2026 at 22:48 UTC
3b34e84be07cd259f9a0096be2489f51a5d7f374
4 files changed
+13
-16
PROJECT_STATE.md
+1
-1
@@ -15,7 +15,7 @@ This is high-assurance accounting/ERP software. Posted financial history, tenant
15
The latest user message is the sole source of new instructions. Read AGENTS.md then PROJECT_STATE.md in full; verify live main/head/recent commits/CI and Supabase migrations/RLS before implementation; reconcile discrepancies first. Record each request before implementation and update this file in the same commit as every durable change. Work in verified vertical slices. CI success alone is not completion: real-DOM smoke and accounting-invariant tests must pass; unrun checks are NOT VERIFIED. Every Supabase migration must be archived under supabase/migrations/. Ask the owner before schema/RLS/auth/role changes or destructive data operations; older standing approvals below do not override this requirement. Final reports: Persian, approximately 15 lines maximum, evidence SHAs/run IDs, unverified work and next step. This request authorizes verification and reconciliation; older backlog entries are context, not new implementation instructions.
16
17
## Current change ledger
18
-| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; Real-DOM and protected-branch CI remain pending. |
18
+| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Commercial sale/purchase workspaces now share a stable `صدور سند تجاری` header/actions layout; duplicate purchase sidebar injection removed; the public selector is the single document-type selector and the legacy internal invoice-kind control is hidden. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; protected-branch CI remains pending. |
19
20
| Date | Request / decision | Status | Evidence / next action |
21
|---|---|---|---|
index.html
+6
-5
@@ -408,10 +408,11 @@ body{background:#f6f9fc}
408
409
<section id="view-invoices" class="view-pane">
410
<div class="card no-print">
411
-<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;flex-wrap:wrap;gap:10px">
412
-<h2 style="font-size:17px" id="invoice-form-title">صدور فاکتور جدید</h2>
413
-<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center">
411
+<div class="finora-commercial-head" style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;flex-wrap:wrap;gap:10px">
412
+<h2 style="font-size:17px" id="invoice-form-title">صدور سند تجاری</h2>
413
+<div class="finora-commercial-actions" style="display:flex;gap:8px;flex-wrap:wrap;align-items:center">
414
<label class="btn btn-secondary btn-inline" style="min-height:34px;padding:4px 10px;font-size:12px">📥 ورود اقلام از اکسل<input type="file" id="excel-import-invoice-items" style="display:none" onchange="importInvoiceItemsFromExcel(event)" accept=".xlsx, .xls" /></label>
415
+<button type="button" class="btn btn-secondary btn-inline" onclick="finoraShowGuide('invoices')">؟ راهنما</button>
416
<button class="btn btn-secondary btn-inline" style="display:none;padding:4px 10px;font-size:12px" id="btn-cancel-edit" onclick="cancelInvoiceEdit()">انصراف از ویرایش</button>
417
</div>
418
</div>
@@ -419,8 +420,8 @@ body{background:#f6f9fc}
420
<div class="form-row" style="background:#f1f5f9;padding:12px;border-radius:10px;margin-bottom:14px">
421
<div class="form-group" style="margin-bottom:0"><label>تاریخ فاکتور</label><input type="text" id="invoice-date-input" class="form-control" /></div>
422
<div class="form-group" style="margin-bottom:0"><label>شماره فاکتور</label><input type="text" id="invoice-number" class="form-control" placeholder="PINV-31" /></div>
422
-<div class="form-group" style="margin-bottom:0">
423
-<label>قالب و نوع سند</label>
423
+<div class="form-group" style="margin-bottom:0;display:none" aria-hidden="true">
424
+<label>قالب داخلی سند</label>
425
<select id="invoice-kind" class="form-control" onchange="handleInvoiceKindChange()">
426
<option value="non_formal">فاکتور غیررسمی</option>
427
<option value="formal">فاکتور رسمی</option>
js/purchases.js
+3
-10
@@ -12,20 +12,13 @@
12
13
function injectUI(){
14
if($('view-purchases'))return;
15
- const menu=document.querySelector('.sidebar-menu');
16
- const expLi=menu&&menu.querySelector('[data-view="view-expenses"]');
17
- if(menu){
18
- const li=document.createElement('li');
19
- li.innerHTML='<a href="#" class="nav-link" data-view="view-purchases" onclick="switchView(\'view-purchases\');return false">🛒 فاکتور خرید</a>';
20
- if(expLi&&expLi.parentElement)menu.insertBefore(li,expLi.parentElement);else menu.appendChild(li);
21
- }
15
const sec=document.createElement('section');
16
sec.id='view-purchases';sec.className='view-pane';
17
sec.innerHTML=`
18
<div class="card no-print">
26
- <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;flex-wrap:wrap;gap:10px">
27
- <div><h2 style="font-size:17px" id="pur-form-title">🛒 ثبت فاکتور خرید</h2><input type="hidden" id="pur-edit-id" value="" /></div>
28
- <label class="btn btn-secondary btn-inline" style="min-height:34px;padding:4px 10px;font-size:12px">📥 ورود اقلام از اکسل<input type="file" style="display:none" accept=".xlsx,.xls" onchange="purImportExcel(event)" /></label>
19
+ <div class="finora-commercial-head" style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;flex-wrap:wrap;gap:10px">
20
+ <div><h2 style="font-size:17px" id="pur-form-title">صدور سند تجاری</h2><input type="hidden" id="pur-edit-id" value="" /></div>
21
+ <div class="finora-commercial-actions" style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><label class="btn btn-secondary btn-inline" style="min-height:34px;padding:4px 10px;font-size:12px">📥 ورود اقلام از اکسل<input type="file" style="display:none" accept=".xlsx,.xls" onchange="purImportExcel(event)" /></label><button type="button" class="btn btn-secondary btn-inline" onclick="finoraShowGuide('invoices')">؟ راهنما</button></div>
22
</div>
23
<div class="form-row" style="background:#f1f5f9;padding:12px;border-radius:10px;margin-bottom:14px">
24
<div class="form-group" style="margin-bottom:0"><label>تاریخ</label><input type="text" id="pur-date" class="form-control" /></div>
scripts/accounting-product-guidance-check.mjs
+3
@@ -7,4 +7,7 @@ ok(!html.includes('id="prod-internal-id-input"')&&!html.includes('id="quick-p-in
7
ok(inv.includes("prod.code||intEl?.value"),'Electronic-document internal item ID must derive from product code.');
8
ok(p.includes('nextProductCode')&&p.includes("padStart(4,'0')"),'New product code generator must use group prefix plus four-digit sequence.');
9
ok(ux.includes('searchNorm')&&ux.includes('tokens.every'),'Search must normalize Persian/Arabic forms and match all typed fragments.');
10
+ok(html.includes('finora-commercial-head')&&html.includes("finoraShowGuide('invoices')"),'Sale workspace must use the stable commercial header and contextual guide.');
11
+const pur=fs.readFileSync('js/purchases.js','utf8');ok(pur.includes('finora-commercial-head')&&!pur.includes("data-view=\"view-purchases\""),'Purchase workspace must share the stable commercial header without injecting a duplicate sidebar route.');
12
+ok(html.includes('aria-hidden="true"')&&html.includes('قالب داخلی سند'),'Internal invoice-kind control must not duplicate the public commercial document selector.');
13
console.log('Accounting/product guidance invariants passed.');