سامانه صدور فاکتور و حسابداری
feat: expose source-linked draft deletion through lifecycle UI
davoodmehraban89 committed
Nov 18, 2026 at 09:03 UTC
f9d567399507768eb2d4ac8dc20849d9fa85e906
1 file changed
+4
-4
js/document-management.js
+4
-4
@@ -11,7 +11,7 @@ function renderDocumentManagement(){
11
const btn=mayPost?'<button class="btn btn-success btn-inline" data-doc-action="post" data-doc-id="'+esc(inv.id)+'">قطعیسازی</button>':'';
12
const correction=state==='posted'&&invoiceCreatesAccountingEntry(inv.kind)?
13
'<button class="btn btn-secondary btn-inline" data-doc-action="reopen" data-doc-id="'+esc(inv.id)+'">اصلاح فاکتور</button> <button class="btn btn-danger btn-inline" data-doc-action="cancel" data-doc-id="'+esc(inv.id)+'">ابطال</button>':'';
14
- const deleteDraft=state==='draft'&&!inv.journalVoucherId?
14
+ const deleteDraft=state==='draft'?
15
'<button class="btn btn-danger btn-inline" data-doc-action="delete" data-doc-id="'+esc(inv.id)+'">حذف پیشنویس</button>':'';
16
const edit=invoiceMayEdit(inv)?'<button class="btn btn-secondary btn-inline" data-doc-action="edit" data-doc-id="'+esc(inv.id)+'">ویرایش</button>':'';
17
const posted=inv.journalVoucherId?'<button class="btn btn-secondary btn-inline" data-doc-action="voucher" data-doc-id="'+esc(inv.id)+'">مشاهده سند قطعی</button>':'';
@@ -90,8 +90,8 @@ document.addEventListener('click',async event=>{
90
return;
91
}
92
if(action==='delete'){
93
- if(!confirm('پیشنویس انتخابی حذف شود؟ سند قطعی/تاریخچه حذف نخواهد شد.'))return;
94
- try{deleteInvoicePilotDraft(inv.id);renderDocumentManagement();}
93
+ if(!confirm('این سند موقت حذف شود؟\n\nاگر سند حسابداری موقت متصل داشته باشد، آن سند نیز همزمان حذف میشود و سابقه حذف در لاگ باقی میماند. شماره عطف هرگز دوباره استفاده نخواهد شد.'))return;
94
+ try{await deleteInvoicePilotDraft(inv.id);renderDocumentManagement();}
95
catch(e){alert('حذف پیشنویس مجاز نیست: '+e.message);}
96
return;
97
}
@@ -102,4 +102,4 @@ document.addEventListener('click',async event=>{
102
if(typeof openDashboardVoucher==='function'&&inv.journalVoucherId)return openDashboardVoucher(inv.journalVoucherId);
103
alert('مرجع حسابداری قابل نمایش نیست.');
104
}
105
-});
105
+});
\ No newline at end of file