1import{j as t}from"./jsx-runtime-v2-CbI9v5tQ.js";import{r as P}from"./index-v2-BwHx0sZC.js";import{l as v}from"./hashHistory-v2-39pc4ofo.js";import{aj as M,ai as y}from"./app-v2-Bu_IeHEg.js";import{P as T,T as k}from"./PageLayouts-v2-DnShUCjr.js";import{S as w}from"./Headers-v2-B_tcew82.js";import{T as C}from"./TimeLogger-v2-DnNhwK-9.js";import{O as R}from"./Chrono-v2-ByF_DfZ0.js";import{B as q}from"./index-v2-NoM7OtH8.js";import{a as E,b as H,c as I,F as N}from"./TextAreaInput-v2-DVDt6IuS.js";import{N as _}from"./NumericInput-v2-Ct17jxKw.js";import{D as F,S as B}from"./DateScale-v2-BctC36Ai.js";import{P as L}from"./Content-v2-CKUBOLA3.js";import{u as A}from"./Icon-v2-TpeFkaBN.js";import"./alt-v2-CxZ-irWq.js";import"./MultiDomain-v2-Dr4GeBsh.js";import"./InputFormatters-v2-BWYNhFeD.js";import"./TextInputBase-v2-CDLRnkFj.js";import"./Link-v2-B8ELKL5J.js";import"./URLFormatters-v2-CjBPDAv3.js";import"./Lang-v2-BD-V2E7c.js";import"./DSGAnalytics-v2-VhekLzW8.js";import"./NotesInput-v2-8g03SnJF.js";import"./EmojiRating-v2-D3b8UPjE.js";import"./OverlayTrigger-v2-DNmfbIZy.js";import"./bootstrapUtils-v2-Dc_zAE3x.js";import"./createChainedFunction-v2-C1NM2QhX.js";import"./RootCloseWrapper-v2-Dms4jmas.js";import"./Transition-v2-CFfn2TmF.js";import"./index-v2-1xUD4EOd.js";import"./index-v2-nAQpcEbz.js";import"./index-v2-D3cjEimh.js";import"./elementType-v2-0VMJziRj.js";import"./Tooltip-v2-PiBgVp7G.js";import"./react-emoji-v2-B-idHd2n.js";import"./CheckBox-v2-C7NBqqGp.js";import"./BusinessSelect-v2-DxZ1UY7W.js";import"./FilteredSingleSelect-v2-BkD_QlPT.js";import"./SingleSelect-v2-B0QUQ_z-.js";import"./EmptyState-v2-BrufXSjm.js";import"./Animations-v2-C_6GGzLZ.js";import"./ProfileImage-v2-BFXbA-76.js";import"./Image-v2-Cdau3_h-.js";import"./String-v2-D85yhdDb.js";import"./DSGPropTypes-v2-DzyURuHL.js";import"./Numbers-v2-BXlm8y9G.js";import"./CalendarSelect-v2-v8sYq56E.js";import"./CalendarInput-v2-CAsCbspd.js";import"./SimpleName-v2-DlamRTZq.js";import"./IconAndName-v2-B5g4N9ru.js";import"./ModalComponents-v2-xiqPmSn6.js";function O({minDate:p,maxDate:h,allowDate:i,value:n,loading:d,onSubmit:a}){const{t:r}=A(["vol","commonPlat"]),[c,f]=P.useState("default"),g=P.useCallback(()=>{M.setModal({component:F,options:{onChangeMode:(e,x)=>{f(e),x()}}})},[]);return t.jsxs(E,{value:n,onSubmit:a,children:[t.jsx(L,{highlight:!0,children:r("vol:labels.alreadyLoggedDateCanEditUntilApproved")}),i&&t.jsx(H,{label:r("vol:labels.whenVolunteerismPerformed"),children:t.jsx(B,{id:"startDate",required:!0,mode:c,minDate:p,maxDate:h,onRequestMode:g})}),t.jsx(I,{children:t.jsx(H,{label:r("vol:labels.howManyHours"),children:t.jsx(_,{id:"hours",required:!0,decimals:!0,style:{width:90}})})}),t.jsx(N,{children:t.jsx(q.Primary,{disabled:d,type:"submit",children:r("commonPlat:actions.save")})})]})}function Lt({user:p,loggable:h,params:i,reloadLoggable:n}){const[d,a]=P.useState(!1),r=()=>{const o=h.find(s=>s.slug===i.applicationSlug),{shifts:j=[]}=o||{},u=j.find(s=>s.id===i.shiftId),m=u.schedule.find(s=>
1s.starts===i.startDate);return{app:o,shift:u,shiftDate:m}},c=(o,j,u,m)=>{a(!0);const{shiftDate:s,app:D}=r();y.makeRequest(`/hours/shift/${i.shiftId}`,"POST",{startDate:s.starts,feedback:o.feedback,rating:o.rating,hours:o.hours,business:o.business},m(S=>{S?(n(),v.push({pathname:"/user/log-hours/thanks",state:{logged:{...o,roleName:D.roleName}}})):a(!1)}))},f=(o,j,u,m)=>{const{shiftDate:s,app:D}=r();a(!0),y.makeRequest(`/hours/${s.hourIds[0]}`,"PUT",{hours:o.hours},m(S=>{S?(n(),v.push({pathname:"/user/log-hours/thanks",state:{logged:{...o,roleName:D.roleName}}})):a(!1)}))},{shift:g,shiftDate:e}=r();if(!e)return t.jsx(w,{children:"Can't find specific shift date"});const x=g.suggestedHours||R(e.starts,e.ends,!1),l=e.hours,b=e.hourIds||[];return t.jsx(T,{children:t.jsx(k,{side:t.jsx("div",{}),children:l&&b.length===1?t.jsx(O,{value:{hours:l,startDate:e.starts},onSubmit:f}):t.jsx(C,{notice:l&&b.length===0?"noEditableHours":l&&b.length>1?"tooManyHourRecords":null,loading:d,user:p,value:{hours:x},onSubmit:c})})})}export{Lt as default}; 2//# sourceMappingURL=ShiftLogger-v2-mYcuOdmv.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.