whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> //home/qbizpnmr/arif.umairtax.com/public/Client-CXR1jw51.js
import{u as T,bS as y,i as o,j as s,bT as V,L as w,a9 as I,Y as M,bt as H,p as i,cY as Q,de as U,be as j,bP as Y,a3 as $,Q as q,S as W,bV as z,bW as G,a7 as J,a8 as v,bE as K,bf as f,r as X,e as Z,$ as ss}from"./bundle.OlIVtvc7.js";import{P as es}from"./PreviousNextNavigation-zAd8_mLU.js";function ts({client:e}){const[c]=T(),{id:n}=y();return[{name:c("edit"),href:o("/clients/:id/edit",{id:n})},{name:c("settings"),href:o("/clients/:id/settings",{id:n})},{name:c("documents"),href:o("/clients/:id/documents",{id:n}),formatName:()=>s.jsx(V,{numberOfDocuments:e==null?void 0:e.documents.length})},{name:c("locations"),href:o("/clients/:id/locations",{id:n}),formatName:()=>s.jsxs("div",{className:"flex space-x-1",children:[s.jsx("span",{children:c("locations")}),!!(e!=null&&e.locations.length)&&s.jsxs("span",{className:"font-bold",children:["(",e==null?void 0:e.locations.length,")"]})]})}]}function is(){const{documentTitle:e,setDocumentTitle:c}=w("edit_client"),[n]=T(),{id:l}=y(),C=I(),S=M(),N=H(),[E,p]=i.useState(!1),P=Q({setIsPurgeOrMergeActionCalled:p}),{data:r,isLoading:A}=U({id:l,enabled:!E}),[t,d]=i.useState(),[D,b]=i.useState(),[h,x]=i.useState(!1),[m,g]=i.useState([]),B=ts({client:t});i.useEffect(()=>{if(r){d({...r});const a=j.cloneDeep(r.contacts);a.map(u=>u.password=""),g(a)}return()=>{p(!1)}},[r]),i.useEffect(()=>{c((t==null?void 0:t.display_name)||"edit_client")},[t]),i.useEffect(()=>{d(a=>j.set(a,"contacts",m))},[m]);const L=[{name:n("clients"),href:"/clients"},{name:e,href:o("/clients/:id",{id:l})},{name:n("edit"),href:o("/clients/:id",{id:l})}],R=Y(),_=async()=>{h||(f.processing(),x(!0),await R({excludeToasters:!0}),X("PUT",Z("/api/v1/clients/:id",{id:l}),{...t,documents:[]}).then(()=>{f.success("updated_client"),ss(["clients"]),C(o("/clients/:id",{id:l}))}).catch(a=>{var u;((u=a.response)==null?void 0:u.status)===422&&(f.dismiss(),b(a.response.data))}).finally(()=>x(!1)))},{changeTemplateVisible:k,setChangeTemplateVisible:F,changeTemplateResources:O}=$();return s.jsxs(q,{title:e,breadcrumbs:L,...(S("edit_client")||N(t))&&t&&{navigationTopRight:s.jsx(K,{resource:t,actions:P,onSaveClick:_,disableSaveButton:!t||h,cypressRef:"clientActionDropdown"})},afterBreadcrumbs:s.jsx(es,{entity:"client"}),children:[A&&s.jsx(W,{}),t&&s.jsxs("div",{className:"space-y-4",children:[s.jsx(z,{tabs:B}),s.jsx(G,{context:{errors:D,setErrors:b,client:t,setClient:d,contacts:m,setContacts:g}}),s.jsx(J,{entity:"client",entities:O,visible:k,setVisible:F,labelFn:a=>s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsx(v,{children:n("number")}),s.jsx("span",{children:a.number})]}),bulkLabelFn:a=>s.jsxs("div",{className:"flex space-x-2",children:[s.jsxs(v,{children:[n("number"),":"]}),s.jsx("span",{children:a.number})]}),bulkUrl:"/api/v1/clients/bulk"})]})]})}export{is as default};
Copyright ©2021 || Defacer Indonesia