1"use strict";(self.webpackChunk_geovelo_frontends_companies=self.webpackChunk_geovelo_frontends_companies||[]).push([[192],{13463:function(e,n,t){var i=t(13761),a=t(64864),s=t(60060);n.A=function({children:e,onClickCapture:n,sx:t,...o}){const r=(0,a.useRef)({down:!1,moved:!1,startX:0,scrollLeft:0,scroller:null}),l=(0,a.useRef)(null);function c(e){const n=r.current;if(!n.down||!n.scroller)return;const t=e.clientX-n.startX;Math.abs(t)>3&&(n.moved=!0),n.scroller.scrollLeft=n.scrollLeft-t}function d(){r.current.down=!1,document.body.style.userSelect="",document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)}return(0,a.useEffect)((()=>()=>{document.body.style.userSelect="",document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d)}),[]),(0,a.useEffect)((()=>{var e;const n=null===(e=l.current)||void 0===e?void 0:e.querySelector(".MuiTabs-scroller");if(n)return n.addEventListener("wheel",t,{passive:!1}),()=>n.removeEventListener("wheel",t);function t(e){Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),n.scrollLeft+=e.deltaY)}}),[]),(0,s.jsx)(i.A,{...o,allowScrollButtonsMobile:!0,onClickCapture:e=>{r.current.moved&&(e.stopPropagation(),r.current.moved=!1),null===n||void 0===n||n(e)},onMouseDown:function(e){const n=e.currentTarget.querySelector(".MuiTabs-scroller");n&&(r.current={down:!0,moved:!1,startX:e.clientX,scrollLeft:n.scrollLeft,scroller:n},document.body.style.userSelect="none",document.addEventListener("mousemove",c),document.addEventListener("mouseup",d))},ref:l,scrollButtons:"auto",sx:{cursor:"grab","&:active":{cursor:"grabbing"},...t},variant:"scrollable",children:e})}},69361:function(e,n,t){var i=t(90106),a=t(91877),s=t(42457),o=t(27988),r=t(75922),l=t(71380),c=t(29072),d=t(27525),p=t(32154),m=t(25285),u=t(46782),x=t(65721),f=t(3905),h=t(83419),y=t(58628),g=t(79602),j=t.n(g),_=t(80881),b=t.n(_),A=t
1(64864),v=t(41811),w=t(90119),C=t(95167),D=t(12938),S=t(85859),k=t(83741),Y=t(40111),E=t(60060);const F=b()().endOf("year");n.A=function({own:e,employee:n}){const{currentYearFirstDay:t,setCurrentYearFirstDay:g}=(0,D.A)({otherSearchParams:{tab:"attestations"}}),[_,I]=(0,A.useState)(!1),[L,M]=(0,A.useState)(),[z,T]=(0,A.useState)({}),[P,$]=(0,A.useState)(!1),{partner:{current:K}}=(0,A.useContext)(w.BR),{data:R}=(0,k.A)(K),{t:W}=(0,v.useTranslation)(),{cancellablePromise:B,cancelPromises:O}=(0,i.useCancellablePromise)(),{toDistanceWithMeters:X,toPrice:G}=(0,i.useUnits)(),{trackEvent:q}=(0,S.A)(),{downloadBlob:H}=(0,i.useFileSaver)();(0,A.useEffect)((()=>{K&&R&&I(!0)}),[K,R]),(0,A.useEffect)((()=>(_&&t&&n&&async function(e){if(M(void 0),T({}),!K||!R||!n)return;try{let t=[];if("fixed"===R.type){t=(await B(i.EmployeeService.getCertificates({partner:K,employeeId:n.id,startDate:b()("2023-01-01"),endDate:b()().endOf("year"),page:1,pageSize:100,query:"{id, type, start_date, end_date, count_days_total, sum_distance_manually_declared_journeys, sum_distance_user_trace_journeys, amount_to_pay, attestation_file, is_valid}",excludeInvalid:!0}))).certificates.filter((({type:e})=>"fixed"===e))}else{t=(await B(i.EmployeeService.getCertificates({partner:K,employeeId:n.id,startDate:e.clone(),endDate:e.clone().endOf("year"),page:1,pageSize:100,query:"{id, type, start_date, count_days_total, sum_distance_manually_declared_journeys, sum_distance_user_trace_journeys, amount_to_pay, attestation_file, is_valid}",excludeInvalid:!0}))).certificates.filter((({type:e})=>"fixed"!==e))}M(t)}catch(t){t instanceof Error&&"CancelledPromiseError"===(null===t||void 0===t?void 0:t.name)||console.error(t)}}(t),()=>{O(),M(void 0)})),[_,t,n]);const N=Object.values(z).filter(Boolean).length;return(0,E.jsx)(a.A,{sx:{backgroundColor:"#fff",borderRadius:4,flexGrow:1},variant:"outlined",children:(0,E.jsxs)(s.A,{sx:{display:"flex",flexDirection:"column",gap:3,padding:3},children:[R&&"fixed"!==R.type&&(0,E.jsx)(Y.A,{isTitle:!0,currentPeriodFirstDay:t,currentPeriodType:"year",maxDate:F,setCurrentPeriodFirstDay:g}),null===R||L&&0===L.length?(0,E.jsx)(o.A,{alignItems:"center",bgcolor:"#F7F7F7",borderRadius:4,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:148,padding:3,children:(0,E.jsx)(r.A,{children:W(e?R&&"fixed"===R.type?"companies.pages.bicycle_compensation.certificates_table.empty_state_fixed":"companies.pages.bicycle_compensation.certificates_table.empty_state":R&&"fixed"===R.type?"companies.pages.bicycle_compensation.certificates_table.empty_state_beneficiary_fixed":"companies.pages.bicycle_compensation.certificates_table.empty_state_beneficiary")})}):(0,E.jsxs)(o.A,{display:"flex",flexDirection:"column",gap:2,children:[(0,E.jsxs)(o.A,{alignItems:{xs:"flex-start",sm:"center"},bgcolor:"#F3F6FF",borderRadius:4,display:"flex",flexDirection:{xs:"column",sm:"row"},gap:3,justifyContent:"space-between",padding:3,children:[(0,E.jsx)(r.A,{fontWeight:700,children:t&&L?(0,E.jsx)(E.Fragment,{children:N>0?W("companies.pages.bicycle_compensation.certificates_table.selected",{count:N}):(0,E.jsx)(v.Trans,{components:[(0,E.jsx)(r.A,{color:"textSecondary",component:"span",variant:"caption"},0)],i18nKey:"companies.pages.bicycle_compensation.certificates_table.actions.download_own",values:{period:t.format("YYYY"),count:null===L||void 0===L?void 0:L.length}})}):(0,E.jsx)(l.A,{variant:"text",width:200})}),(0,E.jsx)(C.$n,{color:"primary",disabled:!L||P,onClick:()=>async function(){if(L&&t){$(!0);try{const e=`${W("companies.pages.bicycle_compensation.download_dialog.compensations").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g,"_")}_${t.format("YYYY")}`,n=new(j()),i=0===Object.values(z).filter(Boolean).length?L:L.filter((({id:e})=>z[e]));await Promise.all(i.map((async({url:t,monthFirstDay:i})=>{if(!t)return;const a=await fetch(t,{method:"GET",headers:{"Content-Type":"application/pdf"}}),s=await a.blob();return n.folder(e),n.file(`${e}/${null===i||void 0===i?void 0:i.format("YYYY-MM")}.pdf`,s)})));const a=await n.generateAsync({type:"blob"});H(`${e}.zip`,a),q("Indemnities Certificates Downloaded",{data_type:"pdf",start_date:t.format("YYYY-MM-DD"),end_date:t.clone().endOf("year").format("YYYY-MM-DD")})}catch(e){console.error(e)}$(!1)}}(),size:"medium",startIcon:P?(0,E.jsx)(c.A,{color:"inherit",size:16,thickness:4}):(0,E.jsx)(C.s3,{}),variant:"contained",children:W("commons.actions.download")})]}),(0,E.jsx)(d.A,{children:(0,E.jsxs)(p.A,{size:"small",children:[(0,E.jsx)(m.A,{children:(0,E.jsxs)(u.A,{children:[(0,E.jsx)(x.A,{padding:"checkbox",children:(0,E.jsx)(f.A,{checked:L&&N===L.length||!1,color:"primary",disabled:!L,indeterminate:L&&N>0&&N!==L.length,onClick:()=>T(0===N?(L||[]).reduce(((e,{id:n})=>(e[n]=!0,e)),{}):{}),size:"small"})}),(0,E.jsx)(x.A,{children:R&&"fixed"===R.type?W("commons.periods.year"):W("commons.periods.month")}),R?(0,E.jsxs)(E.Fragment,{children:["fixed"!==R.type&&(0,E.jsx)(x.A,{align:"right",sx:{whiteSpace:"nowrap"},children:W(i.fmdConfigMap[R.type].valueLabelKey)}),"dailyAndDistance"===R.type&&(0,E.jsx)(x.A,{align:"right",sx:{whiteSpace:"nowrap"},children:W(i.fmdConfigMap.distance.valueLabelKey)})]}):(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(l.A,{sx:{display:"inline-block"},variant:"text",width:100})}),(0,E.jsx)(x.A,{align:"right",children:W(e?"companies.pages.bicycle_compensation.certificates_table.compensation_label_own":"companies.pages.bicycle_compensation.certificates_table.compensation_label")}),(0,E.jsx)(x.A,{align:"right",children:W("commons.actions.download")})]})}),(0,E.jsx)(h.A,{children:R&&L?L.map((({id:e,monthFirstDay:n,monthLastDay:t,daysCount:i,totalDistance:a,compensation:s,url:l})=>(0,E.jsxs)(u.A,{children:[(0,E.jsx)(x.A,{padding:"checkbox",children:(0,E.jsx)(f.A,{checked:z[e]||!1,color:"primary",onChange:(n,t)=>T({...z,[e]:t}),size:"small"})}),(0,E.jsx)(x.A,{children:n?R&&"fixed"===R.type?1!==R.annualPeriodStartDay||1!==R.annualPeriodStartMonth?W("commons.periods.from_to",{from:n.format("LL"),to:(null===t||void 0===t?void 0:t.clone().add(1,"year").add(-1,"day").format("LL"))||"-"}):n.format("YYYY"):n.format("MMMM YYYY"):"-"}),"fixed"!==R.type&&(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(r.A,{children:"daily"===R.type||"dailyAndDistance"===R.type?i:X(a||0)})}),"dailyAndDistance"===R.type&&(0,E.jsx)(x.A,{align:"right",children:X(a||0)}),(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(r.A,{noWrap:!0,children:G(s||0)})}),(0,E.jsx)(x.A,{padding:"checkbox",children:l&&(0,E.jsx)(o.A,{alignItems:"center",display:"flex",gap:1,justifyContent:"flex-end",children:(0,E.jsx)(y.A,{color:"primary",component:"a",href:l,onClick:()=>{try{q("Indemnities Certificates Downloaded",{data_type:"pdf"})}catch(e){console.error(e)}},rel:"noreferrer",size:"small",target:"_blank",children:(0,E.jsx)(C.s3,{fontSize:"small"})})})})]},e))):new Array(12).fill(null).map(((e,n)=>(0,E.jsxs)(u.A,{children:[(0,E.jsx)(x.A,{padding:"checkbox",children:(0,E.jsx)(f.A,{disabled:!0,checked:!1,color:"primary",size:"small"})}),(0,E.jsx)(x.A,{children:(0,E.jsx)(r.A,{children:(0,E.jsx)(l.A,{variant:"text",width:150})})}),R&&(0,E.jsxs)(E.Fragment,{children:["fixed"!==R.type&&(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(l.A,{sx:{display:"inline-block"},variant:"text",width:50})}),"dailyAndDistance"===R.type&&(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(l.A,{sx:{display:"inline-block"},variant:"text",width:50})})]}),(0,E.jsx)(x.A,{align:"right",children:(0,E.jsx)(r.A,{children:(0,E.jsx)(l.A,{sx:{display:"inline-block"},variant:"text",width:50})})}),(0,E.jsx)(x.A,{align:"right",padding:"checkbox",children:(0,E.jsx)(o.A,{alignItems:"center",display:"flex",gap:1,justifyContent:"flex-end",children:(0,E.jsx)(l.A,{height:30,variant:"circular",width:30})})})]},n)))})]})})]})]})})}},84975:function(e,n,t){t.r(n),t.d(n,{default:function(){return S},tabs:function(){return C},tabsMap:function(){return D}});var i=t(90106),a=t(27988),s=t(75922),o=t(4587),r=t(77286),l=t(64864),c=t(41811),d=t(33387),p=t(90119),m=t(95167),u=t(13463),x=t(83741),f=t(76300),h=t(95158),y=t(45561),g=t(69361),j=t.p+"static/media/calendar.3024ea8af1322063f0ca.png",_=t.p+"static/media/validation.7a85e59a696ed40a5317.png",b=t(51919),A=t
1(60060);const v=["intro","calendar","validation","ready"];var w=function({...e}){const[n,t]=(0,l.useState)("intro"),{t:i}=(0,c.useTranslation)();(0,l.useEffect)((()=>{e.open&&t("intro")}),[e.open]);const o=v.findIndex((e=>e===n));return(0,A.jsx)(m.lG,{fullWidth:!0,maxWidth:"sm",...e,children:(0,A.jsxs)(a.A,{display:"flex",flexDirection:"column",gap:3,children:["intro"===n?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("img",{src:b.A,width:120}),(0,A.jsx)(s.A,{fontSize:"1.25rem",fontWeight:600,children:i("companies.pages.bicycle_compensation.info_dialog.title")}),(0,A.jsx)(s.A,{children:i("companies.pages.bicycle_compensation.info_dialog.description")}),(0,A.jsx)(s.A,{component:"ul",children:(0,A.jsx)(c.Trans,{components:[(0,A.jsx)("li",{},0),(0,A.jsx)("li",{},1),(0,A.jsx)("li",{},2)],i18nKey:"companies.pages.bicycle_compensation.info_dialog.list"})})]}):"calendar"===n?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s.A,{fontSize:"1.25rem",fontWeight:600,children:i("companies.pages.bicycle_compensation.info_dialog.calendar.title")}),(0,A.jsx)(s.A,{children:i("companies.pages.bicycle_compensation.info_dialog.calendar.description")}),(0,A.jsx)(a.A,{sx:{aspectRatio:1665/938},children:(0,A.jsx)("img",{src:j,width:"100%"})})]}):"validation"===n?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s.A,{fontSize:"1.25rem",fontWeight:600,children:i("companies.pages.bicycle_compensation.info_dialog.validation.title")}),(0,A.jsx)(s.A,{children:i("companies.pages.bicycle_compensation.info_dialog.validation.description")}),(0,A.jsx)(a.A,{sx:{aspectRatio:1581/542},children:(0,A.jsx)("img",{src:_,width:"100%"})})]}):"ready"===n&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s.A,{fontSize:"1.25rem",fontWeight:600,children:i("companies.pages.bicycle_compensation.info_dialog.ready.title")}),(0,A.jsx)(s.A,{children:i("companies.pages.bicycle_compensation.info_dialog.ready.description")})]}),(0,A.jsx)(a.A,{alignItems:"center",display:"flex",gap:3,children:"ready"!==n?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a.A,{flexGrow:1,children:(0,A.jsx)(s.A,{color:"textSecondary",variant:"caption",children:i("companies.step",{stepIndex:o+1,stepsCount:v.length-1})})}),(0,A.jsx)(m.$n,{color:"primary",onClick:()=>e.onClose(),variant:"outlined",children:i("companies.actions.skip")}),(0,A.jsx)(m.$n,{color:"primary",endIcon:(0,A.jsx)(m.vK,{}),onClick:()=>t(v[o+1]),variant:"contained",children:i("commons.actions.next")})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a.A,{flexGrow:1}),(0,A.jsx)(m.$n,{color:"primary",onClick:()=>e.onClose(!0),variant:"outlined",children:i("companies.pages.bicycle_compensation.info_dialog.actions.discover")}),(0,A.jsx)(m.$n,{color:"primary",onClick:()=>e.onClose(),variant:"contained",children:"OK"})]})})]})})};const C=["calendar","attestations"],D={attestations:{Icon:m.gz,labelKey:"companies.pages.bicycle_compensation.navigation.attestations"},calendar:{Icon:i.CalendarIcon,labelKey:"companies.pages.bicycle_compensation.navigation.calendar"}};var S=function(){const[e]=(0,d.ok)(),{partner:{current:n,permissions:t},user:{employee:i}}=(0,l.useContext)(p.BR),{data:j}=(0,x.A)(n),[_,b]=(0,l.useState)(!1),[v,S]=(0,l.useState)(!1),[k,Y]=(0,l.useState)(!1),[E,F]=(0,l.useState)((()=>"attestations"!==e.get("tab")&&t.fmdEnabled&&null!==j?"calendar":"attestations")),I=(0,d.Zp)(),{t:L}=(0,c.useTranslation)(),M=(0,r.A)();return(0,l.useEffect)((()=>{t.fmdEnabled||I("/")}),[]),(0,l.useEffect)((()=>{"calendar"!==E||t.fmdEnabled&&null!==j||F("attestations")}),[t,j]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f.A,{actions:!_&&(0,A.jsx)(m.$n,{color:"primary",onClick:()=>S(!0),startIcon:(0,A.jsx)(m.NT,{}),variant:"outlined",children:"Besoin d'aide ?"}),title:L("companies.pages.bicycle_compensation.title"),children:(0,A.jsxs)(a.A,{alignSelf:"stretch",display:"flex",flexDirection:"column",gap:5,children:[(0,A.jsx)(s.A,{children:L("companies.pages.bicycle_compensation.description")}),(0,A.jsxs)(a.A,{alignSelf:"stretch",display:"flex",flexDirection:"column",gap:3,children:[(0,A.jsx)(u.A,{onChange:(e,n)=>F(n),value:E,children:C.filter((e=>"attestations"===e||null!==j&&t.fmdEnabled)).map((e=>{const{Icon:n,labelKey:t}=D[e];return(0,A.jsx)(o.A,{icon:(0,A.jsx)(n,{}),iconPosition:"start",label:(0,A.jsx)(a.A,{alignItems:"flex-start",component:"span",display:"flex",gap:1,children:L(t)}),sx:{minHeight:48,textTransform:"initial"},value:e},e)}))}),null!==j&&t.fmdEnabled&&"calendar"===E?(0,A.jsx)(y.A,{own:!0,closeHelpCard:()=>{b(!1);try{localStorage.setItem(`fmd_help_card_closed_${null===n||void 0===n?void 0:n.id}`,"true")}catch(e){console.error(e),console.error("localStorage access is denied")}},displayHelpCard:b,employee:i,helpCardDisplayed:_,openInfoDialog:()=>S(!0)}):"attestations"===E&&(0,A.jsx)(g.A,{own:!0,employee:i})]})]})}),(0,A.jsx)(w,{onClose:e=>{S(!1),e&&setTimeout((()=>Y(!0)),M.transitions.duration.leavingScreen)},open:v}),(0,A.jsx)(h.A,{onClose:()=>Y(!1),open:k})]})}}}]); 2//# sourceMappingURL=192.e51e2d67.chunk.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.