1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-mq93TrXA.js"])))=>i.map(i=>d[i]); 2import{m as f,p as e,an as ne,bN as oe}from"./vendor-mq93TrXA.js";import{A as F}from"./AdminLayout-B932Ewnk.js";import{u as D,b as se}from"./DataContext-BhM46Acw.js";import{l as A,m as K,n as N,B as t,o as H,q as ae,r as ie,t as le,v as ce,w as de,x as me,y as ue}from"./bilginiTazeleRepository-D_L5L6HG.js";import{_ as V}from"./pdf-DnYcS9Bc.js";import{h as I,c as y,X as Q}from"./excelExport-UumXfbJa.js";import{z as J,P as pe,D as U,E as ge,F as Z,G as he,H as X,e as fe,J as ee,q as xe,K as ye,U as q,T as G,g as be}from"./icons-x970t0xX.js";import"./LogoImage-BMcyrcB6.js";import"./hesapStatusu-BogwU7bf.js";import"./firebase-CIE5gVYo.js";import"./firebase.config-6nbkXHPx.js";import"./index-CFUjeldQ.js";import"./auditLogger-CW1SMtQ7.js";import"./userRoleMapping-D2vPCZcP.js";const te=["Kategori","Soru","A","B","C","D","DoÄru Cevap","Açıklama","Aktif","sourceId"],C=n=>n==null?"":String(n).trim(),je=n=>n.replace(/[çÄıöÅü]/g,o=>({ç:"c",Ä:"g",ı:"i",ö:"o",Å:"s",ü:"u"})[o]||o),Se=n=>{const o=C(n).toLocaleLowerCase("tr-TR").replace(/[_-]+/g," ").replace(/\s+/g," ").trim();if(!o)return"";if(K[o])return K[o];const m=je(o);return K[m]?K[m]:o.replace(/\s+/g,"-")},ve=n=>N.some(o=>o.key===n),ke=n=>{var o;return((o=N.find(m=>m.key===n))==null?void 0:o.name)||n},ze=n=>{const o=C(n).toLocaleUpperCase("tr-TR");if(!o)return null;if(A.includes(o))return o;const m=Number(o);if(Number.isInteger(m)){if(m>=0&&m<=3)return A[m];if(m>=1&&m<=4)return A[m-1]}return null},we=n=>Array.isArray(n)?n.map(o=>o&&typeof o=="object"&&"text"in o?C(o.text):C(o)):[],Ne=n=>{if(!Array.isArray(n))return null;const o=n.findIndex(m=>m&&typeof m=="object"&&m.isCorrect===!0);return o>=0&&o<A.length?A[o]:null},re=n=>{const o=[],m=Se(n.categoryKey||n.category);m?ve(m)||o.push(`Bilinmeyen kategori: "${C(n.categoryKey||n.category)}".`):o.push("Kategori boÅ.");const p=C(n.question);p||o.push("Soru metni boÅ.");const g=we(n.options);if(g.length!==4)o.push(`Åık sayısı 4 olmalı, ${g.length} bulundu.`);else if(g.some(a=>!a)){const a=g.map((i,l)=>i?null:A[l]).filter(Boolean).join(", ");o.push(`BoÅ Åık var: ${a}.`)}const c=ze(n.correctAnswer)??Ne(n.options);if(c||o.push("DoÄru cevap okunamadı (A-D ya da 1-4 bekleniyor)."),o.length>0)return{ok:!1,question:null,errors:o};const s=g.map((a,i)=>({id:A[i],text:a,isCorrect:A[i]===c}));return s.filter(a=>a.isCorrect).length!==1?{ok:!1,question:null,errors:["Tam olarak bir doÄru Åık olmalı."]}:{ok:!0,errors:[],question:{categoryKey:m,categoryName:ke(m),question:p,options:s,correctAnswer:c,explanation:C(n.explanation),active:!["hayir","hayır","false","0","pasif"].includes(C(n.active).toLocaleLowerCase("tr-TR")),sourceId:C(n.sourceId)||null}}},Ce=n=>({category:n[0],question:n[1],options:[n[2],n[3],n[4],n[5]],correctAnswer:n[6],explanation:n[7],active:n[8],sourceId:n[9]}),Ae=()=>V(()=>import("./xlsx-CN95FN1n.js").then(n=>n.a),__vite__mapDeps([0])),M=()=>V(()=>import("./xlsx-CN95FN1n.js").then(n=>n.x),__vite__mapDeps([0])),Te=async n=>{const o=await Ae(),m=await n.arrayBuffer(),p=o.read(m,{type:"buffer"}),g=p.Sheets[p.SheetNames[0]],c=o.utils.sheet_to_json(g,{header:1,blankrows:!1}),s=[],a=[];return c.slice(1).forEach((i,l)=>{const u=l+2;if(!Array.isArray(i)||i.every(v=>v==null||String(v).trim()===""))return;const j=re(Ce(i));j.ok&&j.question?s.push(j.question):a.push({rowNumber:u,preview:String(i[1]??"").slice(0,60),errors:j.errors})}),{valid:s,invalid:a,totalRows:s.length+a.length}},Y=n=>n.map(o=>({wch:o})),Re=async()=>{const n=await M(),o=te.map(c=>I(c)),m=[y("Health"),y("Ãrnek soru metni?"),y("Birinci Åık"),y("İkinci Åık"),y("Ãçüncü Åık"),y("Dördüncü Åık"),y("B"),y("DoÄru cevabın açıklaması"),y("Evet"),y("")],p=n.utils.aoa_to_sheet([o,m]);p["!cols"]=Y([22,70,34,34,34,34,12,50,8,24]);const g=n.utils.book_new();n.utils.book_append_sheet(g,p,"Sorular"),n.writeFile(g,"bilgini-tazele-soru-sablonu.xlsx")},Be=async n=>{const o=await M(),m=[te.map(c=>I(c)),...n.map(c=>{var s,a,i,l;return[y(c.categoryName||c.categoryKey),y(c.question),y(((s=c.options[0])==null?void 0:s.text)||""),y(((a=c.options[1])==null?void 0:a.text)||""),y(((i=c.options[2])==null?void 0:i.text)||""),y(((l=c.options[3])==null?void 0:l.text)||""),y(c.correctAnswer),y(c.explanation),y(c.active?"Evet":"Hayır"),y(c.sourceId||c.id)]})],p=o.utils.aoa_to_sheet(m);p["!cols"]=Y([22,70,34,34,34,34,12,50,8,24]);const g=o.utils.book_new();o.utils.book_append_sheet(g,p,"Sorular"),o.writeFile(g,`bilgini-tazele-sorular-${new Date().toISOString().slice(0,10)}.xlsx`)},We=n=>{if(!n)return"â";const o=new Date(n);return Number.isNaN(o.getTime())?"â":o.toLocaleDateString("tr-TR")},$e=async n=>{const o=await M(),p=[["Ad Soyad","Sicil No","MaÄaza","Unvan","Kategori","DoÄru","YanlıÅ","Toplam","Puan","Sonuç","Süre (dk)","Deneme","Tamamlanma"].map(s=>I(s)),...n.map(s=>[y(s.personName),y(s.sicilNo),y(s.storeName||"â"),y(s.userRole),y(s.categoryName),y(s.correctCount),y(s.wrongCount),y(s.totalQuestions),y(s.score),y(s.passed?"Geçti":"Kaldı",s.passed?Q.GREEN_ROW:Q.RED_ROW),y(Math.round(s.durationSec/60)),y(s.attemptNumber),y(We(s.completedAt))])],g=o.utils.aoa_to_sheet(p);g["!cols"]=Y([26,12,24,20,22,8,8,8,8,10,11,8,14]);const c=o.utils.book_new();o.utils.book_append_sheet(c,g,"Sonuçlar"),o.writeFile(c,`bilgini-tazele-sonuclar-${new Date().toISOString().slice(0,10)}.xlsx`)},Ee=()=>({id:"",categoryKey:N[0].key,question:"",options:["","","",""],correctAnswer:"A",explanation:"",active:!0}),Ke=()=>{const{currentUser:n}=D(),[o,m]=f.useState([]),[p,g]=f.useState(!0),[c,s]=f.useState(""),[a,i]=f.useState(!1),[l,u]=f.useState(""),[j,v]=f.useState(""),[b,k]=f.useState(null),T=async()=>{g(!0);try{m(await H()),s("")}
2catch(r){console.error("Sorular okunamadı:",r),s("Sorular yüklenemedi.")}finally{g(!1)}};f.useEffect(()=>{T()},[]);const x=f.useMemo(()=>{const r=l.trim().toLocaleLowerCase("tr-TR");return o.filter(d=>!j||d.categoryKey===j).filter(d=>!r||d.question.toLocaleLowerCase("tr-TR").includes(r)).sort((d,h)=>d.categoryKey===h.categoryKey?d.question.localeCompare(h.question,"tr"):d.categoryKey.localeCompare(h.categoryKey,"tr"))},[o,l,j]),z=f.useMemo(()=>{const r=new Map;return o.forEach(d=>r.set(d.categoryKey,(r.get(d.categoryKey)||0)+1)),r},[o]),w=()=>{s(""),k(Ee())},R=r=>{s(""),k({id:r.id,categoryKey:r.categoryKey,question:r.question,options:[0,1,2,3].map(d=>{var h;return((h=r.options[d])==null?void 0:h.text)||""}),correctAnswer:r.correctAnswer,explanation:r.explanation,active:r.active})},_=async()=>{if(!b)return;const r=re({categoryKey:b.categoryKey,question:b.question,options:b.options,correctAnswer:b.correctAnswer,explanation:b.explanation,active:b.active?"Evet":"Hayır"});if(!r.ok||!r.question){s(r.errors.join(" "));return}i(!0);try{const d=(n==null?void 0:n.name)||(n==null?void 0:n.email)||"admin";b.id?await ae(b.id,r.question,d):await ie(r.question,d),k(null),await T()}catch(d){console.error("Soru kaydedilemedi:",d),s("Kaydedilemedi. Yalnızca Yönetici rolü soru yazabilir.")}finally{i(!1)}},L=async r=>{if(confirm(`Bu soru kalıcı olarak silinecek: 3 4"${r.question.slice(0,120)}" 5 6Emin misiniz?`))try{await le(r.id),await T()}catch(d){console.error("Soru silinemedi:",d),s("Silinemedi. Yalnızca Yönetici rolü soru silebilir.")}};return e.jsxs("div",{children:[e.jsx("style",{children:` 7 .bt-adm-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; } 8 .bt-adm-input { padding: 0.5rem 0.7rem; border-radius: 8px; border: 1.5px solid ${t.border}; font-size: 0.85rem; background: #fff; outline: none; color: ${t.content}; } 9 .bt-adm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 0.9rem; border-radius: 8px; border: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; } 10 .bt-adm-chip { padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; } 11 .bt-adm-card { background: #fff; border: 1px solid ${t.border}; border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.6rem; } 12 .bt-adm-iconbtn { background: none; border: 1.5px solid currentColor; border-radius: 6px; padding: 4px 6px; cursor: pointer; display: inline-flex; align-items: center; } 13 .bt-adm-opt { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; } 14 .bt-adm-optbadge { display: flex; align-items: center; justify-content: center; height: 34px; border-radius: 8px; font-weight: 800; font-size: 0.8rem; } 15 `}),e.jsxs("div",{className:"bt-adm-toolbar",children:[e.jsxs("div",{style:{position:"relative",flex:"1 1 240px",minWidth:200},children:[e.jsx(J,{size:15,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:t.contentSoft}}),e.jsx("input",{className:"bt-adm-input",style:{width:"100%",paddingLeft:32},placeholder:"Soru metninde ara...",value:l,onChange:r=>u(r.target.value)})]}),e.jsxs("select",{className:"bt-adm-input",value:j,onChange:r=>v(r.target.value),children:[e.jsxs("option",{value:"",children:["Tüm kategoriler (",o.length,")"]}),N.map(r=>e.jsxs("option",{value:r.key,children:[r.name," (",z.get(r.key)||0,")"]},r.key))]}),e.jsxs("button",{className:"bt-adm-btn",style:{background:t.primary,color:"#fff"},onClick:w,children:[e.jsx(pe,{size:16})," Yeni Soru"]}),e.jsxs("button",{className:"bt-adm-btn",style:{background:"#f1f5f9",color:t.content},onClick:()=>Be(o),disabled:o.length===0,children:[e.jsx(U,{size:16})," Excel'e Aktar"]})]}),c&&e.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.6rem 0.8rem",background:t.dangerSoft,border:`1px solid ${t.danger}55`,borderRadius:8,fontSize:"0.82rem",color:t.danger},children:c}),b&&e.jsxs("div",{className:"bt-adm-card",style:{borderColor:t.primary,borderWidth:2,marginBottom:"1.25rem"},children:[e.jsx("div",{style:{fontWeight:700,fontSize:"0.95rem",color:t.content,marginBottom:"0.9rem"}
15,children:b.id?"Soruyu Düzenle":"Yeni Soru"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.8rem",marginBottom:"0.8rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"0.75rem",fontWeight:600,color:t.contentSoft,display:"block",marginBottom:4},children:"Kategori"}),e.jsx("select",{className:"bt-adm-input",style:{width:"100%"},value:b.categoryKey,onChange:r=>k({...b,categoryKey:r.target.value}),children:N.map(r=>e.jsx("option",{value:r.key,children:r.name},r.key))})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"0.75rem",fontWeight:600,color:t.contentSoft,display:"block",marginBottom:4},children:"Durum"}),e.jsxs("select",{className:"bt-adm-input",style:{width:"100%"},value:b.active?"1":"0",onChange:r=>k({...b,active:r.target.value==="1"}),children:[e.jsx("option",{value:"1",children:"Aktif"}),e.jsx("option",{value:"0",children:"Pasif"})]})]})]}),e.jsx("label",{style:{fontSize:"0.75rem",fontWeight:600,color:t.contentSoft,display:"block",marginBottom:4},children:"Soru"}),e.jsx("textarea",{className:"bt-adm-input",style:{width:"100%",minHeight:70,resize:"vertical",marginBottom:"0.8rem",fontFamily:"inherit"},value:b.question,onChange:r=>k({...b,question:r.target.value})}),e.jsx("label",{style:{fontSize:"0.75rem",fontWeight:600,color:t.contentSoft,display:"block",marginBottom:6},children:"Åıklar â doÄru olanı seçin"}),A.map((r,d)=>{const h=b.correctAnswer===r;return e.jsxs("div",{className:"bt-adm-opt",children:[e.jsx("button",{type:"button",className:"bt-adm-optbadge",onClick:()=>k({...b,correctAnswer:r}),title:"DoÄru cevap olarak iÅaretle",style:{background:h?t.success:"#f1f5f9",color:h?"#fff":t.contentSoft,border:`1.5px solid ${h?t.success:t.border}`,cursor:"pointer"},children:r}),e.jsx("input",{className:"bt-adm-input",value:b.options[d],onChange:S=>{const B=[...b.options];B[d]=S.target.value,k({...b,options:B})},placeholder:`${r} Åıkkı`})]},r)}),e.jsxs("label",{style:{fontSize:"0.75rem",fontWeight:600,color:t.contentSoft,display:"block",margin:"0.6rem 0 4px"},children:["Açıklama ",e.jsx("span",{style:{fontWeight:400},children:"(isteÄe baÄlı â sınav sonunda gösterilir)"})]}),e.jsx("textarea",{className:"bt-adm-input",style:{width:"100%",minHeight:56,resize:"vertical",fontFamily:"inherit"},value:b.explanation,onChange:r=>k({...b,explanation:r.target.value})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:"1rem"},children:[e.jsx("button",{className:"bt-adm-btn",style:{background:"#f1f5f9",color:t.content},onClick:()=>k(null),children:"İptal"}),e.jsx("button",{className:"bt-adm-btn",style:{background:t.primary,color:"#fff",opacity:a?.7:1},onClick:_,disabled:a,children:a?"Kaydediliyor...":"Kaydet"})]})]}),p?e.jsx("p",{style:{textAlign:"center",color:t.contentSoft,fontSize:"0.85rem",padding:"2rem 0"},children:"Yükleniyor..."}):x.length===0?e.jsxs("div",{style:{background:t.base,border:`1px dashed ${t.border}`,borderRadius:12,padding:"2.5rem",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:t.content,marginBottom:4},children:o.length===0?"Soru bankası boÅ":"Filtreye uyan soru yok"}),e.jsx("div",{style:{fontSize:"0.82rem",color:t.contentSoft},children:o.length===0?"İçe Aktarım sekmesinden Excel ile toplu yükleme yapabilirsiniz.":"Arama veya kategori filtresini deÄiÅtirin."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{fontSize:"0.8rem",color:t.contentSoft,marginBottom:"0.6rem"},children:[x.length," soru gösteriliyor"]}),x.map(r=>{const d=N.find(h=>h.key===r.categoryKey);return e.jsx("div",{className:"bt-adm-card",children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,alignItems:"flex-start"},children:[e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{className:"bt-adm-chip",style:{background:`${(d==null?void 0:d.color)||t.primary}18`,color:(d==null?void 0:d.color)||t.primary},children:(d==null?void 0:d.name)||r.categoryKey}),!r.active&&e.jsx("span",{className:"bt-adm-chip",style:{background:"#f1f5f9",color:t.contentSoft},children:"Pasif"})]}),e.jsx("div",{style:{fontSize:"0.86rem",fontWeight:600,color:t.content,marginBottom:6},children:r.question}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.options.map(h=>e.jsxs("span",{style:{fontSize:"0.74rem",padding:"0.2rem 0.55rem",borderRadius:6,background:h.isCorrect?t.successSoft:"#f8fafc",color:h.isCorrect?"#065F46":t.contentSoft,border:`1px solid ${h.isCorrect?t.success+"55":t.border}`,fontWeight:h.isCorrect?700:400},children:[h.id,") ",h.text]},h.id))})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flexShrink:0},children:[e.jsx("button",{className:"bt-adm-iconbtn",style:{color:t.primary},onClick:()=>R(r),title:"Düzenle",children:e.jsx(ge,{size:15})}),e.jsx("button",{className:"bt-adm-iconbtn",style:{color:t.danger},onClick:()=>L(r),title:"Sil",children:e.jsx(Z,{size:15})})]})]})},r.id)})]})]})},De=()=>{const{currentUser:n}=D(),[o,m]=f.useState(!1),[p,g]=f.useState(!1),[c,s]=f.useState(null),[a,i]=f.useState(""),[l,u]=f.useState(""),[j,v]=f.useState(null),b=async x=>{if(x){u(""),v(null),s(null),i(x.name),m(!0);try{s(await Te(x))}catch(z){console.error("Excel okunamadı:",z),u("Dosya okunamadı. Å
15ablona uygun bir .xlsx dosyası seçtiÄinizden emin olun.")}finally{m(!1)}}},k=async()=>{if(!(!c||c.valid.length===0)){g(!0),u("");try{const x=(n==null?void 0:n.name)||(n==null?void 0:n.email)||"admin";v(await ce(c.valid,x)),s(null),i("")}catch(x){console.error("İçe aktarım baÅarısız:",x),u("İçe aktarılamadı. Yalnızca Yönetici rolü soru yazabilir.")}finally{g(!1)}}},T=c?c.valid.reduce((x,z)=>(x[z.categoryKey]=(x[z.categoryKey]||0)+1,x),{}):{};return e.jsxs("div",{children:[e.jsx("style",{children:` 16 .bt-imp-drop { border: 2px dashed ${t.border}; border-radius: 14px; padding: 2rem 1.5rem; text-align: center; background: ${t.base}; } 17 .bt-imp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.55rem 1rem; border-radius: 8px; border: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; } 18 .bt-imp-stat { flex: 1 1 150px; padding: 0.9rem 1rem; border-radius: 12px; border: 1px solid ${t.border}; } 19 .bt-imp-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; } 20 .bt-imp-table th, .bt-imp-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid ${t.border}; text-align: left; vertical-align: top; } 21 .bt-imp-table th { background: ${t.base}; font-weight: 700; color: ${t.contentSoft}; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; } 22 `}),e.jsxs("div",{style:{background:t.primarySoft,border:`1px solid ${t.primary}33`,borderRadius:10,padding:"0.85rem 1rem",marginBottom:"1.25rem",fontSize:"0.82rem",color:"#0f766e"},children:["Åablonu indirip doldurun, ardından yükleyin. Her satır doÄrulanır; kurallara uymayan satırlar",e.jsx("strong",{children:" içe aktarılmaz"})," ve aÅaÄıda karantina listesinde nedeniyle birlikte gösterilir.",e.jsx("strong",{children:" sourceId"})," sütunu dolu olan satırlar mevcut soruyu günceller, yenisini oluÅturmaz."]}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:"1.25rem"},children:e.jsxs("button",{className:"bt-imp-btn",style:{background:"#f1f5f9",color:t.content},onClick:()=>Re(),children:[e.jsx(he,{size:16})," Åablonu İndir"]})}),e.jsxs("div",{className:"bt-imp-drop",children:[e.jsx(X,{size:30,style:{color:t.contentSoft,marginBottom:8}}),e.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:t.content,marginBottom:4},children:"Excel dosyası yükleyin"}),e.jsx("div",{style:{fontSize:"0.8rem",color:t.contentSoft,marginBottom:12},children:".xlsx â ilk sayfa okunur, ilk satır baÅlık kabul edilir"}),e.jsx("input",{type:"file",accept:".xlsx,.xls",onChange:x=>{var z;return b((z=x.target.files)==null?void 0:z[0])},style:{fontSize:"0.82rem"}}),a&&e.jsxs("div",{style:{marginTop:10,fontSize:"0.8rem",color:t.contentSoft},children:["Seçilen: ",e.jsx("strong",{children:a})]})]}),o&&e.jsx("p",{style:{textAlign:"center",color:t.contentSoft,fontSize:"0.85rem",padding:"1.5rem 0"},children:"Dosya okunuyor..."}),l&&e.jsx("div",{style:{marginTop:"1rem",padding:"0.7rem 0.9rem",background:t.dangerSoft,border:`1px solid ${t.danger}55`,borderRadius:8,fontSize:"0.82rem",color:t.danger},children:l}),j&&e.jsxs("div",{style:{marginTop:"1rem",padding:"0.9rem 1rem",background:t.successSoft,border:`1px solid ${t.success}55`,borderRadius:10,fontSize:"0.85rem",color:"#065F46",display:"flex",gap:8,alignItems:"center"},children:[e.jsx(fe,{size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:j.created})," yeni soru eklendi, ",e.jsx("strong",{children:j.updated})," mevcut soru güncellendi."]})]}),c&&e.jsxs("div",{style:{marginTop:"1.5rem"},children:[e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:"1rem"},children:[e.jsxs("div",{className:"bt-imp-stat",style:{background:t.successSoft,borderColor:`${t.success}55`},children:[e.jsx("div",{style:{fontSize:"1.5rem",fontWeight:800,color:"#065F46"},children:c.valid.length}),e.jsx("div",{style:{fontSize:"0.78rem",fontWeight:600,color:"#065F46"},children:"Geçerli satır"})]}),e.jsxs("div",{className:"bt-imp-stat",style:{background:c.invalid.length>0?t.dangerSoft:"#fff",borderColor:c.invalid.length>0?`${t.danger}55`:t.border},children:[e.jsx("div",{style:{fontSize:"1.5rem",fontWeight:800,color:c.invalid.length>0?t.danger:t.contentSoft},children:c.invalid.length}),e.jsx("div",{style:{fontSize:"0.78rem",fontWeight:600,color:c.invalid.length>0?t.danger:t.contentSoft},children:"Karantina (aktarılmayacak)"})]}),e.jsxs("div",{className:"bt-imp-stat",children:[e.jsx("div",{style:{fontSize:"1.5rem",fontWeight:800,color:t.content},children:c.totalRows}),e.jsx("div",{style:{fontSize:"0.78rem",fontWeight:600,color:t.contentSoft},children:"Toplam satır"})]})]}),c.valid.length>0&&e.jsxs("div",{style:{marginBottom:"1rem"},children:[e.jsx("div",{style:{fontSize:"0.78rem",fontWeight:700,color:t.contentSoft,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:6},children:"Kategori daÄılımı"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Object.entries(T).sort().map(([x,z])=>{const w=N.find(R=>R.key===x);return e.jsxs("span",{style:{fontSize:"0.76rem",padding:"0.25rem 0.65rem",borderRadius:999,background:`${(w==null?void 0:w.color)||t.primary}18`,color:(w==null?void 0:w.color)||t.primary,fontWeight:600},children:[(w==null?void 0:w.name)||x,": ",z]},x)})})]}),c.invalid.length>0&&e.jsxs("div",{style:{marginBottom:"1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.85rem",fontWeight:700,color:t.danger,marginBottom:8},children:[e.jsx(ee,{size:16})," Karantina â bu satırlar içe aktarılmayacak"]}),e.jsx("div",{style:{overflowX:"auto",border:`1px solid ${t.border}`,borderRadius:10},children:e.jsxs("table",{className:"bt-imp-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:70},children:"Satır"}),e.jsx("th",{children:"Soru"}),e.jsx("th",{children:"Neden"})]})}),e.jsx("tbody",{children:c.invalid.map(x=>e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:700,color:t.content},children:x.rowNumber}),e.jsx("td",{style:{color:t.contentSoft},children:x.preview||e.jsx("em",{children:"(boÅ)"})}),e.jsx("td",{style:{color:t.danger},children:x.errors.join(" ")})]},x.rowNumber))})]})})]}),e.jsxs("button",{className:"bt-imp-btn",style:{background:c.valid.length>0?t.primary:"#cbd5e1",color:"#fff",opacity:p?.7:1,cursor:c.valid.length>0?"pointer":"not-allowed"},onClick:k,disabled:p||c.valid.length===0,children:[e.jsx(X,{size:16}),p?"Aktarılıyor...":`${c.valid.length} geçerli satırı içe aktar`]})]})]})},P=()=>{const[n,o]=f.useState([]),[m,p]=f.useState(!0),[g,c]=f.useState(""),s=f.useCallback(async()=>{p(!0);try{o(await de()),c("")}catch(l){console.error("Sınav sonuçları okunamadı:",l),c("Sonuçlar yüklenemedi.")}finally{p(!1)}},[]);f.useEffect(()=>{s()},[s]);const a=f.useCallback(async(l,u)=>{await me(l,u),await s()},[s]),i=f.useCallback(async()=>{const l=await ue();return await s(),l},[s]);return{results:n,loading:m,error:g,reload:s,reopen:a,resetAll:i}},_e=n=>{if(!n)return"â";const o=new Date(n);
22return Number.isNaN(o.getTime())?"â":o.toLocaleString("tr-TR",{dateStyle:"short",timeStyle:"short"})},Le=()=>{const{currentUser:n}=D(),{results:o,loading:m,error:p,reopen:g,resetAll:c}=P(),[s,a]=f.useState(""),[i,l]=f.useState(""),[u,j]=f.useState(""),[v,b]=f.useState(""),[k,T]=f.useState(!1),x=f.useMemo(()=>{const r=s.trim().toLocaleLowerCase("tr-TR");return o.filter(d=>!i||d.categoryKey===i).filter(d=>!u||(u==="passed"?d.passed:!d.passed)).filter(d=>r?d.personName.toLocaleLowerCase("tr-TR").includes(r)||d.sicilNo.includes(r)||(d.storeName||"").toLocaleLowerCase("tr-TR").includes(r):!0)},[o,s,i,u]),z=f.useMemo(()=>{const r=new Map;return x.forEach(h=>{const S=`${h.storeName||"â"}__${h.categoryKey}`;r.has(S)||r.set(S,[]),r.get(S).push(h)}),Array.from(r.values()).map(h=>{var B,O;const S=[...h].sort((W,$)=>$.score!==W.score?$.score-W.score:(W.durationSec||0)-($.durationSec||0));return{magazaAdi:((B=S[0])==null?void 0:B.storeName)||"â",kategoriAdi:((O=S[0])==null?void 0:O.categoryName)||"",satirlar:S.map((W,$)=>({...W,siraNo:$+1}))}}).sort((h,S)=>h.magazaAdi.localeCompare(S.magazaAdi,"tr")||h.kategoriAdi.localeCompare(S.kategoriAdi,"tr")).flatMap(h=>h.satirlar)},[x]),w=r=>`${String(Math.floor((r||0)/60)).padStart(2,"0")}:${String((r||0)%60).padStart(2,"0")}`,R=f.useMemo(()=>{const r=x.length,d=x.filter(S=>S.passed).length,h=r>0?Math.round(x.reduce((S,B)=>S+B.score,0)/r):0;return{total:r,passed:d,failed:r-d,avg:h}},[x]),_=async()=>{if(o.length===0||!confirm(`Toplam ${o.length} sınav sonucunun TAMAMI kalıcı olarak silinecek. 23 24Bu iÅlem geri alınamaz â tüm personelin sınav geçmiÅi, puanları ve deneme hakları sıfırlanacak. 25 26Devam etmek istiyor musunuz?`))return;const r=prompt('Onaylamak için "SIFIRLA" yazın:');if(r!=="SIFIRLA"){r!==null&&alert("Yazı eÅleÅmedi, iÅlem iptal edildi.");return}T(!0);try{const d=await c();alert(`${d} sınav sonucu silindi.`)}catch(d){console.error("Sınav sonuçları sıfırlanamadı:",d),alert("Sınav sonuçları sıfırlanamadı. Yalnızca Yönetici rolü bu iÅlemi yapabilir.")}finally{T(!1)}},L=async(r,d,h)=>{if(confirm(`${d} adlı kiÅinin "${h}" sınavı yeniden açılacak ve bir deneme hakkı daha verilecek. 27 28Onaylıyor musunuz?`)){b(r);try{await g(r,(n==null?void 0:n.name)||(n==null?void 0:n.email)||"admin")}catch(S){console.error("Sınav yeniden açılamadı:",S),alert("Sınav yeniden açılamadı. Yalnızca Yönetici rolü bu iÅlemi yapabilir.")}finally{b("")}}};return e.jsxs("div",{children:[e.jsx("style",{children:` 29 .bt-res-input { padding: 0.5rem 0.7rem; border-radius: 8px; border: 1.5px solid ${t.border}; font-size: 0.85rem; background: #fff; outline: none; color: ${t.content}; } 30 .bt-res-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 0.9rem; border-radius: 8px; border: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; } 31 .bt-res-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 860px; } 32 .bt-res-table th, .bt-res-table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid ${t.border}; text-align: left; white-space: nowrap; } 33 .bt-res-table th { background: ${t.base}; font-weight: 700; color: ${t.contentSoft}; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; } 34 .bt-res-stat { flex: 1 1 130px; background: #fff; border: 1px solid ${t.border}; border-radius: 12px; padding: 0.85rem 1rem; } 35 `}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.6rem",alignItems:"center",marginBottom:"1rem"},children:[e.jsxs("div",{style:{position:"relative",flex:"1 1 220px",minWidth:190},children:[e.jsx(J,{size:15,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:t.contentSoft}}),e.jsx("input",{className:"bt-res-input",style:{width:"100%",paddingLeft:32},placeholder:"Ad veya maÄaza ara...",value:s,onChange:r=>a(r.target.value)})]}),e.jsxs("select",{className:"bt-res-input",value:i,onChange:r=>l(r.target.value),children:[e.jsx("option",{value:"",children:"Tüm kategoriler"}),N.map(r=>e.jsx("option",{value:r.key,children:r.name},r.key))]}),e.jsxs("select",{className:"bt-res-input",value:u,onChange:r=>j(r.target.value),children:[e.jsx("option",{value:"",children:"Tümü"}),e.jsx("option",{value:"passed",children:"Geçenler"}),e.jsx("option",{value:"failed",children:"Kalanlar"})]}),e.jsxs("button",{className:"bt-res-btn",style:{background:"#f1f5f9",color:t.content},onClick:()=>$e(z),disabled:x.length===0,children:[e.jsx(U,{size:16})," Excel'e Aktar"]}),e.jsxs("button",{className:"bt-res-btn",style:{background:t.dangerSoft,color:t.danger,opacity:k||o.length===0?.6:1},onClick:_,disabled:k||o.length===0,title:"Tüm sınav sonuçlarını kalıcı olarak sil",children:[e.jsx(Z,{size:16})," ",k?"Siliniyor...":"Tümünü Sıfırla"]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.6rem",flexWrap:"wrap",marginBottom:"1rem"},children:[e.jsxs("div",{className:"bt-res-stat",children:[e.jsx("div",{style:{fontSize:"1.35rem",fontWeight:800,color:t.content},children:R.total}),e.jsx("div",{style:{fontSize:"0.76rem",color:t.contentSoft,fontWeight:600},children:"Sınav"})]}),e.jsxs("div",{className:"bt-res-stat",children:[e.jsx("div",{style:{fontSize:"1.35rem",fontWeight:800,color:t.success},children:R.passed}),e.jsx("div",{style:{fontSize:"0.76rem",color:t.contentSoft,fontWeight:600},children:"Geçen"})]}),e.jsxs("div",{className:"bt-res-stat",children:[e.jsx("div",{style:{fontSize:"1.35rem",fontWeight:800,color:t.danger},children:R.failed}),e.jsx("div",{style:{fontSize:"0.76rem",color:t.contentSoft,fontWeight:600},children:"Kalan"})]}),e.jsxs("div",{className:"bt-res-stat",children:[e.jsx("div",{style:{fontSize:"1.35rem",fontWeight:800,color:t.primary},children:R.avg}),e.jsx("div",{style:{fontSize:"0.76rem",color:t.contentSoft,fontWeight:600},children:"Ortalama puan"})]})]}),p&&e.jsx("div",{style:{marginBottom:"0.75rem",padding:"0.6rem 0.8rem",background:t.dangerSoft,border:`1px solid ${t.danger}55`,borderRadius:8,fontSize:"0.82rem",color:t.danger},children:p}),m?e.jsx("p",{style:{textAlign:"center",color:t.contentSoft,fontSize:"0.85rem",padding:"2rem 0"},children:"Yükleniyor..."}):x.length===0?e.jsxs("div",{style:{background:t.base,border:`1px dashed ${t.border}`,borderRadius:12,padding:"2.5rem",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:t.content,marginBottom:4},children:o.length===0?"Henüz tamamlanmıŠsınav yok":"Filtreye uyan sonuç yok"}),e.jsx("div",{style:{fontSize:"0.82rem",color:t.contentSoft},children:o.length===0?"Personel sınav çözdükçe sonuçlar burada listelenecek.":"Filtreleri deÄiÅtirmeyi deneyin."})]}):e.jsx("div",{style:{overflowX:"auto",border:`1px solid ${t.border}`,borderRadius:12,background:"#fff",maxHeight:620,overflowY:"auto"},children:e.jsxs("table",{className:"bt-res-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Sıra"}),e.jsx("th",{children:"Ad Soyad"}),e.jsx("th",{children:"MaÄaza"}),e.jsx("th",{children:"Kategori"}),e.jsx("th",{children:"Puan"}),e.jsx("th",{children:"Süre"}),e.jsx("th",{children:"D/Y"}),e.jsx("th",{children:"Sonuç"}),e.jsx("th",{children:"Deneme"}),e.jsx("th",{children:"Tamamlanma"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:z.map((r,d)=>{const h=z[d-1],S=!h||h.storeName!==r.storeName||h.categoryKey!==r.categoryKey;return e.jsxs(ne.Fragment,{children:[S&&e.jsx("tr",{children:e.jsxs("td",{colSpan:11,style:{background:t.base,fontWeight:800,fontSize:"0.74rem",color:t.contentSoft,textTransform:"uppercase",letterSpacing:"0.04em"},children:[r.storeName||"â"," · ",r.categoryName]})}),e.jsxs("tr",{children:[e.jsxs("td",{style:{fontWeight:800,color:r.siraNo===1?t.primary:t.contentSoft},children:[r.siraNo,"."]}),e.jsxs("td",{children:[e.jsx("div",{style:{fontWeight:700,color:t.content},children:r.personName}),e.jsxs("div",{style:{fontSize:"0.7rem",color:t.contentSoft},children:["Sicil: ",r.sicilNo]})]}),e.jsx("td",{style:{color:t.contentSoft},children:r.storeName||"â"}),e.jsx("td",{style:{color:t.contentSoft},children:r.categoryName}),e.jsx("td",{style:{fontWeight:800,color:r.passed?t.success:t.danger},children:r.score}),e.jsx("td",{style:{color:t.contentSoft,fontVariantNumeric:"tabular-nums"},children:w(r.durationSec)}),e.jsxs("td",{style:{color:t.contentSoft},children:[r.correctCount,"/",r.totalQuestions]}),e.jsx("td",{children:e.jsx("span",{style:{fontSize:"0.72rem",fontWeight:700,padding:"0.2rem 0.6rem",borderRadius:999,background:r.passed?t.successSoft:t.dangerSoft,color:r.passed?"#065F46":t.danger},children:r.passed?"Geçti":"Kaldı"})}),e.jsxs("td",{style:{color:t.contentSoft},children:[r.attemptNumber,r.reopened&&e.jsx("span",{style:{marginLeft:6,fontSize:"0.7rem",color:t.primary,fontWeight:700},children:"(açık)"})]}),e.jsx("td",{style:{color:t.contentSoft},children:_e(r.completedAt)}),e.jsx("td",{children:e.jsx("button",{onClick:()=>L(r.id,r.personName,r.categoryName),disabled:r.reopened||v===r.id,title:r.reopened?"Zaten yeniden açık":"Sınavı yeniden aç",style:{background:"none",border:`1.5px solid ${r.reopened?t.border:t.primary}`,color:r.reopened?t.contentSoft:t.primary,borderRadius:6,padding:"3px 7px",cursor:r.reopened?"default":"pointer",display:"inline-flex",alignItems:"center"},children:e.jsx(xe,{size:14})})})]})]},r.id)})})]})})]})},Fe=()=>{const{results:n,loading:o}=P(),[m,p]=f.useState(""),g=f.useMemo(()=>{const s=n.filter(i=>!!i.storeName).filter(i=>!m||i.categoryKey===m),a=new Map;
35return s.forEach(i=>{const l=i.storeName;a.has(l)||a.set(l,{scores:[],passed:0,users:new Set});const u=a.get(l);u.scores.push(i.score),i.passed&&(u.passed+=1),u.users.add(i.sicilNo)}),[...a.entries()].map(([i,l])=>({storeName:i,examCount:l.scores.length,passedCount:l.passed,averageScore:Math.round(l.scores.reduce((u,j)=>u+j,0)/l.scores.length),participantCount:l.users.size})).sort((i,l)=>{if(l.averageScore!==i.averageScore)return l.averageScore-i.averageScore;const u=i.passedCount/i.examCount,j=l.passedCount/l.examCount;return j!==u?j-u:i.storeName.localeCompare(l.storeName,"tr")})},[n,m]),c=s=>s===0?"#D97706":s===1?"#94A3B8":s===2?"#B45309":null;return e.jsxs("div",{children:[e.jsx("style",{children:` 36 .bt-rank-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 620px; } 37 .bt-rank-table th, .bt-rank-table td { padding: 0.65rem 0.8rem; border-bottom: 1px solid ${t.border}; text-align: left; white-space: nowrap; } 38 .bt-rank-table th { background: ${t.base}; font-weight: 700; color: ${t.contentSoft}; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; } 39 `}),e.jsxs("div",{style:{display:"flex",gap:"0.6rem",alignItems:"center",marginBottom:"1rem",flexWrap:"wrap"},children:[e.jsxs("select",{value:m,onChange:s=>p(s.target.value),style:{padding:"0.5rem 0.7rem",borderRadius:8,border:`1.5px solid ${t.border}`,fontSize:"0.85rem",background:"#fff",color:t.content,outline:"none"},children:[e.jsx("option",{value:"",children:"Tüm kategoriler (genel sıralama)"}),N.map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))]}),e.jsxs("span",{style:{fontSize:"0.8rem",color:t.contentSoft},children:[g.length," maÄaza"]})]}),o?e.jsx("p",{style:{textAlign:"center",color:t.contentSoft,fontSize:"0.85rem",padding:"2rem 0"},children:"Yükleniyor..."}):g.length===0?e.jsxs("div",{style:{background:t.base,border:`1px dashed ${t.border}`,borderRadius:12,padding:"2.5rem",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:t.content,marginBottom:4},children:"Sıralama için henüz veri yok"}),e.jsx("div",{style:{fontSize:"0.82rem",color:t.contentSoft},children:"MaÄaza personeli sınav çözdükçe sıralama oluÅacak."})]}):e.jsx("div",{style:{overflowX:"auto",border:`1px solid ${t.border}`,borderRadius:12,background:"#fff"},children:e.jsxs("table",{className:"bt-rank-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:60},children:"Sıra"}),e.jsx("th",{children:"MaÄaza"}),e.jsx("th",{children:"Ort. Puan"}),e.jsx("th",{children:"Sınav"}),e.jsx("th",{children:"Geçen"}),e.jsx("th",{children:"BaÅarı"}),e.jsx("th",{children:"Katılımcı"})]})}),e.jsx("tbody",{children:g.map((s,a)=>{const i=c(a),l=Math.round(s.passedCount/s.examCount*100);return e.jsxs("tr",{children:[e.jsx("td",{children:i?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontWeight:800,color:i},children:[e.jsx(ye,{size:15})," ",a+1]}):e.jsx("span",{style:{fontWeight:700,color:t.contentSoft},children:a+1})}),e.jsx("td",{style:{fontWeight:700,color:t.content},children:s.storeName}),e.jsx("td",{style:{fontWeight:800,color:s.averageScore>=70?t.success:t.danger},children:s.averageScore}),e.jsx("td",{style:{color:t.contentSoft},children:s.examCount}),e.jsx("td",{style:{color:t.contentSoft},children:s.passedCount}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:60,height:6,background:"#E2E8F0",borderRadius:999,overflow:"hidden"},children:e.jsx("div",{style:{width:`${l}%`,height:"100%",background:l>=70?t.success:t.danger,borderRadius:999}})}),e.jsxs("span",{style:{fontSize:"0.78rem",color:t.contentSoft},children:["%",l]})]})}),e.jsx("td",{style:{color:t.contentSoft},children:s.participantCount})]},s.storeName)})})]})})]})},Ie=()=>{const{results:n,loading:o}=P(),[m,p]=f.useState([]);f.useEffect(()=>{let a=!1;return(async()=>{try{const i=await H();a||p(i)}catch(i){console.error("Sorular okunamadı:",i)}})(),()=>{a=!0}},[]);const g=f.useMemo(()=>{const a=n.length,i=n.filter(v=>
39v.passed).length,l=new Set(n.map(v=>v.sicilNo)).size,u=new Set(n.map(v=>v.storeName).filter(Boolean)).size,j=a>0?Math.round(n.reduce((v,b)=>v+b.score,0)/a):0;return{total:a,passed:i,participants:l,stores:u,avg:j,passRate:a>0?Math.round(i/a*100):0}},[n]),c=f.useMemo(()=>N.map(a=>{const i=n.filter(u=>u.categoryKey===a.key),l=i.filter(u=>u.passed).length;return{...a,examCount:i.length,passedCount:l,averageScore:i.length>0?Math.round(i.reduce((u,j)=>u+j.score,0)/i.length):0,passRate:i.length>0?Math.round(l/i.length*100):0}}),[n]),s=f.useMemo(()=>{const a=new Map;n.forEach(l=>{l.answers.forEach(u=>{a.has(u.questionId)||a.set(u.questionId,{asked:0,wrong:0});const j=a.get(u.questionId);j.asked+=1,u.correct||(j.wrong+=1)})});const i=new Map(m.map(l=>[l.id,l]));return[...a.entries()].filter(([,l])=>l.asked>=3).map(([l,u])=>({id:l,question:i.get(l),asked:u.asked,wrong:u.wrong,wrongRate:Math.round(u.wrong/u.asked*100)})).filter(l=>l.question&&l.wrongRate>0).sort((l,u)=>u.wrongRate-l.wrongRate||u.asked-l.asked).slice(0,10)},[n,m]);return o?e.jsx("p",{style:{textAlign:"center",color:t.contentSoft,fontSize:"0.85rem",padding:"2rem 0"},children:"Yükleniyor..."}):n.length===0?e.jsxs("div",{style:{background:t.base,border:`1px dashed ${t.border}`,borderRadius:12,padding:"2.5rem",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:t.content,marginBottom:4},children:"Henüz veri yok"}),e.jsx("div",{style:{fontSize:"0.82rem",color:t.contentSoft},children:"Personel sınav çözdükçe göstergeler burada oluÅacak."})]}):e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginBottom:"1.5rem"},children:[e.jsx(E,{icon:e.jsx(q,{size:17,color:t.primary}),bg:t.primarySoft,value:g.participants,label:"Katılımcı"}),e.jsx(E,{icon:e.jsx(G,{size:17,color:t.accent}),bg:"#FEF3C7",value:g.total,label:"Tamamlanan sınav"}),e.jsx(E,{icon:e.jsx(be,{size:17,color:t.success}),bg:t.successSoft,value:`%${g.passRate}`,label:"BaÅarı oranı"}),e.jsx(E,{icon:e.jsx(G,{size:17,color:t.content}),bg:"#F1F5F9",value:g.avg,label:"Ortalama puan"}),e.jsx(E,{icon:e.jsx(q,{size:17,color:"#7C3AED"}),bg:"#EDE9FE",value:g.stores,label:"Katılan maÄaza"})]}),e.jsx("div",{style:{fontSize:"0.8rem",fontWeight:700,color:t.contentSoft,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"0.6rem"},children:"Kategori bazında"}),e.jsx("div",{style:{background:"#fff",border:`1px solid ${t.border}`,borderRadius:12,overflow:"hidden",marginBottom:"1.75rem"},children:c.map((a,i)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"0.8rem 1rem",borderTop:i===0?"none":`1px solid ${t.border}`},children:[e.jsxs("div",{style:{flex:"1 1 auto",minWidth:0},children:[e.jsx("div",{style:{fontSize:"0.86rem",fontWeight:700,color:t.content},children:a.name}),e.jsxs("div",{style:{fontSize:"0.75rem",color:t.contentSoft,marginTop:1},children:[a.examCount," sınav · ",a.passedCount," geçen"]})]}),e.jsx("div",{style:{width:90,flexShrink:0},children:e.jsx("div",{style:{height:6,background:"#E2E8F0",borderRadius:999,overflow:"hidden"},children:e.jsx("div",{style:{width:`${a.passRate}%`,height:"100%",background:a.color,borderRadius:999}})})}),e.jsxs("div",{style:{flexShrink:0,textAlign:"right",minWidth:64},children:[e.jsx("div",{style:{fontSize:"0.95rem",fontWeight:800,color:a.examCount===0?t.contentSoft:a.averageScore>=70?t.success:t.danger},children:a.examCount===0?"â":a.averageScore}),e.jsx("div",{style:{fontSize:"0.7rem",color:t.contentSoft},children:"ort. puan"})]})]},a.key))}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.8rem",fontWeight:700,color:t.contentSoft,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"0.6rem"},children:[e.jsx(ee,{size:15})," En çok yanlıŠyapılan sorular"]}),s.length===0?e.jsx("div",{style:{background:t.base,border:`1px dashed ${t.border}`,borderRadius:12,padding:"1.5rem",textAlign:"center",fontSize:"0.82rem",color:t.contentSoft},children:"Anlamlı bir analiz için her sorunun en az 3 kez sorulmuÅ olması gerekiyor. Yeterli veri birikince burada görünecek."}):e.jsx("div",{style:{background:"#fff",border:`1px solid ${t.border}`,borderRadius:12,overflow:"hidden"},children:s.map((a,i)=>e.jsxs("div",{style:{padding:"0.85rem 1rem",borderTop:i===0?"none":`1px solid ${t.border}`,display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsxs("span",{style:{fontSize:"0.9rem",fontWeight:800,color:t.danger,flexShrink:0,minWidth:42},children:["%",a.wrongRate]}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:t.content},children:a.question.question}),e.jsxs("div",{style:{fontSize:"0.74rem",color:t.contentSoft,marginTop:2},children:[a.question.categoryName," · ",a.asked," kez soruldu, ",a.wrong," yanlıÅ"]})]})]},a.id))})]})},E=({icon:n,bg:o,value:m,label:p})=>e.jsxs("div",{style:{flex:"1 1 140px",background:"#fff",border:`1px solid ${t.border}`,borderRadius:14,padding:"1rem"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:9,background:o,display:"flex",alignItems:"center",justifyContent:"center",marginBottom:8},children:n}),e.jsx("div",{style:{fontSize:"1.4rem",fontWeight:800,color:t.content},children:m}),e.jsx("div",{style:{fontSize:"0.77rem",color:t.contentSoft,fontWeight:600},children:p})]}),tt=()=>{const n=oe(),{currentUserPermissions:o,rolePermissionsLoaded:m}=D(),[p,g]=f.useState("questions");
39return m?se(o,"/bilgini-tazele-yonetimi")?e.jsxs(F,{backTo:"/bilgini-tazele",backLabel:"Bilgini Tazele'ye Dön",children:[e.jsx("style",{children:` 40 .bty-tabs { display: flex; gap: 0.5rem; background: #ffffff; padding: 0.5rem; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 2rem; border: 1px solid #e2e8f0; } 41 .bty-tab-btn { flex: 1; background: transparent; border: none; padding: 0.85rem 1rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; color: #64748b; border-radius: 12px; transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; display: flex; align-items: center; justify-content: center; gap: 0.5rem; } 42 .bty-tab-btn.active { background: linear-gradient(135deg, #0F8A70, #006B56); color: #ffffff; box-shadow: 0 4px 12px rgba(0, 107, 86, 0.25); } 43 .bty-tab-btn:hover:not(.active) { background-color: #f8fafc; color: #0f172a; } 44 @media (max-width: 768px) { 45 .bty-tabs { display: grid !important; grid-template-columns: repeat(1, 1fr) !important; gap: 0.35rem !important; padding: 0.35rem !important; } 46 .bty-tab-btn { font-size: 0.85rem !important; padding: 0.7rem 0.5rem !important; } 47 } 48 `}),e.jsxs("div",{className:"content-container",children:[e.jsx("div",{className:"page-header",style:{marginBottom:0},children:e.jsx("h1",{className:"page-title",children:"Bilgini Tazele Yönetimi"})}),e.jsx("p",{className:"page-subtitle",style:{marginTop:0,marginBottom:"1.5rem"},children:"MaÄaza personelinin ürün bilgisi sınavlarının soru bankası buradan yönetilir."}),e.jsxs("div",{className:"bty-tabs",children:[e.jsxs("button",{className:`bty-tab-btn ${p==="questions"?"active":""}`,onClick:()=>g("questions"),children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1.1rem"},children:"quiz"}),"Sorular"]}),e.jsxs("button",{className:`bty-tab-btn ${p==="import"?"active":""}`,onClick:()=>g("import"),children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1.1rem"},children:"upload_file"}),"İçe Aktarım"]}),e.jsxs("button",{className:`bty-tab-btn ${p==="results"?"active":""}`,onClick:()=>g("results"),children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1.1rem"},children:"fact_check"}),"Sonuçlar"]}),e.jsxs("button",{className:`bty-tab-btn ${p==="ranking"?"active":""}`,onClick:()=>g("ranking"),children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1.1rem"},children:"leaderboard"}),"MaÄaza Sıralaması"]}),e.jsxs("button",{className:`bty-tab-btn ${p==="kpi"?"active":""}`,onClick:()=>g("kpi"),children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1.1rem"},children:"monitoring"}),"Göstergeler"]})]}),p==="questions"&&e.jsx(Ke,{}),p==="import"&&e.jsx(De,{}),p==="results"&&e.jsx(Le,{}),p==="ranking"&&e.jsx(Fe,{}),p==="kpi"&&e.jsx(Ie,{})]})]}):e.jsx(F,{backTo:"/bilgini-tazele",backLabel:"Bilgini Tazele'ye Dön",children:e.jsx("div",{className:"content-container",style:{display:"flex",justifyContent:"center",paddingTop:"3rem"},children:e.jsxs("div",{style:{maxWidth:480,width:"100%",textAlign:"center",background:"#fff",border:"1px solid #fecaca",borderRadius:"16px",padding:"2.5rem 2rem",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.05)"},children:[e.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"3rem",color:"#dc2626",marginBottom:"0.75rem",display:"inline-block"},children:"lock"}),e.jsx("h2",{style:{fontSize:"1.15rem",fontWeight:700,color:"#1e293b",margin:"0 0 0.5rem"},children:"Bu bölüme giriÅ yetkiniz bulunmuyor"}),e.jsx("p",{style:{fontSize:"0.88rem",color:"#64748b",margin:"0 0 1.5rem"},children:"Bilgini Tazele yönetim ekranına eriÅmek için gerekli izne sahip deÄilsiniz. İhtiyacınız varsa sistem yöneticinizden bu sayfaya eriÅim talep edebilirsiniz."}),e.jsx("button",{onClick:()=>n("/bilgini-tazele"),className:"btn btn-secondary",style:{padding:"0.6rem 1.25rem",borderRadius:"8px",fontWeight:600},children:"Bilgini Tazele'ye Dön"})]})})}):e.jsx(F,{backTo:"/bilgini-tazele",backLabel:"Bilgini Tazele'ye Dön",children:e.jsx("div",{className:"content-container",children:e.jsx("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Yükleniyor..."})})})};export{tt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.