سامانه صدور فاکتور و حسابداری
fix: restore dark theme contrast
Davood Mehraban committed
Oct 7, 2026 at 20:05 UTC
92e4b8680209d641dbd471a59f3b04c059444196
4 files changed
+29
-3
index.html
+1
-1
@@ -915,7 +915,7 @@ body{background:#f6f9fc}
915
<script src="js/enterprise-iran.js?v=20260930-iran-erp-v1"></script>
916
<script src="js/enterprise-iran-v2.js?v=20260930-iran-erp-v2"></script>
917
<script src="js/selfcheck.js?v=20260928-release-1-0"></script>
918
-<script src="js/ux-hardening-r2.js?v=20261007-ux-r3"></script>
918
+<script src="js/ux-hardening-r2.js?v=20261007-ux-r4"></script>
919
920
</body>
921
</html>
js/ux-hardening-r2.js
+18
-1
@@ -37,7 +37,24 @@
37
const modals=[...document.querySelectorAll('.modal-backdrop.active')];if(!modals.length)return false;const m=modals[modals.length-1],cancel=[...m.querySelectorAll('button')].find(b=>/انصراف|بستن|لغو|✕/.test(b.textContent||''));if(cancel){cancel.click();return true}m.classList.remove('active');return true;
38
}
39
window.finoraCloseTopModal=closeTopModal;
40
- const THEME_CSS=`body.finora-theme-dark{--bg:#07111f;--surface:#0f1b2d;--card:#122238;--text:#e6edf7;--text-muted:#9db0c9;--border:#263a55;--primary:#22b8c7;color:var(--text);background:var(--bg)}body.finora-theme-dark .card,body.finora-theme-dark .modal-card,body.finora-theme-dark input,body.finora-theme-dark select,body.finora-theme-dark textarea{background:#122238!important;color:#e6edf7!important;border-color:#2b405d!important}body.finora-theme-dark table th,body.finora-theme-dark table td{border-color:#2b405d!important}body.finora-theme-dark .form-row[style*="background"]{background:#0d1a2c!important}`;
40
+ const THEME_CSS=`body.finora-theme-dark{--bg:#07111f;--surface:#0f1b2d;--card:#122238;--card-bg:#122238;--text:#f1f5f9;--text-muted:#b8c7da;--border:#405675;--primary:#38c6d4;--primary-hover:#22aebb;color:var(--text);background:var(--bg);color-scheme:dark}
41
+body.finora-theme-dark .main-surface,body.finora-theme-dark .view-pane{color:var(--text)}
42
+body.finora-theme-dark .sidebar,body.finora-theme-dark .card,body.finora-theme-dark .modal-card,body.finora-theme-dark .accordion-item,body.finora-theme-dark .accordion-body,body.finora-theme-dark .kpi-unit,body.finora-theme-dark .table-responsive{background:#122238!important;color:var(--text)!important;border-color:var(--border)!important}
43
+body.finora-theme-dark h1,body.finora-theme-dark h2,body.finora-theme-dark h3,body.finora-theme-dark h4,body.finora-theme-dark h5,body.finora-theme-dark h6,body.finora-theme-dark label,body.finora-theme-dark .form-group label,body.finora-theme-dark td,body.finora-theme-dark .kpi-val,body.finora-theme-dark .report-bar-value{color:#f1f5f9!important}
44
+body.finora-theme-dark p,body.finora-theme-dark small,body.finora-theme-dark .text-muted,body.finora-theme-dark .kpi-lbl,body.finora-theme-dark .report-bar-label,body.finora-theme-dark .sidebar-footer{color:#b8c7da!important}
45
+body.finora-theme-dark input,body.finora-theme-dark select,body.finora-theme-dark textarea,body.finora-theme-dark .form-control{background:#0b1728!important;color:#f8fafc!important;border-color:#526985!important}
46
+body.finora-theme-dark input::placeholder,body.finora-theme-dark textarea::placeholder{color:#9fb0c5!important;opacity:1}
47
+body.finora-theme-dark .form-control:disabled,body.finora-theme-dark input:disabled,body.finora-theme-dark select:disabled{background:#17263a!important;color:#aebdd0!important;opacity:1}
48
+body.finora-theme-dark table th{background:#1a2b42!important;color:#f8fafc!important;border-color:var(--border)!important}
49
+body.finora-theme-dark table td{background:#122238!important;border-color:var(--border)!important}
50
+body.finora-theme-dark .accordion-header{background:#182940!important;color:#f1f5f9!important}
51
+body.finora-theme-dark .sidebar-menu li a{color:#dbe7f5!important}
52
+body.finora-theme-dark .sidebar-menu li a:hover,body.finora-theme-dark .sidebar-menu li a.active{background:#193553!important;color:#67e8f9!important}
53
+body.finora-theme-dark .btn-secondary{background:#263b55!important;color:#f8fafc!important;border-color:#526985!important}
54
+body.finora-theme-dark .finora-combobox-list{background:#0b1728!important;border-color:#526985!important;color:#f8fafc!important}
55
+body.finora-theme-dark .finora-combobox-option{color:#f8fafc!important;border-color:#334a67!important}
56
+body.finora-theme-dark .finora-combobox-option:hover,body.finora-theme-dark .finora-combobox-option:focus{background:#1b3552!important}
57
+body.finora-theme-dark .form-row[style*="background"]{background:#0d1a2c!important}`;
58
function ensureThemeCss(){if($('finora-theme-r2-css'))return;const s=document.createElement('style');s.id='finora-theme-r2-css';s.textContent=THEME_CSS;document.head.appendChild(s)}
59
function resolveTheme(mode){if(mode==='dark'||mode==='light')return mode;const h=new Date().getHours();return h>=7&&h<19?'light':'dark'}
60
window.finoraApplyTheme=function(){ensureThemeCss();const mode=getMySettings()?.ui_theme||'auto',r=resolveTheme(mode);document.body.classList.toggle('finora-theme-dark',r==='dark');document.documentElement.dataset.finoraTheme=r}
scripts/ux-hardening-r2-check.mjs
+1
-1
@@ -8,7 +8,7 @@ const purchases=fs.readFileSync('js/purchases.js','utf8');
8
const commerce=fs.readFileSync('js/commercial-rnd.js','utf8');
9
const print=fs.readFileSync('js/print.js','utf8');
10
const ok=(v,m)=>{if(!v)throw new Error(m)};
11
-ok(index.includes('js/ux-hardening-r2.js?v=20261007-ux-r3'),'UX R2 module must be loaded.');
11
+ok(index.includes('js/ux-hardening-r2.js?v=20261007-ux-r4'),'UX R2 module must be loaded.');
12
ok(projects.includes('getMyGlobalProjects')&&projects.includes('attachExistingProject')&&projects.includes('linkedContactIds'),'Counterparty project management must reuse global project master data.');
13
ok(projects.includes('createAndAttachProject')&&projects.includes('openProjectAttachModal'),'Counterparty project UI must support select-existing or create-new in place.');
14
ok(ux.includes('select.options.length<8')&&ux.includes('finora-combobox-input')&&ux.includes('finora-combobox-option')&&!ux.includes('finora-select-search'),'Large selectors must use one integrated searchable combobox, not a separate search field plus select.');
scripts/ux-hardening-r2.spec.js
+9
@@ -61,3 +61,12 @@ test('product combobox searches one field by code, name and specification',async
61
await input.fill('AAC');await expect(page.locator('#product-search').locator('xpath=..').locator('.finora-combobox-option')).toContainText('بلوک سایز ۱۰');
62
await input.fill('سیمان');await expect(page.locator('#product-search').locator('xpath=..').locator('.finora-combobox-option')).toContainText('سیمان تیپ ۲');
63
});
64
+
65
+test('dark theme keeps settings text controls tables and navigation legible',async({page})=>{
66
+ await page.setContent('<aside class="sidebar"><ul class="sidebar-menu"><li><a class="active">شرکتها</a></li></ul></aside><main class="main-surface"><section id="view-settings" class="view-pane active"><div class="card"><div class="form-group"><label>نشانی کامل</label><input class="form-control" placeholder="نشانی"></div><div class="table-responsive"><table><thead><tr><th>نام</th><th>عملیات</th></tr></thead><tbody><tr><td>شرکت آزمایشی</td><td><button class="btn btn-secondary">ویرایش</button></td></tr></tbody></table></div></div></section></main>');
67
+ await page.addScriptTag({content:"var currentUser={id:'U1'},datastore={settings:[{ownerUserId:'U1',ui_theme:'dark'}],products:[],contacts:[],companies:[{id:'C1',ownerUserId:'U1'}],accounts:[],projects:[],invoices:[],purchases:[],cheques:[],journalVouchers:[]};var FINORA_MODULES={settings:{groups:[]}};function getMySettings(){return datastore.settings[0]}function getMyCompanies(){return datastore.companies}function getMyProducts(){return []}function getMyContacts(){return []}function getMyAccounts(){return []}function getMyGlobalProjects(){return []}function requireWrite(){return true}function saveDatastore(){}function toggleAccordion(){}function esc(v){return String(v)}"});
68
+ await page.addScriptTag({path:path.resolve('js/ux-hardening-r2.js')});await page.evaluate(()=>document.dispatchEvent(new Event('DOMContentLoaded')));
69
+ await expect(page.locator('body')).toHaveClass(/finora-theme-dark/);
70
+ for(const sel of ['label','th','td','.sidebar-menu a','.form-control','.btn-secondary']){const c=await page.locator(sel).first().evaluate(el=>getComputedStyle(el).color);expect(c).not.toBe('rgb(51, 65, 85)')}
71
+ const input=await page.locator('.form-control').evaluate(el=>({fg:getComputedStyle(el).color,bg:getComputedStyle(el).backgroundColor,border:getComputedStyle(el).borderColor}));expect(input.fg).toBe('rgb(248, 250, 252)');expect(input.bg).toBe('rgb(11, 23, 40)');
72
+});