PageSourceSearch

https://tenders.lk/_nuxt/D_3lJf3_.js

js tenders.lk collected 2026-10-04 21:07:43 UTC 6,932 bytes, 1 lines download raw bytes

1import{f as $,O as N,I as j,c as n,b as a,a as t,w,U as k,V as B,u as o,ac as D,W as U,X as S,F as I,r as M,h as F,i as d,e as L,a6 as z,o as r,a7 as K,g as R,d as q,t as _}from"./DB2dOjJ2.js";import{_ as H}from"./CSq86agr.js";import{_ as O}from"./DhEQOhDH.js";import{_ as W}from"./BylMPX7b.js";import{_ as X}from"./BJu9xa0X.js";import{u as G}from"./BRh-gwnQ.js";const J={class:"mt-4 mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Q={class:"mb-4 rounded-lg bg-white p-4 shadow-sm ring-1 ring-gray-100"},Y={class:"grid grid-cols-1 gap-3 sm:grid-cols-3"},Z={class:"rounded-lg bg-white shadow-sm ring-1 ring-gray-100"},tt={key:0,class:"flex items-center justify-center py-20"},et={key:1,class:"overflow-x-auto"},st={class:"w-full text-sm"},at={class:"divide-y divide-gray-50"},ot={class:"px-4 py-3 text-gray-500"},nt={class:"px-4 py-3"},rt={class:"flex items-center gap-3"},lt=["src","alt"],it={key:1,class:"h-8 w-8 rounded-full bg-primary-100 flex items-center justify-center"},dt={class:"font-medium text-gray-900"},ct={class:"text-xs text-gray-400"},pt={class:"px-4 py-3 text-gray-500"},ut={class:"px-4 py-3 text-gray-500 whitespace-nowrap"},mt={class:"px-4 py-3 text-gray-500 max-w-[150px] truncate"},_t={class:"px-4 py-3"},gt={class:"px-4 py-3"},xt={class:"px-4 py-3 text-right"},yt={class:"flex items-center justify-end gap-1"},ft=["onClick"],ht={key:0},vt={key:2,class:"border-t border-gray-100 px-4 py-3"},Tt=$({__name:"index",setup(bt){G({title:"Manage Users - Tenders.lk Admin"});const{apiFetch:A}=N(),y=z(),f=d(!0),h=d([]),c=d(""),p=d(""),u=d(""),l=d({current_page:1,last_page:1,total:0,per_page:15});async function g(x=1){f.value=!0;try{const e=new URLSearchParams({page:String(x),per_page:"15"});c.value&&e.set("search",c.value),p.value&&e.set("payment_status",p.value),u.value&&e.set("status",u.value);const i=await A(`/admin/users?${e}`);h.value=i.data||[],l.value={current_page:i.current_page||1,last_page:i.last_page||1,total:i.total||0,per_page:i.per_page||15}}catch{y.error("Failed to load users")}finally{f.value=!1}}async function T(x){if(confirm("Are you sure you want to delete this user? This action cannot be undone."))try{await A(`/admin/users/${x}`,{method:"DELETE"}),y.success("User deleted successfully"),g(l.value.current_page)}catch{y.error("Failed to delete user")}}function v(){g(1)}return j(()=>g()),(x,e)=>{const i=K,V=H,m=R,b=L,E=O,C=W,P=X;return r(),n("div",null,[a(i),a(V,{items:[{label:"Admin",to:"/admin"},{label:"Users"}]}),t("div",J,[e[4]||(e[4]=t("div",null,[t("h1",{class:"text-2xl font-bold text-dark-900"},"Users"),t("p",{class:"text-sm text-gray-500 mt-1"},"Manage registered users")],-1)),a(b,{to:"/admin/users/create",class:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-primary-600 transition-colors"},{default:w(()=>[a(m,{name:"heroicons:plus-20-solid",class:"h-4 w-4"}),e[3]||(e[3]=q(" Add User ",-1))]),_:1})]),t("div",Q,[t("div",Y,[k(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>U(c)?c.value=s:null),type:"text",placeholder:"Search by name, email, or company...",class:"rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-primary-500 focus:ring-1 focus:ring-primary-500 outline-none",onKeyup:D(v,["enter"])},null,544),[[B,o(c)]]),k(t("select",{"onUpdate:modelValue":e[1]||(e[1]=s=>U(p)?p.value=s:null),class:"rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-primary-500 focus:ring-1 focus:ring-primary-500 outline-none",onChange:v},[...e[5]||(e[5]=[t("option",{value:""},"All Payment Status",-1),t("option",{value:"active"},"Active",-1),t("option",{value:"expired"},"Expired",-1),t("option",{value:"pending"},"Pending",-1)])],544),[[S,o(p)]]),k(t("select",{"onUpdate:modelValue":e[2]||(e[2]=s=>U(u)?u.value=s:null),class:"rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-primary-500 focus:ring-1 focus:ring-primary-500 outline-none",onChange:v},[...e[6]||(e[6]=[t("option",{value:""},"All Account Status",-1),t("option",{value:"active"},"Active",-1),t("option",{value:"inactive"},"Inactive",-1)])],544),[[S,o(u)]])])]),t("div",Z,[o(f)?(r(),n("div",tt,[...e[7]||(e[7]=[t("div",{class:"h-8 w-8 animate-spin rounded-full border-4 border-primary-200 border-t-primary-600"},null,-1)])])):(r(),n("div",et,[t("table",st,[e[9]||(e[9]=t("thead",null,[t("tr",{class:"border-b border-gray-100 bg-gray-50/80"},[t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"ID"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"User"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"Email"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"Phone"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"Company"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"Payment"),t("th",{class:"px-4 py-3 text-left font-medium text-dark-700"},"Status"),t("th",{class:"px-4 py-3 text-right font-medium text-dark-700"},"Actions")])],-1)),t("tbody",at,[(r(!0),n(I,null,M(o(h),s=>(r(),n("tr",{key:s.id,class:"hover:bg-gray-50/50"},[t("td",ot,[a(E,{value:s.id,monospace:"","text-class":"text-xs text-gray-600"},null,8,["value"])]),t("td",nt,[t("div",rt,[s.profile_image?(r(),n("img",{key:0,src:s.profile_image,alt:s.full_name,class:"h-8 w-8 rounded-full object-cover"},null,8,lt)):(r(),n("div",it,[a(m,{name:"heroicons:user-solid",class:"h-4 w-4 text-primary-600"})])),t("div",null,[t("p",dt,_(s.full_name),1),t("p",ct,_(s.username),1)])])]),t("td",pt,_(s.email),1),t("td",ut,_(s.phone||s.mobile||"-"),1),t("td",mt,_(s.company_name||"-"),1),t("td",_t,[a(C,{status:s.user_payment_status||"inactive",size:"sm"},null,8,["status"])]),t("td",gt,[a(C,{status:s.status===1||s.status==="active"?"active":"inactive",size:"sm"},null,8,["status"])]),t("td",xt,[t("div",yt,[a(b,{to:`/admin/users/${s.id}`,class:"rounded-lg p-1.5 text-gray-400 hover:bg-primary-50 hover:text-primary-600 transition-colors",title:"Edit"},{default:w(()=>[a(m,{name:"heroicons:pencil-square-20-solid",class:"h-4 w-4"})]),_:1},8,["to"]),a(b,{to:`/admin/users/${s.id}/invoices`,class:"rounded-lg p-1.5 text-gray-400 hover:bg-emerald-50 hover:text-emerald-600 transition-colors",title:"Invoices"},{default:w(()=>[a(m,{name:"heroicons:document-currency-dollar-20-solid",class:"h-4 w-4"})]),_:1},8,["to"]),t("button",{class:"rounded-lg p-1.5 text-gray-400 hover:bg-red-50 hover:text-red-600 transition-colors",title:"Delete",onClick:wt=>T(s.id)},[a(m,{name:"heroicons:trash-20-solid",class:"h-4 w-4"})],8,ft)])])]))),128)),o(h).length?F("",!0):(r(),n("tr",ht,[...e[8]||(e[8]=[t("td",{colspan:"8",class:"px-4 py-12 text-center text-gray-400"},"No users found",-1)])]))])])])),o(l).total>0?(r(),n("div",vt,[a(P,{"current-page":o(l).current_page,"last-page":o(l).last_page,total:o(l).total,"per-page":o(l).per_page,onPageChange:g},null,8,["current-page","last-page","total","per-page"])])):F("",!0)])])}}});
1export{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.