ruạṛ
import{T as C,bN as D,ep as R,a1 as S,bp as E,p as c,u as N,h as i,c as a,bO as $,a5 as k,j as b,W as O,bt as V,dM as _,bQ as w,bR as B,a9 as M,bc as u,r as Q,e as U,$ as q}from"./bundle.9abe88c8.js";import{a as F}from"./hooks-344a2ac4.js";import{P as H}from"./PreviousNextNavigation-f6f14b66.js";import"./atoms-d3dbf501.js";function I(){const{documentTitle:p,setDocumentTitle:j}=C("project"),{id:o}=D(),{data:s}=R({id:o}),m=S(),f=E(),h=F(),[e,d]=c.useState(),[T,r]=c.useState(),[n]=N();c.useEffect(()=>{s!=null&&s.name&&j(s.name),s&&d(s)},[s]);const g=[{name:n("projects"),href:"/projects"},{name:p,href:i("/projects/:id",{id:o})}],v=[{name:n("edit"),href:i("/projects/:id/edit",{id:o})},{name:n("documents"),href:i("/projects/:id/documents",{id:o}),enabled:m("view_project")||m("edit_project")||f(e),formatName:()=>{var t;return a($,{numberOfDocuments:(t=e==null?void 0:e.documents)==null?void 0:t.length})}}],P=()=>{u.processing(),r(void 0),Q("PUT",U("/api/v1/projects/:id",{id:o}),e).then(()=>{u.success("updated_project"),q(["projects"])}).catch(t=>{var l;((l=t.response)==null?void 0:l.status)==422&&(u.dismiss(),r(t.response.data))})},{changeTemplateVisible:x,setChangeTemplateVisible:y,changeTemplateResources:A}=k();return b(O,{title:p,breadcrumbs:g,disableSaveButton:!e,navigationTopRight:e&&a(V,{resource:e,onSaveClick:P,actions:h,cypressRef:"projectActionDropdown"}),afterBreadcrumbs:a(H,{entity:"project"}),children:[b(_,{breadcrumbs:[],children:[a(w,{tabs:v}),a(B,{context:{errors:T,setErrors:r,project:e,setProject:d}})]}),a(M,{entity:"project",entities:A,visible:x,setVisible:y,labelFn:t=>`${n("number")}: ${t.number}`,bulkUrl:"/api/v1/projects/bulk"})]})}export{I as default};
cải xoăn