30 lines
2.5 KiB
JavaScript
30 lines
2.5 KiB
JavaScript
/* All option labels are local text. No logos/CDN/bank APIs.
|
|
Destination fixtures are ID + display name ONLY; production supplies them from the company DB.
|
|
Origin catalog includes familiar and historical names for matching older receipts; maintain centrally. */
|
|
(() => {
|
|
'use strict';
|
|
const origin=document.querySelector('#origin-bank');if(!origin)return;
|
|
const banks=[
|
|
['melli','ملی ایران'],['mellat','ملت'],['saderat','صادرات ایران'],['sepah','سپه'],['tejarat','تجارت'],
|
|
['refah','رفاه کارگران'],['keshavarzi','کشاورزی'],['maskan','مسکن'],['sanat-madan','صنعت و معدن'],
|
|
['tosee-saderat','توسعه صادرات ایران'],['tosee-taavon','توسعه تعاون'],['post','پست بانک ایران'],
|
|
['pasargad','پاسارگاد'],['parsian','پارسیان'],['saman','سامان'],['eghtesad-novin','اقتصاد نوین'],
|
|
['karafarin','کارآفرین'],['sina','سینا'],['shahr','شهر'],['sarmayeh','سرمایه'],['dey','دی'],
|
|
['gardeshgari','گردشگری'],['iran-zamin','ایران زمین'],['khavarmianeh','خاورمیانه'],
|
|
['resalat','قرضالحسنه رسالت'],['mehr-iran','قرضالحسنه مهر ایران'],['iran-venezuela','مشترک ایران و ونزوئلا'],
|
|
['melal','مؤسسه اعتباری ملل']
|
|
];
|
|
function option(container,id,name){container.append(new Option(name,id));}
|
|
banks.sort((left,right)=>left[1].localeCompare(right[1],'fa')).forEach(([id,name])=>option(origin,id,name));
|
|
const historical=document.createElement('optgroup');historical.label='نامهای قدیمی روی فیشها';
|
|
[['ayandeh','آینده'],['ansar','انصار'],['ghavamin','قوامین'],['hekmat','حکمت ایرانیان'],['mehr-eghtesad','مهر اقتصاد'],['kosar','مؤسسه کوثر'],['noor','مؤسسه نور'],['tosee','مؤسسه توسعه']].forEach(([id,name])=>option(historical,id,name));
|
|
origin.append(historical);option(origin,'other','سایر');
|
|
origin.addEventListener('change',()=>{
|
|
const other=origin.value==='other';document.querySelector('#origin-other-field').hidden=!other;
|
|
document.querySelector('#origin-bank-other').disabled=!other;
|
|
});
|
|
const destination=document.querySelector('#destination-account');
|
|
(window.chaharsuCompanyAccounts || []).forEach(account=>option(destination,account.id,account.name));
|
|
if(!destination.options[1])document.querySelector('#destination-help').textContent='هنوز حسابی برای انتخاب در دسترس نیست؛ با کارشناس هماهنگ کنید.';
|
|
})();
|