PageSourceSearch

https://bizvanguard.ai/assets/BusinessDocuments-DRQUK2p-.js

js bizvanguard.ai collected 2026-10-05 13:48:20 UTC 6,915 bytes, 1 lines download raw bytes

1import{r as D,j as e}from"./vendor-react-zwv87yMD.js";import{u as S,a as T,b as m}from"./vendor-query-DYq8g7OI.js";import{d as E,p as k,b as C,a as L}from"./business-documents-BU88rFEc.js";import{u as P}from"./authStore-Bv6p2Ne2.js";import{u as F}from"./useOrgTimezone-C1UagyKl.js";import{L as i}from"./vendor-router-DimZLiZb.js";import"./vendor-charts-CtrTLS4K.js";import"./vendor-i18n-BdYkS11p.js";import"./vendor-ui-CfDMlrKu.js";import"./vendor-pdf-DQuePnfN.js";import"./vendor-state-ByI9XJey.js";import"./vendor-editor-C_dhmuey.js";import"./api-client-wl3SCNAO.js";import"./i18n-CwjSIy0a.js";import"./vendor-icons-bLSWzydc.js";import"./employeeAuthStore-lYSKMuhw.js";const R={POLICY:"Policy",CONTRACT:"Contract",AGREEMENT:"Agreement",MEMO:"Notice"},I={DRAFT:"Draft",PUBLISHED:"Published",ARCHIVED:"Archived"},M={DRAFT:"bg-yellow-100 text-yellow-800",PUBLISHED:"bg-green-100 text-green-800",ARCHIVED:"bg-gray-100 text-gray-800"};function X({embedded:l=!1}={}){const{permissions:h,currentOrganizationId:u}=P(),p=F(),c=h.includes("MANAGE_BUSINESS_DOCUMENTS"),[a,y]=D.useState("all"),o=S(),{data:n=[],isLoading:g}=T({queryKey:["business-documents",u],queryFn:()=>L(),staleTime:300*1e3,gcTime:1200*1e3,enabled:!!u}),b=m({mutationFn:E,onSuccess:()=>{o.invalidateQueries({queryKey:["business-documents"]})}}),f=m({mutationFn:t=>k(t),onSuccess:()=>{o.invalidateQueries({queryKey:["business-documents"]})}}),N=m({mutationFn:C,onSuccess:()=>{o.invalidateQueries({queryKey:["business-documents"]})}}),x=n.filter(t=>a==="all"?!0:t.status===a),j=async t=>{var s,r;if(window.confirm(`Are you sure you want to delete "${t.title}"? This action cannot be undone.`))try{await b.mutateAsync(t.id)}catch(d){alert(((r=(s=d.response)==null?void 0:s.data)==null?void 0:r.message)||"Failed to delete document")}},w=async t=>{var s,r;if(window.confirm(`Publish "${t.title}"? Employees will be able to view and acknowledge this document.`))try{await f.mutateAsync(t.id)}catch(d){alert(((r=(s=d.response)==null?void 0:s.data)==null?void 0:r.message)||"Failed to publish document")}},v=async t=>{window.confirm(`Archive "${t.title}"? This will hide it from employees.`)&&await N.mutateAsync(t.id)},A=[{key:"all",label:"All",count:n.length},{key:"DRAFT",label:"Drafts",count:n.filter(t=>t.status==="DRAFT").length},{key:"PUBLISHED",label:"Published",count:n.filter(t=>t.status==="PUBLISHED").length},{key:"ARCHIVED",label:"Archived",count:n.filter(t=>t.status==="ARCHIVED").length}];return e.jsxs("div",{className:l?"":"p-6",children:[e.jsxs("div",{className:`flex justify-between items-center mb-6 ${l?"sm:justify-end":""}`,children:[!l&&e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Company Documents"}),e.jsx("p",{className:"text-gray-600",children:"Manage company policies, contracts, and agreements"})]}),c&&e.jsx(i,{to:"/dashboard/business-documents/new",className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"+ New Document"})]}),e.jsx("div",{className:"border-b border-gray-200 mb-6",children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:A.map(t=>e.jsxs("button",{onClick:()=>y(t.key),className:`py-4 px-1 border-b-2 font-medium text-sm ${a===t.key?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[t.label,e.jsx("span",{className:`ml-2 py-0.5 px-2 rounded-full text-xs ${a===t.key?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-600"}`,children:t.count})]},t.key))})}),g?e.jsx("div",{className:"text-center py-12 text-gray-500",children:"Loading documents..."}):x.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"text-gray-400 text-5xl mb-4",children:"📄"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No documents found"}),e.jsx("p",{className:"text-gray-500 mt-1",children:a==="all"?"Create your first company document to get started.":`No ${a.toLowerCase()} documents.`})]}):e.jsx("div",{className:"bg-white rounded-lg shadow overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Document"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Updated"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:x.map(t=>{var s;return e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsxs("td",{className:"px-6 py-4",children:[e.jsx(i,{to:`/dashboard/business-documents/${t.id}`,className:"text-blue-600 hover:text-blue-800 font-medium",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-gray-500 mt-1 truncate max-w-xs",children:t.description})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:R[t.type]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${M[t.status]}`,children:I[t.status]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((s=t.currentVersion)==null?void 0:s.version)||"-"}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:new Date(t.updatedAt).toLocaleDateString(void 0,{timeZone:p})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(i,{to:`/dashboard/business-documents/${t.id}`,className:"text-blue-600 hover:text-blue-900",children:"View"}),c&&t.status==="DRAFT"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>w(t),className:"text-green-600 hover:text-green-900",disabled:!t.currentVersion,title:t.currentVersion?"Publish":"Add content first",children:"Publish"}),e.jsx("button",{onClick:()=>j(t),className:"text-red-600 hover:text-red-900",children:"Delete"})]}),c&&t.status==="PUBLISHED"&&e.jsxs(e.Fragment,{children:[e.jsx(i,{to:`/dashboard/document-signing?send=${t.id}`,className:"text-blue-600 hover:text-blue-900",children:"Send"}),e.jsx("button",{onClick:()=>v(t),className:"text-gray-600 hover:text-gray-900",children:"Archive"})]})]})})]},t.id)})})]})})]})}export{X 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.