1import{r as i,j as e,i as L,b as E,o as U}from"../chunks/chunk-h__KfRcZ.js";import{M as _}from"../chunks/chunk-BIJZlKBe.js";import{i as A}from"../chunks/chunk-DdXTjL9J.js";import"../chunks/chunk-BA0VV6zI.js";/* empty css */const I=["Dirigent SMPO","Dirigent PO MC","Mentor","Mentorica"];function O(){const[a,d]=i.useState([]),[k,m]=i.useState(!0),[u,h]=i.useState(null),[j,g]=i.useState(!1),[f,p]=i.useState(null),[b,v]=i.useState(null),S=async()=>{const t=await fetch("/api/admin/mc-mentors");t.ok&&d(await t.json()),m(!1)};i.useEffect(()=>{S()},[]);const N=()=>{g(!0),setTimeout(()=>g(!1),1800)},z=(t,s)=>{p(s),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(s))},M=(t,s)=>{t.preventDefault(),t.dataTransfer.dropEffect="move",s!==b&&v(s)},C=()=>{p(null),v(null)},T=async(t,s)=>{t.preventDefault();const c=f;if(p(null),v(null),!c||c===s)return;const o=a.findIndex(n=>n.id===c),y=a.findIndex(n=>n.id===s);if(o===-1||y===-1)return;const r=[...a],[l]=r.splice(o,1);r.splice(y,0,l);const w=r.map((n,x)=>({...n,sort_order:x}));d(w);try{(await fetch("/api/admin/mc-mentors/reorder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ordered_ids:w.map(x=>x.id)})})).ok&&N()}catch(n){console.error(n)}},P=(t,s)=>{d(c=>s?[...c,t]:c.map(o=>o.id===t.id?t:o)),h(null),N()},D=async t=>{const s=a.find(o=>o.id===t);if(!s||!confirm(`IzbriÅ¡em "${s.name}"?`))return;(await fetch(`/api/admin/mc-mentors/${t}`,{method:"DELETE"})).ok&&(d(o=>o.filter(y=>y.id!==t)),N())};return e.jsxs("div",{children:[e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx(_,{active:"mentorji"}),e.jsxs("div",{className:"flex items-start justify-between mb-8 gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Mentorji & dirigenti"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Upravljaj ekipo Musice Creative. Vleci za vrstni red. Klikni za urejanje CV."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-green-50 text-green-700 text-xs font-semibold border border-green-200",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Shranjeno"]}),e.jsxs("span",{className:"text-sm text-gray-400",children:[a.length," oseb"]}),e.jsxs("button",{onClick:()=>h("new"),className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg bg-gradient-to-br from-[#e8734a] to-[#d4612e] text-white text-sm font-semibold shadow-sm hover:shadow-md hover:from-[#f08158] hover:to-[#e06d39] transition-all",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,d:"M12 4v16m8-8H4"})}),"Dodaj mentorja"]})]})]}),k?e.jsx("div",{className:"text-center py-20 text-gray-400",children:"Nalagamâ¦"}):a.length===0?e.jsxs("div",{className:"text-center py-20 text-gray-400 bg-white rounded-2xl border-2 border-dashed border-gray-200",children:[e.jsx("p",{className:"font-medium",children:"Nobenega mentorja Å¡e ni."}),e.jsx("p",{className:"text-xs mt-1",children:"Kliknite âDodaj mentorjaâ za zaÄetek."})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:a.map(t=>e.jsx(V,{mentor:t,isDragging:f===t.id,isDragOver:b===t.id&&f!==t.id,onDragStart:s=>z(s,t.id),onDragOver:s=>M(s,t.id),onDragEnd:C,onDrop:s=>T(s,t.id),onEdit:()=>h(t),onDelete:()=>D(t.id)},t.id))})]}),u&&e.jsx(B,{mentor:u==="new"?null:u,onClose:()=>h(null),onSaved:P})]})}function V({mentor:a,isDragging:d,isDragOver:k,onDragStart:m,onDragOver:u,onDragEnd:h,onDrop:j,onEdit:g,onDelete:f}){return e.jsxs("div",{draggable:!0,onDragStart:m,onDragOver:u,onDragEnd:h,onDrop:j,className:`group relative rounded-xl overflow-hidden bg-white shadow-sm border-2 transition-all cursor-grab active:cursor-grabbing ${d?"opacity-30 scale-95":""} ${k?"border-[#e8734a] ring-4 ring-[#e8734a]/15":"border-gray-200 hover:border-gray-300 hover:shadow-md"}`,style:{aspectRatio:"3/4"},onClick:g,children:[a.image_url?e.jsx("img",{src:a.image_url,alt:a.name,className:"absolute inset-0 w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center text-gray-400",children:e.jsx("svg",{className:"w-12 h-12",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/30 to-transparent"}),e.jsx("div",{className:"absolute top-2 left-2 w-7 h-7 rounded-full bg-white/15 backdrop-blur flex items-center justify-center text-white/70 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M7 4a1 1 0 100 2 1 1 0 000-2zM7 9a1 1 0 100 2 1 1 0 000-2zM7 14a1 1 0 100 2 1 1 0 000-2zM13 4a1 1 0 100 2 1 1 0 000-2zM13 9a1 1 0 100 2 1 1 0 000-2zM13 14a1 1 0 100 2 1 1 0 000-2z"})})}),e.jsxs("div",{className:"absolute top-2 right-2 flex flex-col items-end gap-1.5",children:[!a.is_published&&e.jsx("span",{className:"text-[9px] font-bold tracking-wider up
1percase px-1.5 py-0.5 rounded bg-yellow-400/95 text-yellow-900 shadow",children:"Skrito"}),a.cv_html&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-bold tracking-wider uppercase px-1.5 py-0.5 rounded bg-emerald-400/95 text-emerald-900 shadow",children:[e.jsx("svg",{className:"w-2.5 h-2.5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z"})}),"CV"]})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-3.5",children:[e.jsx("h3",{className:"text-sm font-bold text-white leading-tight",children:a.name}),e.jsxs("p",{className:"text-[11px] text-white/60 mt-0.5",children:[a.role,a.instrument?` · ${a.instrument}`:""]})]}),e.jsx("div",{className:"absolute inset-x-0 bottom-0 p-3 flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:e.jsxs("div",{className:"ml-auto flex items-center gap-1.5 pointer-events-auto",children:[e.jsx("button",{onClick:p=>{p.stopPropagation(),g()},className:"px-2.5 py-1.5 rounded-md text-[11px] font-semibold bg-white/90 backdrop-blur text-gray-800 hover:bg-white shadow-sm",children:"Uredi"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),f()},className:"w-7 h-7 rounded-md bg-white/90 backdrop-blur text-red-600 hover:bg-red-50 flex items-center justify-center shadow-sm",title:"IzbriÅ¡i",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]})}function B({mentor:a,onClose:d,onSaved:k}){const m=!a,[u,h]=i.useState(a?.name||""),[j,g]=i.useState(a?.role||"Mentor"),[f,p]=i.useState(a?.instrument||""),[b,v]=i.useState(a?.image_url||""),[S,N]=i.useState(a?.cv_html||""),[z,M]=i.useState(a?.is_published??!0),[C,T]=i.useState(!1),[P,D]=i.useState(!1),[t,s]=i.useState(""),c=i.useRef(null),o=async r=>{D(!0),s("");try{const l=new FormData;l.append("files",r);const w=await fetch("/api/storage/upload",{method:"POST",body:l});if(!w.ok)throw new Error("Upload failed");const n=await w.json(),x=n.files?.[0]?.url||n.url;x&&v(x)}catch(l){s(l.message||"Napaka pri nalaganju slike")}finally{D(!1)}},y=async()=>{if(!u.trim()){s("Ime je obvezno");return}T(!0),s("");try{const r={name:u.trim(),role:j.trim(),instrument:f.trim()||null,image_url:b.trim()||null,cv_html:S.trim()||null,is_published:z},l=m?"/api/admin/mc-mentors":`/api/admin/mc-mentors/${a.id}`,x=await(await fetch(l,{method:m?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json();x.success?k(x.mentor,m):s(x.error||"Napaka pri shranjevanju")}catch(r){s(r.message||"Napaka pri shranjevanju")}finally{T(!1)}};return e.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:d}),e.jsxs("div",{className:"relative ml-auto w-full max-w-3xl bg-white shadow-2xl flex flex-col animate-slide-in-right",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex items-center justify-between bg-gradient-to-r from-[#fff7f2] to-white",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-gray-900",children:m?"Nov mentor":`Uredi: ${a.name}`}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Vsi podatki, fotografija in CV"})]}),e.jsx("button",{onClick:d,className:"p-2 text-gray-400 hover:text-gray-700 rounded-lg hover:bg-gray-100 transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[200px_1fr] gap-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Fotografija"}),e.jsxs("div",{className:"relative rounded-xl overflow-hidden bg-gray-100 border-2 border-dashed border-gray-200 group cursor-pointer",style:{aspectRatio:"3/4"},onClick:()=>c.current?.click(),children:[b?e.jsx("img",{src:b,alt:"",className:"absolute inset-0 w-full h-full object-cover"}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-gray-400 p-4 text-center",children:[e.jsx("svg",{className:"w-10 h-10 mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("span",{className:"text-xs font-medium",children:"Klikni za nalaganje"})]}),b&&e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center text-white text-xs font-semibold",children:"Zamenjaj"}),P&&e.jsx("div",{className:"absolute inset-0 bg-white/80 flex items-center justify-center",children:e.jsxs("svg",{className:"animate-spin w-6 h-6 text-[#e8734a]",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]}),e.jsx("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:r=>{const l=r.target.files?.[0];l&&o(l),r.target.value=""}}),b&&e.jsx("button",{onClick:()=>v(""),className:"mt-2 w-full text-xs text-red-600 hover:text-red-700 hover:underline",children:"Odstrani fotografijo"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1.5",children:"Ime in priimek *"}),e.jsx("input",{type:"text",value:u,onChange:r=>h(r.target.value),placeholder:"npr. Nikica Banjac",className:"w-full px-3.5 py-2.5 rounded-lg border border-gray-300 text-sm focus:ring-2 focus:ring-[#e8734a] focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1.5",children:"Vloga"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(r=>e.jsx("button",{type:"button",onClick:()=>g(r),className:`px-2.5 py-1.5 rounded-md text-xs font-medium border transition-all ${j===r?"bg-[#e8734a] text-white border-[#e8734a]":"bg-white text-gray-700 border-gray-300 hover:border-gray-400"}`,children:r},r))}),e.jsx("input",{type:"text",value:j,onChange:r=>g(r.target.value),placeholder:"ali roÄno vnesiâ¦",className:"mt-2 w-full px-3.5 py-2 rounded-lg border border-gray-200 text-sm focus:ring-2 focus:ring-[#e8734a] focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1.5",children:"InÅ¡trument"}),e.jsx("input",{type:"text",value:f,onChange:r=>p(r.target.value),placeholder:"npr. Rog",className:"w-full px-3.5 py-2.5 rounded-lg border border-gray-300 text-sm focus:ring-2 focus:ring-[#e8734a] focus:border-transparent"})]}),e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer select-none",children:[e.jsxs("span",{className:"relative inline-flex",children:[e.jsx("input",{type:"checkbox",checked:z,onChange:r=>M(r.target.checked),className:"sr-only peer"}),e.jsx("span",{className:"w-9 h-5 bg-gray-300 peer-checked:bg-[#e8734a] rounded-full transition-colors"}),e.jsx("span",{className:"absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform peer-checked:translate-x-4 shadow-sm"})]}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Objavljen na javni strani"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Življenjepis / CV"}),e.jsx("span",{className:"text-[11px] text-gray-400",children:"Prikaže se ob kliku na fotografijo na javni strani"})]}),e.jsx("textarea",{value:S,onChange:r=>N(r.target.value),placeholder:`Biografija, izobrazba, glasbena pot, dosežki⦠2 3Prazna vrstica = nov odstavek.`,rows:14,className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-[15px] leading-relaxed text-gray-800 focus:ring-2 focus:ring-[#e8734a]/30 focus:border-[#e8734a]/50 outline-none transition-all resize-y min-h-[280px]"}),e.jsx("p",{className:"mt-1.5 text-[11px] text-gray-400",children:"Tipkajte normalno â prelome vrstic ohranimo, prazna vrstica naredi nov odstavek."})]}),t&&e.jsx("div",{className:"px-4 py-2.5 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:t})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:d,className:"px-4 py-2.5 text-sm font-semibold text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:"PrekliÄi"}),e.jsx("button",{onClick:y,disabled:C,className:"px-5 py-2.5 text-sm font-semibold text-white bg-gradient-to-br from-[#e8734a] to-[#d4612e] rounded-lg hover:from-[#f08158] hover:to-[#e06d39] transition-all shadow-sm disabled:opacity-50",children:C?"Shranjujemâ¦":"Shrani"})]})]}),e.jsx("style",{children:` 4 @keyframes slide-in-right { 5 from { transform: translateX(100%); } 6 to { transform: translateX(0); } 7 } 8 .animate-slide-in-right { animation: slide-in-right 0.25s ease-out; } 9 `})]})}const R=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"})),J={hasServerOnlyHook:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!1}},isClientRuntimeLoaded:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},onBeforeRenderEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},dataEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},guardEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},onRenderClient:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/onRenderClient",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:U}},Page:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/admin/musicacreativa/mentorji/+Page.tsx",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:R}},hydrationCanBeAborted:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/config",fileExportPathToShowToUser:["default","hydrationCanBeAborted"]},valueSerialized:{type:"js-serialized",value:!0}},Layout:{type:"cumulative",definedAtData:[{filePathToShowToUser:"/pages/admin/+Layout.t
9sx",fileExportPathToShowToUser:[]},{filePathToShowToUser:"/pages/+Layout.tsx",fileExportPathToShowToUser:[]}],valueSerialized:[{type:"plus-file",exportValues:A},{type:"plus-file",exportValues:E}]},title:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/admin/+config.ts",fileExportPathToShowToUser:["default","title"]},valueSerialized:{type:"js-serialized",value:"Admin - Slovenski Godbenik"}},Loading:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/Loading",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:L}}};export{J as configValuesSerialized};
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.