pkg-components
Version:
6 lines (5 loc) • 5.13 kB
JavaScript
import{j as i,a as h,F as V}from"./jsx-runtime-DI8_P1Ft.js";import{P as r}from"./index-B3IC6ylx.js";import"./index-BApHpKep.js";import{D as $}from"./index-Daagk5ZO.js";import{A as E}from"./index-BGQ0fQPX.js";const k="_container_1hbp9_1",A="_timeColumn_1hbp9_11",R="_time_1hbp9_11",D="_scheduleGrid_1hbp9_71",T="_dayColumn_1hbp9_87",j="_dayLabel_action_1hbp9_109",x="_hourCell_1hbp9_133",G="_event_1hbp9_163",d={container:k,timeColumn:A,time:R,scheduleGrid:D,dayColumn:T,dayLabel_action:j,hourCell:x,event:G},P=s=>{const l={};for(let e=0;e<=6;e++)l[e]=[];s.forEach(e=>{const a=e.schDay;l[a].push(e)});const c={},p=Array.from({length:24},(e,a)=>a);for(let e in l){c[e]={};const a=new Set;p.forEach(n=>{const o=l[e].filter(t=>{const u=parseInt(t.schHoSta.split(":")[0]),m=parseInt(t.schHoEnd.split(":")[0]);return n>=u&&n<m&&u!==m});o.length>0&&!a.has(n)&&(c[e][n]=o,a.add(n))})}return c},w="_scheduleHeader_1irl2_1",I="_card_1irl2_25",B="_active_1irl2_65",F="_scheduleGrid_1irl2_83",W="_dayColumn_1irl2_99",z="_dayLabel_1irl2_113",O="_hourCell_1irl2_127",J="_event_1irl2_159",N={scheduleHeader:w,card:I,active:B,scheduleGrid:F,dayColumn:W,dayLabel:z,hourCell:O,event:J},g=({isMobile:s,data:l,showTiming:c,openStoreEveryDay:p,handleClick:e,style:a,handleHourPmAM:n=t=>t,days:o})=>i("div",{className:N.scheduleHeader,style:s?{...a}:{margin:"auto",width:"95%",...a},children:l==null?void 0:l.map((t,u)=>{const m=n(t.schHoSta),b=n(t.schHoEnd);return h("div",{className:`${N.card} ${t.schDay===c?N.active:""}`,onClick:()=>p?()=>{}:e(Number(t.schDay||t.day)),children:[i("div",{children:o[Number(t.schDay??t.day)]}),h("div",{children:[m," - ",b]})]},u+1)})});g.propTypes={combinedArray:r.shape({map:r.func}),data:r.any,days:r.any,handleClick:r.func,style:r.object,handleHourPmAM:r.func,isMobile:r.bool,openStoreEveryDay:r.any,showTiming:r.any};try{g.displayName="ScheduleMobile",g.__docgenInfo={description:"",displayName:"ScheduleMobile",props:{isMobile:{defaultValue:null,description:"",name:"isMobile",required:!0,type:{name:"any"}},data:{defaultValue:null,description:"",name:"data",required:!0,type:{name:"any"}},showTiming:{defaultValue:null,description:"",name:"showTiming",required:!0,type:{name:"any"}},openStoreEveryDay:{defaultValue:null,description:"",name:"openStoreEveryDay",required:!0,type:{name:"any"}},handleClick:{defaultValue:null,description:"",name:"handleClick",required:!0,type:{name:"any"}},style:{defaultValue:null,description:"",name:"style",required:!0,type:{name:"any"}},handleHourPmAM:{defaultValue:{value:"(string) => { return string }"},description:"",name:"handleHourPmAM",required:!1,type:{name:"((string: any) => any)"}},days:{defaultValue:null,description:"",name:"days",required:!0,type:{name:"any"}}}}}catch{}const q={1:"Lunes",2:"Martes",3:"Miércoles",4:"Jueves",5:"Viernes",6:"Sábado",0:"Domingo"},y=Array.from({length:25},(s,l)=>l),S=({isMobile:s,handleClick:l=a=>a,handleHourPmAM:c=a=>a,schedules:p=[],style:e={}})=>{const a=P(p);return s?i(g,{data:p,days:q,handleClick:l,handleHourPmAM:c,isMobile:s,style:e}):h(V,{children:[i($,{margin:"0 0 50px 0"}),i(E,{message:"Aquí puedes crear tus horarios de atención para programar tus actividades.",type:"info"}),i($,{margin:"0 0 100px 0"}),h("div",{className:d.container,style:e,children:[i("div",{className:d.timeColumn,children:y==null?void 0:y.map(n=>i("div",{className:d.time,children:`${n}h`},n))}),i("div",{className:d.scheduleGrid,children:Object.entries(a).map(([n,o],t)=>{let u=!1,m=0;const b=Object.keys(o).length;let C=0;for(let _ in o)C+=o[_].length;return h("div",{className:d.dayColumn,children:[h("span",{className:d.dayLabel_action,onClick:()=>l(Number(t)),children:[q[n],C?` ${C||0} h`:null]}),y==null?void 0:y.map((_,v)=>{const H=o[_];if(H&&H.length>0){const M=H[0],L=!u;u=!0,m=v;let f={};return b===1?f={borderRadius:"5px"}:v===0?f={borderTopLeftRadius:"5px",borderTopRightRadius:"5px"}:v===b-1?f={borderBottomLeftRadius:"5px",borderBottomRightRadius:"5px"}:v===m-1&&(f={borderBottomLeftRadius:"0",borderBottomRightRadius:"0"}),i("div",{className:d.hourCell,onClick:()=>l(t),children:i("div",{className:d.event,style:f,children:L?`${M.schHoSta} - ${M.schHoEnd}`:null})},`${n}-${_}`)}return i("div",{className:d.hourCell},`${n}-${_}`)})]},n)})})]})]})};S.propTypes={handleClick:r.func,handleHourPmAM:r.func,isMobile:r.bool,openStoreEveryDay:r.bool,schedules:r.array,style:r.object};try{S.displayName="ScheduleLinearWeekly",S.__docgenInfo={description:"",displayName:"ScheduleLinearWeekly",props:{isMobile:{defaultValue:null,description:"",name:"isMobile",required:!0,type:{name:"any"}},handleClick:{defaultValue:{value:`(number) => {\r
return number\r
}`},description:"",name:"handleClick",required:!1,type:{name:"((number: any) => any)"}},handleHourPmAM:{defaultValue:{value:`(string) => {\r
return string\r
}`},description:"",name:"handleHourPmAM",required:!1,type:{name:"((string: any) => any)"}},schedules:{defaultValue:{value:"[]"},description:"",name:"schedules",required:!1,type:{name:"never[]"}},style:{defaultValue:{value:"{}"},description:"",name:"style",required:!1,type:{name:"{}"}}}}}catch{}export{S};