PageSourceSearch

https://kp.gov.pk/assets/TenderScreen-C00CoyuO.js

js kp.gov.pk collected 2026-09-24 18:57:44 UTC 11,488 bytes, 7 lines download raw bytes

1import{j as e,a7 as R,u as F,b as D,r as s,a8 as M,a9 as O,d as H,h as T,a6 as I,a5 as z,S as U}from"./index-D43MT5hw.js";import{i as V,T as B}from"./Expiry24hours-Bfs9TLC5.js";import"./UseWithinLastHours-CtBWlGtI.js";function W({open:a,onClose:n,corrigenda:c,tenderTitle:i}){return a?e.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/50 px-4",children:e.jsxs("div",{className:"w-full max-w-2xl rounded-xl bg-white shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Corrigendum Details"}),i?e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:i}):null]}),e.jsx("button",{type:"button",onClick:n,className:"rounded-md p-2 hover:bg-slate-100",children:e.jsx(R,{size:20})})]}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto p-5",children:c?.length>0?e.jsx("div",{className:"space-y-4",children:c.map((l,o)=>e.jsx("div",{className:"rounded-lg border border-slate-200 p-4",children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase text-slate-500",children:"Description"}),e.jsx("p",{className:"mt-1 text-sm text-slate-800",children:l.corrigendum_description||"-"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase text-slate-500",children:"Extended Close Date"}),e.jsx("p",{className:"mt-1 text-sm text-slate-800",children:l.corrigendum_close_date||"-"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase text-slate-500",children:"Corrigendum Created"}),e.jsx("p",{className:"mt-1 text-sm text-slate-800",children:l.corrigendum_created||"-"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase text-slate-500",children:"Document"}),l.corrigendum_document?e.jsx("a",{href:l.corrigendum_document,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-block text-sm font-medium text-sky-600 hover:underline",children:"View Document"}):e.jsx("p",{className:"mt-1 text-sm text-slate-800",children:"-"})]})]})},o))}):e.jsx("p",{className:"text-sm text-slate-500",children:"No corrigendum data found."})})]})}):null}const K=({status:a})=>{const n=a==="Open"?"bg-green-100 text-green-700 ring-green-200":a==="Closed"?"bg-amber-100 text-amber-700 ring-amber-200":"bg-gray-100 text-gray-700 ring-gray-200";return e.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-medium ring-1 ${n}`,children:a})},X=({tenderData:a,mode:n,setMode:c,pagedata:i,setPageData:l,searchText:o,setSearchText:w,loading:k,error:p})=>{const C=F(),{domain:x}=D(),[m,j]=s.useState([]),g=s.useRef([]),h=async()=>{try{const d=(await T.getRelatedLinks(x,"tenders"))?.data?.[0]?.related_links??[];j(d)}catch{}};s.useEffect(()=>{h()},[]);const[S,u]=s.useState(!1),[y,r]=s.useState([]),[_,L]=s.useState(""),[N,v]=s.useState(null),A=t=>{r(t?.corrigenda||[]),L(t?.title||""),u(!0)},$=()=>{u(!1),r([]),L("")};return s.useEffect(()=>{const t=d=>{N!==null&&g.current[N]&&!g.current[N]?.contains(d.target)&&v(null)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[N]),e.jsxs("section",{className:"w-full relative",children:[e.jsx(M,{}),e.jsx("div",{className:"mx-auto w-[95%] py-4 z-30 relative min-h-[60vh]",children:e.jsxs("div",{className:"lg:flex gap-3",children:[e.jsxs("div",{className:"lg:w-7/8",children:[e.jsx(O,{title:"Tenders",description:"Latest tenders with deadlines and status."}),e.jsxs("div",{className:"mt-2 md:flex justify-between items-center",children:[e.jsxs("div",{className:"flex justify-end items-center gap-3 p-2",children:[e.jsx("span",{className:`text-sm font-semibold ${n==="active"?"text-slate-900":"text-slate-400"}`,children:"Active"}),e.jsxs("button",{type:"button",role:"switch","aria-checked":n==="archive",onClick:()=>{c(n==="active"?"archive":"active"),l(t=>({...t,currentPage:1}))},className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
2                ${n==="archive"?"bg-slate-600":"bg-emerald-500"}
3                 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2`,children:[e.jsx("span",{className:`inline-block h-5 w-5 transform rounded-full bg-white shadow transition-transform
4                  ${n==="archive"?"translate-x-5":"translate-x-1"}`}),e.jsx("span",{className:"sr-only",children:"Toggle active/archive"})]}),e.jsx("span",{className:`text-sm font-semibold ${n==="archive"?"text-slate-900":"text-slate-400"}`,children:"Archive"})]}),e.jsxs("div",{className:"w-full sm:w-80",children:[e.jsx("label",{className:"sr-only",children:"Search tenders"}),e.jsx("input",{value:o,onChange:t=>{w(t.target.value),l(d=>({...d,currentPage:1}))},type:"text",placeholder:"Search by title, tender no , dept...",className:"w-full rounded-lg my-2 border border-gray-200 bg-white px-3 py-2 text-sm outline-none ring-emerald-200 focus:ring-2"})]})]}),e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mt-3 ",children:[e.jsx("div",{className:"overflow-x-auto rounded-xl border border-gray-200 bg-white",children:e.jsxs("table",{className:"min-w-full text-left text-sm",children:[e.jsx("thead",{className:"background-linear text-white ",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-6 font-semibold",children:"S.No"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Tender No"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Title"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Date of Advertisement"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Closing Date"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Status"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Department"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Source Site"}),e.jsx("th",{className:"px-4 py-6 font-semibold",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:a?.length>0?a?.map((t,d)=>{const E=V(t?.closing_date),P=t?.reference?.toLowerCase()==="kppra",f=P?t?.media?.file_path||t?.file_path:t?.media?.file_path||t?.file_path||"",b=t?.bidding_document?.file_path||"";return e.jsxs("tr",{className:"hover:bg-gray-50/70",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-gray-900",children:(Number(i?.currentPage??1)-1)*Number(i?.perPage??15)+(d+1)}),e.jsx("td",{className:"px-4 py-3 font-medium text-gray-900",children:t?.tender_number}),e.jsx("td",{className:"px-4 py-3 text-gray-800",children:e.jsx(B,{title:t?.title,created_at:t?.created_at})}),e.jsx("td",{className:"px-4 py-3 text-gray-700",children:t?.date_of_advertisement}),e.jsxs("td",{className:`"px-4 py-3 text-gray-700" ${E?"text-rose-500 font-semibold animate-pulse":""}`,children:[t?.closing_date,E?e.jsxs("span",{className:"text-[12px]",children:[" ","(Today)"]}):null]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(K,{status:t?.status})}),e.jsx("td",{className:"px-4 py-3 text-gray-700 hover:underline cursor-pointer",children:t?.department_name}),e.jsx("td",{onClick:()=>{P?window.open("https://kppra.gov.pk/"):window.open("https://kp.gov.pk/")},className:"px-4 py-3 cursor-pointer text-blue-500 hover:underline",children:t?.reference==="kppra"?t.reference.toUpperCase():t?.reference}),e.jsx("td",{className:"px-4 py-3 text-gray-700 relative",children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>C(`/tender/detail/${t.uuid}`),className:"px-4 py-1.5 rounded-full whitespace-nowrap text-xs font-medium bg-emerald-100 text-emerald-700 transition hover:bg-emerald-200",children:"View Details"}),f&&e.jsx("button",{type:"button",disabled:!f,onClick:()=>{f&&(window.open(f,"_blank","noopener,noreferrer"),v(null))},className:`px-4 py-1.5 rounded-full text-xs font-medium transition
5        ${f?"bg-blue-100 text-blue-700 hover:bg-blue-200":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:"Tender File"}),b&&e.jsx("button",{type:"button",disabled:!b,onClick:()=>{b&&(window.open(b,"_blank","noopener,noreferrer"),v(null))},className:`px-4 py-1.5 rounded-full text-xs whitespace-nowrap font-medium transition
6        ${b?"bg-green-100 text-green-700 hover:bg-green-200":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:"Bidding Docs"}),t?.corrigenda&&t.corrigenda.length>0&&e.jsx("button",{type:"button",disabled:!Array.isArray(t?.corrigenda)||t.corrigenda.length===0,onClick:()=>{Array.isArray(t?.corrigenda)&&t.corrigenda.length>0&&(A(t),v(null))},className:`px-4 py-1.5 rounded-full text-xs font-medium transition
7        ${t?.corrigenda&&t.corrigenda.length>0?"bg-blue-100 text-blue-700 hover:bg-blue-200":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:"Corrigendum"})]})})]},d)}):e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-gray-500",children:"No data found"})})})]})}),e.jsx(H,{forcePage:(i.currentPage??1)-1,pageCount:i.lastPage,onPageChange:t=>{const d=t.selected+1;l({...i,currentPage:d})},pageRangeDisplayed:3,marginPagesDisplayed:1,previousLabel:"< Prev",nextLabel:"Next >",breakLabel:"…",containerClassName:"flex items-center justify-start gap-2 mt-6",pageClassName:"cursor-pointer",pageLinkClassName:"min-w-[40px] bg-white px-3 py-2 rounded-md text-sm border hover:bg-gray-50",activeLinkClassName:"background-linear border  text-white border-emerald-900 ",previousLinkClassName:"px-3 py-2 rounded-md border text-sm hover:bg-gray-50",nextLinkClassName:"px-3 py-2 rounded-md border text-sm hover:bg-gray-50",disabledLinkClassName:"opacity-50 cursor-not-allowed hover:bg-transparent",breakLinkClassName:"px-2 text-sm text-gray-500"})]})})]}),e.jsx("div",{className:"lg:w-1/8",children:e.jsxs("div",{className:" border-l border-l-gray-200 p-4  lg:min-h-screen h-fit sticky top-20",children:[e.jsx("h2",{className:"text-lg font-semibold ",children:"Relevant "}),e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Links "}),e.jsx("div",{className:"flex flex-col gap-3",children:m.map(t=>e.jsx("div",{children:e.jsx("a",{href:t.url,target:"_blank",className:"block text-sm hover:text-blue-500 hover:underline font-medium text-slate-700 mb-1",children:t.title})},t.id))})]})})]})}),e.jsx(W,{open:S,onClose:$,corrigenda:y,tenderTitle:_})]})};function Q(){const{domain:a,basicInfo:n}=D(),[c,i]=s.useState(null),[l,o]=s.useState(!1),[w,k]=s.useState(null),[p,C]=s.useState("active"),[x,m]=s.useState({currentPage:1,perPage:20,total:0,lastPage:0}),[j,g]=s.useState(""),h=I(j,300),[S]=z(),u=S.get("title")||"",y=s.useCallback(async()=>{o(!0),k(null);try{const r=p==="active"?await T.getTenders(a,x.currentPage,h):await T.getTendersForArchive(a,x.currentPage,h);i(r.data),m(_=>({..._,currentPage:r?.meta?.current_page,perPage:r?.meta?.per_page,total:r?.meta?.total,lastPage:r?.meta?.last_page}))}catch(r){console.error("Error fetching tenders:",r),k(r)}finally{o(!1)}},[p,a,x.currentPage,h]);return s.useEffect(()=>{y()},[y]),s.useEffect(()=>{m(r=>({...r,currentPage:1}))}
7,[p]),s.useEffect(()=>{u&&(g(u),m(r=>({...r,currentPage:1})))},[u]),e.jsxs(e.Fragment,{children:[e.jsx(U,{title:`${n?.title.replace(/\r?\n/g," ")}`,titleSuffix:"Tenders",description:"",keywords:"",type:"article"}),e.jsx(X,{tenderData:c,mode:p,setMode:C,pagedata:x,setPageData:m,loading:l,error:w,searchText:j,setSearchText:g})]})}export{Q 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.