H2Hhope

لوحة الإدارة الثانوية
يرجى تسجيل الدخول للمتابعة

نسخة تجريبية: admin2 / H2H-2026
هذه حماية واجهة فقط وليست نظام مصادقة آمنًا.

H2HhopeAssistant workspace
مساحة المساعد الإداري

مرحبا بك 👋

خدم على الحالات والقصص والمحتوى ديالك، وصيفط كلشي للمراجعة قبل النشر.

📲
ثبّت H2Hhope على هاتفك
يفتح كتطبيق مستقل بأيقونة خاصة.

ملخص الخدمة

المستفيدون 🤝
0الحالات المسجلة
قصصي ✍️
0قصص قيد التحرير
بانتظار المراجعة ⏳
0محتوى مرسل للمسؤول
المهام الخاصة بي ✓
0مهام قيد الإنجاز

المهام المتاحة لك

Assistant

آخر النشاطات

ما كاين حتى نشاط مسجل دابا.

المستفيدون 🤝

خاص بالأدمين

الأسماء والقيم المالية هنا لائحة داخلية خاصة بالأدمين، وما كتظهرش في صفحة Cases. الإضافة والتعديل والحذف كتتحفظ محلياً فهاد النموذج؛ الربط بالأدمين الرئيسي يحتاج WordPress.

لائحة المستفيدين

مازال ما ضفتي حتى حالة.

أدخل الاسم ثم اضغط إضافة إلى اللائحة.

استوديو المحتوى ✍️

مسودة
المعاينة كتبان هنا...

المحتوى كيبقى مسودة حتى تدير المعاينة وتوافق عليه. النشر الفعلي في صفحة Cases وربط الصور والفيديو بWordPress يحتاج تكامل الموقع.

المسودات والمحتوى ديالي

مازال ما كايناش مسودات محفوظة.

الصور والفيديوهات 🖼️

☁️
اختار ملفات من الهاتف

الصور والفيديوهات غادي تبان هنا للمعاينة.

تقدر تفتح الكاميرا أو تختار فيديو/صورة. المعاينة محلية؛ الرفع للموقع يحتاج ربط WordPress.

رابط TikTok LIVE

يمكن لصق الأسماء هنا أو إدخالها يدوياً. الإضافة المباشرة من TikTok LIVE تحتاج تكاملاً رسمياً عبر API وصلاحيات مناسبة؛ هذا الملف لا يسحب أسماء المشاهدين تلقائياً.

المراجعة والمهام ⏳

للمتابعة

ما كايناش مهام مسجلة دابا.

هذه اللائحة توضيحية ولا تتصل بلوحة الأدمين الرئيسي حتى يتم بناء إضافة WordPress وربطها.

حسابي 🔐

👤
Assistant Editorالأدمين الثانوي

عند التفعيل، تبقى الجلسة مفتوحة حتى تضغط «إغلاق لوحة الإدارة».

تنبيه تقني: هذه الواجهة جاهزة للتثبيت كتطبيق ويب، لكن مزامنة البيانات مع WordPress لا تصبح فعالة إلا بعد تثبيت إضافة H2Hhope API وإعداد المصادقة والاتصال بها.

`); w.document.close(); } function escapeHTML(v){return String(v).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]))} function resetBeneficiaryForm(){ editingBeneficiary=null; document.getElementById('bName').value=''; document.getElementById('bNeed').selectedIndex=0; document.getElementById('bFinancialType').selectedIndex=0; document.getElementById('bAmount').value=''; document.getElementById('bNote').value=''; document.getElementById('bAidStatus').value='لم تتم المساعدة'; const btn=document.getElementById('saveBeneficiaryBtn');if(btn)btn.textContent='+ إضافة إلى اللائحة'; } function saveBeneficiary(){ const form=document.getElementById('beneficiaryForm'); const field=(id)=>form ? form.querySelector('#'+id) : document.getElementById(id); const nameField=field('bName'); const name=String(nameField?.value ?? '').trim(); const need=String(field('bNeed')?.value ?? '').trim(); const financialType=String(field('bFinancialType')?.value ?? 'غير محدد')||'غير محدد'; const amount=String(field('bAmount')?.value ?? '').trim(); const note=String(field('bNote')?.value ?? '').trim(); const aidStatus=String(field('bAidStatus')?.value ?? 'لم تتم المساعدة')||'لم تتم المساعدة'; if(!name){alert('يرجى كتابة اسم المستفيد في خانة الاسم.');nameField?.focus();return false} if(!need){alert('يرجى اختيار الحالة / نوع الحاجة.');field('bNeed')?.focus();return false} const wasEditing=editingBeneficiary!==null; const id=wasEditing?editingBeneficiary:('person-'+Date.now()+'-'+Math.random().toString(16).slice(2)); const item={id,name,need,financialType,amount,note,aidStatus,addedAt:new Date().toISOString()}; if(wasEditing){ const idx=beneficiaries.findIndex(x=>String(x.id)===String(editingBeneficiary)); if(idx>=0) beneficiaries[idx]={...beneficiaries[idx],...item}; else beneficiaries.unshift(item); }else{ beneficiaries.unshift(item); } const persisted=persistBeneficiaries(); renderBeneficiaries(); resetBeneficiaryForm(); const status=document.getElementById('beneficiaryStatus'); if(status)status.textContent=(wasEditing?'تم تعديل بيانات المستفيد. ':'تمت إضافة المستفيد إلى اللائحة. ')+(persisted?'تم الحفظ محلياً.':'تعذر الحفظ الدائم في هذا المتصفح.'); document.getElementById('beneficiaryList')?.scrollIntoView({behavior:'smooth',block:'start'}); return true; } function editBeneficiary(id){ const b=beneficiaries.find(x=>String(x.id)===String(id));if(!b)return; editingBeneficiary=b.id; document.getElementById('bName').value=b.name||''; document.getElementById('bNeed').value=b.need||''; document.getElementById('bFinancialType').value=b.financialType||'غير محدد'; document.getElementById('bAmount').value=b.amount??''; document.getElementById('bNote').value=b.note||''; document.getElementById('bAidStatus').value=b.aidStatus||'لم تتم المساعدة'; const btn=document.getElementById('saveBeneficiaryBtn');if(btn)btn.textContent='💾 حفظ التعديلات'; document.getElementById('bName').scrollIntoView({behavior:'smooth',block:'center'}); } function clearBeneficiaries(){if(!beneficiaries.length)return;if(confirm('هل تريد مسح جميع أسماء المستفيدين؟')){beneficiaries=[];persistBeneficiaries();renderBeneficiaries();resetBeneficiaryForm()}} function deleteBeneficiary(id){ const b=beneficiaries.find(x=>String(x.id)===String(id));if(!b)return; if(!confirm('هل تريد حذف '+b.name+' من اللائحة؟'))return; beneficiaries=beneficiaries.filter(x=>String(x.id)!==String(id)); persistBeneficiaries();renderBeneficiaries(); } const saveBeneficiaryBtn=document.getElementById('saveBeneficiaryBtn'); const beneficiaryForm=document.getElementById('beneficiaryForm'); if(saveBeneficiaryBtn){ saveBeneficiaryBtn.type='button'; saveBeneficiaryBtn.onclick=function(e){if(e)e.preventDefault();saveBeneficiary();}; } if(beneficiaryForm)beneficiaryForm.onsubmit=function(e){e.preventDefault();saveBeneficiary();return false;}; document.getElementById('beneficiaryForm').addEventListener('reset',()=>{setTimeout(resetBeneficiaryForm,0)}); // لا نسترجع نسخة IndexedDB بشكل غير متزامن هنا حتى لا تعود سجلات قديمة بعد الحذف. let storyMediaFiles=[]; function renderStoryMediaFiles(){ const box=document.getElementById('storyMediaPreview');box.innerHTML=''; storyMediaFiles.forEach((f,index)=>{ const wrap=document.createElement('div');wrap.className='card';wrap.style.padding='7px'; const u=URL.createObjectURL(f);const el=f.type.startsWith('video/')?document.createElement('video'):document.createElement('img'); el.src=u;el.style.cssText='width:100%;max-height:130px;object-fit:contain;border-radius:9px';if(el.tagName==='VIDEO')el.controls=true; const nm=document.createElement('small');nm.textContent=f.name;nm.style.cssText='display:block;overflow-wrap:anywhere;margin:6px 0'; const del=document.createElement('button');del.type='button';del.className='softbtn';del.textContent='🗑️ حذف';del.onclick=()=>{storyMediaFiles.splice(index,1);renderStoryMediaFiles()}; wrap.append(el,nm,del);box.appendChild(wrap); }); } function showStoryMedia(files){storyMediaFiles.push(...Array.from(files||[]));renderStoryMediaFiles()} ['storyCamera','storyVideo','storyFiles'].forEach(id=>{const el=document.getElementById(id);if(el)el.addEventListener('change',e=>{showStoryMedia(e.target.files);e.target.value=''})}); let editingStory=-1; function renderStories(){ const box=document.getElementById('storyList');box.innerHTML=''; if(!stories.length){box.innerHTML='

مازال ما كايناش مسودات محفوظة.

';return} stories.forEach((s,i)=>{ const d=document.createElement('div');d.className='rowitem';d.style.alignItems='flex-start'; const icon=document.createElement('span');icon.className='rowicon pink';icon.textContent='✍️'; const content=document.createElement('div');content.className='rowtext'; const title=document.createElement('b');title.textContent=s.title; const body=document.createElement('small');body.textContent=s.body;body.style.display='block'; const cat=document.createElement('small');cat.textContent='القسم: '+(s.category==='helped'?'حالات استفادت من المساعدة':'حالات تحتاج إلى الدعم')+(s.extraTitle?' · '+s.extraTitle:'')+(s.mediaNames&&s.mediaNames.length?' · '+s.mediaNames.length+' ملفات':'');cat.style.display='block'; const status=document.createElement('span');status.className='pill '+(s.status==='موافق عليها (معاينة)'?'green':'');status.textContent=s.status; const actions=document.createElement('div');actions.className='item-actions'; const edit=document.createElement('button');edit.textContent='✏️ تعديل';edit.onclick=async()=>{editingStory=i;document.getElementById('storyTitle').value=s.title;document.getElementById('storyBody').value=s.body;document.getElementById('storyCategory').value=s.category||'needs';document.getElementById('storyExtraTitle').value=s.extraTitle||'';storyMediaFiles=[];try{const saved=await readMedia(s.id);saved.forEach(x=>storyMediaFiles.push(new File([x.blob],x.name,{type:x.type})));renderStoryMediaFiles()}catch(e){}document.querySelector('#storyForm .primary').textContent='💾 حفظ التعديلات';updateStoryPreview();showView('story');window.scrollTo({top:0,behavior:'smooth'});}; const approve=document.createElement('button');approve.textContent='✓ موافقة';approve.onclick=()=>{stories[i].status='موافق عليها (معاينة)';put('stories',stories);renderStories();alert('تم وضع علامة الموافقة داخل المعاينة فقط.');}; const del=document.createElement('button');del.textContent='🗑️ حذف';del.className='danger';del.onclick=()=>{if(confirm('هل تريد حذف هذا المحتوى؟')){removeStoredMedia(s.id).catch(console.warn);stories.splice(i,1);put('stories',stories);if(editingStory===i)editingStory=-1;renderStories();}}; actions.append(edit,approve,del);content.append(title,cat,body,actions);d.append(icon,content,status);box.appendChild(d); }); } const mediaDBPromise=new Promise((resolve,reject)=>{ const req=indexedDB.open('h2hhope_admin_media_v1',1); req.onupgradeneeded=()=>{const db=req.result;if(!db.objectStoreNames.contains('files'))db.createObjectStore('files',{keyPath:'id'})}; req.onsuccess=()=>resolve(req.result);req.onerror=()=>reject(req.error); }); async function storeMedia(id,files){ const db=await mediaDBPromise; return new Promise((resolve,reject)=>{const tx=db.transaction('files','readwrite'),store=tx.objectStore('files'); store.delete(id); files.forEach((f,i)=>store.put({id:id+'-'+i,owner:id,name:f.name,type:f.type,blob:f})); tx.oncomplete=resolve;tx.onerror=()=>reject(tx.error); }); } async function readMedia(owner){ const db=await mediaDBPromise; return new Promise((resolve,reject)=>{const tx=db.transaction('files','readonly'),req=tx.objectStore('files').getAll(); req.onsuccess=()=>resolve(req.result.filter(x=>x.owner===owner));req.onerror=()=>reject(req.error); }); } async function removeStoredMedia(owner){ const db=await mediaDBPromise;const all=await readMedia(owner); return new Promise((resolve,reject)=>{const tx=db.transaction('files','readwrite'),store=tx.objectStore('files');all.forEach(x=>store.delete(x.id));tx.oncomplete=resolve;tx.onerror=()=>reject(tx.error)}); } async function saveStory(status='مسودة'){ const title=document.getElementById('storyTitle').value.trim(),body=document.getElementById('storyBody').value.trim(); if(!title||!body){alert('يرجى إدخال العنوان والنص أولاً.');return} const old=editingStory>=0?stories[editingStory]:null; const id=old?.id||('story-'+Date.now()+'-'+Math.random().toString(16).slice(2)); const item={id,title,body,category:document.getElementById('storyCategory').value,extraTitle:document.getElementById('storyExtraTitle').value.trim(),mediaNames:storyMediaFiles.map(f=>f.name),status,updatedAt:new Date().toISOString()}; try{ await storeMedia(id,storyMediaFiles); if(editingStory>=0){stories[editingStory]={...old,...item};editingStory=-1}else stories.unshift(item); if(!put('stories',stories))throw new Error('localStorage unavailable'); renderStories();document.getElementById('storyForm').reset();storyMediaFiles=[];renderStoryMediaFiles();updateStoryPreview();document.querySelector('#storyForm .primary').textContent='💾 حفظ مسودة'; const pc=document.getElementById('pendingCount');if(pc)pc.textContent=stories.filter(s=>s.status==='قيد المراجعة').length+6; alert('تم حفظ المسودة والوسائط على هذا الجهاز. لا يتم نشرها في WordPress إلا بعد ربط الموقع.'); }catch(err){console.error(err);alert('تعذر حفظ الوسائط. قد تكون مساحة التخزين غير كافية، خصوصاً للفيديو الكبير.')} } function submitStory(){saveStory('مسودة')} function updateStoryPreview(){const p=document.getElementById('storyPreview');p.textContent=(document.getElementById('storyTitle').value+'\n'+document.getElementById('storyBody').value).trim()||'المعاينة كتبان هنا...';p.style.fontFamily=document.getElementById('font').value;p.style.fontSize=document.getElementById('fontSize').value+'px'} ['storyTitle','storyBody','font','fontSize'].forEach(id=>document.getElementById(id).addEventListener('input',updateStoryPreview)); let selectedMedia=[]; async function renderSavedMedia(){ const box=document.getElementById('mediaPreview');box.innerHTML=''; try{ const all=await readMedia('library'); all.forEach(item=>{ const wrap=document.createElement('div');wrap.className='card';wrap.style.padding='8px'; const url=URL.createObjectURL(item.blob),el=item.type.startsWith('video/')?document.createElement('video'):document.createElement('img'); el.src=url;el.style.cssText='width:100%;max-height:180px;object-fit:contain;border-radius:10px';if(el.tagName==='VIDEO')el.controls=true; const name=document.createElement('small');name.textContent=item.name;name.style.cssText='display:block;overflow-wrap:anywhere;margin:7px 0'; const del=document.createElement('button');del.className='softbtn';del.textContent='🗑️ حذف';del.onclick=async()=>{const db=await mediaDBPromise;db.transaction('files','readwrite').objectStore('files').delete(item.id);renderSavedMedia()}; wrap.append(el,name,del);box.appendChild(wrap); }); }catch(e){console.warn(e)} } document.getElementById('mediaInput').addEventListener('change',async e=>{ const files=Array.from(e.target.files||[]);e.target.value=''; try{ const db=await mediaDBPromise; await new Promise((resolve,reject)=>{const tx=db.transaction('files','readwrite'),store=tx.objectStore('files');files.forEach((f,i)=>store.put({id:'library-'+Date.now()+'-'+i,owner:'library',name:f.name,type:f.type,blob:f}));tx.oncomplete=resolve;tx.onerror=()=>reject(tx.error)}); await renderSavedMedia(); }catch(err){console.error(err);alert('تعذر حفظ الملفات على هذا الجهاز. حاول ملفات أصغر.')} }); function saveLive(){put('liveUrl',document.getElementById('liveUrl').value.trim());put('guestNames',document.getElementById('guestNames').value);alert('تحفظ الرابط محلياً فهاد المتصفح.')} function openLive(){const u=document.getElementById('liveUrl').value.trim();if(/^https?:\/\//i.test(u))window.open(u,'_blank','noopener');else alert('دخل رابط صحيح أولاً.')} function saveGuests(){put('guestNames',document.getElementById('guestNames').value);renderTikTokGuestTable();alert('تحفظات لائحة TikTok محلياً.')} function importTikTokGuests(){ const names=document.getElementById('guestNames').value.split(/\r?\n|,|;/).map(x=>x.trim()).filter(Boolean); if(!names.length){alert('لصق الأسماء أولاً، كل اسم في سطر.');return} const n=window.__h2hAddTikTokNames?window.__h2hAddTikTokNames(names):0; put('guestNames',document.getElementById('guestNames').value);renderTikTokGuestTable(); alert('تمت إضافة '+n+' أسماء إلى جدول المستفيدين. راجع الأسماء قبل اعتمادها كمستفيدين.'); } function renderTikTokGuestTable(){ const box=document.getElementById('tiktokGuestTableWrap');if(!box)return;box.replaceChildren(); const names=(document.getElementById('guestNames').value||'').split(/\r?\n|,|;/).map(x=>x.trim()).filter(Boolean); if(!names.length){const p=document.createElement('p');p.className='notice';p.textContent='لائحة TikTok فارغة حالياً.';box.appendChild(p);return} let states=[];try{states=JSON.parse(localStorage.getItem('h2h_tiktok_guest_states')||'[]')}catch(e){} const table=document.createElement('table');table.id='tiktokGuestTable';const thead=document.createElement('thead'),tr=document.createElement('tr'); ['رقم','الاسم','حالة المتابعة','إجراءات'].forEach(t=>{const th=document.createElement('th');th.textContent=t;tr.appendChild(th)});thead.appendChild(tr);table.appendChild(thead); const tbody=document.createElement('tbody'); names.forEach((name,i)=>{ const row=document.createElement('tr');const num=document.createElement('td');num.textContent=String(i+1);num.style.cssText='text-align:center;font-weight:700;color:#3b5f9f;background:#edf3ff';row.appendChild(num); const nm=document.createElement('td');const inp=document.createElement('input');inp.value=name;inp.setAttribute('aria-label','اسم مشارك TikTok '+(i+1));inp.addEventListener('input',()=>{names[i]=inp.value;document.getElementById('guestNames').value=names.join('\n');put('guestNames',document.getElementById('guestNames').value)});nm.appendChild(inp);row.appendChild(nm); const state=document.createElement('td');const sel=document.createElement('select');sel.setAttribute('aria-label','حالة متابعة TikTok '+(i+1)); const options=[['جديد','tiktok-status-new'],['تم التواصل','tiktok-status-contact'],['تمت الإضافة للمستفيدين','tiktok-status-added'],['لا يحتاج مساعدة','tiktok-status-none']];options.forEach(([v])=>{const o=document.createElement('option');o.value=v;o.textContent=v;sel.appendChild(o)});sel.value=states[i]?.status||'جديد';sel.className=options.find(x=>x[0]===sel.value)?.[1]||'tiktok-status-new';sel.addEventListener('change',()=>{states[i]={...(states[i]||{}),status:sel.value};sel.className=options.find(x=>x[0]===sel.value)?.[1]||'tiktok-status-new';localStorage.setItem('h2h_tiktok_guest_states',JSON.stringify(states))});state.appendChild(sel);row.appendChild(state); const acts=document.createElement('td');acts.style.cssText='white-space:nowrap;text-align:center'; const edit=document.createElement('button');edit.type='button';edit.textContent='✏️';edit.title='تعديل الاسم';edit.style.cssText='border:1px solid #c9d8f5;background:#edf3ff;border-radius:9px;padding:8px;margin:2px;font-size:16px';edit.onclick=()=>{inp.focus();inp.select()}; const saveBtn=document.createElement('button');saveBtn.type='button';saveBtn.textContent='💾';saveBtn.title='حفظ الاسم والحالة';saveBtn.style.cssText='border:1px solid #a9dfbf;background:#e2f7e9;color:#176b3a;border-radius:9px;padding:8px;margin:2px;font-size:16px';saveBtn.onclick=()=>{put('guestNames',document.getElementById('guestNames').value);states[i]={...(states[i]||{}),status:sel.value};localStorage.setItem('h2h_tiktok_guest_states',JSON.stringify(states));alert('تم حفظ بيانات TikTok لهذا السطر محلياً.')};acts.append(edit,saveBtn);row.appendChild(acts);tbody.appendChild(row); }); table.appendChild(tbody);box.appendChild(table); const actions=document.createElement('div');actions.className='h2h-review-action'; const saveAll=document.createElement('button');saveAll.type='button';saveAll.className='softbtn';saveAll.textContent='💾 حفظ لائحة TikTok';saveAll.onclick=()=>saveGuests(); const send=document.createElement('button');send.type='button';send.className='primary';send.style.background='#168b61';send.textContent='📨 إرسال لائحة TikTok للمراجعة';send.onclick=()=>{const current=(document.getElementById('guestNames').value||'').split(/\r?\n|,|;/).map(x=>x.trim()).filter(Boolean);if(!current.length){alert('لا توجد أسماء لإرسالها.');return}let q=[];try{q=JSON.parse(localStorage.getItem('h2h_review_queue')||'[]');if(!Array.isArray(q))q=[]}catch(e){}q.unshift({id:'tiktok-review-'+Date.now(),type:'tiktok',title:'لائحة TikTok LIVE ('+current.length+')',status:'بانتظار المراجعة',submittedAt:new Date().toISOString(),items:current.map((name,i)=>({number:i+1,name,status:states[i]?.status||'جديد'}))});try{localStorage.setItem('h2h_review_queue',JSON.stringify(q));const pc=document.getElementById('pendingCount');if(pc)pc.textContent=String((Number(pc.textContent)||0)+1);alert('تم حفظ لائحة TikTok في قائمة المراجعة المحلية. الإرسال الفعلي للمسؤول يحتاج ربط WordPress/API.')}catch(e){alert('تعذر حفظ لائحة المراجعة.')}}; actions.append(saveAll,send);box.appendChild(actions); } document.getElementById('liveUrl').value=get('liveUrl','');document.getElementById('guestNames').value=get('guestNames','');renderBeneficiaries();renderStories();renderSavedMedia();renderTikTokGuestTable();