PageSourceSearch

https://medicallibrary.net/assets/AdminBooks-DYPrkfak.js

js medicallibrary.net collected 2026-10-06 09:26:46 UTC 3,020 bytes, 1 lines download raw bytes

1import{j as e,E as g,e as r}from"./index-DOQVHmTR.js";import{b as t,L as m}from"./vendor-CkCoFkzs.js";import{f as b,P as S}from"./AdminWidgets-DhdcCxzH.js";import"./slick-CIvBZSzf.js";function P(){const[o,x]=t.useState(""),[d,j]=t.useState(""),[n,p]=t.useState(!1),[c,i]=t.useState(1),[a,u]=t.useState(null),[k,f]=t.useState(null),h=()=>r.admin.books(d,n,c,25).then(u).catch(f);t.useEffect(()=>{h()},[d,n,c]);const N=async s=>{s.isDeleted?await r.admin.restoreBook(s.book.id):await r.admin.withdrawBook(s.book.id),h()};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"npl-admin__head",children:[e.jsx("h2",{children:"Books"}),e.jsxs(m,{to:"/admin/books/new",className:"cus-btn small",children:[e.jsx("i",{className:"fal fa-plus"})," New book"]})]}),e.jsxs("form",{className:"npl-admin__filters",onSubmit:s=>{s.preventDefault(),i(1),j(o)},children:[e.jsx("input",{className:"form-control",placeholder:"Title, author, WPLBN, ISBN or id",value:o,onChange:s=>x(s.target.value),"aria-label":"Search books"}),e.jsx("button",{type:"submit",className:"cus-btn small",children:"Search"}),e.jsxs("label",{className:"npl-check",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:s=>{i(1),p(s.target.checked)}}),e.jsx("span",{children:"Include withdrawn"})]})]}),e.jsx(g,{error:k}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"dark-gray mb-16",children:[a.total.toLocaleString()," book",a.total===1?"":"s"]}),e.jsx("div",{className:"table-responsive",children:e.jsxs("table",{className:"table npl-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Id"}),e.jsx("th",{}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Author"}),e.jsx("th",{children:"Year"}),e.jsx("th",{children:"Reads"}),e.jsx("th",{children:"File"}),e.jsx("th",{children:"Updated"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:a.items.map(s=>e.jsxs("tr",{className:s.isDeleted?"npl-row-muted":"",children:[e.jsx("td",{className:"npl-mono",children:s.book.id}),e.jsx("td",{children:s.book.coverUrl&&e.jsx("img",{src:s.book.coverUrl,alt:"",className:"npl-thumb"})}),e.jsxs("td",{children:[e.jsx(m,{to:`/admin/books/${s.book.id}`,children:s.book.title}),s.isDeleted&&e.jsx("span",{className:"npl-pill npl-pill--warn ms-2",children:"Withdrawn"}),s.lists.length>0&&e.jsx("div",{children:s.lists.map(l=>e.jsx("span",{className:"npl-chip",children:l},l))})]}),e.jsx("td",{children:s.book.authors.map(l=>l.name).join(", ")}),e.jsx("td",{children:s.book.year??"—"}),e.jsx("td",{children:s.book.readCount}),e.jsx("td",{children:s.filePath?e.jsx("i",{className:"fal fa-file-pdf",title:s.filePath,"aria-label":"Has a PDF"}):e.jsx("span",{className:"dark-gray",children:"—"})}),e.jsx("td",{children:b(s.updated)}),e.jsx("td",{className:"text-end",children:e.jsx("button",{type:"button",className:"cus-btn small npl-outline",onClick:()=>N(s),children:s.isDeleted?"Restore":"Withdraw"})})]},s.book.id))})]})}),e.jsx(S,{page:a.page,pageSize:a.pageSize,total:a.total,onPage:i})]})]})}export{P 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.