PageSourceSearch

https://dashboard.camelohq.com/_next/static/chunks/pages/crm/clients/[id]-77d637a9340532a6.js

js camelohq.com collected 2026-10-05 03:49:23 UTC 42,680 bytes, 2 lines download raw bytes

1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d6b46ac5-4544-4dd2-9621-84587dcb2b64",e._sentryDebugIdIdentifier="sentry-dbid-d6b46ac5-4544-4dd2-9621-84587dcb2b64")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7617],{12915:function(e,t,l){var s=l(92822)("eq",l(77813));s.placeholder=l(69306),e.exports=s},89615:function(e,t,l){var s=l(92822)("isNaN",l(7654),l(69087));s.placeholder=l(69306),e.exports=s},49546:function(e,t,l){var s=l(92822)("isNumber",l(81763),l(69087));s.placeholder=l(69306),e.exports=s},7654:function(e,t,l){var s=l(81763);e.exports=function(e){return s(e)&&e!=+e}},81763:function(e,t,l){var s=l(44239),a=l(37005);e.exports=function(e){return"number"==typeof e||a(e)&&"[object Number]"==s(e)}},37437:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/crm/clients/[id]",function(){return l(90340)}])},27065:function(e,t,l){"use strict";l.d(t,{M:function(){return f}});var s=l(87536),a=l(30202),n=l(16789),r=l(1393),i=l(71956);let d=(e,t)=>e.filter(e=>!t.includes(e)),c=e=>{let{taskId:t,...l}=e;return l},o=e=>{let{checklistId:t,tasks:l,...s}=e;return{tasks:(null!=l?l:[]).map(c),...s}},x=e=>t=>{var l,s,a,n;let r=(null!==(l=e.tasks)&&void 0!==l?l:[]).find(e=>e.id===t.taskId);if(!r)return t;let i=(null!==(s=t.subTasks)&&void 0!==s?s:[]).map(e=>e.taskId),c=(null!==(a=r.subTasks)&&void 0!==a?a:[]).map(e=>e.id);return{...t,subTasks:(null!==(n=t.subTasks)&&void 0!==n?n:[]).concat(d(c,i).map(e=>({taskId:e,_destroy:!0})))}},m=e=>t=>{var l,s,a,n,r;let i=null===(l=(null!==(s=e.checklistAssignments)&&void 0!==s?s:[]).find(e=>e.checklist.id===t.checklistId))||void 0===l?void 0:l.checklist;if(!i)return o(t);let c=(null!==(a=t.tasks)&&void 0!==a?a:[]).map(e=>e.taskId),m=(null!==(n=i.tasks)&&void 0!==n?n:[]).map(e=>e.id);return{...t,tasks:(null!==(r=t.tasks)&&void 0!==r?r:[]).map(x(i)).concat(d(m,c).map(e=>({taskId:e,_destroy:!0})))}},u=(e,t)=>Object.fromEntries(Object.entries(e).filter(e=>{let[l]=e;return t.includes(l)})),h={schedule:["scheduleId"],time:["startTime","endTime"],assignee:["assigneeId"],position:["groupId"],openReceivers:["openShiftRequestReceiverIds"],client:["clientId"],jobSite:["jobSiteId"],additionalJobSites:["additionalJobSiteIds"],repeat:["recurrenceRule"]},f=(e,t,l)=>{var s,a;let{checklists:n,attachments:r,...c}=(0,i.XK)(e),o=(null!=n?n:[]).map(e=>e.checklistId),x=(null!==(s=l.checklistAssignments)&&void 0!==s?s:[]).map(e=>e.checklist.id),f=u({checklists:(null!=n?n:[]).map(m(l)).concat(d(x,o).map(e=>({checklistId:e,_destroy:!0}))),...c},Object.keys(t).reduce((e,t)=>e.concat(null!==(a=h[t])&&void 0!==a?a:[t]),[]));return f},p=()=>{let e=(0,a.NL)(),t=(0,n.vN)(),{mutateAsync:l,isPending:i}=(0,r.edi)(),{formState:{dirtyFields:d},getFieldState:c,getValues:o}=(0,s.Gc)(),x=(s,a)=>{let n=f(a,d,s),r=c("attachments"),i=o("attachments"),x=!0===r.isDirty?null==i?void 0:i.map(e=>({attachmentKey:e.fileKey})):void 0;return l({input:{shiftId:s.id,recurrenceEditType:"THIS",attachments:x,...n}}).then(l=>{var s,a,n;let r=null!==(n=null===(s=l.updateShift)||void 0===s?void 0:s.errors)&&void 0!==n?n:[],i=null===(a=l.updateShift)||void 0===a?void 0:a.result;if(0===r.length&&i)return e.invalidateQueries({queryKey:["ClientJobs"]}),e.invalidateQueries({queryKey:["Shift"]}),i;t(r[0])})};return{submitFormData:x,isSubmitting:i}};t.Z=p},98174:function(e,t,l){"use strict";var s=l(85893),a=l(67294),n=l(58575);let r=e=>{let{children:t,className:l="",scrollable:r=!0}=e,i=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=i.current,t=t=>{if(!e)return;let l=e.scrollWidth>e.clientWidth;if(l&&0!==t.deltaY&&0===t.deltaX){let l=0===e.scrollLeft,s=e.scrollLeft+e.clientWidth>=e.scrollWidth,a=t.deltaY>0,n=t.deltaY<0;if(a&&!s||n&&!l){t.preventDefault();let l=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,e.scrollLeft+2*t.deltaY));e.scrollLeft=l}}};return r&&e&&e.addEventListener("wheel",t),()=>{e&&e.removeEventListener("wheel",t)}},[r]),(0,s.jsx)("div",{className:(0,n.m)("flex flex-1 flex-row gap-3 py-3",r?"snap-x overflow-x-auto scroll-smooth pl-0.5 pr-4":"overflow-hidden",l),ref:i,children:t})};t.Z=r},90340:function(e,t,l){"use strict";l.r(t),l.d(t,{__N_SSG:function(){return ej},default:function(){return eb}});var s=l(85893),a=l(60013),n=l(67294),r=l(78357),i=l(71750),d=l(11163),c=l(61200),o=l(1393),x=l(99724),m=l(30120),u=l(78403),h=l(59435),f=l(16789),p=l(88485),j=l(74287),b=l(87536),v=l(30202),N=l(58192),g=l(78230),k=l(71956);let y=e=>null!=e?{hour:Math.floor(e/60),minute:e%60}:{hour:0,minute:0},w=e=>{let{clientId:t,closeForm:l}=e,{t:a}=(0,i.$G)(),n=(0,v.NL)(),r=(0,N.U0)(),d=(0,f.vN)(),{handleSubmit:x,getValues:m}=(0,b.Gc)(),{mutate:u,isPending:h}=(0,o.qu6)({onSuccess:e=>{var t,s,a;let i=null!==(a=null===(t=e.createShift)||void 0===t?void 0:t.errors)&&void 0!==a?a:[],c=null===(s=e.createShift)||void 0===s?void 0:s.result;0===i.length&&c?(n.invalidateQueries({queryKey:["ClientJobs"]}),null==r||r.capture("Created Shift"),l()):d(i[0])}}),{mutate:p}=(0,o.Prm)(),j=x(e=>{let[t,l]=m(["uploadedFiles","attachments"]),s=(null!=l?l:[]).map(e=>e.fileKey),a=null==t?void 0:t.filter(e=>!(null==s?void 0:s.includes(e)));p({input:{keys:null!=a?a:[]}});let{timezone:r,...i}=(0,k.XK)(e,"create");u({input:{timezone:r,...i}},{onSuccess:()=>{e.saveAsTemplate&&n.invalidateQueries({queryKey:["ShiftTemplates"]})}})});return(0,s.jsx)(k.ZP,{clientId:t,onSubmit:j,footer:(0,s.jsx)("div",{className:"flex flex-row-reverse",children:(0,s.jsx)(c.zx,{type:"primary",htmlType:"submit",disabled:h,loading:h,children:a("create_shift")})})})},_=e=>{var t;let{clientId:l,visible:a,onClose:r}=e,i=(0,f.$_)(),{shiftStartTimeOffset:d,shiftEndTimeOffset:x}=null!==(t=null==i?void 0:i.settings)&&void 0!==t?t:{},u=(0,n.useMemo)(()=>({time:{date:m.ou.now(),start:y(d),end:y(x)}
1,breakDuration:0,checklists:[],repeat:null,title:"",note:""}),[d,x]),h=(0,b.cI)({defaultValues:u}),{formState:{dirtyFields:p},reset:v,getValues:N}=h,[k,_]=(0,n.useState)(!1);(0,n.useEffect)(()=>{a||v(u)},[a,v,u]);let{mutate:C}=(0,o.Prm)(),S=()=>{let e=N("uploadedFiles");C({input:{keys:null!=e?e:[]}}),r()};return(0,s.jsx)(c.u_,{visible:a,onClose:()=>{(0,g.isEmpty)(p)?r():_(!0)},className:"sm:max-w-md",children:(0,s.jsxs)(b.RV,{...h,children:[(0,s.jsx)(c.u_.Header,{title:"Add shift"}),(0,s.jsx)(w,{clientId:l,closeForm:r}),(0,s.jsx)(j.Uy,{visible:k,onClose:()=>_(!1),onDiscard:S})]})})},C=e=>{let{clientId:t,...l}=e,{state:a,open:n,close:r}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.zx,{onClick:n,...l}),(0,s.jsx)(_,{clientId:t,visible:a,onClose:r})]})};var S=l(27065);let I=e=>{let{clientId:t,shift:l,closeForm:a}=e,{t:n}=(0,i.$G)(),{submitFormData:r,isSubmitting:d}=(0,S.Z)(),{handleSubmit:x}=(0,b.Gc)(),{mutate:m}=(0,o.Prm)(),u=x(e=>{let{attachments:t,uploadedFiles:s}=e,n=null==t?void 0:t.filter(e=>e.fileKey).map(e=>e.fileKey),i=null==s?void 0:s.filter(e=>!(null==n?void 0:n.includes(e)));m({input:{keys:null!=i?i:[]}}),r(l,e).then(e=>{e&&a()})});return(0,s.jsx)(k.ZP,{clientId:t,shift:l,onSubmit:u,footer:(0,s.jsx)("div",{className:"flex flex-row-reverse",children:(0,s.jsx)(c.zx,{type:"primary",htmlType:"submit",loading:d,children:n("update_shift")})})})},O="EDIT_SHIFT_MODAL",T=e=>{let{clientId:t,shift:l,visible:a,onClose:r}=e,i=(0,n.useMemo)(()=>(0,k.ue)(l),[l]),d=(0,b.cI)({defaultValues:i}),{formState:{dirtyFields:x},reset:m,getValues:u}=d,[h,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{a||m(i)},[a,m,i]);let{mutate:p}=(0,o.Prm)(),v=()=>{let e=u("uploadedFiles");p({input:{keys:null!=e?e:[]}}),r()};return(0,s.jsx)(c.u_,{visible:a,onClose:()=>{(0,g.isEmpty)(x)?r():f(!0)},className:"sm:max-w-md",children:(0,s.jsxs)(b.RV,{...d,children:[(0,s.jsx)(c.u_.Header,{title:"Edit shift"}),(0,s.jsx)(I,{clientId:t,shift:l,closeForm:r}),(0,s.jsx)(j.Uy,{visible:h,onClose:()=>f(!1),onDiscard:v})]})},O)},E=e=>{let{shiftId:t,visible:l,onClose:a,...n}=e,{t:r}=(0,i.$G)(),{data:d}=(0,o.tx7)({id:t},{enabled:l}),x=null==d?void 0:d.shift;return x?(0,s.jsx)(T,{shift:x,visible:l,onClose:a,...n}):(0,s.jsxs)(c.u_,{visible:l,onClose:a,className:"sm:max-w-md",children:[(0,s.jsx)(c.u_.Header,{title:"Edit shift"}),(0,s.jsx)("div",{className:"-mx-6 mb-4 mt-5 overflow-y-auto border-y border-neutral-200 px-6 py-5 dark:border-neutral-700",style:{maxHeight:"calc(90vh - 8rem)"},children:(0,s.jsx)(c.Od.Block,{className:"h-[470px]"})}),(0,s.jsx)("div",{className:"flex flex-row-reverse",children:(0,s.jsx)(c.zx,{type:"primary",disabled:!0,children:r("update_shift")})})]},O)},P=e=>{let{clientId:t,shiftId:l}=e,{t:a}=(0,i.$G)(),{state:n,open:r,close:d}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.u,{content:a("edit"),children:(0,s.jsx)("button",{type:"button",className:"px-1 text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200",onClick:r,children:(0,s.jsx)(c.JO.Pencil,{className:"h-5 w-5"})})}),(0,s.jsx)(E,{clientId:t,shiftId:l,visible:n,onClose:d})]})},z=e=>{let{visible:t,onClose:l,shiftId:a}=e,{t:n}=(0,i.$G)(),r=(0,v.NL)(),d=(0,f.vN)(),{mutate:c,isPending:x}=(0,o.s3O)({onSuccess:e=>{var t,l;let s=null===(t=e.destroyShift)||void 0===t?void 0:t.result;if(s)u.Am.success(n("flash_message.success.description.deleted",{model:n("shift"),ns:"common"})),r.invalidateQueries({queryKey:["ClientJobs"]});else{let t=null===(l=e.destroyShift)||void 0===l?void 0:l.errors[0];d(t)}}});return(0,s.jsx)(j.sm,{type:"danger",confirmText:n("delete_confirm_one",{model:n("shift")}),visible:t,onClose:l,onConfirm:()=>c({input:{shiftId:a}}),btnConfirmProps:{loading:x}})},J=e=>{let{shiftId:t}=e,{t:l}=(0,i.$G)(),{state:a,open:n,close:r}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.u,{content:l("delete"),children:(0,s.jsx)("button",{type:"button",className:"px-1 text-red-500 hover:text-red-700 dark:hover:text-red-400",onClick:n,children:(0,s.jsx)(c.JO.Trash,{className:"h-5 w-5"})})}),(0,s.jsx)(z,{shiftId:t,visible:a,onClose:r})]})},G=e=>{let{shiftId:t}=e,{t:l}=(0,i.$G)(),{state:a,open:n,close:r}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.u,{content:l("publish"),children:(0,s.jsx)("button",{type:"button",className:"px-1 text-blue-500 hover:text-blue-700 dark:hover:text-blue-400",onClick:n,children:(0,s.jsx)(c.JO.Paperplane,{className:"h-5 w-5"})})}),(0,s.jsx)(j.n7,{shiftId:t,visible:a,onClose:r})]})},L=e=>{let{state:t}=e;return(0,s.jsx)(c.Ct,{color:{DRAFT:"gray",REJECTED:"red",OPENING:"indigo",ASSIGNED:"indigo",CONFIRMED:"indigo",ON_SHIFT:"indigo",ON_BREAK:"indigo",READY:"indigo",LATE:"orange",UNFILLED:"red",UNFINISHED:"orange",ABSENT:"red",FINISHED:"green",PROCESSED:"green"}[t],bordered:!0,className:"capitalize",children:t.toLowerCase().replace("_"," ")})},F=e=>{var t,l;let{client:a,shift:n}=e,{t:r}=(0,i.$G)("client"),d=(0,f.f)(n),o=(0,f.Ku)(n,{full:!0}),x=(0,f.a7)(),p=x.can("update",n),b=x.can("publish",n),v=x.can("destroy",n);return(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{className:"relative py-5 pr-6",children:[(0,s.jsxs)("div",{className:"flex items-start gap-x-6",children:[(0,s.jsx)(c.u,{arrow:!0,followMode:"none",content:null!==(l=null===(t=n.assignee)||void 0===t?void 0:t.name)&&void 0!==l?l:r("open_shift",{ns:"common"}),children:(0,s.jsx)("div",{children:n.assignee?(0,s.jsx)(c.qE,{name:n.assignee.name,imageUrl:n.assignee.avatarUrl}):(0,s.jsx)(c.dE,{className:"rounded-full"})})}),(0,s.jsxs)("div",{className:"flex-auto",children:[(0,s.jsxs)("div",{className:"flex items-start gap-x-3",children:[(0,s.jsx)("div",{className:"text-sm/6 font-medium text-neutral-900 dark:text-neutral-100",children:m.ou.fromISO(n.startTime).toLocaleStr
1ing()}),(0,s.jsxs)("div",{className:"text-sm/6",children:[(0,s.jsx)("span",{className:"font-semibold",children:d}),(0,s.jsx)("span",{className:"px-1 text-neutral-400 dark:text-neutral-500",children:"→"}),(0,s.jsx)("span",{className:"font-semibold",children:o})]}),(0,s.jsx)(L,{state:n.state})]}),(0,s.jsxs)("div",{className:"mt-1 text-xs/5 text-neutral-500 dark:text-neutral-400",children:[(0,u.BQ)((0,h.C)("minute")(m.ou.fromISO(n.endTime),m.ou.fromISO(n.startTime))-n.breakDuration),n.breakDuration>0&&r("mins_break",{minutes:n.breakDuration})]})]})]}),(0,s.jsx)("div",{className:"absolute bottom-0 right-full h-px w-screen bg-neutral-100 dark:bg-neutral-700"}),(0,s.jsx)("div",{className:"absolute bottom-0 left-0 h-px w-screen bg-neutral-100 dark:bg-neutral-700"})]}),(0,s.jsxs)("td",{className:"hidden py-5 pr-6 sm:table-cell",children:[(0,s.jsx)("div",{className:"text-sm/6 text-neutral-900 dark:text-neutral-100",children:(0,s.jsx)(j.Uj,{group:n.group})}),n.jobSite&&(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-0.5 text-xs/5 text-neutral-500 dark:text-neutral-400",children:[n.jobSite.color?(0,s.jsx)(c.JO.MapPinFill,{className:"h-4 w-4 shrink-0 ".concat((0,u.Gd)(n.jobSite.color,"paleIcon"))}):(0,s.jsx)(c.JO.MapPin,{className:"h-4 w-4 shrink-0 text-blue-500 dark:text-blue-400"}),(0,s.jsx)("span",{children:n.jobSite.name})]})]}),(0,s.jsx)("td",{className:"py-5 text-right",children:(0,s.jsxs)("div",{className:"flex justify-end gap-1 text-sm",children:[b&&(0,s.jsx)(G,{shiftId:n.id}),p&&(0,s.jsx)(P,{clientId:a.id,shiftId:n.id}),v&&(0,s.jsx)(J,{shiftId:n.id})]})})]})},D=e=>{let{client:t}=e,{t:l}=(0,i.$G)("client"),{data:a}=(0,o.rGh)({id:t.id}),r=(0,p.ZL)(null==a?void 0:a.shifts),d=m.ou.now(),x=[],u=[];r.forEach(e=>{(0,h._w)(m.ou.fromISO(e.startTime),{start:d.startOf("week"),end:d.endOf("week")})?x.push(e):u.push(e)});let f=[{name:l("this_week"),shifts:x},{name:l("others"),shifts:u}];return(0,s.jsxs)("div",{className:"mt-4 flex min-h-0 flex-1 flex-col",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 lg:px-8 xl:px-12",children:[(0,s.jsx)("h2",{className:"max-w-2xl text-base font-semibold text-neutral-900 dark:text-neutral-100 lg:max-w-none",children:l("schedule")}),(0,s.jsx)(C,{clientId:t.id,type:"primary",size:"sm",icon:(0,s.jsx)(c.JO.PlusSymbol,{}),children:l("new_shift")})]}),(0,s.jsx)("div",{className:"mt-6 flex-1 overflow-hidden overflow-y-auto border-t border-neutral-100 dark:border-neutral-700",children:(0,s.jsx)("div",{className:"mx-auto px-4 sm:px-6 lg:px-8 xl:px-12",children:(0,s.jsx)("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:max-w-none",children:(0,s.jsxs)("table",{className:"w-full text-left",children:[(0,s.jsx)("thead",{className:"sr-only",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:l("col_date_time")}),(0,s.jsx)("th",{className:"hidden sm:table-cell",children:l("col_position_job_site")}),(0,s.jsx)("th",{children:l("col_actions")})]})}),(0,s.jsx)("tbody",{children:f.map(e=>(0,s.jsxs)(n.Fragment,{children:[(0,s.jsx)("tr",{className:"text-sm/6 text-neutral-900 dark:text-neutral-100",children:(0,s.jsxs)("th",{scope:"colgroup",colSpan:3,className:"sticky top-0 isolate z-10 py-2 font-semibold",children:[(0,s.jsx)("h3",{children:e.name}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-full -z-10 w-screen border-b border-neutral-200 bg-neutral-50 dark:border-neutral-600 dar
1k:bg-neutral-700/50"}),(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 -z-10 w-screen border-b border-neutral-200 bg-neutral-50 dark:border-neutral-600 dark:bg-neutral-700/50"})]})}),e.shifts.map(e=>(0,s.jsx)(F,{client:t,shift:e},e.id))]},e.name))})]})})})})]})};var $=l(22638),A=l(10817),M=l(59183),R=l(57664),K=l(31934);let Z=e=>{var t;let{client:l}=e,{t:a}=(0,i.$G)("table"),{t:r}=(0,i.$G)("client"),[d,o]=(0,n.useState)(1),[x,m]=(0,n.useState)(0),[u,h]=(0,n.useState)(void 0),[f,j]=(0,n.useState)(void 0),{data:b,isPending:v}=(0,p.MD)({id:l.id,first:u?void 0:20,last:f?void 0:20,before:u,after:f}),N=20*d,g=null==b?void 0:b.comments.pageInfo,k=(0,$.Z)(()=>{o(e=>e-1),j(void 0),h((null==g?void 0:g.startCursor)||void 0)}),y=(0,$.Z)(()=>{o(e=>e+1),h(void 0),j((null==g?void 0:g.endCursor)||void 0)}),w=!(null==g?void 0:g.hasNextPage),_=!(null==g?void 0:g.hasPreviousPage),C=(0,p.ZL)(null==b?void 0:b.comments);return(0,n.useEffect)(()=>{var e,t;(null==b?void 0:null===(e=b.comments)||void 0===e?void 0:e.totalCount)&&m(null==b?void 0:null===(t=b.comments)||void 0===t?void 0:t.totalCount)},[null==b?void 0:null===(t=b.comments)||void 0===t?void 0:t.totalCount]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"px-8 py-4 xl:px-12",children:[(0,s.jsx)("div",{className:"flex max-w-screen-lg items-end justify-between",children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-base font-semibold leading-7 text-neutral-900 dark:text-neutral-100",children:[(0,s.jsx)("span",{children:r("notes",{ns:"common"})}),(0,s.jsx)(c.u,{content:r("notes_tooltip"),children:(0,s.jsx)(c.JO.InfoCircle,{className:"h-6 w-6 text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200"})})]})}),(0,s.jsx)(K.ZP,{uploader:"COMMENT_ATTACHMENT",children:(0,s.jsx)(R.Z,{commentableType:"CLIENT",commentableId:l.id,autoFocus:!1,containerClassName:"mx-auto max-w-screen-lg pt-4 px-0"})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-8 pb-12 pt-4 xl:px-12",children:(0,s.jsxs)("div",{className:"mx-auto max-w-screen-lg",children:[0===C.length?v?(0,s.jsx)(M.Z,{}):(0,s.jsxs)("div",{className:"my-4 py-4 text-center",children:[(0,s.jsx)(c.JO.PlusRectOutlined,{className:"mx-auto h-12 w-12 text-neutral-400/80 dark:text-neutral-500/80"}),(0,s.jsx)("h3",{className:"mt-1 text-sm font-semibold text-neutral-900 dark:text-neutral-100",children:r("no_note")}),(0,s.jsx)("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:r("no_note_description")})]}):null,(0,s.jsx)("ul",{className:"max-w-screen-lg space-y-6 pt-8",children:C.map(e=>(0,s.jsx)(A.Z,{commentableId:l.id,commentableType:"CLIENT",comment:e},e.id))})]})}),(0,s.jsx)("div",{className:"px-8 pb-4 xl:px-12",children:(0,s.jsx)("div",{className:"bg-default sticky bottom-0 left-0 right-0 z-[5] col-span-full shadow-[0_-3px_3px_-3px_rgba(48,49,61,0.1)]",children:(0,s.jsxs)("div",{className:"mx-auto flex w-full max-w-screen-lg items-center justify-between py-3",children:[(0,s.jsx)("div",{className:"text-sm",dangerouslySetInnerHTML:{__html:"<span>".concat(a("showing_results",{startIndexOfPage:"".concat((d-1)*20+1),endIndexOfPage:x>N?"".concat(N):"".concat(x),totalResults:"<b>".concat(x,"</b>")}),"</span>")}}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(c.zx,{icon:(0,s.jsx)(c.JO.ChevronLeft,{}),size:"xs",disabled:_,onClick:k,children:a("pagination.previous")}),(0,s.jsxs)(c.zx,{size:"xs",disabled:w,onClick:y,children:[(0,s.jsx)("span",{className:"ml-0.5",children:a("pagination.next")}),(0,s.jsx)(c.JO.ChevronRight,{className:"-mr-0.5 ml-1 h-4 w-4"})]})]})]})})})]})};var q=l(58575),X=l(81865),U=l(37070),B=l(94184),H=l.n(B);let Q=e=>{let{jobSites:t}=e,{t:l}=(0,i.$G)("common"),{register:a,watch:n,setValue:r}=(0,b.Gc)(),d=n("adds"),o=Object.keys(d).every(e=>d[e]),x=Object.keys(d).every(e=>!d[e]);return(0,s.jsxs)("fieldset",{className:"-mx-6 flex min-h-0 flex-1 flex-col overflow-y-scroll border-b border-neutral-200 px-6 dark:border-neutral-700",children:[(0,s.jsxs)("div",{className:"bg-default sticky top-0 z-10 -mx-6 flex items-center justify-between border-b border-neutral-200 px-6 pb-4 dark:border-neutral-700",children:[(0,s.jsx)("legend",{className:"contents font-medium text-neutral-900 dark:text-neutral-100",children:l("select_existing_job_sites")}),(0,s.jsx)(c.XZ,{indeterminate:!o&&!x,checked:o,onChange:e=>{r("adds",Object.fromEntries(Object.keys(d).map(t=>[t,e.target.checked])))}})]}),t.map((e,t)=>(0,s.jsxs)("div",{className:H()("relative flex items-center py-4",t>0&&"border-t border-neutral-200 dark:border-neutral-700"),children:[(0,s.jsx)("div",{className:"min-w-0 flex-1 text-sm",children:(0,s.jsxs)("label",{htmlFor:"jobsite-".concat(e.id),className:"flex cursor-pointer select-none items-start gap-3",children:[e.color?(0,s.jsx)(c.JO.MapPinFill,{className:"mt-0.5 h-5 w-5 shrink-0 ".concat((0,u.Gd)(e.color,"paleIcon"))}):(0,s.jsx)(c.JO.MapPin,{className:"mt-0.5 h-5 w-5 shrink-0 text-blue-500 dark:text-blue-400"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{className:"font-medium text-neutral-900 dark:text-neutral-100",children:e.name}),(0,s.jsx)("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:e.address})]})]})}),(0,s.jsx)("div",{className:"ml-3 flex h-5",children:(0,s.jsx)("input",{...a("adds.".concat(e.id)),id:"jobsite-".concat(e.id),type:"checkbox",className:"h-4 w-4 roun
1ded border-neutral-300 text-blue-600 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50 focus:ring-offset-0 dark:border-neutral-600 dark:focus:border-blue-500/60 dark:focus:ring-blue-500/40"})})]},e.id))]})},V=e=>{let{jobSites:t,clientId:l,onSuccess:s}=e,{t:a}=(0,i.$G)("common"),r=(0,v.NL)(),[d,c]=(0,n.useState)(!1),{mutateAsync:x}=(0,o.U40)(),m=(0,b.cI)({defaultValues:{adds:Object.fromEntries(t.map(e=>[e.id,!1]))}}),{handleSubmit:h}=m,f=h(async e=>{let{adds:n}=e,i=Object.keys(n).filter(e=>n[e]);if(0!==i.length){c(!0);try{let e=i.map(e=>{var s,a;let n=t.find(t=>t.id===e);if(!n)return Promise.resolve();let r=null!==(a=null===(s=n.clients)||void 0===s?void 0:s.map(e=>e.id))&&void 0!==a?a:[],i=[...r,l];return x({input:{jobSiteId:e,clientIds:i}})});await Promise.all(e),r.invalidateQueries({queryKey:["Client"]}),r.invalidateQueries({queryKey:["JobSites"]}),u.Am.success(a("flash_message.success.description.added",{model:a("job_site_plural")})),s()}catch(e){u.Am.error(a("something_went_wrong"))}finally{c(!1)}}});return[m,f,d]},W=e=>{let{client:t,closeForm:l}=e,{t:a}=(0,i.$G)("common"),r=(0,v.NL)(),{jobSites:d,isPending:o}=(0,p.V4)(),x=t.jobSites.map(e=>e.id),m=d.filter(e=>!x.includes(e.id)&&"CLIENT"===e.siteType),h=m.length>0,[f,N,g]=V({jobSites:m,clientId:t.id,onSuccess:l}),[k,y,w]=(0,U.Z)({defaultName:t.name,onSuccess:()=>{u.Am.success(a("flash_message.success.description.created",{model:a("job_site")})),r.invalidateQueries({queryKey:["Client"]}),l()}}),{watch:_}=f,C=_("adds"),S=Object.keys(C).every(e=>!C[e]),[I,O]=(0,n.useState)(!h);(0,n.useEffect)(()=>{O(!h)},[h]);let T=()=>O(!0),E=()=>O(!1);return o?(0,s.jsxs)("div",{className:"flex h-full flex-col gap-6",children:[(0,s.jsx)(c.Od.Title,{className:"flex-1"}),(0,s.jsxs)("div",{className:"flex gap-3 self-end",children:[(0,s.jsx)(c.Od.Button,{}),(0,s.jsx)(c.Od.Button,{})]})]}):(0,s.jsxs)("form",{className:"flex h-full flex-col gap-6",children:[(0,s.jsxs)("div",{className:"-mx-6 flex flex-1 overflow-y-auto px-6",children:[(0,s.jsx)(j.mJ,{fullWidth:!0,visible:!I,className:"flex flex-col overflow-y-auto",children:(0,s.jsxs)(b.RV,{...f,children:[(0,s.jsx)(c.zx,{icon:(0,s.jsx)(c.JO.PlusSymbol,{}),onClick:T,children:a("add_new_job_site")}),(0,s.jsx)("p",{className:"py-2 text-sm",children:"or"}),(0,s.jsx)(Q,{jobSites:m})]})}),(0,s.jsx)(j.mJ,{fullWidth:!0,visible:I,children:(0,s.jsx)(b.RV,{...k,children:(0,s.jsx)(X.Z,{client:t,className:"flex-1"})})})]}),I?(0,s.jsxs)("div",{className:"flex self-end",children:[h?(0,s.jsx)(c.zx,{className:"mr-3",onClick:E,children:a("back")}):(0,s.jsx)(c.zx,{className:"mr-3",onClick:l,children:a("cancel")}),(0,s.jsx)(c.zx,{type:"primary",htmlType:"submit",disabled:w,loading:w,onClick:y,children:a("add_new_job_site")})]}):(0,s.jsxs)("div",{className:"flex self-end",children:[(0,s.jsx)(c.zx,{className:"mr-3",onClick:l,children:a("cancel")}),(0,s.jsx)(c.zx,{type:"primary",htmlType:"submit",disabled:S||g,loading:g,onClick:N,children:a("add_job_sites")})]})]})},Y=e=>{let{client:t}=e,{t:l}=(0,i.$G)("common"),{state:a,open:n,close:r}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.zx,{size:"xs",icon:(0,s.jsx)(c.JO.PlusSymbol,{}),onClick:n,children:l("add_job_site")}),(0,s.jsx)(c.dy,{visible:a,onClose:r,title:(0,s.jsx)("h1",{children:l("add_job_site")}),placement:"right",children:(0,s.jsx)("div",{className:"relative mt-6 flex-1 px-4 sm:px-6","data-tour":"1-1",children:(0,s.jsx)("div",{className:"absolute inset-0 px-4 sm:px-6",children:(0,s.jsx)(W,{client:t,closeForm:r})})})})]})},ee=e=>{let{visible:t,onClose:l,jobSiteId:a}=e,{t:n}=(0,i.$G)(),r=(0,v.NL)(),d=(0,f.vN)(),{mutate:c,isPending:x}=(0,o.Tgy)({onSuccess:e=>{var t,l;let s=null===(t=e.destroyJobSite)||void 0===t?void 0:t.result;if(s)u.Am.success(n("flash_message.success.description.deleted",{model:n("job_site"),ns:"common"})),r.invalidateQueries({queryKey:["Client"]});else{let t=null===(l=e.destroyJobSite)||void 0===l?void 0:l.errors[0];d(t)}}});return(0,s.jsx)(j.sm,{type:"danger",confirmText:n("delete_confirm_one",{model:n("job_site")}),visible:t,onClose:l,onConfirm:()=>c({input:{jobSiteId:a}}),btnConfirmProps:{loading:x}})},et=e=>{let{jobSiteId:t}=e,{state:l,open:a,close:n}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"px-1 text-red-500 hover:text-red-700 dark:hover:text-red-400",onClick:a,children:(0,s.jsx)(c.JO.Trash,{className:"h-5 w-5"})}),(0,s.jsx)(ee,{jobSiteId:t,visible:l,onClose:n})]})},el=e=>{var t,l,s;let{jobSite:a,onSuccess:n}=e,{t:r}=(0,i.$G)("common"),d=(0,f.vN)(),c=[{id:"all",name:r("for_all_schedules",{ns:"common"})},{id:"some",name:r("for_specific_schedule",{ns:"common"})}],x=(0,b.cI)({defaultValues:{name:a.name,address:{place:{id:"",name:a.address,matchedSubstrings:[]},location:{lat:a.geoLat,lng:a.geoLong}},note:null!==(l=a.note)&&void 0!==l?l:void 0,color:a.color?{colorName:a.color}:void 0,attachments:(null!==(s=a.jobSiteAttachments)&&void 0!==s?s:[]).map(e=>{let{id:t,url:l}=e,s=decodeURIComponent(l.split("?")[0].split(".com/")[1]),a=s.split("/").pop()||"",n=a.split(".").pop(),r=(0,u.Un)(n);return{id:t,fileKey:s,name:a,url:l,fileType:r}}),selectScheduleType:(null===(t=a.schedules)||void 0===t?void 0:t.length)?c[1]:c[0],schedules:a.schedules?a.schedules.map(e=>({id:e.id,name:e.name,color:e.color})):[]}}),{handleSubmit:m,reset:h}=x,{mutate:p}=(0,o.Prm)(),{mutate:j,isPending:v}=(0,o.U40)({onSuccess:e=>{var t,l;let s=null===(t=e.updateJobSite)||void 0===t?void 0:t.result;if(s)h(),n(s);else{let t=null===(l=e.updateJobSite)||void 0===l?void 0:l.errors[0];d(t)}}}),N=m(e=>{var t;let{name:l,address:s,note:n,color:r,attachments:i,uploadedFiles:d,selectScheduleType:c,schedules:o}=e,x=null==i?void 0:i.map(e=>e.fileKey),m=null==d?void 0:d.filter(e=>!(null==x?void 0:x.includes(e)));p({input:{keys:null!=m?m:[]}}),s.place&&s.location&&j({input:{jobSiteId:a.id,name:l,address:s.place.name,geoLat:s.location.lat,geoLong:s.location.lng,note:n,scheduleIds:c&&"all"===c.id?[]:null!==(t=null==o?void 0:o.map(e=>e.id))&&void 0!==t?t:[],color:(null==r?void 0:r.colorName)||"",attachments:i?i.map(e=>({attachmentKey:e.fileKey})):void 0}})});return[x,N,v]},es=e=>{let{client:t,jobSite:l,closeForm:a}=e,{t:n}=(0,i.$G)(),r=(0,v.NL)(),[d,o,x]=el({jobSite:l,onSuccess:()=>{u.Am.success(n("flash_message.success.description.updated",{model:n("job_site"),ns:"common"})),r.invalidateQueries({queryKey:["Client"]}),a()}});return(0,s.jsxs)("form",{className:"flex h-full flex-col gap-6",onSubmit:o,children:[(0,s.jsx)(b.RV,{...d,children:(0,s.jsx)(X.Z,{client:t,className:"flex-1"})}),(0,s.jsxs)("div",{className:"mt-5 flex justify-end gap-5 self-stretch",children:[(0,s.jsx)(c.zx,{type:"secondary",onClick:a,children:n("cancel",{ns:"common"})}),(0,s.jsx)(c.zx,{htmlType:"submit",type:"primary",loading:x,children:n("save",{ns:"common"})})]})]})},ea=e=>{let{client:t,jobSite:l}=e,{state:a,open:n,close:r}=(0,f.X9)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"px-1 text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",onClick:n,children:(0,s.jsx)(c.JO.Pencil,{className:"h-5 w-5"})}),(0,s.jsx)(c.dy,{visible:a,onClose:r,title:(0,s.jsx)("h1",{className:"",children:"Edit Job Site"}),placement:"right",children:(0,s.jsx)("div",{className:"relative mt-6 flex-1 px-4 sm:px-6","data-tour":"1-1",children:(0,s.jsx)("div",{className:"absolute inset-0 px-4 sm:px-6",children:(0,s.jsx)(es,{client:t,jobSite:l,closeForm:r})})})})]})},en=e=>{let{className:t}=e,{t:l}=(0,i.$G)("client");return(0,s.jsxs)("div",{className:(0,q.m)("my-4 text-center",t),children:[(0,s.jsx)(c.JO.PlusRectOutlined,{className:"mx-auto h-12 w-12 text-neutral-400/80 dark:text-neutral-500/80"}),(0,s.jsx)("h3",{className:"mt-1 text-sm font-semibold text-neutral-900 dark:text-neutral-100",children:l("no_job_site")}),(0,s.jsx)("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:l("no_job_site_description")})]})},er=e=>{let{client:t}=e,{t:l}=(0,i.$G)("common"),{jobSites:a}=t;return(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-8 pb-12 pt-4 xl:px-12",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-end justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 text-base font-semibold leading-7 text-neutral-900 dark:text-neutral-100",children:[(0,s.jsx)("span",{children:l("job_site_plural")}),(0,s.jsx)(c.u,{content:l("job_sites_tooltip",{ns:"client"}),children:(0,s.jsx)(c.JO.InfoCircle,{className:"h-6 w-6 text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200"})})]}),(0,s.jsx)(Y,{client:t})]}),(0,s.jsxs)("div",{className:"border-neutral-200 text-sm text-neutral-900 dark:border-neutral-700 dark:text-neutral-100",children:[0===a.length&&(0,s.jsx)(en,{className:"py-4"}),a.map(e=>(0,s.jsxs)("div",{className:"flex items-start gap-3 py-4",children:[e.color?(0,s.jsx)(c.JO.MapPinFill,{className:"mt-0.5 h-5 w-5 shrink-0 ".concat((0,u.Gd)(e.color,"paleIcon"))}):(0,s.jsx)(c.JO.MapPin,{className:"mt-0.5 h-5 w-5 shrink-0 text-blue-500 dark:text-blue-400"}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col items-center gap-1 text-left",children:[(0,s.jsx)("div",{className:"flex self-stretch font-medium",children:e.name}
1),(0,s.jsx)("div",{className:"flex w-full self-stretch text-xs text-neutral-500 dark:text-neutral-400",children:e.address})]}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-1",children:[(0,s.jsx)(ea,{client:t,jobSite:e}),(0,s.jsx)(et,{jobSiteId:e.id})]})]},e.id))]})]})};var ei=l(85980);let ed=e=>{let{children:t,className:l="",header:a}=e;return(0,s.jsx)("div",{className:(0,q.m)(a?"sticky top-0 z-[3] flex h-12 items-center border-b border-neutral-300 bg-white px-3 text-left text-sm font-semibold text-neutral-900 dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-100":"flex h-full flex-col justify-center truncate border-b border-neutral-200 px-3 py-4 text-sm bg-white dark:border-neutral-700 dark:bg-neutral-800",l),children:t})},ec=e=>{let{contact:t,isLast:l}=e,a=[t.firstName,t.lastName].filter(Boolean).join(" "),n=l?"border-0":"";return(0,s.jsxs)("div",{className:"contents",children:[(0,s.jsx)(ed,{className:n,children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(c.qE,{name:a||"?",size:32}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,s.jsx)("span",{className:"truncate font-medium",children:a||"—"}),t.title&&(0,s.jsx)("span",{className:"truncate text-xs text-neutral-500 dark:text-neutral-400",children:t.title})]})]})}),(0,s.jsx)(ed,{className:n,children:(0,s.jsx)("span",{className:"truncate text-neutral-700 dark:text-neutral-200",children:t.email||"—"})}),(0,s.jsx)(ed,{className:n,children:(0,s.jsx)("span",{className:"truncate text-neutral-700 dark:text-neutral-200",children:t.phoneNumber||"—"})})]})},eo=e=>{var t;let{client:l}=e,{t:a}=(0,i.$G)("client"),{t:r}
1=(0,i.$G)("common"),[d,o]=(0,n.useState)(""),[x,m]=(0,n.useState)(""),[u,h]=(0,n.useState)(!1),f=(0,n.useRef)(null),{run:p}=(0,ei.Z)(e=>m(e.trim().toLowerCase()),{wait:500}),j=(0,n.useCallback)(e=>{let t=e.target.value;o(t),p(t)},[p]),b=(0,n.useCallback)(()=>{var e;o(""),m(""),null===(e=f.current)||void 0===e||e.focus()},[]),v=null!==(t=l.contacts)&&void 0!==t?t:[],N=x?v.filter(e=>{var t,l,s;let a="".concat(null!==(t=e.firstName)&&void 0!==t?t:""," ").concat(null!==(l=e.lastName)&&void 0!==l?l:"").toLowerCase();return a.includes(x)||(null!==(s=e.email)&&void 0!==s?s:"").toLowerCase().includes(x)}):v;return(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-8 pb-12 pt-4 xl:px-12",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-base font-semibold leading-7 text-neutral-900 dark:text-neutral-100",children:a("contacts")}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:u?(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(c.II,{ref:f,placeholder:"".concat(r("type_to_search"),"..."),wrapperClassName:"flex items-center pr-2",value:d,onChange:j,"aria-label":r("search"),className:"px-3 sm:text-xs",onBlur:()=>{0===d.trim().length&&h(!1)},autoFocus:!0}),d&&(0,s.jsx)("button",{type:"button",className:"absolute bottom-0 right-0 top-0 z-50 mr-1 self-center rounded-sm p-0.5 text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200",onClick:b,"aria-label":r("clear_search"),children:(0,s.jsx)(c.JO.XmarkBold,{className:"h-4 w-4"})})]}):(0,s.jsx)(c.zx,{icon:(0,s.jsx)(c.JO.Magnifyingglass,{className:"h-5 w-5"}),onClick:()=>h(!0),size:"sm",className:"border-none text-neutral-600 shadow-none dark:text-neutral-300",children:r("search")})})]}),0===N.length?(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center text-sm text-neutral-500 dark:text-neutral-400",children:a(x?"no_contacts_found":"no_contacts")}):(0,s.jsxs)("div",{className:"grid flex-1 auto-rows-min divide-y divide-neutral-200 overflow-auto dark:divide-neutral-700",style:{gridTemplateColumns:"minmax(14rem, 1fr) minmax(14rem, 1fr) minmax(10rem, 1fr)"},children:[(0,s.jsxs)("div",{className:"contents",children:[(0,s.jsx)(ed,{header:!0,children:r("name")}),(0,s.jsx)(ed,{header:!0,children:r("email")}),(0,s.jsx)(ed,{header:!0,children:a("col_phone")})]}),N.map((e,t)=>(0,s.jsx)(ec,{contact:e,isLast:t===N.length-1},"".concat(e.firstName,"-").concat(e.lastName,"-").concat(t)))]})]})},ex=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),em=e=>{let{client:t}=e,{t:l}=(0,i.$G)("client"),a=t.additionalData,n=a?Object.entries(a):[];return(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-8 pb-12 pt-4 xl:px-12",children:[(0,s.jsx)("div",{className:"mb-2 border-neutral-200 text-base font-semibold leading-7 text-neutral-900 dark:border-neutral-700 dark:text-neutral-100",children:(0,s.jsx)("span",{children:l("additional_info")})}),0===n.length?(0,s.jsx)("p",{className:"mt-4 text-sm text-neutral-500 dark:text-neutral-400",children:l("no_additional_info")}):(0,s.jsx)("dl",{className:"grid grid-cols-1 gap-2.5 pt-2 sm:grid-cols-2",children:n.map(e=>{let[t,l]=e;return(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:ex(t)}),(0,s.jsx)("dd",{className:"text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:null==l||""===l?"--":String(l)})]},t)})})]})},eu=e=>{let{client:t}=e,{t:l}=(0,i.$G)("client"),a=(0,d.useRouter)();return(0,s.jsxs)("div",{className:"relative flex h-full w-64 flex-none flex-col overflow-y-auto border-r border-neutral-200 dark:border-neutral-700",children:[(0,s.jsxs)("div",{className:"sticky left-0 right-0 top-0 flex flex-col items-center bg-white px-8 py-4 text-center text-sm dark:bg-neutral-800",children:[(0,s.jsx)("div",{className:"w-full",children:(0,s.jsxs)("button",{type:"button",onClick:()=>a.back(),className:"-ml-1 flex items-center gap-0.5 text-blue-600 dark:text-blue-400",children:[(0,s.jsx)(c.JO.ChevronLeft,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:l("back_to_clients")})]})}),(0,s.jsx)("div",{className:"w-full break-words pb-1 pt-6 text-base font-semibold",children:t.name}),(0,s.jsx)("div",{className:"w-full break-words",children:t.title}),(0,s.jsx)("div",{className:"w-full break-all",children:t.email}),(0,s.jsx)("div",{className:"w-full break-words",children:t.phoneNumber}),(0,s.jsxs)("div",{className:"flex gap-1 pt-1.5",children:[(0,s.jsx)("a",{href:"mailto:".concat(t.email),children:(0,s.jsx)(c.zx,{size:"xs",disabled:!t.email,children:l("email_button")})}),(0,s.jsx)("a",{href:"tel:".concat(t.phoneNumber),children:(0,s.jsx)(c.zx,{size:"xs",disabled:!t.phoneNumber,children:l("call_button")})})]})]}),(0,s.jsxs)("div",{className:"flex-1 px-8 pt-6",children:[(0,s.jsx)("div",{className:"border-b border-neutral-200 text-base font-semibold leading-7 text-neutral-900 dark:border-neutral-700 dark:text-neutral-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between pb-1",children:[(0,s.jsx)("span",{children:l("details")}),(0,s.jsx)(x.Z,{client:t,className:"text-neutral-500 hover:text-neutral-700",children:(0,s.jsx)(c.JO.Pencil,{className:"h-5 w-5"})})]})}),(0,s.jsxs)("dl",{className:"flex flex-col gap-2.5 pb-4 pt-2",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:l("account_number")}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:t.clientNumber||"--"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:l("email_button")}),(0,s.jsx)("dd",{className:"break-all text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:t.email||"--"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:l("phone_number")}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:t.phoneNumber||"--"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:l("billing_address")}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:t.billingAddress||"--"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:l("tags")}
1),(0,s.jsx)("dd",{className:"flex flex-wrap gap-1 text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:0===t.tags.length?"--":t.tags.map(e=>{let{name:t,colorName:l}=e;return(0,s.jsx)(c.Vp,{color:l,children:t},t)})})]})]}),t.entities.map(e=>(0,s.jsxs)(n.Fragment,{children:[(0,s.jsx)("div",{className:"border-b border-neutral-200 text-base font-semibold leading-7 text-neutral-900 dark:border-neutral-700 dark:text-neutral-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between pb-1 pt-2",children:[(0,s.jsx)("span",{children:e.entitySchema.name}),(0,s.jsx)("button",{type:"button",children:(0,s.jsx)(c.JO.Pencil,{className:"h-5 w-5 text-neutral-900 dark:text-neutral-100"})})]})}),(0,s.jsxs)("dl",{className:"flex flex-col gap-2.5 pb-4 pt-2",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:"Full name"}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:"Margot Danny"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:"Full name"}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:"Margot Danny"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("dt",{className:"text-sm font-medium leading-6 text-neutral-900 dark:text-neutral-100",children:"Full name"}),(0,s.jsx)("dd",{className:"break-words text-sm leading-5 text-neutral-700 dark:text-neutral-200",children:"Margot Danny"})]})]})]},e.id))]})]})},eh=e=>{let{tabs:t,onSelect:l}=e;return(0,s.jsx)("div",{className:"flex space-x-1 rounded-lg bg-slate-100 p-0.5 dark:bg-slate-500/20",role:"tablist","aria-orientation":"horizontal",children:t.map(e=>(0,s.jsxs)("button",{className:"flex relative group items-center rounded-md py-2.5 pl-2 pr-2 text-sm font-semibold lg:pr-3",role:"tab",type:"button","aria-selected":e.current,"aria-current":e.current,onClick:()=>l(e),children:[(0,s.jsx)("span",{className:"z-10 text-slate-600 group-aria-selected:text-slate-900 dark:text-slate-300 dark:group-aria-selected:text-slate-100 lg:ml-2",children:e.name}),e.badge&&(0,s.jsx)("span",{className:"z-10 ml-2 hidden rounded-full bg-slate-200 px-2.5 py-0.5 text-xs font-medium text-slate-600 group-aria-selected:bg-slate-200 group-aria-selected:text-slate-900 dark:text-slate-300 dark:group-aria-selected:text-slate-100 md:inline-block",children:e.badge}),e.current&&(0,s.jsx)(r.E.span,{layoutId:"filterBubble",className:"absolute inset-0 z-0 rounded-md bg-white shadow dark:bg-neutral-800",transition:{type:"spring",bounce:.2,duration:.6}})]},e.name))})},ef=()=>{var e,t;let{t:l}=(0,i.$G)("client"),a=(0,d.useRouter)(),r=a.query.id,{data:x,isPending:m,isError:u}=(0,o.fmp)({id:r}),h=null==x?void 0:x.client,f=[{name:l("notes",{ns:"common"}),Component:Z},{name:l("schedule"),Component:D},{name:l("job_site_plural",{ns:"common"}),Component:er},{name:l("contacts"),Component:eo},{name:l("additional_info"),Component:em}],[p,j]=(0,n.useState)(f[0].name),b=null!==(t=null===(e=f.find(e=>e.name===p))||void 0===e?void 0:e.Component)&&void 0!==t?t:f[0].Component;return m?(0,s.jsx)("div",{className:"m-auto",children:(0,s.jsx)(c.yC,{})}):u?(0,s.jsx)("div",{className:"mx-8 mt-8 xl:mx-12",children:l("error_loading")}):h?(0,s.jsxs)("div",{className:"flex flex-auto overflow-hidden",children:[(0,s.jsx)(eu,{client:h}),(0,s.jsxs)("div",{className:"relative flex h-full flex-1 flex-col overflow-y-hidden",children:[(0,s.jsx)("div",{className:"px-4 pb-2 pt-4 xl:px-12 xl:pt-8",children:(0,s.jsx)(eh,{tabs:f.map(e=>{let{name:t}=e;return{name:t,current:t===p}}),onSelect:e=>j(e.name)})}),(0,s.jsx)(b,{client:h})]})]}):(0,s.jsx)("div",{className:"mx-8 mt-8 xl:mx-12",children:l("nothing_to_show")})},ep=()=>(0,s.jsx)(ef,{});ep.getLayout=e=>(0,s.jsx)(a.Z,{title:"Camelo | Clients",containerClassNames:"px-0 py-0 h-full print:max-h-full print:overflow-none overflow-hidden flex flex-col",topBarClassNames:"border-b",children:e});var ej=!0,eb=ep}},function(e){e.O(0,[1255,1204,7536,959,3609,944,497,6799,2921,4287,13,1555,817,7802,2266,1956,9724,9774,2888,179],function(){return e(e.s=37437)}),_N_E=e.O()}]);
2//# sourceMappingURL=[id]-77d637a9340532a6.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.