whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> /home/qbizpnmr/arif.umairtax.com/public/Expense-CXyEITL2.js
import{j as e,a as $,H as T,u as R,bu as D,p as c,r as E,dS as I,e as _,fF as F,cf as H,cg as L,fG as U,fH as A,S as k,L as G,bS as Q,dC as O,bo as q,Y as M,bt as V,i as P,bT as W,fI as Y,Q as J,bV as K,bC as X,bW as Z,aA as ee,bE as se}from"./bundle.OlIVtvc7.js";import{P as re,a as oe,b as te}from"./react-resizable-panels.browser.esm-DGjypp5c.js";import{a as N}from"./InvoiceViewer-Dp83-peG.js";import{r as ne}from"./react-responsive-DfXP7Il0.js";import{P as ae}from"./PreviousNextNavigation-zAd8_mLU.js";function w(s){const{children:l,renderBasePanel:r}=s;return r?e.jsx(re,{defaultSize:50,minSize:25,children:l}):e.jsx(e.Fragment,{children:l})}function ce(s){const{children:l,renderBasePanelGroup:r}=s;return r?e.jsx(oe,{direction:"horizontal",className:"gap-4 mt-4",children:l}):e.jsx("div",{className:"flex flex-col gap-4",children:l})}const le=T(te)` background-color: ${s=>s.theme.backgroundColor}; &:hover { background-color: ${s=>s.theme.hoverColor}; } `;function ie(s){const l=$(),{renderBasePanelResizeHandler:r}=s;return r?e.jsx(le,{className:"flex items-center",theme:{hoverColor:"#3366CC",backgroundColor:l.$21},style:{width:"2.5px"}}):e.jsx(e.Fragment,{})}const v=T.div` background-color: ${s=>s.theme.backgroundColor}; border-color: ${s=>s.theme.borderColor}; &:hover { background-color: ${s=>s.theme.hoverColor}; } `;function de(s){var g;const[l]=R(),{documents:r}=s,t=$(),C=D(),d=c.useRef(null),[u,b]=c.useState(""),[h,x]=c.useState(!1),[i,m]=c.useState(0),[f,n]=c.useState(!1),p=()=>{var a;const o=(a=r[i])==null?void 0:a.type;return o==="png"||o==="jpg"||o==="gif"||o==="webp"||o==="tiff"},j=()=>{var a;return((a=r[i])==null?void 0:a.type)==="pdf"};return c.useEffect(()=>{var o;return r.length&&(x(!0),n(!1),r[i]?C.fetchQuery(["/api/v1/documents",(o=r[i])==null?void 0:o.hash],()=>{var a;return E("GET",_("/documents/:hash",{hash:(a=r[i])==null?void 0:a.hash}),{headers:I()},{responseType:"arraybuffer"})},{staleTime:1/0}).then(a=>{const y=new Blob([a.data],{type:a.headers["content-type"]});p()?b(URL.createObjectURL(y)):!N&&d.current&&j()?d.current.src=URL.createObjectURL(y):n(!0)}).finally(()=>x(!1)):m(0)),()=>{b(""),x(!1),n(!1)}},[r,i]),N?e.jsx("p",{children:"Unable to preview PDF. "}):e.jsxs(e.Fragment,{children:[r.length?e.jsxs("div",{className:"flex flex-col",children:[!h&&e.jsxs("div",{className:"flex self-end pb-2",children:[e.jsx(v,{className:"p-2 border rounded-l-md shadow-sm cursor-pointer",theme:{hoverColor:t.$4,backgroundColor:t.$1,borderColor:t.$24},onClick:()=>m(0),children:e.jsx(F,{size:"0.85rem",color:t.$3})}),e.jsx(v,{className:"p-2 border-b border-t border-r rounded-r-md shadow-sm cursor-pointer",theme:{hoverColor:t.$4,backgroundColor:t.$1,borderColor:t.$24},onClick:()=>i!==0&&m(o=>o-1),children:e.jsx(H,{size:"0.85rem",color:t.$3})}),e.jsx(v,{className:"p-2 border-t border-b border-l rounded-l-md shadow-sm cursor-pointer ml-2",theme:{hoverColor:t.$4,backgroundColor:t.$1,borderColor:t.$24},onClick:()=>i!==r.length-1&&m(o=>o+1),children:e.jsx(L,{size:"0.85rem",color:t.$3})}),e.jsx(v,{className:"p-2 border rounded-r-md shadow-sm cursor-pointer",theme:{hoverColor:t.$4,backgroundColor:t.$1,borderColor:t.$24},onClick:()=>m(r.length-1),children:e.jsx(U,{size:"0.85rem",color:t.$3})})]}),p()&&!h&&!f&&e.jsx("img",{className:"w-full",src:u}),e.jsx("iframe",{ref:d,width:"100%",height:h||!j()||f?0:1500,tabIndex:-1,loading:"lazy"}),f&&e.jsx("div",{className:"flex h-full justify-center items-center",children:e.jsx(A,{type:(g=r[i])==null?void 0:g.type,size:150})})]}):e.jsxs("div",{className:"flex justify-center",children:[l("no_records_found"),"."]}),h&&e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsx(k,{})})]})}function pe(){const[s]=R(),{documentTitle:l}=G("edit_expense"),{id:r}=Q(),t=O(),C=$(),{data:d}=q({id:r}),u=ne.useMediaQuery({query:"(min-width: 1024px)"}),b=M(),h=V(),x=[{name:s("expenses"),href:"/expenses"},{name:s("edit_expense"),href:P("/expenses/:id/edit",{id:r})}],i=[{name:s("edit"),href:P("/expenses/:id/edit",{id:r})},{name:s("documents"),href:P("/expenses/:id/documents",{id:r}),formatName:()=>e.jsx(W,{numberOfDocuments:n==null?void 0:n.documents.length})}],[m,f]=c.useState(),[n,p]=c.useState(),[j,g]=c.useState(!1),[o,a]=c.useState(!1),[y,S]=c.useState("by_rate"),B=Y({setErrors:f,isFormBusy:j,setIsFormBusy:g});return c.useEffect(()=>{d&&(p(d),S(d.calculate_tax_by_amount?"by_amount":"by_rate"))},[d]),e.jsx(J,{title:l,breadcrumbs:x,...(b("edit_expense")||h(n))&&n&&{navigationTopRight:e.jsx(se,{resource:n,onSaveClick:()=>B(n),actions:t,disableSaveButton:!n,cypressRef:"expenseActionDropdown"})},afterBreadcrumbs:e.jsx(ae,{entity:"expense"}),children:n?e.jsxs("div",{className:"space-y-4",children:[e.jsx(K,{tabs:i,rightSide:e.jsxs("div",{className:"flex items-center justify-end space-x-3",children:[e.jsx("span",{className:"text-sm",children:s("preview")}),e.jsx(X,{checked:o,onValueChange:z=>a(z)})]})}),e.jsxs(ce,{renderBasePanelGroup:o&&u,children:[e.jsx(w,{renderBasePanel:o&&u,children:e.jsx(Z,{context:{errors:m,setErrors:f,expense:n,setExpense:p,taxInputType:y,setTaxInputType:S,isPreviewMode:o}})}),e.jsx(ie,{renderBasePanelResizeHandler:o&&u}),o&&!u&&e.jsx(ee,{className:"pt-4",withoutPadding:!0,borderColor:C.$21}),e.jsx(w,{renderBasePanel:o&&u,children:o&&e.jsx(de,{documents:n.documents})})]})]}):e.jsx(k,{})})}export{pe as default};
Copyright ©2021 || Defacer Indonesia