
🏭
Ijad Ghar
ایجاد گھر · House of Innovation · Staff Portal
Dashboard
');w.document.close();}
function pdfHead(t,s){return '
Ijad Ghar
ایجاد گھر — House of Innovation
MapTheSkills (Pvt.) Ltd. · SECP CUIN: 0327776 · maptheskills.org/ijad-ghar
'+t+'
'+s+'
';}
function pdfFoot(){return '
Ijad Ghar · maptheskills.org/ijad-ghar · maptheskills@gmail.com · +92-317-5853399
MapTheSkills (Pvt.) Ltd. · SECP CUIN 0327776 · P-114 Paradise Floor, Siddique Trade Center, Gulberg III, Lahore
';}
function detFields(fields){return fields.filter(f=>f[1]).map(f=>'
').join('');}function pdfStudent(s){openPdf(pdfHead('Student Profile','Generated: '+new Date().toLocaleDateString('en-PK'))+'
'+s['Full Name']+'
ID: '+s['ID']+'
'+detFields([["Father's Name",s['Father Name']],['Email',s['Email']],['Phone',s['Phone']],['DOB',s['DOB']],['Gender',s['Gender']],['CNIC',s['CNIC']],['City',s['City']],['Course',s['Course']],['Monthly Fee','Rs '+(s['Monthly Fee']||'—')],['Teacher',s['Teacher Name']],['Institution',s['Institution Name']],['Admitted',s['Enrollment Date']],['Status',s['Status']],['Added By',s['Added By Name']]])+pdfFoot(),'Student: '+s['Full Name']);}
function pdfTeacher(t){openPdf(pdfHead('Trainer Profile','Generated: '+new Date().toLocaleDateString('en-PK'))+'
'+t['Full Name']+'
ID: '+t['ID']+'
'+detFields([['Email',t['Email']],['Phone',t['Phone']],['Gender',t['Gender']],['CNIC',t['CNIC']],['Qualification',t['Qualification']],['Specialization',t['Specialization']],['Institution',t['Institution Name']],['Join Date',t['Join Date']],['Status',t['Status']],['Added By',t['Added By Name']]])+pdfFoot(),'Trainer: '+t['Full Name']);}
function pdfInst(i){openPdf(pdfHead('Institution Profile','Generated: '+new Date().toLocaleDateString('en-PK'))+'
'+i['Institution Name']+'
ID: '+i['ID']+'
'+detFields([['Contact',i['Contact Person']],['Email',i['Email']],['Phone',i['Phone']],['City',i['City']],['Address',i['Address']],['NTN',i['NTN Number']],['Join Date',i['Join Date']],['Capacity',i['Total Capacity']],['Bank',i['Bank Name']],['Account No',i['Account Number']],['Account Title',i['Account Title']],['Status',i['Status']],['Added By',i['Added By Name']]])+pdfFoot(),'Institution: '+i['Institution Name']);}
function pdfFee(x){var total=Number(x['Total Fee']||0);openPdf(pdfHead('Fee Receipt','Receipt: '+x['Receipt No']+' · '+new Date().toLocaleDateString('en-PK'))+detFields([['Student',x['Student Name']],['Student ID',x['Student ID']],['Course',x['Course']],['Month / Year',x['Month']+' '+x['Year']],['Payment Date',x['Payment Date']],['Method',x['Payment Method']],['Total Fee','Rs '+total.toLocaleString()],['Status',x['Payment Status']]])+pdfFoot(),'Fee Receipt '+x['Receipt No']);}function expStudsPDF(){var rows=window._SD||[];if(!rows.length){toast('❌ Load Students panel first',true);return;}openPdf(pdfHead('Students Register','Total: '+rows.length+' · '+new Date().toLocaleDateString('en-PK'))+'
| ID | Student Name | Father | Course | Teacher | Institution | Fee/mo | Admitted | Status |
'+rows.map(s=>'| '+s['ID']+' | '+s['Full Name']+' | '+s['Father Name']+' | '+s['Course']+' | '+s['Teacher Name']+' | '+s['Institution Name']+' | Rs '+s['Monthly Fee']+' | '+s['Enrollment Date']+' | '+s['Status']+' |
').join('')+'
Assessment: Practical 60% + Written 30% + Attendance 10% · Grades: A(85-100%) B(70-84%) C(50-69%) F(<50%)
'+pdfFoot(),'Students Register');}
function expTeachersPDF(){var rows=window._TD||[];if(!rows.length){toast('❌ Load Teachers panel first',true);return;}openPdf(pdfHead('Trainers Register','Total: '+rows.length+' · '+new Date().toLocaleDateString('en-PK'))+'
| ID | Name | Specialization | Institution | Phone | Qualification | Join Date | Status |
'+rows.map(t=>'| '+t['ID']+' | '+t['Full Name']+' | '+t['Specialization']+' | '+t['Institution Name']+' | '+t['Phone']+' | '+t['Qualification']+' | '+t['Join Date']+' | '+t['Status']+' |
').join('')+'
'+pdfFoot(),'Trainers Register');}
function expInstsPDF(){var rows=window._ID||[];if(!rows.length){toast('❌ Load Institutions panel first',true);return;}openPdf(pdfHead('Institutions Register','Total: '+rows.length+' · '+new Date().toLocaleDateString('en-PK'))+'
| ID | Institution | Contact | City | Phone | Join Date | Capacity | Status |
'+rows.map(i=>'| '+i['ID']+' | '+i['Institution Name']+' | '+i['Contact Person']+' | '+i['City']+' | '+i['Phone']+' | '+i['Join Date']+' | '+i['Total Capacity']+' | '+i['Status']+' |
').join('')+'
'+pdfFoot(),'Institutions Register');}
function expCoursesPDF(){var rows=window._CD||[];if(!rows.length){toast('❌ Load Courses panel first',true);return;}openPdf(pdfHead('Course Catalog','Total: '+rows.length+' · '+new Date().toLocaleDateString('en-PK'))+'
| ID | Course Name | Category | Duration | Fee | Description |
'+rows.map(c=>'| '+c['ID']+' | '+c['Course Name']+' | '+c['Category']+' | '+c['Duration']+' | Rs '+Number(c['Fee']||0).toLocaleString()+' | '+c['Description']+' |
').join('')+'
'+pdfFoot(),'Course Catalog');}
function expFeesPDF(){api('getFees',Object.assign({role:CU.role,userId:CU.id,institutionId:CU.institutionId,institutionName:CU.institutionName},me())).then(r=>{var recs=(r&&r.records)||[],tot=(r&&r.totals)||{};if(!recs.length){toast('❌ No fee records',true);return;}openPdf(pdfHead('Fee & Revenue Report','Total records: '+recs.length+' · '+new Date().toLocaleDateString('en-PK'))+'
| Receipt | Month | Student | Course | Total | Trainer 50% | Inst 35% | MTS 15% | Status |
'+recs.map(x=>'| '+x['Receipt No']+' | '+x['Month']+' '+x['Year']+' | '+x['Student Name']+' | '+x['Course']+' | Rs '+Number(x['Total Fee']||0).toLocaleString()+' | Rs '+Number(x['Trainer Share (50%)']||0).toLocaleString()+' | Rs '+Number(x['Institution Share (35%)']||0).toLocaleString()+' | Rs '+Number(x['MTS Share (15%)']||0).toLocaleString()+' | '+x['Payment Status']+' |
').join('')+'| TOTAL | Rs '+Math.round(tot.total||0).toLocaleString()+' | Rs '+Math.round(tot.trainer||0).toLocaleString()+' | Rs '+Math.round(tot.institution||0).toLocaleString()+' | Rs '+Math.round(tot.mts||0).toLocaleString()+' | |
'+pdfFoot(),'Fee Report');});}// ═══════════════════════════════════════════════════
// DETAIL MODAL
// ═══════════════════════════════════════════════════
function detModal(title,subtitle,rows){
var m=document.createElement('div');m.className='ov';
m.innerHTML='
'+rows.map(r=>'
').join('')+'
';
document.body.appendChild(m);m.addEventListener('click',e=>{if(e.target===m)m.remove();});
}// ═══════════════════════════════════════════════════
// TOPBAR ACTIONS
// ═══════════════════════════════════════════════════
function topAdd(){var m={institutions:'iform',teachers:'tform',students:'sform',courses:'cform'};if(PNL==='accounts'){document.getElementById('ac-nm')&&document.getElementById('ac-nm').focus();return;}var fid=m[PNL];if(fid)tog(fid);}
function topExport(){var fn={students:expStudsPDF,teachers:expTeachersPDF,institutions:expInstsPDF,courses:expCoursesPDF,fees:expFeesPDF,earnings:expFeesPDF};var f=fn[PNL];if(f)f();else toast('📄 Navigate to a data panel to export PDF.');}// ═══════════════════════════════════════════════════
// FILTER & UTILS
// ═══════════════════════════════════════════════════
function filt(inp,tbodyId){var q=inp.value.toLowerCase();document.querySelectorAll('#'+tbodyId+' tr').forEach(r=>r.style.display=r.textContent.toLowerCase().includes(q)?'':'none');}
function toast(msg,isErr){var t=document.getElementById('toast');t.textContent=msg;t.className='on'+(isErr?' err':'');clearTimeout(toast._t);toast._t=setTimeout(()=>{t.className='';},3500);}
document.addEventListener('keydown',e=>{if(e.key==='Enter'&&document.getElementById('auth').style.display!=='none')doLogin();});