PageSourceSearch

https://www.app.buildhive.be/_next/static/chunks/2qclxjwmklzt7.js?dpl=dpl_49MEZVe2r8BmTHqsGxwRCEc1zE7P

js buildhive.be collected 2026-10-02 15:54:55 UTC 62,057 bytes, 4 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3600902c-b314-d68b-cb7a-39a027afba57")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,698282,e=>{"use strict";var t=e.i(391398);e.i(20799);var s=e.i(131235),a=e.i(140095),r=e.i(8820),n=e.i(770084),i=e.i(618890),o=e.i(857792);e.i(689243);var l=e.i(61449),c=e.i(191788);e.i(47620);var d=e.i(271179),m=e.i(743465),u=e.i(390886),p=e.i(966291),h=e.i(261028),x=e.i(753291);e.i(437501);var f=e.i(907252);let g=(0,l.observer)(function(e){let{t:l}=(0,d.useTranslation)(),[g,j]=(0,c.useState)(!1),b="onProjectSelect"in e&&"function"==typeof e.onProjectSelect,v=b?e.selectedProjectId:void 0,N=b?e.onProjectSelect:void 0,y=b?null:e.registration,C=!!b||e.canEdit,_=b?void 0:e.onProjectChange,w=!0===e.hideNoProject,k=!0===e.compact,S=!0===e.includeArchived,[T,P]=(0,c.useState)(!1),D=s.Project.findAllActive(),I=(0,c.useMemo)(()=>[...D].sort((e,t)=>e.project_name.localeCompare(t.project_name)),[D]),A=(0,c.useMemo)(()=>I.filter(e=>e.active),[I]),M=(0,c.useMemo)(()=>I.filter(e=>!e.active),[I]),E=T?s.Project.findAllArchived().sort((e,t)=>e.project_name.localeCompare(t.project_name)):[],F=b?v:y?.project_id,R=(0,c.useMemo)(()=>(0,f.findSelectedProject)(D,F)??(F?s.Project.find(F):void 0),[D,F]),L=e=>{if(b&&N){N(e.project_id),j(!1);return}y&&((0,o.runInAction)(()=>{y.project_id=e.project_id,y.project_phase=e.project_phase,y.project_subphase=""}),_?.(),j(!1))},$=e=>!!F&&(e.project_id===F||e.id===F);return(0,t.jsxs)(p.Popover,{open:b?g:C&&g,onOpenChange:e=>{j(e),e||P(!1)},children:[(0,t.jsx)(p.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(m.Button,{variant:k?"ghost":"input-style",size:k?"sm":void 0,role:"combobox","aria-expanded":g,"data-testid":"project-selector-button",className:(0,x.cn)("justify-between",k?"h-6 min-w-[100px] max-w-[140px] border-0 px-1.5 text-xs font-normal shadow-none":(0,u.timesheetFieldSurfaceVariants)({surface:"combobox"}),!b&&!C&&"cursor-default"),onClick:()=>(b||C)&&j(!0),type:"button",children:[(0,t.jsx)("span",{className:(0,x.cn)("truncate",!F&&"text-muted-foreground font-normal"),children:F?R?.project_name:l("Select project...")}),(0,t.jsx)(i.ChevronsUpDown,{className:(0,x.cn)("shrink-0 opacity-60",k?"h-3.5 w-3.5":"opacity-50")})]})}),(0,t.jsx)(p.PopoverContent,{className:"w-[220px] p-0",children:(0,t.jsxs)(h.Command,{children:[(0,t.jsx)(h.CommandInput,{placeholder:l("Search project..."),className:"h-9"}),(0,t.jsxs)(h.CommandList,{onWheel:e=>e.stopPropagation(),children:[(0,t.jsx)(h.CommandEmpty,{children:l("No project found.")}),!w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.CommandGroup,{children:(0,t.jsxs)(h.CommandItem,{value:"no-project",onSelect:()=>{y&&((0,o.runInAction)(()=>{y.project_id=void 0,y.project_phase=void 0,y.project_subphase=""}),_?.(),j(!1))},children:[l("No project"),(0,t.jsx)(n.Check,{className:(0,x.cn)("ml-auto",F?"opacity-0":"opacity-100")})]})}),(0,t.jsx)(h.CommandSeparator,{})]}),A.length>0&&(0,t.jsx)(h.CommandGroup,{heading:l("My projects"),children:A.map(e=>(0,t.jsxs)(h.CommandItem,{value:e.project_name+(e.project_number??""),keywords:[e.project_name,e.id],onSelect:()=>L(e),children:[e.project_name," ",e.project_number&&(0,t.jsx)("span",{className:"text-[0.85em] text-muted-foreground",children:e.project_number}),(0,t.jsx)(n.Check,{className:(0,x.cn)("ml-auto",$(e)?"opacity-100":"opacity-0")})]},e.id||e.project_id))}),A.length>0&&M.length>0&&(0,t.jsx)(h.CommandSeparator,{}),M.length>0&&(0,t.jsx)(h.CommandGroup,{heading:l("All projects"),children:M.map(e=>(0,t.jsxs)(h.CommandItem,{value:e.project_name+(e.project_number??""),keywords:[e.project_name,e.id],onSelect:()=>L(e),children:[e.project_name," ",e.project_number&&(0,t.jsx)("span",{className:"text-[0.85em] text-muted-foreground",children:e.project_number}),(0,t.jsx)(n.Check,{className:(0,x.cn)("ml-auto",$(e)?"opacity-100":"opacity-0")})]},e.id||e.project_id))}),(A.length>0||M.length>0)&&E.length>0&&(0,t.jsx)(h.CommandSeparator,{}),E.length>0&&(0,t.jsx)(h.CommandGroup,{heading:l("Archive"),children:E.map(e=>(0,t.jsxs)(h.CommandItem,{value:e.project_name+(e.project_number??""),keywords:[e.project_name,e.id],onSelect:()=>L(e),children:[e.project_name," ",e.project_number&&(0,t.jsx)("span",{className:"text-[0.85em] text-muted-foreground",children:e.project_number}),(0,t.jsx)(n.Check,{className:(0,x.cn)("ml-auto",$(e)?"opacity-100":"opacity-0")})]},e.id||e.project_id))}),S&&!T&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.CommandSeparator,{}),(0,t.jsx)(h.CommandGroup,{children:(0,t.jsxs)(h.CommandItem,{value:"show-archived-projects",forceMount:!0,onSelect:()=>{P(!0),a.ProjectHydrator.hydrateArchived().catch(e=>{console.error("[ProjectSelector] archived project hydration failed:",e)})},className:"gap-2 text-muted-foreground","data-testid":"project-selector-show-archived",children:[(0,t.jsx)(r.Archive,{className:"size-4","aria-hidden":!0}),l("Show archived projects")]})})]})]})]})})]})});e.s(["ProjectSelector",0,g])},744847,e=>{"use strict";let t=(0,e.i(369547).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],744847)},720491,e=>{"use strict";var t=e.i(191788);e.i(47620);var s=e.i(271179),a=e.i(156642);e.s(["useProjectPhase",0,()=>{let{t:e}=(0,s.useTranslation)();return{getPhaseLabel:(0,t.useCallback)(t=>{switch(t){case a.ProjectPhaseName.DESIGN:return e("Design");case a.ProjectPhaseName.EXECUTION:return e("Execution");case a.ProjectPhaseName.PERMITS:return e("Permits");case a.ProjectPhaseName.TENDER:return e("Tender");default:return t}},[e])}}])},437501,907252,e=>{"use strict";var t=e.i(757752),s=e.i(156642);let a=e=>{if(!e)return;let t=e instanceof Date?e:"string"==typeof e?new Date(e):void 0;if(!(!t||Number.isNaN(t.getTime())))return new Date(t.getFullYear(),t.getMonth(),t.getDate())};e.s(["QUICK_DURATION_PRESETS",0,[15,30,60,120],"calculateRegistrationTotals",0,e=>e.reduce((e,t)=>
2{let s=t.hours_spent||0,a=t.minutes_spent||0;return{totalHours:e.totalHours+s+a/60,totalKilometers:e.totalKilometers+(t.distance||0),totalCosts:e.totalCosts+(t.cost||0)}},{totalHours:0,totalKilometers:0,totalCosts:0}),"convertKmToMi",0,e=>Number((.621371*e).toFixed(2)),"convertMiToKm",0,e=>Number((e/.621371).toFixed(2)),"filterEntitiesWithRegistrations",0,(e,t,s,a,r)=>{if(!s||!a||0===t.length)return e;let n=new Set(t.map(e=>"user"===r?e.user_id:e.project_id).filter(e=>"string"==typeof e));return e.filter(e=>{let t="user"===r?e.user_id:e.project_id;return t&&n.has(t)})},"findSelectedProject",0,(e,t)=>{if(t)return e.find(e=>e.project_id===t||e.id===t)},"formatDateKey",0,e=>{if(!e)return;let t=a(e);if(!t)return;let s=t.getFullYear(),r=`${t.getMonth()+1}`.padStart(2,"0"),n=`${t.getDate()}`.padStart(2,"0");return`${s}-${r}-${n}`},"getAvailableDefaults",0,(e,t)=>{let s=e.map(e=>e.value.toLowerCase());return t.filter(e=>!s.includes(e.toLowerCase()))},"getPhaseDisplayName",0,(e,t)=>t({design:"Design",permit:"Permits",tender:"Tender",execution:"Execution"}[e]||e),"getProjectPhaseOrder",0,e=>{if(!e||"object"!=typeof e)return[...s.PROJECT_PHASE_DISPLAY_ORDER];let t=[...s.PROJECT_PHASE_DISPLAY_ORDER].map(e=>e.toString());if(e.isFullyHydrated){let s=e.project_phases??[];if(Array.isArray(s)&&s.length>0){let e=s.map(e=>e?.name).filter(e=>"string"==typeof e&&t.includes(e));if(e.length>0)return e}}let a=e.project_phase;return a&&s.PROJECT_PHASE_DISPLAY_ORDER.includes(a)?[a,...s.PROJECT_PHASE_DISPLAY_ORDER.filter(e=>e!==a)]:[...s.PROJECT_PHASE_DISPLAY_ORDER]},"getTaskTypeLabel",0,e=>{if(!e)return;let s=t.TaskType.findAll().find(t=>t.value===e);if(s)return s.value;let a=t.TaskType.find(e);return a?a.value:e},"normalizeDateValue",0,a],907252),e.s([],437501)},235797,e=>{"use strict";var t=e.i(391398);let s=(0,e.i(369547).default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var a=e.i(191788);e.i(47620);var r=e.i(271179),n=e.i(658839),i=e.i(537782),o=e.i(753291);let l=a.forwardRef((e,a)=>{let{className:l,label:c,showLabel:d=!1,...m}=e,{t:u}=(0,r.useTranslation)(),p=c??u("Admin only"),h=d?"gap-1":(0,o.cn)("h-[22px] w-[22px] items-center justify-center rounded-full p-[3px]"),x=(0,t.jsxs)(n.Badge,{ref:a,variant:"admin-only",size:"default",className:(0,o.cn)("flex items-center justify-center",h,l),...m,children:[(0,t.jsx)(s,{size:12}),d&&(0,t.jsx)("span",{children:p})]});return(0,t.jsx)(i.TooltipProvider,{children:(0,t.jsxs)(i.Tooltip,{children:[(0,t.jsx)(i.TooltipTrigger,{asChild:!0,children:x}),(0,t.jsx)(i.TooltipContent,{className:"max-w-[300px] text-center whitespace-pre-wrap word-break-break-word text-xs text-white bg-foreground ",children:(0,t.jsx)("p",{children:u("This section is only visible to company administrators. Other team members will not see it.")})})]})})});l.displayName="AdminBadge",e.s(["AdminBadge",0,l],235797)},824573,e=>{"use strict";var t=e.i(68231),s=e.i(594216),a=e.i(943486),r=e.i(81877);async function n(e){e&&await Promise.all([s.ProjectBudgetHydrator.hydrateByProject(e),r.UserCostRateHydrator.hydrateByProject(e),r.UserCostRateHydrator.hydrateCompany(),t.FixedCostHydrator.hydrateByProject(e),t.FixedCostHydrator.hydrateCompany(),a.TaskCostExceptionHydrator.hydrateByProject(e),a.TaskCostExceptionHydrator.hydrateCompany()])}e.s(["hydrateProjectCostContext",0,n])},23761,931439,e=>{"use strict";var t=e.i(857792),s=e.i(191788);e.i(47620);var a=e.i(271179);e.i(20799);var r=e.i(916484),n=e.i(131235),i=e.i(457680),o=e.i(824573),l=e.i(248558),c=e.i(907252);
2e.s(["useSharedTimesheetCardLogic",0,e=>{let{editRegistration:d,onDateChange:m,onDeleted:u,onSaved:p,onClose:h,isOwner:x=!0,presetUser:f,presetProjectId:g,selectedDate:j,presetDate:b,presetStartTime:v,presetEndTime:N,presetUserId:y,isAdminMode:C=!1,onSubmitOverride:_,skipDefaultValidation:w=!1,autoFillEndTimeWithCurrent:k=!1,onSaveMetadata:S,onValidationError:T,onSuccessMessage:P}=e,{t:D}=(0,a.useTranslation)(),[I,A]=(0,s.useState)(null),[M,E]=(0,s.useState)(0),[F,R]=(0,s.useState)("00:00"),[L,$]=(0,s.useState)(!1),[B,H]=(0,s.useState)(!1),[O,U]=(0,s.useState)(!1),z=(0,s.useRef)(0),V=(0,s.useRef)(b||j),K=(0,s.useRef)(v),W=(0,s.useRef)(N),G=!!d,Y=!G||x,J=(0,s.useMemo)(()=>f||(d?.user?d.user:y?r.CompanyUser.find(y)??r.CompanyUser.getCurrent():r.CompanyUser.getCurrent()),[f,d,y]),q=n.Project.findAllActive(),Q=(0,s.useMemo)(()=>{let e=I?.project_id||g;return(0,c.findSelectedProject)(q,e)??(e?n.Project.find(e):void 0)},[q,I?.project_id,g]),Z=(0,s.useMemo)(()=>(0,c.normalizeDateValue)(I?.date),[I?.date]);(0,s.useEffect)(()=>{if(!I||G)return;let e=I.project_id;if(!e)return;let s=++z.current,a=n.Project.find(e),r=a=>{if(s!==z.current||!a||I.project_id!==e)return;let r=a.project_subphase;r&&(0,t.runInAction)(()=>{I.project_subphase=r})};a?.isFullyHydrated?r(a):(H(!0),n.Project.hydrateById(e).then(e=>r(e)).catch(t=>console.error("[useSharedTimesheetCardLogic] Failed to hydrate project",e,t)).finally(()=>{s===z.current&&H(!1)}))},[I,I?.project_id,G]),(0,s.useEffect)(()=>{let e=I?.project_id;if(!e)return;let t=!1;return U(!0),(0,o.hydrateProjectCostContext)(e).catch(t=>console.error("[useSharedTimesheetCardLogic] Failed to hydrate project cost context",e,t)).finally(()=>{t||U(!1)}),()=>{t=!0}},[I?.project_id]),(0,s.useEffect)(()=>{if(d){let e=i.TimeRegistration.createDraft(d.user_id);(0,t.runInAction)(()=>{e.project_id=d.project_id,e.project_phase=d.project_phase,e.project_subphase=d.project_subphase,e.task_type=d.task_type,e.date=d.date?new Date(d.date):new Date,e.start_time=(0,l.convertTimeToHHmm)(d.start_time),e.end_time=(0,l.convertTimeToHHmm)(d.end_time),e.break_time=d.break_time,e.hours_spent=d.hours_spent,e.minutes_spent=d.minutes_spent,e.cost=d.cost;let t=d.total_cost,s=e.computedTotalCost;e.total_cost="number"==typeof t&&Math.abs(t-s)>.01?t:void 0,e.currency=d.currency,e.distance=d.distance,e.distance_unit=d.distance_unit,e.description=d.description,e.user_id=d.user_id,e.is_locked=d.is_locked,e.invoice_id=d.invoice_id,e.is_extra_works=d.is_extra_works}),A(e)}else{let e=i.TimeRegistration.createDraft(J?.user_id||"");(0,t.runInAction)(()=>{e.project_phase=void 0,g&&(e.project_id=g);let t=V.current,s=K.current,a=W.current;t?e.date=t instanceof Date?t:new Date(t):e.date||(e.date=new Date),s&&(e.start_time=s),a&&(e.end_time=a)}),A(e)}},[d,J,g]),(0,s.useEffect)(()=>{if(!I)return;let e=!1;(0,t.runInAction)(()=>{I.currency||(I.currency="EUR",e=!0),I.distance_unit||(I.distance_unit="km",e=!0)}),e&&E(e=>e+1)},[I]),(0,s.useEffect)(()=>{let e=b||j;if(!I||G||!e||I.project_id||I.project_phase||I.task_type||I.start_time||I.end_time||I.hours_spent||I.minutes_spent||I.description)return;let s=(0,c.formatDateKey)(I.date),a="string"==typeof e?(0,c.formatDateKey)(new Date(e)):(0,c.formatDateKey)(e);s!==a&&a&&((0,t.runInAction)(()=>{I.date="string"==typeof e?new Date(a):(0,c.normalizeDateValue)(e)??I.date}),E(e=>e+1))},[I,j,b,G]),(0,s.useEffect)(()=>{if(!I)return void R("00:00");let e=I.start_time||"",t=k?(0,l.formatTimeFromDate)(new Date):I.end_time||"",s=I.break_time||"",a=I.durationLabel||"";e&&t?R(i.TimeRegistration.calculateWorkedHours(e,t,s)):a&&""!==a?R(a):R("00:00")},[I,M,k]);let X=(0,s.useCallback)(e=>{if(!I)return;let s=e??new Date,a=(0,l.formatDateToISO)(s);(0,c.formatDateKey)(I.date)!==a&&((0,t.runInAction)(()=>{I.date=new Date(a)}),E(e=>e+1),m?.(a))},[I,m]),ee=(0,s.useCallback)(()=>{h?.()},[h]),et=async()=>{if(I){if(!J?.displayName?.trim()||C&&!f&&!d&&!J)return void T?.(C&&!f?D("Select a user!"):D("User not logged in!"));if(!_){let e=F&&"00:00"!==F&&"0:00"!==F&&""!==F&&"0"!==F&&"0:0"!==F&&"00:0"!==F,t=I.hasCosts,s=I.distance&&I.distance>0;if(!e&&!t&&!s&&!w)return void T?.(D("Enter at least time, cost, or distance for this registration."))}if((0,t.runInAction)(()=>{I.setDurationFromString(F),I.user_id=J.user_id,I.updated_at=new Date().toISOString()}),_){await _({registration:I,workedHours:F,selectedUser:J,selectedProject:Q}),p?.();return}if(G&&d)(0,t.runInAction)(()=>{d.project_id=I.project_id,d.project_phase=I.project_phase,d.project_subphase=I.project_subphase,d.task_type=I.task_type,d.date=I.date,d.start_time=I.start_time,d.end_time=I.end_time,d.break_time=I.break_time,d.hours_spent=I.hours_spent,d.minutes_spent=I.minutes_spent,d.cost=I.cost,d.total_cost=I.total_cost,d.currency=I.currency,d.distance=I.distance,d.distance_unit=I.distance_unit,d.description=I.description,d.user_id=I.user_id,d.is_extra_works=I.is_extra_works,d.updated_at=I.updated_at}),d.save(),P?.(D("Time registration updated successfully!")),p?.();else{I.save();let e=i.TimeRegistration.createDraft(J.user_id);(0,t.runInAction)(()=>{e.project_phase=void 0,g&&(e.project_id=g)}),A(e),P?.(D("Time registration added successfully!")),p?.()}}};return{registration:I,workedHours:F,isEditMode:G,canEdit:Y,selectedUser:J,selectedProject:Q,allProjects:q,registrationDateV
2alue:Z,isDeleteDialogOpen:L,isProjectHydrating:B,isCostContextHydrating:O,handleDateSelect:X,handleClose:ee,handleManualHoursChange:e=>{if(!I)return;let s=i.TimeRegistration.formatTimeInput(e);(0,t.runInAction)(()=>{I.setDurationFromString(s),s.trim()&&":"!==s&&"0:00"!==s&&(I.start_time||I.end_time)&&(I.start_time="",I.end_time="",I.break_time="")}),R(s),E(e=>e+1)},applyQuickDuration:e=>{if(I){if(I.start_time&&I.end_time){let s=I.end_time.split(":").map(e=>parseInt(e)||0),a=60*(s[0]||0)+(s[1]||0)+e,r=Math.floor(a/60)%24,n=a%60;a<0&&(r=0,n=0);let i=`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`;(0,t.runInAction)(()=>{I.end_time=i})}else{let s=F.split(":").map(e=>parseInt(e.trim())||0),a=60*(s[0]||0)+(s[1]||0)+e,r=Math.floor(a/60).toString().padStart(2,"0"),n=(a%60).toString().padStart(2,"0"),i=`${r}:${n}`;(0,t.runInAction)(()=>{I.start_time="",I.end_time="",I.break_time="",I.setDurationFromString(i)}),R(i)}E(e=>e+1)}},handleTimeFieldChange:(e,s)=>{if(I){if((0,t.runInAction)(()=>{"start"===e&&(I.start_time=s,s.trim()&&I.durationLabel&&I.setDurationFromString("")),"end"===e&&(I.end_time=s,s.trim()&&I.durationLabel&&I.setDurationFromString("")),"break"===e&&(I.break_time=s)}),I.start_time&&I.end_time){let e=i.TimeRegistration.calculateWorkedHours(I.start_time,I.end_time,I.break_time);R(e),(0,t.runInAction)(()=>{I.setDurationFromString(e)})}else R("00:00"),(0,t.runInAction)(()=>{I.setDurationFromString("00:00")});E(e=>e+1)}},handleSubmit:et,handleDelete:()=>{I&&G&&$(!0)},handleConfirmDelete:()=>{d&&G&&(d.delete(),P?.(D("Time registration deleted successfully!")),A(null),$(!1),u?.())},handleCloseDeleteDialog:()=>{$(!1)},handleResetAllTimes:()=>{I&&((0,t.runInAction)(()=>{I.start_time="",I.end_time="",I.break_time="",I.setDurationFromString("0:00")}),R("0:00"),E(e=>e+1))},handleSaveMetadata:()=>{I&&S&&S(I)},triggerUpdate:()=>E(e=>e+1)}}],23761);var d=e.i(391398),m=e.i(898108);let u=e=>{let{className:t=""}=e;return(0,d.jsx)("div",{className:`animate-pulse bg-slate-200 rounded ${t}`,"aria-label":"Loading..."})};e.s(["default",0,()=>(0,d.jsxs)(m.Card,{className:"w-full rounded-lg xl:max-w-md h-auto md:h-[600px] 2xl:h-[600px] border-0",children:[(0,d.jsx)(m.CardHeader,{className:"pb-3",children:(0,d.jsx)(m.CardTitle,{className:"text-lg",children:(0,d.jsx)(u,{className:"h-6 w-48"})})}),(0,d.jsx)(m.CardContent,{className:"p-2 sm:p-3 md:p-4 pt-0 overflow-y-auto max-h-[calc(100%-4rem)]",children:(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,d.jsx)(u,{className:"flex-1 h-10"}),(0,d.jsx)(u,{className:"flex-1 h-10"})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,d.jsx)(u,{className:"flex-1 h-10"}),(0,d.jsx)(u,{className:"flex-1 h-10"})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 w-full sm:w-1/2",children:[(0,d.jsx)(u,{className:"h-10"}),(0,d.jsx)(u,{className:"h-10"}),(0,d.jsx)(u,{className:"h-10"})]}),(0,d.jsx)("div",{className:"w-full sm:w-1/2 flex flex-col",children:(0,d.jsx)(u,{className:"h-full min-h-[80px] sm:min-h-0"})})]}),(0,d.jsx)(u,{className:"h-16"}),(0,d.jsx)(u,{className:"h-10"}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,d.jsx)(u,{className:"w-full sm:w-1/2 h-10"}),(0,d.jsx)(u,{className:"w-full sm:w-1/2 h-10"})]}),(0,d.jsx)(u,{className:"h-8 w-32"}),(0,d.jsx)(u,{className:"h-9 w-full"})]})})]})],931439)},586761,62012,e=>{"use strict";var t=e.i(369547);let s=(0,t.default)("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);e.s(["Car",0,s],586761);let a=(0,t.default)("coins",[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]]);e.s(["Coins",0,a],62012)},528608,e=>{"use strict";var t=e.i(391398);e.i(649947);var s=e.i(525555),a=e.i(23761),r=e.i(248558),n=e.i(756043),i=e.i(600300),o=e.i(835707),l=e.i(909289);e.i(689243);var c=e.i(61449),d=e.i(191788);e.i(47620);var m=e.i(271179),u=e.i(679935),p=e.i(931439),h=e.i(743465),x=e.i(111415),f=e.i(728106),g=e.i(966291),j=e.i(898108),b=e.i(284295),v=e.i(111830),N=e.i(537782),y=e.i(25791),C=e.i(753291),_=e.i(586761),w=e.i(62012),k=e.i(857792);let S=[{code:"EUR",name:"Euro",symbol:"€",locale:"EU"}
2,{code:"USD",name:"United States Dollar",symbol:"$",locale:"US"},{code:"GBP",name:"British Pound",symbol:"£",locale:"GB"},{code:"CAD",name:"Canadian Dollar",symbol:"$",locale:"CA"},{code:"AUD",name:"Australian Dollar",symbol:"$",locale:"AU"},{code:"CHF",name:"Swiss Franc",symbol:"CHF",locale:"CH"},{code:"SEK",name:"Swedish Krona",symbol:"kr",locale:"SE"},{code:"NOK",name:"Norwegian Krone",symbol:"kr",locale:"NO"},{code:"JPY",name:"Japanese Yen",symbol:"¥",locale:"JP"},{code:"CNY",name:"Chinese Yuan",symbol:"¥",locale:"CN"},{code:"NZD",name:"New Zealand Dollar",symbol:"$",locale:"NZ"},{code:"BRL",name:"Brazilian Real",symbol:"R$",locale:"BR"},{code:"INR",name:"Indian Rupee",symbol:"₹",locale:"IN"},{code:"ZAR",name:"South African Rand",symbol:"R",locale:"ZA"}];var T=e.i(618890),P=e.i(390886);let D=e=>{let{registration:s,disabled:a=!1,amountPlaceholder:r="0.00",onUpdateTrigger:n}=e,[i,o]=(0,d.useState)(!1),l=(0,d.useMemo)(()=>S.find(e=>e.code.toLowerCase()===s.currency?.toLowerCase())??null,[s.currency]);return(0,t.jsxs)("div",{className:(0,C.cn)("flex w-full items-stretch rounded-md border border-foreground
2/10 bg-background hover:border-foreground/20 focus-within:ring-2 focus-within:ring-ring/50 focus-within:ring-offset-1",a&&"pointer-events-none"),children:[(0,t.jsxs)(g.Popover,{open:i,onOpenChange:o,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:"flex h-10 min-h-10 w-16 shrink-0 items-center justify-between gap-0.5 rounded-l-md border-0 bg-transparent pl-2 pr-1 text-left text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",disabled:a,children:[(0,t.jsx)("span",{className:"truncate text-xs font-semibold uppercase tracking-wide",children:l?.code||"---"}),(0,t.jsx)(T.ChevronsUpDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),(0,t.jsx)(g.PopoverContent,{className:"w-36 p-1.5",align:"start",children:(0,t.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:S.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>{s.currency=e.code,o(!1),n()},className:(0,C.cn)("flex items-center gap-1.5 rounded-md px-2 py-1 hover:bg-muted",e.code===s.currency&&"bg-muted"),children:[(0,t.jsx)("span",{className:"text-base leading-none",children:(e=>{if(!e)return"🏳️";let t=e.toUpperCase();return t.includes("|")?t.split("|").map(e=>e.trim().slice(0,2).replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))).join(""):t.replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))})(e.locale)}),(0,t.jsx)("span",{className:"font-semibold uppercase",children:e.code})]},e.code))})})]}),(0,t.jsx)("div",{className:"flex w-px shrink-0 self-stretch bg-border","aria-hidden":!0}),(0,t.jsx)("div",{className:"flex min-h-10 min-w-0 flex-1 items-center px-3",children:(0,t.jsx)("input",{type:"text",inputMode:"decimal","data-testid":"cost-input",defaultValue:null!=s.cost?String(s.cost):"",onChange:e=>{let t=parseFloat(e.target.value.replace(",","."));s.cost=Number.isNaN(t)?void 0:t,n()},placeholder:r,disabled:a,className:(0,C.cn)(P.nativeNumberInputClassName,"w-full flex-1",a&&"text-foreground/25")})})]})},I=[{value:"km",label:"KM"},{value:"mi",label:"MI"}],A=e=>{let{registration:s,onUpdateTrigger:a,disabled:r=!1,placeholder:n="0"}=e,[i,o]=(0,d.useState)(!1),l=(0,d.useMemo)(()=>I.find(e=>e.value===s.distance_unit),[s.distance_unit]);return(0,t.jsxs)("div",{className:(0,C.cn)("flex w-full items-stretch rounded-md border border-foreground
2/10 bg-background hover:border-foreground/20 focus-within:ring-2 focus-within:ring-ring/50 focus-within:ring-offset-1",r&&"pointer-events-none"),children:[(0,t.jsxs)(g.Popover,{open:i,onOpenChange:o,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:"flex h-10 min-h-10 w-14 shrink-0 items-center justify-between gap-0.5 rounded-l-md border-0 bg-transparent pl-2 pr-1 text-left text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",disabled:r,children:[(0,t.jsx)("span",{className:"text-xs font-semibold uppercase",children:l?.label||"--"}),(0,t.jsx)(T.ChevronsUpDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),(0,t.jsx)(g.PopoverContent,{className:"w-28 p-1.5",align:"start",children:(0,t.jsx)("div",{className:"flex flex-col gap-0.5 text-xs",children:I.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{s.distance_unit=e.value,o(!1),a()},className:(0,C.cn)("flex items-center gap-1.5 rounded-md px-2 py-1 hover:bg-muted",e.value===s.distance_unit&&"bg-muted"),children:(0,t.jsx)("span",{className:"font-semibold uppercase",children:e.label})},e.value))})})]}),(0,t.jsx)("div",{className:"flex w-px shrink-0 self-stretch bg-border","aria-hidden":!0}),(0,t.jsx)("div",{className:"flex min-h-10 min-w-0 flex-1 items-center px-3",children:(0,t.jsx)("input",{type:"text",inputMode:"decimal","data-testid":"distance-input",defaultValue:null!=s.distance?String(s.distance):"",onChange:e=>{let t=parseFloat(e.target.value.replace(",","."));s.distance=Number.isNaN(t)?void 0:t,a()},placeholder:n,disabled:r,className:(0,C.cn)(P.nativeNumberInputClassName,"w-full",r&&"text-foreground/25")})})]})},M=e=>{let{registration:s,canEdit:a,onUpdateTrigger:r}=e,{t:n}=(0,m.useTranslation)();return(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(b.Label,{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(_.Car,{className:"h-3 w-3"}),n("Distance")]}),(0,t.jsx)(A,{registration:s,onUpdateTrigger:r,disabled:!a},s.id)]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(b.Label,{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(w.Coins,{className:"h-3 w-3"}),n("Expense")]}),(0,t.jsx)(D,{registration:s,onUpdateTrigger:r,disabled:!a},s.id)]})]})},E=e=>{let{registration:s,canEdit:a,onUpdateTrigger:r}=e,{t:n}=(0,m.useTranslation)();return(0,t.jsx)("textarea",{id:"description",value:s?.description||"",onChange:e=>{s&&((0,k.runInAction)(()=>{s.description=e.target.value}),r())},rows:2,placeholder:n("Description"),className:"rounded-md border border-foreground
2/10 bg-background px-2 py-1.5 text-sm text-foreground shadow-xs hover:border-foreground/20 focus:border-primary focus:outline-none focus:ring-2 focus:ring-ring/40",readOnly:!a})};var F=e.i(151670),R=e.i(868462),L=e.i(224202);let $=e=>{let{canEdit:s,registrationDateValue:a,formattedDateTitle:r,userDisplayName:n,isMobileViewport:i,onDateSelect:o,onClose:l}=e,{t:c}=(0,m.useTranslation)();return(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[s?(0,t.jsx)(L.DateSelectionPopover,{value:a,onSelect:o,contentClassName:"w-fit",renderTrigger:(e,s)=>(0,t.jsxs)("button",{type:"button",className:(0,C.cn)("group flex items-center gap-2 rounded-md px-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",i?"w-full justify-between":"justify-start"),children:[(0,t.jsx)("span",{className:"text-lg md:text-xl capitalize font-semibold leading-tight tracking-tight",children:r}),(0,t.jsx)(F.Calendar,{className:(0,C.cn)("h-4 w-4 text-primary transition-colors duration-150")})]})}):(0,t.jsx)(j.CardTitle,{className:"text-lg md:text-xl capitalize",children:r}),(0,t.jsxs)("div",{className:"flex items-center gap-2 sm:justify-end",children:[(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:n}),l&&(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":c("Close"),title:c("Close"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-foreground/70 hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(R.X,{className:"h-4 w-4"})})]})]})};var B=e.i(88565),H=e.i(770084),O=e.i(322138),U=e.i(972733),z=e.i(261028);e.i(437501);var V=e.i(907252);let K=e=>{let{t}=(0,m.useTranslation)(),s=B.ProjectSubPhase.groupByPhase(),a=(0,d.useMemo)(()=>(0,V.getProjectPhaseOrder)(e),[e]),r=(0,d.useMemo)(()=>a.map(e=>{let a=s[e];return{id:e,name:(0,V.getPhaseDisplayName)(e,t),subPhases:(a||[]).map(e=>({id:e.id,label:e.id.startsWith("custom:")?e.label:t(e.label),originalLabel:e.label}))}}),[a,s,t]),n=(0,d.useMemo)(()=>r.flatMap(e=>e.subPhases.map(t=>({...t,parentId:e.id,parentName:e.name}))),[r]);return{projectPhaseOrder:a,phaseGroups:r,allSubPhaseOptions:n}},W=e=>{let{registration:s,canEdit:a,onPhaseChange:r}=e,{t:n}=(0,m.useTranslation)(),[i,o]=(0,d.useState)(!1),{projectPhaseOrder:l,phaseGroups:c}=K(s?.project),u=(0,d.useMemo)(()=>c.find(e=>e.id===s?.project_phase),[c,s?.project_phase]),p=u?.name||n("Select phase..."),x=!u;return(0,d.useEffect)(()=>{if(s&&l.length){if(!s.project_phase){if(!s.project_id)return;(0,k.runInAction)(()=>{s.project_phase=l[0]}),r?.();return}l.includes(s.project_phase)||((0,k.runInAction)(()=>{s.project_phase=l[0],s.project_subphase&&(s.project_subphase="")}),r?.())}},[s,l,r]),(0,t.jsxs)(g.Popover,{open:a&&i,onOpenChange:o,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(h.Button,{variant:"input-style",role:"combobox","aria-expanded":i,"data-testid":"phase-selector-button",className:(0,C.cn)((0,P.timesheetFieldSurfaceVariants)({surface:"combobox"}),!a&&"cursor-default",x&&"text-muted-foreground font-normal"),onClick:()=>a&&o(!0),type:"button",children:[p,(0,t.jsx)(T.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(g.PopoverContent,{className:"w-[260px] p-0",children:(0,t.jsxs)(z.Command,{children:[(0,t.jsx)(z.CommandInput,{placeholder:n("Search phase..."),className:"h-9"}),(0,t.jsx)("div",{className:"flex items-center justify-between px-3 py-2 text-xs text-muted-foreground",children:(0,t.jsx)("span",{children:n("Phases")})}),(0,t.jsxs)(z.CommandList,{onWheel:e=>e.stopPropagation(),children:[(0,t.jsx)(z.CommandEmpty,{children:n("No phase found.")}),!s?.project_id&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z.CommandGroup,{children:(0,t.jsxs)(z.CommandItem,{value:"no-phase","data-testid":"phase-option-none",className:(0,C.cn)(s?.project_phase?'[&[data-selected="true"]]:bg-transparent [&[data-selected="true"]]:text-foreground hover:bg-transparent':""),onSelect:()=>{s&&((0,k.runInAction)(()=>{s.project_phase=void 0,s.project_subphase=""}),r?.(),o(!1))},children:[n("No phase"),(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",s?.project_phase?"opacity-0":"opacity-100")})]})}),(0,t.jsx)(z.CommandSeparator,{})]}),(0,t.jsx)(z.CommandGroup,{children:c.map(e=>(0,t.jsxs)(z.CommandItem,{value:e.name,keywords:[e.name,e.id],"data-testid":`phase-option-${e.id}`,onSelect:()=>{var t;return t=e.id,void(s&&((0,k.runInAction)(()=>{s.project_phase=t,s.project_subphase&&(s.project_subphase="")}),r?.(),o(!1)))},children:[e.name,(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",s?.project_phase===e.id?"opacity-100":"opacity-0")})]},e.id))})]})]})})]})},G=e=>{let s,{registration:a,canEdit:r,onPhaseChange:n,isLoading:o=!1}=e,{t:l}=(0,m.useTranslation)(),[c,u]=(0,d.useState)(!1),[p,x]=(0,d.useState)(!1),[f,j]=(0,d.useState)(""),b=(0,y.useIsMobileDialog)(),{allSubPhaseOptions:v}=K(a?.project),_=(0,d.useMemo)(()=>[...a?.project_phase?v.filter(e=>e.parentId===a.project_phase):v].sort((e,t)=>
2e.label.localeCompare(t.label)),[v,a?.project_phase]);(0,d.useEffect)(()=>{!a||!o&&a.project_subphase&&(_.some(e=>e.label===a.project_subphase||e.originalLabel===a.project_subphase)||((0,k.runInAction)(()=>{a.project_subphase=""}),n?.()))},[a,_,n,o]);let w=(0,d.useMemo)(()=>!f.trim()||_.some(e=>e.label.toLowerCase()===f.toLowerCase()),[f,_]),S=(0,d.useMemo)(()=>a?.project_phase?(0,V.getPhaseDisplayName)(a.project_phase,l):"",[a?.project_phase,l]),D=(0,d.useMemo)(()=>{if(!a?.project_subphase)return l("Select sub phase...");let e=v.find(e=>e.label===a.project_subphase);if(e)return e.label;let t=v.find(e=>e.originalLabel===a.project_subphase);return t?.label||a.project_subphase||l("Select sub phase...")},[a?.project_subphase,v,l]);return(0,t.jsxs)(g.Popover,{open:r&&!o&&c,onOpenChange:u,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(h.Button,{variant:"input-style",role:"combobox","aria-expanded":c,className:(0,C.cn)((0,P.timesheetFieldSurfaceVariants)({surface:"combobox"}),(!r||o)&&"cursor-default",!a?.project_subphase&&"text-muted-foreground font-normal"),onClick:()=>r&&!o&&u(!0),type:"button",disabled:o,children:[(0,t.jsx)("span",{className:"flex-1 min-w-0 truncate text-left",children:D}),o?(0,t.jsx)(O.Loader2,{className:"shrink-0 h-4 w-4 animate-spin opacity-60"}):(0,t.jsx)(T.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(g.PopoverContent,{className:"w-[260px] p-0",children:(0,t.jsxs)(z.Command,{shouldFilter:!1,children:[(0,t.jsx)(z.CommandInput,{placeholder:l("Search sub phase..."),className:"h-9",value:f,onValueChange:j}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:l("Sub phases")}),b?(0,t.jsxs)(g.Popover,{open:p,onOpenChange:x,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"About sub phases",type:"button",className:"cursor-pointer text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),x(!0)},children:(0,t.jsx)(i.Info,{className:"h-4 w-4"})})}),(0,t.jsxs)(g.PopoverContent,{side:"right",align:"center",className:"max-w-xs text-xs",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:l("What are sub phases?")}),(0,t.jsx)("p",{className:"mb-1",children:l("Sub phases are reusable steps your team can choose when logging time for extra detail.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:l("Manage sub phases from the Templates tab. Add new sub phases there to make them available here.")})]})]}):(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(i.Info,{className:"h-4 w-4 cursor-help text-muted-foreground"})}),(0,t.jsxs)(N.TooltipContent,{side:"right",align:"center",className:"max-w-xs text-xs",children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:l("What are sub phases?")}),(0,t.jsx)("p",{className:"mb-1",children:l("Sub phases are reusable steps your team can choose when logging time for extra detail.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:l("Manage sub phases from the Templates tab. Add new sub phases there to make them available here.")})]})]})})]}),(0,t.jsx)(z.CommandList,{className:"max-h-40 overflow-y-auto",onWheel:e=>e.stopPropagation(),children:(s=f?_.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())):_,(0,t.jsxs)(t.Fragment,{children:[0===s.length&&f&&w&&(0,t.jsx)(z.CommandEmpty,{children:l("No sub phases found.")}),(0,t.jsx)(z.CommandGroup,{children:(0,t.jsxs)(z.CommandItem,{value:"no-sub-phase",className:(0,C.cn)(a?.project_subphase?'[&[data-selected="true"]]:bg-transparent [&[data-selected="true"]]:text-foreground hover:bg-transparent':""),onSelect:()=>{a&&((0,k.runInAction)(()=>{a.project_subphase=""}),n?.(),u(!1))},children:[l("No sub phase"),(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",a?.project_subphase?"opacity-0":"opacity-100")})]})}),s.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z.CommandSeparator,{}),(0,t.jsx)(z.CommandGroup,{children:s.map(e=>(0,t.jsxs)(z.CommandItem,{value:e.label,keywords:[e.label,e.parentName||"",e.id],onSelect:()=>{var t;return t=e.label,void(a&&((0,k.runInAction)(()=>{a.project_subphase=t}),n?.(),u(!1)))},children:[e.label,(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",a?.project_subphase===e.label?"opacity-100":"opacity-0")})]},e.id))})]}),f.trim()&&!w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z.CommandSeparator,{}),(0,t.jsx)(z.CommandGroup,{children:a?.project_phase?(0,t.jsxs)(z.CommandItem,{onSelect:()=>{f.trim()&&a?.project_phase&&(B.ProjectSubPhase.create({phase:a.project_phase,value:f.trim()}).save(),(0,k.runInAction)(()=>{a&&(a.project_subphase=f.trim())}),n?.(),j(""),u(!1))},className:"bg-accent/50 hover:bg-accent",children:[(0,t.jsx)(U.Plus,{className:"mr-2 h-4 w-4"}),l('Add "{{query}}" to {{phase}}',{query:f.trim(),phase:S})]}):(0,t.jsx)("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(U.Plus,{className:"h-4 w-4 opacity-50"}),(0,t.jsx)("span",{children:l("Select a phase first to add a sub phase")})]})})})]})]}))})]})})]})};var Y=e.i(698282),J=e.i(757752);let q=e=>{let s,{registration:a,canEdit:r,onTaskChange:n}=e,{t:o}=(0,m.useTranslation)(),[l,c]=(0,d.useState)(!1),[u,p]=(0,d.useState)(!1),[x,f]=(0,d.useState)(""),j=(0,y.useIsMobileDialog)(),b=J.TaskType.findAll(
2),v=(0,d.useMemo)(()=>b.map(e=>{let t=e.label||e.value||e.id,s=e.id.startsWith("custom:task")?t:o(t);return{id:e.id,name:"string"==typeof s?s:t}}).sort((e,t)=>e.name.localeCompare(t.name)),[b,o]),_=(0,d.useMemo)(()=>{if(!a?.task_type)return;let e=b.find(e=>e.value===a.task_type);if(e){let t=v.find(t=>t.id===e.id);return t?.name||a.task_type}let t=v.find(e=>e.name===a.task_type);return t?t.name:a.task_type},[a?.task_type,v,b]);(0,d.useEffect)(()=>{a?.task_type&&b.some(e=>e.value===a.task_type)},[a,b,n]);let w=(0,d.useMemo)(()=>!x.trim()||v.some(e=>e.name.toLowerCase()===x.toLowerCase()),[x,v]);return(0,t.jsxs)(g.Popover,{open:r&&l,onOpenChange:c,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(h.Button,{variant:"input-style",role:"combobox","aria-expanded":l,className:(0,C.cn)((0,P.timesheetFieldSurfaceVariants)({surface:"combobox"}),!r&&"cursor-default",!_&&"text-muted-foreground font-normal"),onClick:()=>r&&c(!0),type:"button",children:[(0,t.jsx)("span",{className:"flex-1 min-w-0 truncate text-left",children:_||o("Select task...")}),(0,t.jsx)(T.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(g.PopoverContent,{className:"w-[260px] p-0",children:(0,t.jsxs)(z.Command,{shouldFilter:!1,children:[(0,t.jsx)(z.CommandInput,{placeholder:o("Search task..."),className:"h-9",value:x,onValueChange:f}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:o("Tasks")}),j?(0,t.jsxs)(g.Popover,{open:u,onOpenChange:p,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:"cursor-pointer text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),p(!0)},children:(0,t.jsx)(i.Info,{className:"h-4 w-4"})})}),(0,t.jsxs)(g.PopoverContent,{side:"right",align:"center",className:"max-w-xs text-xs",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:o("What are tasks?")}),(0,t.jsx)("p",{className:"mb-1",children:o("Tasks are reusable activities your team can choose when logging time for extra context.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:o("Manage tasks from the Templates tab. Add new tasks there to make them available here.")})]})]}):(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(i.Info,{className:"h-4 w-4 cursor-help text-muted-foreground"})}),(0,t.jsxs)(N.TooltipContent,{side:"right",align:"center",className:"max-w-xs text-xs",children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:o("What are tasks?")}),(0,t.jsx)("p",{className:"mb-1",children:o("Tasks are reusable activities your team can choose when logging time for extra context.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:o("Manage tasks from the Templates tab. Add new tasks there to make them available here.")})]})]})})]}),(0,t.jsx)(z.CommandList,{onWheel:e=>e.stopPropagation(),children:(s=x?v.filter(e=>e.name.toLowerCase().includes(x.toLowerCase())):v,(0,t.jsxs)(t.Fragment,{children:[0===s.length&&x&&w&&(0,t.jsx)(z.CommandEmpty,{children:o("No task found.")}),(0,t.jsx)(z.CommandGroup,{children:(0,t.jsxs)(z.CommandItem,{value:"no-task",className:(0,C.cn)(a?.task_type?'[&[data-selected="true"]]:bg-transparent [&[data-selected="true"]]:text-foreground hover:bg-transparent':""),onSelect:()=>{a&&((0,k.runInAction)(()=>{a.task_type=""}),n?.(),c(!1))},children:[o("No task"),(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",a?.task_type?"opacity-0":"opacity-100")})]})}),s.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z.CommandSeparator,{}),(0,t.jsx)(z.CommandGroup,{children:s.map(e=>{let s=b.find(t=>t.id===e.id),r=s?.value||e.name;return(0,t.jsxs)(z.CommandItem,{value:e.name,keywords:[e.name,e.id],onSelect:()=>(e=>{if(!a)return;let t=b.find(t=>t.id===e),s=t?.value||e;(0,k.runInAction)(()=>{a.task_type=s}),n?.(),c(!1)})(e.id),children:[e.name,(0,t.jsx)(H.Check,{className:(0,C.cn)("ml-auto",a?.task_type===r?"opacity-100":"opacity-0")})]},e.id)})})]}),x.trim()&&!w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z.CommandSeparator,{}),(0,t.jsx)(z.CommandGroup,{children:(0,t.jsxs)(z.CommandItem,{onSelect:()=>{if(!x.trim()||!a)return;let e=x.trim();J.TaskType.create({value:e}).save(),(0,k.runInAction)(()=>{a.task_type=e}),n?.(),f(""),c(!1)},className:"bg-accent/50 hover:bg-accent",children:[(0,t.jsx)(U.Plus,{className:"mr-2 h-4 w-4"}),o('Add "{{query}}" as task',{query:x.trim()})]})})]})]}))})]})})]})};var Q=e.i(918324),Z=e.i(710710),X=e.i(366709);e.i(638271);var ee=e.i(482701);let et=Array.from({length:25},(e,t)=>t),es=Array.from({length:60},(e,t)=>t),ea=(0,C.cn)("-mr-1 flex size-9 shrink-0 items-center justify-center rounded-md","text-muted-foreground transition-colors","hover:bg-muted/60 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","disabled:pointer-events-none disabled:opacity-50"),er=e=>{let{value:s,onChange:a,disabled:i=!1,placeholder:o,id:l,label:c,fieldLabel:u,showClock:p=!0}=e,{t:x}=(0,m.useTranslation)(),f=(0,d.useId)(),j=l??f,[b,v]=(0,d.useState)(!1),[N,y]=(0,d.useState)(""),[_,w]=(0,d.useState)(!1),[k,S]=(0,d.useState)(!1),[T,P]=(0,d.useState)(!1);(0,d.useEffect)(()=>{P(!0);let e=()=>{S(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let D="breakTime"===l,I=(0,d.useMemo)(()=>{let e=x("00:00",{defaultValue:"00:00"});return u?.trim()||!o?.trim()?e:`${o} \xb7 ${e}`},[u,o,x]),{hours:A,minutes:M}=(0,d.useMemo)(()=>
2{if(!s||""===s)return{hours:0,minutes:0};let e=s.split(":"),t=e[0]?parseInt(e[0],10):0,a=e[1]?parseInt(e[1],10):0,r=Number.isNaN(t)?0:Math.max(0,Math.min(24,t));return{hours:r,minutes:24===r||Number.isNaN(a)?0:Math.max(0,Math.min(59,a))}},[s]),E=(0,d.useMemo)(()=>""!==N?N:s&&""!==s?`${String(A).padStart(2,"0")}:${String(M).padStart(2,"0")}`:"",[s,A,M,N]),F=c?(0,t.jsx)("span",{id:`${j}-suffix`,className:"select-none px-0.5 text-xs font-medium text-muted-foreground","aria-hidden":!0,children:c}):null,R=e=>(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-0.5",children:[F,e]}),L=(0,C.cn)("min-w-0 text-xs tabular-nums",_&&"border-destructive focus-visible:ring-destructive",i&&"!opacity-100"),$={id:j,type:"text",value:E,onChange:e=>{let t=e.target.value;if(""===t){a(""),y(""),w(!1);return}let s=t.replace(/\D/g,"");if(""===s){a(""),y(""),w(!1);return}let n=D?(0,r.parseNumericBreakTime)(s):(0,r.parseNumericTime)(s);n&&n.isValid?(a(`${String(n.hours).padStart(2,"0")}:${String(n.minutes).padStart(2,"0")}`),w(!1),s.length<=3?y(s):y("")):(w(!0),y(s))},onBlur:function(){if(_){if(w(!1),y(""),s&&s.includes(":"))return;a("");return}if(""!==N){let e=D?(0,r.parseNumericBreakTime)(N):(0,r.parseNumericTime)(N);e&&e.isValid&&a(`${String(e.hours).padStart(2,"0")}:${String(e.minutes).padStart(2,"0")}`),y("");return}if(s&&""!==s){let e=s.split(":");if(1===e.length&&e[0]){let t=parseInt(e[0],10);if(!Number.isNaN(t)){let e=Math.max(0,Math.min(24,t));a(`${String(e).padStart(2,"0")}:00`)}}else if(2===e.length){let t=parseInt(e[0]||"0",10),s=parseInt(e[1]||"0",10);if(!Number.isNaN(t)&&!Number.isNaN(s)){let e=Math.max(0,Math.min(24,t)),r=24===e?0:Math.max(0,Math.min(59,s));a(`${String(e).padStart(2,"0")}:${String(r).padStart(2,"0")}`)}}}y("")},placeholder:I,disabled:i,className:L,readOnly:i},B=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Break"===c?x("Hours"):x("Hour")}),(0,t.jsx)("div",{className:"flex max-h-[200px] flex-col gap-1 overflow-y-auto pr-2",children:et.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{a(`${String(e).padStart(2,"0")}:${String(M).padStart(2,"0")}`),y(""),w(!1)},className:(0,C.cn)("w-12 rounded-md px-2 py-1 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",A===e&&"bg-accent font-semibold text-accent-foreground"),"aria-label":x("Select {{hour}} hours",{hour:e}),children:String(e).padStart(2,"0")},e))})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Break"===c?x("Minutes"):x("Minute")}),(0,t.jsx)("div",{className:"flex max-h-[200px] flex-col gap-1 overflow-y-auto pr-2",children:es.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{a(`${String(A).padStart(2,"0")}:${String(e).padStart(2,"0")}`),y(""),w(!1)},className:(0,C.cn)("w-12 rounded-md px-2 py-1 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",M===e&&"bg-accent font-semibold text-accent-foreground"),"aria-label":x("Select {{minute}} minutes",{minute:e}),children:String(e).padStart(2,"0")},e))})]})]}),(0,t.jsx)("div",{className:"mt-3 flex justify-end border-t pt-3",children:(0,t.jsx)(h.Button,{type:"button",variant:"borderless",size:"sm",onClick:()=>v(!1),children:x("Done")})})]}),H=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex justify-center gap-4 py-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"mb-2 text-sm font-semibold text-muted-foreground",children:"Break"===c?x("Hours"):x("Hour")}),(0,t.jsx)("div",{className:"flex max-h-[240px] flex-col gap-2 overflow-y-auto pr-2",children:et.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{a(`${String(e).padStart(2,"0")}:${String(M).padStart(2,"0")}`),y(""),w(!1)},className:(0,C.cn)("min-h-[44px] w-14 rounded-md px-3 py-2 text-base transition-colors hover:bg-accent hover:text-accent-foreground",A===e&&"bg-accent font-semibold text-accent-foreground"),"aria-label":x("Select {{hour}} hours",{hour:e}),children:String(e).padStart(2,"0")},e))})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"mb-2 text-sm font-semibold text-muted-foreground",children:"Break"===c?x("Minutes"):x("Minute")}),(0,t.jsx)("div",{className:"flex max-h-[240px] flex-col gap-2 overflow-y-auto pr-2",children:es.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{a(`${String(A).padStart(2,"0")}
2:${String(e).padStart(2,"0")}`),y(""),w(!1)},className:(0,C.cn)("min-h-[44px] w-14 rounded-md px-3 py-2 text-base transition-colors hover:bg-accent hover:text-accent-foreground",M===e&&"bg-accent font-semibold text-accent-foreground"),"aria-label":x("Select {{minute}} minutes",{minute:e}),children:String(e).padStart(2,"0")},e))})]})]}),(0,t.jsx)("div",{className:"flex justify-end border-t pt-4",children:(0,t.jsx)(h.Button,{type:"button",onClick:()=>v(!1),className:"min-h-[44px] px-6",children:x("Done")})})]}),O=e=>u?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:j,className:"w-15 shrink-0 text-left text-xs font-medium leading-tight text-foreground",children:u}),(0,t.jsx)("div",{className:"min-w-0 flex-1",children:e})]}):e,U=F?(0,t.jsx)("div",{className:"flex min-w-0 items-center gap-0.5",children:F}):void 0;return O(p?T?k?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee.Input,{...$,trailingIcon:R((0,t.jsx)("button",{type:"button",className:(0,C.cn)(ea,"size-11"),disabled:i,"aria-label":x("Open time picker"),onClick:e=>{e.preventDefault(),i||v(!0)},children:(0,t.jsx)(n.Clock,{className:"h-5 w-5 shrink-0"})}))}),(0,t.jsx)(X.Dialog,{open:b,onOpenChange:v,children:(0,t.jsxs)(X.DialogContent,{className:"w-fit max-w-xs",children:[(0,t.jsx)(X.DialogHeader,{children:(0,t.jsx)(X.DialogTitle,{children:x("Select Time")})}),H]})})]}):(0,t.jsxs)(g.Popover,{open:b,onOpenChange:v,children:[(0,t.jsx)(ee.Input,{...$,trailingIcon:R((0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:ea,disabled:i,"aria-label":x("Open time picker"),"aria-expanded":b,onClick:e=>{i||e.preventDefault()},children:(0,t.jsx)(n.Clock,{className:"h-4 w-4 shrink-0"})})}))}),(0,t.jsx)(g.PopoverContent,{className:"w-auto p-3",align:"start",children:B})]}):(0,t.jsxs)(g.Popover,{open:b,onOpenChange:v,children:[(0,t.jsx)(ee.Input,{...$,trailingIcon:R((0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:ea,disabled:i,"aria-label":x("Open time picker"),"aria-expanded":b,onClick:e=>{i||e.preventDefault()},children:(0,t.jsx)(n.Clock,{className:"h-4 w-4 shrink-0"})})}))}),(0,t.jsx)(g.PopoverContent,{className:"w-auto p-3",align:"start",children:B})]}):(0,t.jsx)(ee.Input,{...$,trailingIcon:U}))},en=e=>{let{startTime:s,endTime:a,breakTime:n,workedHours:i,canEdit:o,onTimeFieldChange:l,onManualHoursChange:c,applyQuickDuration:u,hideQuickTimeButtons:p=!1,onResetAllTimes:x}=e,{t:f}=(0,m.useTranslation)(),[g,j]=(0,d.useState)(""),[b,v]=(0,d.useState)(!1),N=(0,t.jsxs)("div",{className:(0,C.cn)("flex min-h-0 flex-col gap-1.5",!p&&"sm:min-w-40 sm:max-w-48"),children:[(0,t.jsxs)("div",{className:(0,C.cn)("relative flex min-h-[2.75rem] flex-1 flex-col sm:min-h-0",p&&"min-h-[12rem] sm:min-h-0"),children:[(0,t.jsx)("input",{id:"workedHours",type:"text",value:b&&""!==g?g:i,onChange:e=>{let t=e.target.value;if(""===t){j(""),c("");return}t.includes(":")?j(t):j(t.replace(/\D/g,""))},onFocus:()=>v(!0),onBlur:()=>{if(v(!1),""===g)return;if(j(""),!g)return void c("");let e=g.split(":");if(2===e.length){let t=parseInt(e[0]||"0",10),s=parseInt(e[1]||"0",10);if(!Number.isNaN(t)&&!Number.isNaN(s)){let e=Math.max(0,Math.min(59,s));c(`${t}:${String(e).padStart(2,"0")}`)}return}let t=(0,r.parseNumericDuration)(g);if(t&&t.isValid)c(`${t.hours}:${String(t.minutes).padStart(2,"0")}`);else{let e=parseInt(g,10);!Number.isNaN(e)&&e>=0?c(`${e}:00`):j("")}},readOnly:!o,placeholder:"0:00",className:(0,C.cn)((0,P.timesheetFieldSurfaceVariants)({surface:"duration"}),"min-h-[2.75rem] py-2",p&&"sm:min-h-[8.5rem]",o&&"px-9",!p&&"sm:h-full",p?"text-3xl sm:text-4xl sm:py-6":"text-lg sm:text-xl",!o&&"!opacity-100")}),o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex w-9 items-center justify-center",children:(0,t.jsx)("button",{type:"button",onClick:()=>{j(""),x?x():c("0:00")},className:"text-muted-foreground hover:text-primary pointer-events-auto rounded-sm p-1 transition-colors","aria-label":"Reset all times",children:(0,t.jsx)(R.X,{className:"h-4 w-4"})})}),(0,t.jsxs)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex w-9 flex-col items-center justify-center gap-0",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{j(""),u(1)},className:"text-muted-foreground hover:text-primary pointer-events-auto rounded-sm p-0.5 transition-colors","aria-label":"Add 1 minute",children:(0,t.jsx)(Z.ChevronUp,{className:"h-4 w-4"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{j(""),u(-1)},className:"text-muted-foreground hover:text-primary pointer-events-auto rounded-sm p-0.5 transition-colors","aria-label":"Subtract 1 minute",children:(0,t.jsx)(Q.ChevronDown,{className:"h-4 w-4"})})]})]})]}),o&&!p&&(0,t.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4 sm:gap-1.5",children:V.QUICK_DURATION_PRESETS.map(e=>(0,t.jsxs)(h.Button,{type:"button",variant:"secondary",size:"sm",className:"h-9 text-xs",onClick:()=>u(e),children:["+",e,"'"]},e))})]});return(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-stretch sm:gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,t.jsx)(er,{id:"startTime",fieldLabel:f("Start time"),showClock:!1,value:s,onChange:e=>l("start",e),disabled:!o}),(0,t.jsx)(er,{id:"endTime",fieldLabel:f("End time"),showClock:!1,value:a,onChange:e=>l("end",e),disabled:!o}),(0,t.jsx)(er,{id:"breakTime",fieldLabel:f("Break"),showClock:!1,value:n,onChange:e=>l("break",e),disabled:!o})]}),N]})};var ei=e.i(436254),eo=e.i(235797);let el=(0,c.observer)(function(e){let{registration:s,canEdit:a,onUp
2dateTrigger:r,isCostContextHydrating:n=!1}=e,{t:i}=(0,m.useTranslation)(),[o,l]=(0,d.useState)(!1),c=s.effectiveTotalCost,u=n?"…":c>0?`€${c.toFixed(2)}`:"-",p=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(n){p.current=null;return}null===p.current&&(p.current=s.effectiveTotalCost)},[n]);let h=p.current,x=null!==h?c-h:0,f=!n&&Math.abs(x)>.01,g=f?`${x>0?"+":"−"}€${Math.abs(x).toFixed(2)}`:"";return(0,t.jsxs)("div",{className:(0,C.cn)("flex items-center justify-between gap-2",!a&&"opacity-60"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eo.AdminBadge,{}),(0,t.jsx)(b.Label,{className:"text-xs font-medium text-muted-foreground",children:i("Total cost")})]}),o&&a?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-foreground/10 bg-background px-2 focus-within:border-foreground/20 focus-within:ring-2 focus-within:ring-ring/40",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"€"}),(0,t.jsx)("input",{type:"number",step:.01,min:0,defaultValue:c>0?c.toFixed(2):"",placeholder:"0.00",autoFocus:!0,onFocus:e=>e.currentTarget.select(),onBlur:e=>{var t=e.target.value;if(""===t)(0,k.runInAction)(()=>{s.total_cost=void 0});else{let e=Number(t);(0,k.runInAction)(()=>{s.total_cost=Number.isNaN(e)?void 0:e})}r(),l(!1)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.target.blur()):"Escape"===e.key&&(e.preventDefault(),l(!1))},className:(0,C.cn)(P.nativeNumberInputClassName,"h-7 w-20 text-right text-sm")})]}):(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[f&&(0,t.jsx)("span",{className:(0,C.cn)("rounded-sm bg-muted px-1 py-0.5 text-[10px] font-medium tabular-nums",x>0?"text-primary":"text-muted-foreground"),title:i("Change since opening: {{value}}",{value:g}),children:g}),(0,t.jsxs)("button",{type:"button",onClick:()=>a&&l(!0),disabled:!a,className:(0,C.cn)("group -mx-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-sm font-semibold tabular-nums text-foreground",a&&"cursor-text hover:bg-muted/50"),title:a?i("Click to override"):void 0,children:[(0,t.jsx)("span",{children:u}),a&&(0,t.jsx)(ei.Pencil,{className:"h-3 w-3 text-muted-foreground/30 transition-colors group-hover:text-muted-foreground/80"})]})]})]})}),ec=(0,c.observer)(e=>{let{editRegistration:c,onDateChange:_,onDeleted:w,onSaved:k,onClose:S,isOwner:T=!0,border:P=!0,presetUser:D,presetProjectId:I,presetDate:A,presetStartTime:F,presetEndTime:R,isAdminMode:L=!1,hideQuickTimeButtons:B=!1,autoFillEndTimeWithCurrent:H=!1,onSaveMetadata:O,hideDeleteButton:U=!1}=e,{t:z}=(0,m.useTranslation)(),{user:V}=(0,s.useAuth)(),K=(0,y.useIsMobileDialog)(),J=(0,d.useId)(),[Q,Z]=(0,d.useState)(!1),{registration:X,workedHours:ee,isEditMode:et,canEdit:es,selectedUser:ea,registrationDateV
2alue:er,isDeleteDialogOpen:ei,isProjectHydrating:eo,isCostContextHydrating:ec,handleDateSelect:ed,handleClose:em,handleManualHoursChange:eu,applyQuickDuration:ep,handleTimeFieldChange:eh,handleSubmit:ex,handleDelete:ef,handleConfirmDelete:eg,handleCloseDeleteDialog:ej,handleResetAllTimes:eb,handleSaveMetadata:ev,triggerUpdate:eN}=(0,a.useSharedTimesheetCardLogic)({editRegistration:c,onDateChange:_,onDeleted:w,onSaved:k,onClose:S,isOwner:T,presetUser:D,presetProjectId:I,presetDate:A,presetStartTime:F,presetEndTime:R,presetUserId:V?.id,isAdminMode:L,onSaveMetadata:O,onValidationError:e=>u.toast.error(z(e)),onSuccessMessage:e=>u.toast.success(z(e))}),ey=er?er.toLocaleDateString("nl-NL",{weekday:"short",day:"numeric",month:"long",year:"numeric"}):z("No date selected");if(!ea||!X)return(0,t.jsx)(p.default,{});let eC=!0===X.is_locked,e_=es&&!eC,ew=U||eC,ek=(0,C.cn)(P?"w-full xl:max-w-md flex flex-col md:max-h-[820px]":K?"w-full flex flex-col max-h-[90vh] overflow-y-auto":"w-full flex flex-col max-h-[820px] overflow-y-auto",P?"rounded-xl border border-border/60 bg-card shadow-sm":"rounded-xl border-0 bg-card",e_?"":"flex flex-col"),eS=P||!K?"px-5 pb-5":"px-5 pb-5 max-h-[70vh] overflow-y-auto";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(j.Card,{className:ek,children:[(0,t.jsx)(j.CardHeader,{className:(0,C.cn)("pb-3","p-5"),children:(0,t.jsx)($,{canEdit:e_,registrationDateV
2alue:er,formattedDateTitle:ey,userDisplayName:ea.displayName,isMobileViewport:K,onDateSelect:ed,onClose:S})}),(0,t.jsxs)(j.CardContent,{className:(0,C.cn)("pt-0",P&&"flex-1",eS),children:[eC&&(0,t.jsxs)("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:[(0,t.jsx)(o.Lock,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:z("This time registration is attached to an invoice and can no longer be edited.")})]}),(0,t.jsxs)("form",{className:(0,C.cn)("flex flex-col",P?"gap-3":"gap-2.5"),onSubmit:e=>{e.preventDefault(),ex()},children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)(Y.ProjectSelector,{registration:X,canEdit:e_,onProjectChange:eN}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[(0,t.jsx)(W,{registration:X,canEdit:e_,onPhaseChange:eN}),(0,t.jsx)(G,{registration:X,canEdit:e_,onPhaseChange:eN,isLoading:eo})]})]}),(0,t.jsx)(q,{registration:X,canEdit:e_,onTaskChange:eN}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.Checkbox,{id:J,checked:X.is_extra_works??!1,disabled:!e_,onCheckedChange:e=>{X.is_extra_works=!0===e,eN()}}),(0,t.jsx)(b.Label,{htmlFor:J,className:"text-sm text-muted-foreground cursor-pointer",children:z("Extra work")}),K?(0,t.jsxs)(g.Popover,{open:Q,onOpenChange:Z,children:[(0,t.jsx)(g.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":z("What is extra work?"),type:"button",className:"cursor-pointer text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),Z(!0)},children:(0,t.jsx)(i.Info,{className:"h-4 w-4"})})}),(0,t.jsxs)(g.PopoverContent,{side:"top",align:"center",className:"max-w-xs text-xs",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:z("What is extra work?")}),(0,t.jsx)("p",{className:"mb-1",children:z("Extra work is considered outside the fee estimate, so you can indicate which hours were not initially planned in the budget.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:z("In a project without a fee estimate, this is also treated as a separate part.")})]})]}):(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(i.Info,{"aria-label":z("What is extra work?"),className:"h-4 w-4 cursor-help text-muted-foreground"})}),(0,t.jsxs)(N.TooltipContent,{side:"top",align:"center",className:"max-w-xs text-xs",children:[(0,t.jsx)("p",{className:"font-semibold mb-1",children:z("What is extra work?")}),(0,t.jsx)("p",{className:"mb-1",children:z("Extra work is considered outside the fee estimate, so you can indicate which hours were not initially planned in the budget.")}),(0,t.jsx)("p",{className:"text-muted-foreground",children:z("In a project without a fee estimate, this is also treated as a separate part.")})]})]})})]}),(0,t.jsx)(v.Separator,{className:"my-1"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(b.Label,{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(n.Clock,{className:"h-3 w-3"}),z("Time")]}),(0,t.jsx)(en,{startTime:X.start_time||"",endTime:H?(0,r.formatTimeFromDate)(new Date):X.end_time||"",breakTime:X.break_time||"",workedHours:ee,canEdit:e_,onTimeFieldChange:eh,onManualHoursChange:eu,applyQuickDuration:ep,hideQuickTimeButtons:B,onResetAllTimes:eb})]}),(0,t.jsx)(M,{onUpdateTrigger:eN,registration:X,canEdit:e_}),(0,t.jsx)(E,{onUpdateTrigger:eN,registration:X,canEdit:e_}),et&&V?.isCompanyAdmin&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.Separator,{className:"my-1"}),(0,t.jsx)(el,{registration:X,canEdit:e_,onUpdateTrigger:eN,isCostContextHydrating:ec})]}),e_&&(0,t.jsxs)("div",{className:"flex flex-row items-center gap-2",children:[et&&!ew&&(0,t.jsx)(h.Button,{type:"button",size:"sm",variant:"ghost",onClick:ef,"aria-label":z("Delete"),title:z("Delete"),className:"h-7 w-7 shrink-0 p-0 text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10",children:(0,t.jsx)(l.Trash2,{size:8})}),O?(0,t.jsx)(h.Button,{size:"sm",className:"ml-auto bg-primary text-primary-foreground hover:bg-primary/80 border-none text-sm px-5",type:"button",onClick:ev,"data-testid":"timesheet-save-button",children:z("Save")}):(0,t.jsx)(h.Button,{size:"sm",className:"ml-auto bg-primary text-primary-foreground hover:bg-primary/80 border-none text-sm px-5",type:"submit","data-testid":"timesheet-save-button",children:z("Save")})]})]})]}),!e_&&(0,t.jsx)("div",{className:"p-2 sm:p-3 md:p-4 pt-0 border-t",children:(0,t.jsx)(h.Button,{type:"button",size:"sm",onClick:em,className:"w-full text-sm bg-primary text-primary-foreground hover:bg-primary/80 border-none",children:z("Close")})})]}),(0,t.jsx)(f.PermanentDeleteConfirmationDialog,{open:ei,onClose:ej,onConfirm:eg,title:z("Delete"),description:z("Are you sure you want to delete this time registration?"),cancelLabel:z("Cancel"),confirmLabel:z("Delete"),requireConfirmationText:!1})]})});e.s(["default",0,ec],528608)}]);
3
4//# debugId=3600902c-b314-d68b-cb7a-39a027afba57

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.