1!function(){try{var 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]="23480cbd-df4e-48be-bf81-639a32a58d93",e._sentryDebugIdIdentifier="sentry-dbid-23480cbd-df4e-48be-bf81-639a32a58d93")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4985],{39013:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cabinet/appointments-list",function(){return s(31222)}])},92570:function(e,t,s){"use strict";s.d(t,{r:function(){return w},R:function(){return T}});var a=s(2784),r=s(92958);let n=e=>{let t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(s,"-").concat(a)},i=()=>{let e=new Date,t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(s,"-").concat(a)};var l=s(4397);let o=e=>{let t={};return l.S.forEach((s,a)=>{t[a.toString()]=e.includes(s)}),t},c=e=>{let t=[];return Object.entries(e).forEach(e=>{let[s,a]=e;if(a){let e=parseInt(s,10);e>=0&&e<l.S.length&&t.push(l.S[e])}}),t},u=(e,t)=>{if(!e)return[];let s=e.find(e=>e.corresponded_date===t);return s?c(s.work_time):[]},d=(e,t)=>!!e&&e.some(e=>e.corresponded_date===t),h=(e,t)=>{let s=Object.keys(e),a=Object.keys(t);return s.length===a.length&&s.every(s=>e[s]===t[s])},m=e=>{let t=new Date(e);return 0===t.getDay()?7:t.getDay()},f=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;if(!e)return[];let s=new Set(e.filter(e=>Object.values(e.work_time).some(e=>e)).map(e=>e.day_of_week));if(0===s.size)return[];let a=[],r=new Date;r.setHours(0,0,0,0);for(let e=0;e<t;e++){let t=new Date(r);t.setDate(r.getDate()+e);let n=0===t.getDay()?7:t.getDay();s.has(n)&&a.push(new Date(t))}return a},p=e=>e?e.filter(e=>!Object.values(e.work_time).some(e=>e)).map(e=>new Date(e.corresponded_date)):[],x=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;if(!e)return[];let s=new Set(e.filter(e=>!Object.values(e.work_time).some(e=>e)).map(e=>e.day_of_week));if(0===s.size)return[];let a=[],r=new Date;r.setHours(0,0,0,0);for(let e=0;e<t;e++){let t=new Date(r);t.setDate(r.getDate()+e);let n=0===t.getDay()?7:t.getDay();s.has(n)&&a.push(new Date(t))}return a},g=(e,t)=>e?e.filter(e=>{let s=Object.values(e.work_time).some(e=>e);if(!t)return s;let a=m(e.corresponded_date),r=t.find(e=>e.day_of_week===a);return r?!h(e.work_time,r.work_time):s}).map(e=>new Date(e.corresponded_date)):[],w=e=>{let{workerId:t,configId:s}=e,l=(0,a.useMemo)(()=>i(),[]),{data:h,isLoading:m,error:w}=(0,r.GL)({worker_id:t,config_id:s,date_start:l,interval_in_days:100}),{data:_,isLoading:y}=(0,r._O)({worker_id:t,config_id:s}),b=(0,r.Hf)(),j=(0,a.useMemo)(()=>g(h,_),[h,_]),S=(0,a.useMemo)(()=>f(_,100),[_]),v=(0,a.useMemo)(()=>{let e=new Set((null!=h?h:[]).map(e=>e.corresponded_date));return[...x(_,100).filter(t=>!e.has(n(t))),...p(h)]},[h,_]),M=(0,a.useCallback)(e=>{let t=n(e);if(d(h,t))return u(h,t);if(_){let t=0===e.getDay()?7:e.getDay(),s=_.find(e=>e.day_of_week===t);if(s&&Object.values(s.work_time).some(e=>e))return c(s.work_time)}return[]},[h,_]),T=(0,a.useCallback)(e=>{if(!_)return[];let t=0===e.getDay()?7:e.getDay(),s=_.find(e=>e.day_of_week===t);return s&&Object.values(s.work_time).some(e=>e)?c(s.work_time):[]},[_]),N=(0,a.useCallback)(async(e,a)=>{if(!t||!s)return;let r=n(e);try{await b.mutateAsync({params:{worker_id:t,config_id:s},data:[{worker_id:t,corresponded_date:r,work_time:o(a)}]})}catch(e){throw console.error("Failed to save special work time:",e),e}},[t,s,b]);return{specialDates:j,markedDates:S,holidayDates:v,isLoading:m||y,isSaving:b.isPending,error:w,getTimeSlotsForSelectedDate:M,getDefaultTimeSlotsForDate:T,handleSaveTimeSlots:N}};var _=s(18149),y=s.n(_),b=s(71703),j=s(54882),S=s(97588),v=s(19139),M=s(21847);let T=e=>{let{workerId:t,configId:s}=e,n=(0,j.pm)(),{t:i}=(0,S.$)([b.s2.THERAPIST_CABINET]),{data:l,isLoading:o,error:c}=(0,r._O)({worker_id:t,config_id:s}),u=(0,r._j)(),d=(0,a.useMemo)(()=>l?(0,M.q)(l):(0,v.C)(),[l]),[h,m]=(0,a.useState)(d);a.useEffect(()=>{m(d)},[d]);let f=(0,a.useCallback)((e,t)=>{m(s=>s.map(s=>s.Time===e?{...s,[t]:!s[t]}:s))},[]),p=(0,a.useCallback)(()=>{m(d)},[d]),x=(0,a.useCallback)(async()=>
1{if(!t||!s){console.error("Cannot save: workerId or configId is missing",{workerId:t,configId:s});return}let e=(0,M.J)(h,t);try{await u.mutateAsync({params:{worker_id:t,config_id:s},data:e}),n.success(i("".concat(b.s2.THERAPIST_CABINET,":schedule-update-title")),i("".concat(b.s2.THERAPIST_CABINET,":schedule-update-description")))}catch(e){console.error("Failed to save schedule:",e),n.error(i("".concat(b.s2.THERAPIST_CABINET,":schedule-update-error")))}},[h,t,s,u,n,i]),g=(0,a.useMemo)(()=>!y()(h,d),[h,d]);return{scheduleData:h,initialTableData:d,hasUnsavedChanges:g,isLoading:o,isSaving:u.isPending,error:c,handleToggle:f,handleCancel:p,handleSave:x}}},19139:function(e,t,s){"use strict";s.d(t,{C:function(){return r}});var a=s(4397);let r=()=>a.S.map(e=>({Time:e,Mon:!1,Tue:!1,Wed:!1,Thu:!1,Fri:!1,Sat:!1,Sun:!1}))},56613:function(e,t,s){"use strict";s.d(t,{hb:function(){return a}});let a=(e,t)=>{let s={Mon:{shortKey:"therapist-cabinet:schedule.time-slots-column/02.mon",longKey:"therapist-cabinet:schedule.time-slots-column/02.mon"},Tue:{shortKey:"therapist-cabinet:schedule.time-slots-column/03.tue",longKey:"therapist-cabinet:schedule.time-slots-column/03.tue"},Wed:{shortKey:"therapist-cabinet:schedule.time-slots-column/04.wed",longKey:"therapist-cabinet:schedule.time-slots-column/04.wed"},Thu:{shortKey:"therapist-cabinet:schedule.time-slots-column/05.thu",longKey:"therapist-cabinet:schedule.time-slots-column/05.thu"},Fri:{shortKey:"therapist-cabinet:schedule.time-slots-column/06.fri",longKey:"therapist-cabinet:schedule.time-slots-column/06.fri"},Sat:{shortKey:"therapist-cabinet:schedule.time-slots-column/07.sat",longKey:"therapist-cabinet:schedule.time-slots-column/07.sat"},Sun:{shortKey:"therapist-cabinet:schedule.time-slots-column/08.sun",longKey:"therapist-cabinet:schedule.time-slots-column/08.sun"}}[e];return{short:t(s.shortKey),long:t(s.longKey)}};s(21847)},21847:function(e,t,s){"use strict";s.d(t,{J:function(){return i},q:function(){return n}});var a=s(19139);let r={1:"Mon",2:"Tue",3:"Wed",4:"Thu",5:"Fri",6:"Sat",7:"Sun"},n=e=>{let t=(0,a.C)();return e.forEach(e=>{let s=r[e.day_of_week];s&&Object.entries(e.work_time).forEach(e=>{let[a,r]=e,n=parseInt(a,10);n>=0&&n<24&&t[n]&&(t[n][s]=r)})}),t},i=(e,t)=>{let s=[];return Object.entries(r).forEach(a=>{let[r,n]=a,i={};e.forEach((e,t)=>{i[t.toString()]=e[n]}),s.push({worker_id:t,day_of_week:parseInt(r,10),work_time:i})}),s}},31222:function(e,t,s){"use strict";s.r(t),s.d(t,{AllSessionsPageNext:function(){return M},__N_SSP:function(){return v},default:function(){return T}});var a=s(52322),r=s(82808),n=s(2784),i=s(91143),l=s(71703),o=s(12994),c=s(92958),u=s(17723),d=s(73990),h=s(97588),m=s(44720),f=s(26792);s(51637);var p=s.p+"static/media/harry-counter.7e519340.svg";s(27324),s(94974),s(92570),s(56613);var x=s(3375);let g=e=>{let{summary:t,firstSessions:s,otherSessions:r,isLoading:n=!1,className:i}=e,{t:o}=(0,h.$)([l.s2.THERAPIST_CABINET,l.s2.BASE]);return n?(0,a.jsxs)(x.vm,{className:(0,m.tw)(i,"flex min-h-[180px] w-full flex-row gap-6"),children:[(0,a.jsx)(x.aM,{className:"hidden shrink-0 M:block",width:"120px",height:"100%"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,a.jsx)(x.aM,{width:"160px",height:"24px"}),(0,a.jsx)(x.aM,{height:"40px"}),(0,a.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,a.jsx)(x.aM,{width:"100px",height:"36px"}),(0,a.jsx)(x.aM,{width:"100px",height:"36px"}),(0,a.jsx)(x.aM,{width:"100px",height:"36px"})]})]})]}):(0,a.jsxs)(x.vm,{className:(0,m.tw)(i,"flex h-auto w-full flex-row gap-6"),shadow:"blue",children:[(0,a.jsx)("img",{className:"hidden M:block",src:p,alt:"Harry counter",height:"100%"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("p",{className:"w-full truncate text-1sm font-semibold text-primary-500 M:text-md",children:o("".concat(l.s2.THERAPIST_CABINET,":title.sessions-counter"))}),(0,a.jsx)(x.d9,{children:o("".concat(l.s2.THERAPIST_CABINET,":sessions-counter.disclaimer-info.what-is-shown"))}),(0,a.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,a.jsxs)("div",{className:"w-[160px]",children:[(0,a.jsx)("p",{className:"text-3xs font-medium text-neutral-700 M:text-2xs",children:o("".concat(l.s2.THERAPIST_CABINET,":title-data.summary"))}),(0,a.jsx)("span",{className:"text-xs font-semibold M:text-sm",children:t})]}),(0,a.jsxs)("div",{className:"w-[160px]",children:[(0,a.jsx)("p",{className:"text-3xs font-medium text-neutral-700 M:text-2xs",children:o("".concat(l.s2.THERAPIST_CABINET,":title-data.first-session"))}),(0,a.jsx)("span",{className:"text-xs font-semibold text-primary-500 M:text-sm",children:s})]}),(0,a.jsxs)("div",{className:"w-[160px]",children:[(0,a.jsx)("p",{className:"text-3xs font-medium text-neutral-700 M:text-2xs",children:o("".concat(l.s2.THERAPIST_CABINET,":title-data.two-plus-sessions"))}),(0,a.jsx)("span",{className:"text-xs font-semibold M:text-sm",children:r})]})]})]})]})};var w=s(5254),_=s(86672);let y={UPCOMING:"upcoming",PAST:"past"},b=e=>{let{appointments:t,locale:s,timezone:r,onFilterChange:i,className:c}=e,{t:u}=(0,h.$)([l.s2.THERAPIST_CABINET]),d=(0,n.useRef)(i);d.current=i;
1let[f,p]=(0,n.useState)([]),[g,b]=(0,n.useState)([]),[j,S]=(0,n.useState)(null),v=(0,n.useMemo)(()=>[{label:u("therapist-cabinet:sessions-filter.upcoming"),value:y.UPCOMING},{label:u("therapist-cabinet:sessions-filter.past"),value:y.PAST}],[u]),M=(0,n.useMemo)(()=>{let e=new Map;return t.forEach(t=>{if(!e.has(t.user_id)){var s;e.set(t.user_id,null!==(s=t.user_name)&&void 0!==s?s:t.user_id.substring(0,4))}}),Array.from(e,e=>{let[t,s]=e;return{label:"".concat(s," (").concat(t.substring(0,4),")"),value:t}})},[t]),T=(0,n.useMemo)(()=>{let e=new Map;return t.forEach(t=>{if(!t.payment_to_worker_date)return;let s=JSON.stringify(t.payment_to_worker_date);e.has(s)||e.set(s,t.payment_to_worker_date)}),Array.from(e.entries()).sort((e,t)=>{let[s]=e,[a]=t,r=JSON.parse(s),n=JSON.parse(a),i=Array.isArray(r)?r[0]:r;return(Array.isArray(n)?n[0]:n).localeCompare(i)}).map(e=>{let[t,a]=e;return{label:(0,o.XL)(a,s),value:t}})},[t,s]);return n.useEffect(()=>{let e=t;if(f.length>0){let t=new Set(f);e=e.filter(e=>t.has(e.user_id))}if(g.length>0){let t=new Set(g);e=e.filter(e=>t.has(JSON.stringify(e.payment_to_worker_date)))}if(j){let t=w.ou.now().toMillis();j===y.UPCOMING?e=e.filter(e=>w.ou.fromISO(e.appointment_end_time,{zone:r}).toMillis()>=t):j===y.PAST&&(e=e.filter(e=>w.ou.fromISO(e.appointment_end_time,{zone:r}).toMillis()<t))}d.current(e)},[t,f,g,j,r]),(0,a.jsxs)("div",{className:(0,m.tw)("mb-6 flex flex-wrap items-end justify-start gap-x-3 gap-y-2 font-gilroy ML:justify-start",c),children:[(0,a.jsx)(x.Ac,{options:v,value:j,icon:(0,a.jsx)(_.fz,{className:"h-6 w-6 M:h-8 M:w-8"}),onChange:e=>S(e.value),placeholder:u("therapist-cabinet:sessions-filter.filter-by"),showClear:!0}),(0,a.jsx)(x.Gh,{options:M,value:f,filter:!0,icon:(0,a.jsx)(_.k1,{className:"h-6 w-6 M:h-8 M:w-8"}),onChange:e=>p(e.value),placeholder:u("therapist-cabinet:sessions-filter.filter-by-user")}),(0,a.jsx)(x.Gh,{options:T,value:g,icon:(0,a.jsx)(_.Qu,{className:"h-6 w-6 M:h-8 M:w-8"}),onChange:e=>b(e.value),placeholder:u("therapist-cabinet:sessions-filter.by-payment-date")})]})},j=e=>{let{isLoading:t,view:s,setView:r,appointments:n,locale:i,timezone:l,onFilterChange:o}=e;return t?(0,a.jsxs)("div",{className:"mb-4 flex flex-wrap gap-3 M:mb-6",children:[(0,a.jsx)(x.aM,{width:"120px",height:"56px"}),(0,a.jsx)(x.aM,{width:"325px",height:"56px"}),(0,a.jsx)(x.aM,{width:"325px",height:"56px"}),(0,a.jsx)(x.aM,{width:"325px",height:"56px"})]}):(0,a.jsxs)("div",{className:"mb-4 flex flex-wrap items-end justify-start gap-x-3 gap-y-2 font-gilroy M:mb-6",children:[(0,a.jsx)(x.bT,{value:s,onChange:r,className:"w-fit"}),(0,a.jsx)(b,{appointments:n,locale:i,timezone:l,onFilterChange:o,className:"contents"})]})};j.displayName="AppointmentToolbar";let S=()=>{let{t:e}=(0,h.$)([l.s2.THERAPIST_CABINET,l.s2.BASE]),t=(0,d.bU)(),s=(0,d.gi)(),{isMobile:p}=(0,d.kC)(),{data:x,isLoading:w}=(0,c.vs)({config_id:t}),_=(0,n.useRef)(null),[,y]=(0,r.h)(_),[b,S]=(0,n.useState)(()=>p?u.M.GRID:u.M.LIST);(0,n.useEffect)(()=>{S(p?u.M.GRID:u.M.LIST)},[p]);let[v,M]=(0,n.useState)([]),T=b===u.M.GRID,N=T?o.no:o.rK,k=(0,n.useMemo)(()=>(null!=x?x:[]).filter(o.ij),[x]),I=(0,n.useMemo)(()=>{let e=v.length,t=v.filter(e=>1===e.appointment_number).length;return{summary:e,firstSessions:t,otherSessions:e-t}},[v]),E=(0,n.useCallback)(e=>{M([...e].sort((0,o.TI)(s)))},[s]);return(0,a.jsx)(f.cu,{headerTitle:e("".concat(l.s2.THERAPIST_CABINET,":header-name.sessions")),fullHeight:!0,children:(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsx)(j,{isLoading:w,view:b,setView:S,appointments:k,locale:t,timezone:s,onFilterChange:E}),(0,a.jsx)(g,{className:"mb-6 shrink-0",isLoading:w,...I}),w?(0,a.jsx)("div",{className:"flex flex-wrap justify-center gap-4 ML:justify-start",children:[...Array(6)].map((e,t)=>(0,a.jsx)(N,{},t))}):k.length>0?0===v.length?(0,a.jsx)(o.Mc,{}):(0,a.jsx)("div",{ref:_,className:(0,m.tw)("flex min-h-[calc(100vh_-_86px)] flex-1 flex-col",T?"gap-4 ML:gap-x-6":"overflow-hidden M:overflow-visible"),children:(0,a.jsx)(i.bF,{items:v,isGrid:T,scrollHeight:y},b)}):(0,a.jsx)(o.Mc,{})]})})};var v=!0;let M=()=>(0,a.jsx)(S,{});var T=M},4397:function(e,t,s){"use strict";s.d(t,{S:function(){return a}});let a=["00:00 â 01:00","01:00 â 02:00","02:00 â 03:00","03:00 â 04:00","04:00 â 05:00","05:00 â 06:00","06:00 â 07:00","07:00 â 08:00","08:00 â 09:00","09:00 â 10:00","10:00 â 11:00","11:00 â 12:00","12:00 â 13:00","13:00 â 14:00","14:00 â 15:00","15:00 â 16:00","16:00 â 17:00","17:00 â 18:00","18:00 â 19:00","19:00 â 20:00","20:00 â 21:00","21:00 â 22:00","22:00 â 23:00","23:00 â 00:00"]}},function(e){e.O(0,[1409,58,8223,421,8149,131,3616,1660,1143,7324,2888,9774,179],function(){return e(e.s=39013)}),_N_E=e.O()}]);
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.