1"use strict";(self.webpackChunkfront=self.webpackChunkfront||[]).push([[7944],{27944:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var n=a(65043),i=a(3550),l=a(35475),s=a(88881),o=a(14556),r=a(4729),d=a(20435),c=a(71548),f=a(70579);const g="https://akhuwat.org.pk",p={headers:{"Content-Type":"application/json"},withCredentials:!0},u=()=>{var e,t,a,u;const h=(0,i.zy)(),x=(null===(e=h.state)||void 0===e?void 0:e.page)||"",y=(null===(t=h.state)||void 0===t?void 0:t.section)||"",{user:m}=(0,o.d4)(e=>e.user),b=(0,s.MW)(),[j,v]=(0,n.useState)(!0),[_,S]=(0,n.useState)([]),[k,w]=(0,n.useState)([]),[C,T]=(0,n.useState)([]),[N,z]=(0,n.useState)(x),[A,q]=(0,n.useState)(y),[I,E]=(0,n.useState)(""),[F,W]=(0,n.useState)(!1),[D,M]=(0,n.useState)(null),R=(0,n.useCallback)(async()=>{v(!0);try{const e=await d.A.get("".concat(g,"/api/v1/admin/all/pages/").concat(m.userid,"/logo_slider"),p);w(e.data.data||[])}catch(e){b.error("Failed to load pages.")}finally{v(!1)}},[m.userid]),L=(0,n.useCallback)(async e=>{if(e){v(!0);try{const t=((await d.A.get("".concat(g,"/api/v1/faq/sections/").concat(e),p)).data.data||[]).filter(e=>"logo_slider"===e.section_type);T(t),t.length&&!A&&q(t[0].sec_id),t.length||S([])}catch(t){b.error("Failed to fetch sections."),T([])}finally{v(!1)}}},[A]),B=(0,n.useCallback)(async e=>{if(e){v(!0);try{const t=await d.A.get("".concat(g,"/api/v1/faq/content/").concat(e));S(t.data.data||[])}catch(t){b.error("Failed to fetch content."),S([])}finally{v(!1)}}},[]);(0,n.useEffect)(()=>{R()},[]),(0,n.useEffect)(()=>{x&&(z(x),L(x))},[x]),(0,n.useEffect)(()=>{A&&B(A)},[A]),(0,n.useEffect)(()=>{if(k.length&&!x){const e=k[0].pageid;z(e),L(e)}},[k]);const H=null===(a=k.find(e=>e.pageid===parseInt(N)))||void 0===a?void 0:a.page_name,P=null===(u=C.find(e=>e.sec_id===parseInt(A)))||void 0===u?void 0:u.section_name;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(c.iN,{title:"Logo Slider",subtitle:H?"".concat(H).concat(P?" \u203a ".concat(P):""):"Select a page to begin",actions:N&&A?(0,f.jsxs)(l.N_,{to:"/admin/faq/content/".concat(N,"/").concat(A,"/logo_slider"),className:"admin-btn admin-btn-primary",children:[(0,f.jsx)(c.uI,{})," Add Logo"]}):null,children:[(0,f.jsxs)(c.Qn,{extra:(0,f.jsx)(c.uN,{url:I,show:F,onToggle:()=>W(e=>!e)}),children:[(0,f.jsxs)(c.zM,{label:"Page",value:N,onChange:async e=>{var t;const a=e.target.value;E((null===(t=k.find(e=>e.pageid===parseInt(a)))||void 0===t?void 0:t.page_url)||""),z(a),q(""),S([]),W(!1),await L(a)},children:[(0,f.jsx)("option",{value:"",children:"Select a page\u2026"}
1),k.map(e=>(0,f.jsx)("option",{value:e.pageid,children:e.page_name},e.pageid))]}),(0,f.jsxs)(c.zM,{label:"Section",value:A||"",onChange:async e=>{q(e.target.value),await B(e.target.value)},disabled:!C.length,children:[(0,f.jsx)("option",{value:"",children:C.length?"Select a section\u2026":"No sections"}),C.map(e=>(0,f.jsx)("option",{value:e.sec_id,children:e.section_name},e.sec_id))]})]}),_.length>0&&!j&&(0,f.jsx)("div",{style:{marginBottom:12},children:(0,f.jsx)(c.xz,{count:_.length,label:"logos"})}),j?(0,f.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(160px,1fr))",gap:14},children:[0,1,2,3,4,5].map(e=>(0,f.jsxs)("div",{style:{background:"#fff",borderRadius:12,overflow:"hidden",border:"1px solid #f3f4f6"},children:[(0,f.jsx)("div",{className:"sk",style:{height:120}}),(0,f.jsx)("div",{style:{padding:12},children:(0,f.jsx)("div",{className:"sk",style:{height:12,width:"60%"}})})]},e))}):_.length>0?(0,f.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(160px,1fr))",gap:14},children:_.map(e=>(0,f.jsxs)("div",{style:{background:"#fff",borderRadius:12,border:"1px solid #f0f0f0",overflow:"hidden",transition:"box-shadow .2s,transform .2s"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 6px 20px rgba(0,0,0,0.08)",e.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="none",e.currentTarget.style.transform="none"},children:[(0,f.jsx)("div",{style:{height:120,background:"#f9fafb",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:(0,r.Dw)(e.image_url)?(0,f.jsx)("img",{src:(0,r.Dw)(e.image_url),alt:"logo",style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}):(0,f.jsx)("span",{style:{fontSize:12,color:"#d1d5db"},children:"No image"})}),(0,f.jsxs)("div",{style:{padding:"8px 10px",borderTop:"1px solid #f3f4f6"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,f.jsxs)("span",{style:{fontSize:11,color:"#9ca3af",fontWeight:600},children:["#",e.sequence]}),e.link&&(0,f.jsx)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",title:e.link,style:{color:"#2563eb",display:"flex"},children:(0,f.jsx)(c.AX,{})})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6},children:[(0,f.jsx)(l.N_,{to:"/admin/update/faq/content/".concat(e.entry_id,"/").concat(e.pageid,"/").concat(e.secid),style:{flex:1,padding:"5px 0",textAlign:"center",borderRadius:6,fontSize:11,fontWeight:600,color:"#2563eb",background:"#eff6ff",textDecoration:"none"},children:"Edit"}),(0,f.jsx)("button",{onClick:()=>M(e),style:{flex:1,padding:"5px 0",border:"none",borderRadius:6,fontSize:11,fontWeight:600,color:"#ef4444",background:"#fef2f2",cursor:"pointer"},children:"Delete"})]})]})]},e.entry_id))}):(0,f.jsxs)("div",{style:{background:"#fff",borderRadius:12,border:"1px solid #f0f0f0",padding:"52px 20px",textAlign:"center"},children:[(0,f.jsx)("p",{style:{fontSize:15,fontWeight:700,color:"#374151",margin:"0 0 6px"},children:"No logos yet"}),(0,f.jsx)("p",{style:{fontSize:13,color:"#9ca3af",margin:"0 0 20px"},children:N&&A?"Upload the first logo.":"Select a page and section first."}),N&&A&&(0,f.jsxs)(l.N_,{to:"/admin/faq/content/".concat(N,"/").concat(A,"/logo_slider"),className:"admin-btn admin-btn-primary",style:{display:"inline-flex"},children:[(0,f.jsx)(c.uI,{})," Add Logo"]})]}),F&&I&&(0,f.jsx)("div",{style:{marginTop:24},children:(0,f.jsx)(c.uN,{url:I,show:F,onToggle:()=>W(!1)})})]}),D&&(0,f.jsx)(c.T6,{message:"This logo will be permanently deleted.",onConfirm:async()=>{try{await d.A.delete("".concat(g,"/api/v1/faq/content/").concat(D.entry_id),p),b.success("Deleted."),S(e=>e.filter(e=>e.entry_id!==D.entry_id))}catch(e){b.error("Failed to delete.")}finally{M(null)}},onCancel:()=>M(null)})]})}}}]); 2//# sourceMappingURL=7944.749016ee.chunk.js.map
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.