2 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			2 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import{O as C,bO as D,e9 as R,Z as S,bo as E,p as c,u as O,h as i,c as o,bP as k,a1 as V,j as d,T as _,bq as $,dx as q,bQ as w,bR as Q,a5 as U,ba as u,r as B,e as F,bb as H}from"./bundle.3e24044b.js";import{a as L}from"./bundle.c2fb8014.js";import"./bundle.b5d84393.js";function z(){const{documentTitle:p,setDocumentTitle:j}=C("project"),{id:a}=D(),{data:s}=R({id:a}),m=S(),h=E(),f=L(),[e,l]=c.useState(),[T,r]=c.useState(),[n]=O();c.useEffect(()=>{s!=null&&s.name&&j(s.name),s&&l(s)},[s]);const g=[{name:n("projects"),href:"/projects"},{name:p,href:i("/projects/:id",{id:a})}],v=[{name:n("edit"),href:i("/projects/:id/edit",{id:a})},{name:n("documents"),href:i("/projects/:id/documents",{id:a}),enabled:m("view_project")||m("edit_project")||h(e),formatName:()=>{var t;return o(k,{numberOfDocuments:(t=e==null?void 0:e.documents)==null?void 0:t.length})}}],P=()=>{u.processing(),r(void 0),B("PUT",F("/api/v1/projects/:id",{id:a}),e).then(()=>{u.success("updated_project"),H(["projects"])}).catch(t=>{var b;((b=t.response)==null?void 0:b.status)==422&&(u.dismiss(),r(t.response.data))})},{changeTemplateVisible:x,setChangeTemplateVisible:y,changeTemplateResources:A}=V();return d(_,{title:p,breadcrumbs:g,disableSaveButton:!e,navigationTopRight:e&&o($,{resource:e,onSaveClick:P,actions:f,cypressRef:"projectActionDropdown"}),children:[d(q,{breadcrumbs:[],children:[o(w,{tabs:v}),o(Q,{context:{errors:T,setErrors:r,project:e,setProject:l}})]}),o(U,{entity:"project",entities:A,visible:x,setVisible:y,labelFn:t=>`${n("number")}: ${t.number}`,bulkUrl:"/api/v1/projects/bulk"})]})}export{z as default};
 |