fix fish variz name, dalilrad, sms, bale
This commit is contained in:
1 parent
90931a5a64
commit
35a1ec1794
30 files changed
+674
-39
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/* Preview the exact rejection reason before submitting the staff decision. */
|
||||
(() => {
|
||||
const form = document.querySelector('.pay-decision-form');
|
||||
if (!form) return;
|
||||
form.addEventListener('submit', event => {
|
||||
const confirmation = form.elements.namedItem('confirm_rejection');
|
||||
confirmation.value = '';
|
||||
if (event.submitter?.value !== 'REJECT') return;
|
||||
const reason = form.elements.namedItem('reason');
|
||||
if (!reason.value.trim()) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
reason.setCustomValidity('دلیل رد فیش را برای مشتری بنویسید.');
|
||||
reason.reportValidity();
|
||||
reason.setCustomValidity('');
|
||||
reason.focus();
|
||||
return;
|
||||
}
|
||||
if (!window.confirm('این فیش رد میشود و دلیل زیر با پیامک برای مشتری ارسال خواهد شد:\n\n' + reason.value.trim() + '\n\nرد فیش و ارسال این دلیل را تأیید میکنید؟')) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
confirmation.value = '1';
|
||||
});
|
||||
})();
|
||||
@@ -5,6 +5,7 @@
|
||||
const form=document.querySelector('#receipt-form');if(!form)return;
|
||||
const q=name=>form.elements.namedItem(name),button=document.querySelector('#submit-receipt');
|
||||
const notices=JSON.parse(document.querySelector('#notice-data').textContent);
|
||||
const accounts=JSON.parse(document.querySelector('#account-requirements').textContent);
|
||||
const day=q('paid_day'),month=q('paid_month'),year=q('paid_year');
|
||||
const digits=value=>String(value).replace(/[۰-۹]/g,x=>String(x.charCodeAt(0)-1776)).replace(/[٠-٩]/g,x=>String(x.charCodeAt(0)-1632));
|
||||
const formatter=new Intl.DateTimeFormat('en-US',{calendar:'persian',numberingSystem:'latn',timeZone:'Asia/Tehran',year:'numeric',month:'numeric',day:'numeric'});
|
||||
@@ -24,6 +25,10 @@ function monthUpdate(){
|
||||
[month,year].forEach(control=>control.addEventListener('change',monthUpdate));day.addEventListener('change',dateUpdate);
|
||||
document.querySelector('#date-today').addEventListener('click',()=>{const p=parts(new Date());year.value=p.year;month.value=p.month;monthUpdate();day.value=p.day;dateUpdate();day.focus();});monthUpdate();
|
||||
function sync(){
|
||||
const destination=accounts[q('destination_account').value];
|
||||
const warning=document.querySelector('#destination-deposit-warning');
|
||||
warning.hidden=!destination?.required;
|
||||
warning.querySelector('[data-destination-bank]').textContent=destination?.bank || '';
|
||||
const linked=q('receipt_mode').value==='linked';const select=q('notice_id');form.querySelector('[data-field=notice_id]').hidden=!linked;select.disabled=!linked;select.required=linked;
|
||||
if(!linked)select.value='';
|
||||
const notice=linked?notices.find(n=>n.id===select.value):null;const summary=document.querySelector('#selected-payment');summary.hidden=!notice;
|
||||
@@ -55,6 +60,7 @@ let revision=0;form.addEventListener('input',()=>revision++);form.addEventListen
|
||||
form.addEventListener('submit',async event=>{
|
||||
event.preventDefault();if(busy)return;busy=true;button.disabled=true;button.textContent='در حال بررسی تصویر…';document.querySelector('#form-status').textContent='';const version=revision,errors=new Map();let navigating=false;
|
||||
try{
|
||||
if(!q('depositor_name').value.replace(/[\s\u200c\u200b]/g,''))errors.set('depositor_name','نام واریزکننده را وارد کنید.');
|
||||
const value=digits(q('paid_amount').value).trim();if(!/^\d+$/.test(value) && !/^\d{1,3}(?:[,٬ ]\d{3})+$/.test(value))errors.set('paid_amount','مبلغ را به ریال و با عدد صحیح وارد کنید.');else{const amount=BigInt(value.replace(/[,٬ ]/g,''));if(amount<=0n || amount>9007199254740991n)errors.set('paid_amount','مبلغ باید مثبت و در محدوده مجاز باشد.');}
|
||||
if(q('receipt_mode').value==='linked' && !q('notice_id').value)errors.set('notice_id','اعلامیه را انتخاب کنید یا واریز مستقل را بزنید.');
|
||||
if(!q('destination_account').value)errors.set('destination_account','حساب مقصد را انتخاب کنید.');
|
||||
|
||||
Reference in new issue
Block a user