Files
docker-invoiceninja/docker/app/public/bundle.c357e89e.js
2024-10-19 18:17:42 +00:00

2 lines
1.6 KiB
JavaScript

import{O as y,bP as A,eg as C,Z as E,bp as R,p as c,u as k,h as i,c as o,bQ as O,a1 as V,j as b,T as _,br as $,dD as w,bS as Q,bT as U,a6 as q,bc as u,r as B,e as F,a7 as H}from"./bundle.31c6ea9c.js";import{a as L}from"./bundle.efd06f02.js";import"./bundle.b1ca5cca.js";function z(){const{documentTitle:p,setDocumentTitle:j}=y("project"),{id:a}=A(),{data:s}=C({id:a}),m=E(),h=R(),f=L(),[e,l]=c.useState(),[T,r]=c.useState(),[n]=k();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(O,{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 d;((d=t.response)==null?void 0:d.status)==422&&(u.dismiss(),r(t.response.data))})},{changeTemplateVisible:D,setChangeTemplateVisible:S,changeTemplateResources:x}=V();return b(_,{title:p,breadcrumbs:g,disableSaveButton:!e,navigationTopRight:e&&o($,{resource:e,onSaveClick:P,actions:f,cypressRef:"projectActionDropdown"}),children:[b(w,{breadcrumbs:[],children:[o(Q,{tabs:v}),o(U,{context:{errors:T,setErrors:r,project:e,setProject:l}})]}),o(q,{entity:"project",entities:x,visible:D,setVisible:S,labelFn:t=>`${n("number")}: ${t.number}`,bulkUrl:"/api/v1/projects/bulk"})]})}export{z as default};