1import{r as $,A as D,q as k,o as h,d as g,a as t,i as S,j as P,p as B,x as f,t as s,v as b,u as r,b as c,w as T,k as p,f as I}from"./app-TTdzKPnM.js";import{_ as y}from"./InputError-D-_97zBD.js";import{_ as U}from"./SaturnButton-DBZVI7YW.js";import{b as F,g as W}from"./settings-BbY5TtVV.js";try{let m=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new m.Error().stack;i&&(m._sentryDebugIds=m._sentryDebugIds||{},m._sentryDebugIds[i]="69ac4de9-0f15-4bc8-8e9c-add0867cc37a",m._sentryDebugIdIdentifier="sentry-dbid-69ac4de9-0f15-4bc8-8e9c-add0867cc37a")}catch{}const M={class:"mt-2"},A=["disabled"],w={__name:"DateSelector",props:{disabled:Boolean,modelValue:String},setup(m){const i=m,o=$("");return D(()=>i.modelValue,l=>{o.value=l}),k(()=>{o.value=i.modelValue}),(l,a)=>(h(),g("div",null,[t("div",M,[S(t("input",{onBlur:a[0]||(a[0]=d=>l.$emit("update:modelValue",d.target.value)),disabled:m.disabled,"onUpdate:modelValue":a[1]||(a[1]=d=>o.value=d),step:"1",type:"date",class:"border-gray-300 focus:border-lunar focus:ring-2 focus:ring-lunar font-medium rounded w-full focus:outline-none"},null,40,A),[[P,o.value]])])]))}},O={class:"font-bold text-xl"},C={class:"font-medium mt-2"},E={class:"mt-4"}
1,N={value:"0"},j={value:"1"},q={value:"2"},H={value:"3"},z={value:"4"},G={value:"5"},J={value:"6"},K={class:"font-bold mt-8 text-xl"},L={class:"font-medium mt-2"},Q={class:"mt-4"},R={value:"weekly"},X={value:"two_weeks"},Y={value:"twice_monthly"},Z={value:"monthly"},x={key:0},ee={class:"font-bold mt-8"},te={class:"mt-4"},ae={class:"w-80"},se={class:"font-bold mt-8"},oe={class:"mt-4"},le={class:"w-80"},ue={key:1},re={class:"font-bold mt-8 text-xl"},ne={class:"font-medium mt-2"},de={class:"mt-4"},ie={class:"w-80"},me={class:"mt-8"},ye={__name:"PayScheduleForm",setup(m){const i=B(),o=f({group:"company",name:"pay_schedule",value:"two_weeks",id:null}),l=f({group:"company",name:"pay_start",value:"",id:null}),a=f({group:"company",name:"second_pay_start",value:"",id:null}),d=f({group:"company",name:"week_start",value:0}),v=$("Save"),V=async()=>{if(v.value=p("Saving..."),o.errors.value="",l.errors.value="",a.errors.value="",!l.value){l.errors.value=p("Please select a date");return}if(o.value==="twice_monthly"&&!a.value){a.errors.value=p("Please select a date");return}if((o.value==="weekly"||o.value==="two_weeks")&&d.value!=new Date(l.value).getUTCDay()){l.errors.value=p("Week start and First day of pay period do not match");return}const e=!!(o.value!=="twice_monthly"&&a.id),u=[axios.post("/api/settings",{group:o.group,name:o.name,value:o.value,errorBag:"updatePaySchedule",preserveScroll:!0,team_id:i.props.auth.user.current_team.id}),axios.post("/api/settings",{group:l.group,name:l.name,value:l.value,errorBag:"updatePaySchedule",preserveScroll:!0,team_id:i.props.auth.user.current_team.id})];o.value==="twice_monthly"?u.push(axios.post("/api/settings",{group:a.group,name:a.name,value:a.value,errorBag:"updatePaySchedule",preserveScroll:!0,team_id:i.props.auth.user.current_team.id})):e&&u.push(axios.delete(`/api/settings/${a.id}`)),d.value&&u.push(axios.post("/api/settings",{group:d.group,name:d.name,value:d.value,errorBag:"updateWeekStart",preserveScroll:!0,team_id:i.props.auth.user.current_team.id})),await Promise.all(u).then(n=>{if(e)a.id=null,a.value=null;else if(o.value==="twice_monthly"){const _=n[2].data.data;Array.isArray(_)?(a.id=_[0].id,a.value=new Date(_[0].value).toISOString().substring(0,10)):(a.id=_.id,a.value=new Date(_.value).toISOString().substring(0,10))}v.value=p("Saved"),setTimeout(()=>{v.value=p("Save")},2e3)}).catch(n=>{v.value=p("Save")})};return k(async()=>{F(i.props.auth.user.current_team.id).then(e=>{var u,n;o.value=e.paySchedule.value,o.id=e.paySchedule.id,l.value=new Date(e.payStart.value).toISOString().substring(0,10),l.id=e.payStart.id,a.value=new Date((u=e.secondPayStart)==null?void 0:u.value).toISOString().substring(0,10),a.id=(n=e.secondPayStart)==null?void 0:n.id}).catch(e=>{}),W(i.props.auth.user.current_team.id).then(e=>{d.value=e.value})}),(e,u)=>(h(),g("form",null,[t("h2",O,s(e.$t("Week start")),1),t("p",C,s(e.$t("First day of the week your company uses for payroll")),1),t("div",E,[S(t("select",{id:"value",name:"value","onUpdate:modelValue":u[0]||(u[0]=n=>r(d).value=n),class:"border-gray-300 focus:border-lunar focus:ring-lunar font-medium rounded w-80"},[t("option",N,s(e.$t("Sunday"))+" ("+s(e.$t("Default"))+")",1),t("option",j,s(e.$t("Monday")),1),t("option",q,s(e.$t("Tuesday")),1),t("option",H,s(e.$t("Wednesday")),1),t("option",z,s(e.$t("Thursday")),1),t("option",G,s(e.$t("Friday")),1),t("option",J,s(e.$t("Saturday")),1)],512),[[b,r(d).value]]),c(y,{message:r(d).errors.value,class:"mt-2"},null,8,["message"])]),t("h2",K,s(e.$t("Pay schedule")),1),t("p",L,s(e.$t("How often the company pays employees")),1),t("div",Q,[S(t("select",{id:"value",name:"value","onUpdate:modelValue":u[1]||(u[1]=n=>r(o).value=n),class:"border-gray-300 focus:border-lunar focus:ring-lunar font-medium rounded w-80"},[t("option",R,s(e.$t("Weekly")),1),t("option",X,s(e.$t("Every 2 weeks"))+" ("+s(e.$t("Default"))+")",1),t("option",Y,s(e.$t("Twice a month")),1),t("option",Z,s(e.$t("Monthly")),1)],512),[[b,r(o).value]]),c(y,{message:r(o).errors.value,class:"mt-2"},null,8,["message"])]),r(o).value==="twice_monthly"?(h(),g("div",x,[t("h2",ee,s(e.$t("First pay period starts on")),1
1),t("div",te,[t("div",ae,[c(w,{modelValue:r(l).value,"onUpdate:modelValue":u[2]||(u[2]=n=>r(l).value=n)},null,8,["modelValue"])]),c(y,{message:r(l).errors.value,class:"mt-2"},null,8,["message"])]),t("h2",se,s(e.$t("Second pay period starts on")),1),t("div",oe,[t("div",le,[c(w,{modelValue:r(a).value,"onUpdate:modelValue":u[3]||(u[3]=n=>r(a).value=n)},null,8,["modelValue"])]),c(y,{message:r(a).errors.value,class:"mt-2"},null,8,["message"])])])):(h(),g("div",ue,[t("h2",re,s(e.$t("First day of pay period")),1),t("p",ne,s(e.$t("Select the first day of your company's most recent pay period")),1),t("div",de,[t("div",ie,[c(w,{modelValue:r(l).value,"onUpdate:modelValue":u[4]||(u[4]=n=>r(l).value=n)},null,8,["modelValue"])]),c(y,{message:r(l).errors.value,class:"mt-2"},null,8,["message"])])])),t("div",me,[c(U,{"dusk-attribute":"pay-schedule-form-save",onSaturnButtonClicked:V},{default:T(()=>[I(s(v.value),1)]),_:1})])]))}};export{ye as default}; 2//# sourceMappingURL=PayScheduleForm-DZKNrYMU.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.