سامانه صدور فاکتور و حسابداری
fix: reflect actual license write access in company form action
davoodmehraban89 committed
Oct 14, 2026 at 20:37 UTC
5217391f406de1f1783d15cc437597c105c6e3f2
1 file changed
+3
-2
js/companies.js
+3
-2
@@ -31,10 +31,11 @@ function updateCompanyFormAction(){
31
const isSubsidiary=document.getElementById('company-entity-type')?.value==='legal'&&role==='subsidiary';
32
const valid=hasName&&(!isSubsidiary||!!document.getElementById('company-parent-id')?.value);
33
const changed=!editingCompanyId||companyFormSnapshot()!==companyEditBaseline;
34
- button.disabled=!(valid&&changed);
34
+ const writeAllowed=typeof canWrite==='function'&&canWrite();
35
+ button.disabled=!(valid&&changed&&writeAllowed);
36
button.style.opacity=button.disabled?'0.45':'1';
37
button.style.cursor=button.disabled?'not-allowed':'pointer';
37
- button.title=button.disabled?(editingCompanyId&&!changed?'ابتدا اطلاعات شرکت را تغییر دهید':'نام شرکت و سایر فیلدهای الزامی را تکمیل کنید'):'';
38
+ button.title=!writeAllowed?'امکان ثبت یا اصلاح شرکت وجود ندارد؛ وضعیت اشتراک سازمان فعال را بررسی کنید.':button.disabled?(editingCompanyId&&!changed?'ابتدا اطلاعات شرکت را تغییر دهید':'نام شرکت و سایر فیلدهای الزامی را تکمیل کنید'):'';
39
}
40
function installCompanyFormActionState(){
41
const button=document.getElementById('company-save-btn');