@davoodmehraban89 / Factor-easy / commits / 6abf95c
Fork 0

سامانه صدور فاکتور و حسابداری

Fix Phase 5 import-center navigation syntax

davoodmehraban89 committed Sep 29, 2026 at 21:07 UTC 6abf95ca647335e53376e49e19891cf7ca18a010
1 file changed +1 -1
js/phase5-enterprise.js
+1 -1
@@ -118,7 +118,7 @@ function p5RenderDataCenter(){
118 const root=document.getElementById('p5-data-root');if(!root)return;p5EnsureSeed();const cc=getMyCostCenters(),s=getMySettings(),wh=getMyWarehouses().filter(x=>x.active!==false),cur=getMyCurrencies().filter(x=>x.active!==false);
119 root.innerHTML='<div class="card"><h3>تنظیمات عملیاتی و دسترسی شرکت</h3><div class="form-row"><div class="form-group"><label>انبار پیش‌فرض</label><select id="p5-set-default-wh" class="form-control">'+p5Options(wh)+'</select></div><div class="form-group"><label>ارز پایه</label><select id="p5-set-base-cur" class="form-control">'+cur.map(x=>'<option value="'+esc(x.code)+'">'+esc(x.code+' — '+x.title)+'</option>').join('')+'</select></div><div class="form-group"><label>روش بهای موجودی</label><select id="p5-set-cost-method" class="form-control"><option value="weighted_average">میانگین موزون</option></select></div></div><p style="font-size:12px;color:var(--text-muted);margin-bottom:10px">سطح دسترسی مؤثر: '+esc(currentUser?.role==='admin'?'مدیر سیستم':'کاربر مالک داده')+' — دسترسی رکوردها در سرور با RLS مالک‌محور کنترل می‌شود.</p><button class="btn btn-primary" onclick="p5SaveCompanyOpsSettings()">ذخیره تنظیمات</button></div>'+
120 '<div class="card"><h3>مراکز هزینه و تحلیل</h3><div class="form-row"><div class="form-group"><label>کد</label><input id="p5-cc-code" class="form-control"></div><div class="form-group"><label>عنوان</label><input id="p5-cc-name" class="form-control"></div></div><button class="btn btn-success" onclick="p5SaveCostCenter()">ثبت مرکز هزینه</button><div class="table-responsive" style="margin-top:14px"><table><thead><tr><th>کد</th><th>عنوان</th><th>وضعیت</th></tr></thead><tbody>'+cc.map(x=>'<tr><td>'+esc(x.code)+'</td><td>'+esc(x.name)+'</td><td>فعال</td></tr>').join('')+'</tbody></table></div></div>'+
121 - '<div class="card"><h3>مرکز ورود، اکسل و پشتیبان</h3><p style="color:var(--text-muted);margin:8px 0 14px">ورود داده و پشتیبان در یک مرکز؛ بازگردانی JSON ابتدا اعتبارسنجی و پیش‌نمایش می‌شود و سپس فقط با تأیید صریح ادغام می‌گردد.</p><div style="display:flex;gap:8px;flex-wrap:wrap"><label class="btn btn-secondary">ورود کالا/خدمت از Excel<input type="file" accept=".xlsx,.xls" style="display:none" onchange="importProductsFromExcel(event)"></label><button class="btn btn-secondary" onclick="switchView('view-invoices')">ورود اکسل فاکتور فروش</button><button class="btn btn-secondary" onclick="switchView('view-purchases')">ورود اکسل فاکتور خرید</button><button class="btn btn-secondary" onclick="p5ExportBackup()">دانلود پشتیبان کامل</button><label class="btn btn-secondary">اعتبارسنجی/بازگردانی JSON<input type="file" accept=".json" style="display:none" onchange="p5PreviewRestore(event)"></label></div><div id="p5-import-preview" style="margin-top:12px;font-size:12px;color:var(--text-muted)"></div></div>';
121 + '<div class="card"><h3>مرکز ورود، اکسل و پشتیبان</h3><p style="color:var(--text-muted);margin:8px 0 14px">ورود داده و پشتیبان در یک مرکز؛ بازگردانی JSON ابتدا اعتبارسنجی و پیش‌نمایش می‌شود و سپس فقط با تأیید صریح ادغام می‌گردد.</p><div style="display:flex;gap:8px;flex-wrap:wrap"><label class="btn btn-secondary">ورود کالا/خدمت از Excel<input type="file" accept=".xlsx,.xls" style="display:none" onchange="importProductsFromExcel(event)"></label><button class="btn btn-secondary" onclick="switchView(\'view-invoices\')">ورود اکسل فاکتور فروش</button><button class="btn btn-secondary" onclick="switchView(\'view-purchases\')">ورود اکسل فاکتور خرید</button><button class="btn btn-secondary" onclick="p5ExportBackup()">دانلود پشتیبان کامل</button><label class="btn btn-secondary">اعتبارسنجی/بازگردانی JSON<input type="file" accept=".json" style="display:none" onchange="p5PreviewRestore(event)"></label></div><div id="p5-import-preview" style="margin-top:12px;font-size:12px;color:var(--text-muted)"></div></div>';
122 const whSel=document.getElementById('p5-set-default-wh'),curSel=document.getElementById('p5-set-base-cur'),costSel=document.getElementById('p5-set-cost-method');if(whSel)whSel.value=s.defaultWarehouseId||p5DefaultWarehouse()?.id||'';if(curSel)curSel.value=s.baseCurrencyCode||'IRR';if(costSel)costSel.value=s.inventoryCostMethod||'weighted_average';
123 }
124 function p5RenderIntegrations(){const root=document.getElementById('p5-integrations-root');if(!root)return;const cs=getMyIntegrationConnections(),out=getMyIntegrationOutbox().slice(-20).reverse();root.innerHTML='<div class="card"><h3>اتصالات و API</h3><p style="font-size:12px;color:var(--text-muted);margin-bottom:12px">در مرورگر هیچ Secret ذخیره نمی‌شود. اتصال‌ها متادیتا هستند و رویدادها از الگوی Outbox قابل تحویل به سرویس امن سمت سرور پیروی می‌کنند.</p><div class="form-row"><div class="form-group"><label>نام</label><input id="p5-int-name" class="form-control"></div><div class="form-group"><label>نوع</label><select id="p5-int-kind" class="form-control"><option value="webhook">Webhook</option><option value="tax">سامانه مالیاتی</option><option value="bank">بانک/پرداخت</option><option value="custom">سفارشی</option></select></div><div class="form-group"><label>Endpoint HTTPS</label><input id="p5-int-endpoint" class="form-control" dir="ltr"></div></div><button class="btn btn-success" onclick="p5SaveIntegration()">ثبت اتصال</button><div class="table-responsive" style="margin-top:14px"><table><thead><tr><th>نام</th><th>نوع</th><th>Endpoint</th><th>صف</th></tr></thead><tbody>'+cs.map(x=>'<tr><td>'+esc(x.name)+'</td><td>'+esc(x.kind)+'</td><td dir="ltr">'+esc(x.endpoint||'—')+'</td><td><button class="btn btn-secondary btn-inline" onclick="p5QueueEvent(\''+x.id+'\',\'manual.test\')">رویداد آزمایشی</button></td></tr>').join('')+'</tbody></table></div></div><div class="card"><h3>Integration Outbox</h3><div class="table-responsive"><table><thead><tr><th>رویداد</th><th>وضعیت</th><th>زمان</th><th>خروجی</th></tr></thead><tbody>'+out.map(x=>'<tr><td>'+esc(x.eventType)+'</td><td>'+esc(x.status)+'</td><td>'+esc(x.createdAt)+'</td><td><button class="btn btn-secondary btn-inline" onclick="p5ExportOutbox(\''+x.id+'\')">JSON</button></td></tr>').join('')+'</tbody></table></div></div>'}