PageSourceSearch

https://portal.hlk.hr/assets/AdminProfileUpdateRequestsPage-C4QjLXUZ.js

js hlk.hr collected 2026-09-24 19:19:16 UTC 18,900 bytes, 1 lines download raw bytes

1import{r as l,j as e,aN as se,D as re,U as de,b4 as ie,b5 as le,ae as ne,af as oe,b3 as ce}from"./vendor-DTJgL5bq.js";import{u as xe,P as me,C as y,e as f,b as L,c as V,d as H,L as M,I as ue,h as S,B as p,g as G,a as J,f as he}from"./index-hFQE3-fy.js";/* empty css               */import"./flatpickr-C_UUl-Yg.js";import"./router-BvlDjZPB.js";const q=25;function $(o){if(!o)return"—";try{return new Date(o).toLocaleString("hr-HR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return o}}function pe(o){const c=Number(o||0);return c?c>=1024*1024?`${(c/(1024*1024)).toFixed(2)} MB`:c>=1024?`${(c/1024).toFixed(1)} KB`:`${c} B`:"—"}function Q(o){switch(o){case"completed":return"success";case"rejected":return"destructive";case"in_review":return"warning";case"pending":default:return"outline"}}function ye(){const{user:o}=xe(),[c,A]=l.useState(!0),[N,j]=l.useState(!1),[x,C]=l.useState({requestType:"",status:"pending",search:""}),[n,W]=l.useState({}),[g,Z]=l.useState([]),[I,w]=l.useState(1),[m,X]=l.useState({page:1,pageSize:q,total:0,totalPages:1,hasPrevious:!1,hasNext:!1}),[u,P]=l.useState(null),[K,b]=l.useState(null),[D,k]=l.useState(""),[R,v]=l.useState(""),[F,h]=l.useState(""),O=l.useDeferredValue(x.search.trim()),a=l.useMemo(()=>g.find(t=>t.id===u)||K,[K,g,u]),U=!!(o!=null&&o.is_superuser),E=l.useMemo(()=>!a||a.request_type!=="contact"?[]:[{label:"E-mail",from:a.current_email||"—",to:a.requested_email||"—"},{label:"Mobitel",from:a.current_mobile||"—",to:a.requested_mobile||"—"},{label:"Marketing",from:a.current_marketing_allowed?"Dopušten":"Nije dopušten",to:a.requested_marketing_allowed?"Dopušten":"Nije dopušten"}].filter(r=>r.from!==r.to),[a]);async function z(t){var r,d,i;
1A(!0),h("");try{const s=await G("/api/profile-update/admin/requests/",{...x.requestType?{request_type:x.requestType}:{},...x.status?{status:x.status}:{},...O?{search:O}:{},page:I,page_size:q}),_=Array.isArray(s==null?void 0:s.results)?s.results:[];W((s==null?void 0:s.counts)||{}),X({page:Number((s==null?void 0:s.page)??I)||1,pageSize:Number((s==null?void 0:s.page_size)??q)||q,total:Number((s==null?void 0:s.total)??_.length)||0,totalPages:Number((s==null?void 0:s.total_pages)??1)||1,hasPrevious:!!(s!=null&&s.has_previous),hasNext:!!(s!=null&&s.has_next)}),Z(_);const te=t&&_.some(B=>B.id===t)?t:u&&_.some(B=>B.id===u)?u:((r=_[0])==null?void 0:r.id)??null;P(te)}catch(s){h(((i=(d=s==null?void 0:s.response)==null?void 0:d.data)==null?void 0:i.detail)||"Zahtjeve trenutno nije moguće učitati."),Z([]),P(null),b(null)}finally{A(!1)}}async function Y(t){var r,d;try{const i=await G(`/api/profile-update/admin/requests/${t}/`);b(i),k(i.admin_note||"")}catch(i){h(((d=(r=i==null?void 0:i.response)==null?void 0:r.data)==null?void 0:d.detail)||"Detalje zahtjeva nije moguće učitati.")}}l.useEffect(()=>{z()},[O,x.requestType,x.status,I]),l.useEffect(()=>{u?Y(u):(b(null),k(""))},[u]);async function T(t){var r,d;if(a){j(!0),v(""),h("");try{const i=await J(`/api/profile-update/admin/requests/${a.id}/`,{status:t,admin_note:D});b(i),k(i.admin_note||""),v(t==="completed"?"Zahtjev je označen kao obrađen nakon provjere KIIS podataka.":"Status zahtjeva je spremljen."),await z(i.id)}catch(i){h(((d=(r=i==null?void 0:i.response)==null?void 0:r.data)==null?void 0:d.detail)||"Status nije moguće spremiti.")}finally{j(!1)}}}async function ee(){var t,r;if(a){j(!0),v(""),h("");try{const d=await J(`/api/profile-update/admin/requests/${a.id}/`,{admin_note:D});b(d),k(d.admin_note||""),v("Admin napomena je spremljena."),await z(d.id)}catch(d){h(((r=(t=d==null?void 0:d.response)==null?void 0:t.data)==null?void 0:r.detail)||"Napomenu nije moguće spremiti.")}finally{j(!1)}}}async function ae(){var r,d;if(!(!a||!U||!window.confirm(`Obrisati zahtjev člana ${a.member_name}? Ova radnja se ne može vratiti.`))){j(!0),v(""),h("");try{await he(`/api/profile-update/admin/requests/${a.id}/`),b(null),k(""),v("Zahtjev je obrisan."),await z()}catch(i){h(((d=(r=i==null?void 0:i.response)==null?void 0:r.data)==null?void 0:d.detail)||"Zahtjev nije moguće obrisati.")}finally{j(!1)}}}return e.jsxs("main",{className:"page-shell page-stack",children:[e.jsx(me,{title:"Zahtjevi za ažuriranje profila",description:"Pregled zahtjeva članova za promjenu fotografije i kontakt podataka prije ažuriranja u KIIS-u."}),e.jsxs("section",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(y,{className:"rounded-[28px] border-slate-200 dark:border-gray-700",children:e.jsxs(f,{className:"space-y-1 p-5",children:[e.jsx("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:"Na čekanju"}),e.jsx("div",{className:"text-3xl font-semibold text-slate-950 dark:text-white",children:(n==null?void 0:n.pending)??0})]})}),e.jsx(y,{className:"rounded-[28px] border-slate-200 dark:border-gray-700",children:e.jsxs(f,{className:"space-y-1 p-5",children:[e.jsx("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:"U obradi"}),e.jsx("div",{className:"text-3xl font-semibold text-amber-600 dark:text-amber-300",children:(n==null?void 0:n.in_review)??0})]})}),e.jsx(y,{className:"rounded-[28px] border-slate-200 dark:border-gray-700",children:e.jsxs(f,{className:"space-y-1 p-5",children:[e.jsx("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:"Obrađeno"}),e.jsx("div",{className:"text-3xl font-semibold text-emerald-600 dark:text-emerald-300",children:(n==null?void 0:n.completed)??0})]})}),e.jsx(y,{className:"rounded-[28px] border-slate-200 dark:border-gray-700",children:e.jsxs(f,{className:"space-y-1 p-5",children:[e.jsx("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:"Odbijeno"}),e.jsx("div",{className:"text-3xl font-semibold text-rose-600 dar
1k:text-rose-300",children:(n==null?void 0:n.rejected)??0})]})})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_1.3fr]",children:[e.jsxs(y,{className:"rounded-[32px] border-slate-200 dark:border-gray-700",children:[e.jsxs(L,{className:"pb-0",children:[e.jsx(V,{children:"Zahtjevi članova"}),e.jsx(H,{children:"Filtriraj po vrsti zahtjeva, statusu i članu."})]}),e.jsxs(f,{className:"space-y-4 pt-5",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx(M,{children:"Vrsta zahtjeva"}),e.jsxs("select",{value:x.requestType,onChange:t=>{const r=t.target.value;w(1),C(d=>({...d,requestType:r}))},className:"block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 shadow-sm focus:border-sky-500 focus:ring-1 focus:ring-sky-500 dark:border-gray-700 dark:bg-gray-900 dark:text-white",children:[e.jsx("option",{value:"",children:"Sve vrste"}),e.jsx("option",{value:"photo",children:"Fotografija"}),e.jsx("option",{value:"contact",children:"Kontakt podaci"})]})]}),e.jsxs("div",{children:[e.jsx(M,{children:"Status"}),e.jsxs("select",{value:x.status,onChange:t=>{const r=t.target.value;w(1),C(d=>({...d,status:r}))},className:"block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 shadow-sm focus:border-sky-500 focus:ring-1 focus:ring-sky-500 dark:border-gray-700 dark:bg-gray-900 dark:text-white",children:[e.jsx("option",{value:"",children:"Svi statusi"}),e.jsx("option",{value:"pending",children:"Na čekanju"}),e.jsx("option",{value:"in_review",children:"U obradi"}),e.jsx("option",{value:"completed",children:"Obrađeno"}),e.jsx("option",{value:"rejected",children:"Odbijeno"})]})]}),e.jsxs("div",{children:[e.jsx(M,{children:"Pretraga"}),e.jsxs("div",{className:"relative",children:[e.jsx(se,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"}),e.jsx(ue,{value:x.search,onChange:t=>{const r=t.target.value;w(1),C(d=>({...d,search:r}))},placeholder:"Ime, OIB, e-mail, mobitel",className:"pl-9"})]})]})]}),c?e.jsx("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:"Učitavam zahtjeve..."}):null,F?e.jsx("div",{className:"rounded-2xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-200",children:F}):null,e.jsxs("div",{className:"space-y-3",children:[g.map(t=>{const r=t.id===u;return e.jsxs("button",{type:"button",onClick:()=>P(t.id),className:`w-full rounded-[24px] border px-4 py-4 text-left transition ${r?"border-sky-300 bg-sky-50 shadow-sm dark:border-sky-500/40 dark:bg-sky-500/10":"border-slate-200 bg-white hover:border-slate-300 hover:shadow-sm dark:border-gray-700 dark:bg-gray-900 dark:hover:border-gray-600"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-slate-950 dark:text-white",children:t.member_name}),e.jsxs("div",{className:"mt-1 text-xs text-slate-500 dark:text-gray-400",children:["OIB: ",t.oib||"—"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(S,{variant:"outline",children:t.request_type_label}),e.jsx(S,{variant:Q(t.status),children:t.status_label})]})]}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-slate-600 dark:text-gray-300 md:grid-cols-2",children:[e.jsx("div",{children:t.request_type==="contact"?t.requested_email||t.requested_mobile||"Promjena kontakta":"Nova ili zamjenska fotografija"}),e.jsx("div",{className:"text-right text-xs text-slate-500 dark:text-gray-400",children:$(t.created_at)})]})]},t.id)}),!c&&!g.length?e.jsx("div",{className:"rounded-[24px] border border-dashed border-slate-300 bg-slate-50 px-5 py-8 text-sm text-slate-600 dark:border-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:"Nema zahtjeva za prikaz uz odabrane filtere."}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[24px] border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600 dar
1k:border-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:[e.jsxs("div",{children:["Prikaz ",g.length?(m.page-1)*m.pageSize+1:0," - ",g.length?(m.page-1)*m.pageSize+g.length:0," od ",m.total]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{type:"button",variant:"outline",className:"rounded-xl",disabled:c||!m.hasPrevious,onClick:()=>w(t=>Math.max(1,t-1)),children:"Prethodna"}),e.jsxs("span",{className:"min-w-[92px] text-center text-xs text-slate-500 dark:text-gray-400",children:["Stranica ",m.page," / ",m.totalPages]}),e.jsx(p,{type:"button",variant:"outline",className:"rounded-xl",disabled:c||!m.hasNext,onClick:()=>w(t=>t+1),children:"Sljedeća"})]})]})]})]}),e.jsxs(y,{className:"rounded-[32px] border-slate-200 dark:border-gray-700",children:[e.jsxs(L,{className:"pb-0",children:[e.jsx(V,{children:"Detalji zahtjeva"}),e.jsx(H,{children:"Administrator ažurira podatke u KIIS-u, a zatim ovdje označava zahtjev kao obrađen."})]}),e.jsx(f,{className:"space-y-5 pt-5",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 rounded-[24px] border border-slate-200 bg-slate-50 p-4 dark:border-gray-700 dark:bg-gray-800/70",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-lg font-semibold text-slate-950 dark:text-white",children:a.member_name}),e.jsx(S,{variant:"outline",children:a.request_type_label}),e.jsx(S,{variant:Q(a.status),children:a.status_label})]}),e.jsxs("div",{className:"text-sm text-slate-600 dark:text-gray-300",children:["OIB: ",a.oib||"—"," · Zaprimljeno: ",$(a.created_at)]}),e.jsxs("div",{className:"text-sm text-slate-500 dark:text-gray-400",children:["Obradio: ",a.processed_by_name||"—"," · Zadnja sinkronizacija KIIS-a: ",$(a.kiis_synced_at)]})]}),a.request_type==="photo"&&a.photo_download_url?e.jsx("a",{href:a.photo_download_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex",children:e.jsxs(p,{variant:"outline",className:"rounded-xl",children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Preuzmi fotografiju"]})}):null]}),a.request_type==="photo"?e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_minmax(0,1fr)]",children:[e.jsx("div",{className:"overflow-hidden rounded-[24px] border border-slate-200 bg-slate-50 dark:border-gray-700 dark:bg-gray-800/70",children:a.photo_download_url?e.jsx("img",{src:a.photo_download_url,alt:`Fotografija - ${a.member_name}`,className:"block h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full min-h-[280px] items-center justify-center text-slate-400 dark:text-gray-500",children:e.jsx(de,{className:"h-12 w-12"})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[24px] border border-sky-200 bg-sky-50 p-4 dark:border-sky-500/30 dark:bg-sky-500/10 md:col-span-2",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-sky-700 dark:text-sky-200",children:"Točna izmjena"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-slate-700 dark:text-gray-200",children:"Član je predao novu fotografiju koja treba zamijeniti postojeću fotografiju u KIIS-u."})]}),e.jsxs("div",{className:"rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:"Tehnički podaci"}),e.jsxs("div",{className:"mt-3 space-y-2 text-sm text-slate-700 dark:text-gray-200",children:[e.jsxs("div",{children:["Dimenzije: ",a.photo_width&&a.photo_height?`${a.photo_width} × ${a.photo_height} px`:"—"]}),e.jsxs("div",{children:["Veličina datoteke: ",pe(a.photo_file_size)]}),e.jsxs("div",{children:["Napomena sustava: ",a.photo_validation_note||"Nema dodatne napomene."]})]})]}),e.jsxs("div",{className:"rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:"Napomena člana"}),e.jsx("div",{className:"mt-3 whitespace-pre-wrap text-sm leading-6 text-slate-700 dark:text-gray-200",children:a.member_note||"Član nije ostavio dodatnu napomenu."})]})]})]}):e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[24px] border border-sky-200 bg-sky-50 p-4 dark:border-sky-500/30 dark:bg-sky-500/10 md:col-span-2",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-sky-700 dark:text-sky-200",children:"Točna izmjena"}),e.jsx("div",{className:"mt-3 space-y-3 text-sm text-slate-700 dark:text-gray-200",children:E.length?E.map(t=>e.jsxs("div",{className:"rounded-2xl border border-sky-200/80 bg-white px-4 py-3 dark:border-sky-500/20 dark:bg-gray-900",children:[e.jsx("div",{className:"font-semibold",children:t.label}),e.jsx("div",{className:"mt-1",children:t.from}),e.jsxs("div",{className:"mt-1 text-sky-700 dark:text-sky-300",children:["→ ",t.to]})]},t.label)):e.jsx("div",{children:"Nema razlike u odnosu na trenutno evidentirane podatke."})})]}),e.jsxs("div",{className:"rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:[e.jsx(ie,{className:"h-4 w-4"}),"Trenutni kontakti"]}),e.jsxs("div",{className:"space-y-3 text-sm text-slate-700 dark:text-gray-200",children:[e.jsxs("div",{children:["E-mail: ",a.current_email||"—"]}),e.jsxs("div",{children:["Mobitel: ",a.current_mobile||"—"]}),e.jsxs("div",{children:["Marketing: ",a.current_marketing_allowed?"Dopušten":"Nije dopušten"]})]})]}),e.jsxs("div",{className:"rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:[e.jsx(le,{className:"h-4 w-4"}),"Tražena izmjena"]}),e.jsxs("div",{className:"space-y-3 text-sm text-slate-700 dark:text-gray-200",children:[e.jsxs("div",{children:["E-mail: ",a.requested_email||"—"]}),e.jsxs("div",{children:["Mobitel: ",a.requested_mobile||"—"]}),e.jsxs("div",{children:["Marketing: ",a.requested_marketing_allowed?"Dopušten":"Nije dopušten"]})]})]}),e.jsxs("div",{className:"rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900 md:col-span-2",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:"Napomena člana"}),e.jsx("div",{className:"mt-3 whitespace-pre-wrap text-sm leading-6 text-slate-700 dark:text-gray-200",children:a.member_note||"Član nije ostavio dodatnu napomenu."})]})]}),e.jsxs("div",{className:"space-y-3 rounded-[24px] border border-slate-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-gray-400",children:"Admin napomena"}),e.jsx("textarea",{value:D,onChange:t=>k(t.target.value),rows:6,className:"block w-full rounded-2xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-1 focus:ring-sky-500 dark:border-gray-700 dark:bg-gray-950 dark:text-white",placeholder:"Upiši napomenu o provjeri, kontaktu s članom ili ručnoj izmjeni u KIIS-u."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(p,{type:"button",variant:"outline",className:"rounded-xl",onClick:()=>void ee(),disabled:N,children:"Spremi napomenu"}),e.jsxs(p,{type:"button",variant:"warning",className:"rounded-xl",onClick:()=>void T("in_review"),disabled:N,children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),"Označi kao u obradi"]}),e.jsxs(p,{type:"button",variant:"success",className:"rounded-xl",onClick:()=>void T("completed"),disabled:N,children:[e.jsx(oe,{className:"mr-2 h-4 w-4"}),"Označi kao obrađeno"]}),e.jsx(p,{type:"button",variant:"destructive",className:"rounded-xl",onClick:()=>void T("rejected"),disabled:N,children:"Odbij zahtjev"}),U?e.jsxs(p,{type:"button",variant:"destructive",className:"rounded-xl",onClick:()=>void ae(),disabled:N,children:[e.jsx(ce,{className:"mr-2 h-4 w-4"}),"Obriši zahtjev"]}):null]}),R?e.jsx("div",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-200",children:R}):null]})]}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-slate-300 bg-slate-50 px-5 py-10 text-sm text-slate-600 dar
1k:border-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:"Odaberi zahtjev iz liste kako bi se prikazali detalji, fotografija i tražene izmjene kontakata."})})]})]})]})}export{ye 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.