PageSourceSearch

https://app.cloudjoi.com/build/assets/useDocumentActions-6ed05bfc.js

js cloudjoi.com collected 2026-10-03 21:42:37 UTC 3,071 bytes, 1 lines download raw bytes

1import{r as l,j as n,y as r}from"./app-48b4d92b.js";import{M as c}from"./index-75370af8.js";import{S as v}from"./index-419a052b.js";import{T as b}from"./index-4fca2a20.js";import{I as S}from"./index-00296432.js";import"./PurePanel-cbb63ac1.js";import"./index-46d0c270.js";import"./CheckOutlined-9e8bf667.js";import"./index-def03aa0.js";import"./styleChecker-8a8b866b.js";import"./TextArea-b513a285.js";import"./statusUtils-83a43fdc.js";import"./index-158711a6.js";import"./EyeOutlined-44643bfd.js";import"./SearchOutlined-56d29faa.js";const q=s=>{const[t,a]=l.useState(null),[i,u]=l.useState(""),[h,d]=l.useState(!1),m=e=>e.document_number??`#${e.id}`,f=e=>{c.confirm({title:"Submit this document?",content:`${m(e)} will be packed and sent to the provider. This runs in the background — check back shortly for the result.`,okText:"Submit",onOk:()=>r.post(route("finance.platforms.integrations.documents.submit",s),{document_ids:[e.id]},{preserveScroll:!0})})},k=e=>{r.post(route("finance.platforms.integrations.documents.retry",{...s,document:e.id}))},g=e=>{c.confirm({title:"Discard this document?",content:`${m(e)} will be abandoned locally and stop showing as actionable. It has no live provider presence, so nothing is cancelled at LHDN — but this cannot be undone here, and re-issuing the invoice will generate a brand-new document.`,okText:"Discard",okButtonProps:{danger:!0},onOk:()=>r.post(route("finance.platforms.integrations.documents.discard",{...s,document:e.id}),{},{preserveScroll:!0})})},y=()=>{!t||i.trim()===""||(d(!0),r.post(route("finance.platforms.integrations.documents.cancel",{...s,document:t.id}),{reason:i.trim()},{preserveScroll:!0,onSuccess:()=>a(null),onFinish:()=>d(!1)}))},p=e=>[...e.status==="ready_to_submit"?[{key:"submit",label:"Submit this document",onClick:()=>f(e)}]:[],...["failed","validation_failed","poll_timeout"].includes(e.status)?[{key:"retry",label:"Retry & resubmit this document",onClick:()=>k(e)}]:[],...e.status==="validated"?[{key:"cancel",label:"Cancel",danger:!0,onClick:()=>{a(e),u("")}}]:[],...["pending","ready_to_submit","failed","validation_failed"].includes(e.status)?[{key:"discard",label:"Discard",danger:!0,onClick:()=>g(e)}]:[]],x=e=>p(e).map(o=>({key:o.key,label:o.danger?n.jsx("span",{className:"text-red-500",children:o.label}):o.label,onClick:o.onClick})),C=n.jsx(c,{title:"Cancel document",open:t!==null,onCancel:()=>a(null),onOk:y,okText:"Cancel document",okButtonProps:{danger:!0,loading:h,disabled:i.trim()===""},cancelText:"Keep",children:n.jsxs(v,{direction:"vertical",className:"w-full",children:[n.jsx(b.Text,{children:"Cancelling notifies the provider and cannot be undone. This is only possible within the provider's cancellation window."}),(t==null?void 0:t.document_number)&&n.jsxs(b.Text,{type:"secondary",children:["Document ",t.document_number]}),n.jsx(S.TextArea,{rows:3,maxLength:300,showCount:!0,placeholder:"Reason for cancellation (required)",value:i,onChange:e=>u(e.target.value)})]})});return{actions:p,menuItems:x,cancelModal:C}};export{q as default,q as useDocumentActions};

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.