"use strict";(globalThis.webpackChunkbooktics=globalThis.webpackChunkbooktics||[]).push([[4904],{14904:(e,t,a)=>{a.r(t),a.d(t,{default:()=>l});var s=a(51609),i=a(48876),c=a(22564),m=a(56580),r=a(52911),o=a(27723);const l=()=>{const{getTeamMembers:e}=(0,r.A)();return(0,m.useAdminLicense)()?window?.wp?.hooks.applyFilters("booktics_location_list",(0,s.createElement)(c.EmptyScreen,{isPro:!0}),{PrimaryHeader:i.A,getTeamMembers:e}):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(i.A,{title:(0,o.__)("Locations","booktics")}),(0,s.createElement)(c.ResponsiveContainer,null,(0,s.createElement)(c.EmptyScreen,{isPro:!0})))}},52911:(e,t,a)=>{a.d(t,{A:()=>r});var s=a(47143),i=a(47767),c=a(40309),m=a(11534);const r=()=>{const{setTeamState:e}=(0,s.useDispatch)(c?.team),{setServicesState:t}=(0,s.useDispatch)(c?.services),{id:a}=(0,i.g)(),{teamMembers:r,enable_custom_availability:o,selectedServices:l,profileInfo:n,customSchedule:d,holiday:b,schedule:g,searchQuery:u}=(0,s.useSelect)(c?.team).getTeamState(),{serviceList:y}=(0,s.useSelect)(c?.services).getServicesState(),h=async(t={})=>{t?.resetFilter&&(t={service_id:"",paged:"",per_page:""});const a={...u,...t};e({isFiltering:!0});try{const t=await m.A.team.allTeamMembers(a);t.success&&e({teamMembers:{...t?.data},searchQuery:a})}catch(e){console.log(e)}};return{getMyprofileInfo:async()=>{try{const t=await m.A.team.getTeamMemberProfile();t.success&&e({profileInfo:t.data})}catch(e){console.log(e)}},getTeamMembers:h,addTeamMember:async t=>{try{e({editLoading:!0});const a=await m.A.team.createTeamMember(t);a.success&&e({teamMembers:{...r,total:r.total+1,items:[{...a?.data},...r.items]},visibleModal:!1}),e({editLoading:!1})}catch(t){console.log(t),e({editLoading:!1})}finally{e({editLoading:!1})}},deleteTeamMember:async t=>{try{if((await m.A.team.deleteSingleTeamMember(t)).success){const a=r.items.filter(e=>e.id!==t);e({teamMembers:{...r,total:a.length,items:a}})}}catch(e){console.log(e)}},getSingleTeamMember:async()=>{try{const t=await m.A.team.singleTeamMember(a);t.success&&e({singleTeamMember:{...t?.data},selectedServices:t?.data?.services})}catch(e){console.log(e)}},teamMemberBulkDelete:async(t=[])=>{try{if((await m.A.team.bulkDeleteTeamMember({ids:t})).success){const a=r.items.filter(e=>!t.includes(e.id));e({teamMembers:{...r,items:a}})}}catch(e){console.log(e)}},editTeamMember:async s=>{const i={...s,schedule:g,services:l,custom:s.enable_custom_schedule?d:[],holiday:s.enable_custom_holiday?b:[],enable_custom_availability:o},c=a||n.id;try{e({editLoading:!0});const a=await m.A.team.updateTeamMember(c,i);if(a?.success){const s=r?.items?.map(e=>e?.id===a?.data?.id?a?.data:e);e({teamMembers:{...r,items:s},editLoading:!1});const i=y?.map(e=>Array.isArray(e.team_member)&&e.team_member.includes(a?.data?.id)&&Array.isArray(e.team_member_details)?{...e,team_member_details:e.team_member_details.map(e=>e.id===a?.data?.id?{...e,image:a?.data?.image}:e)}:e);t({serviceList:i})}}catch(e){console.error("Failed to update team member:",e)}finally{e({editLoading:!1})}},reInviteTeam:async e=>{try{const t=await m.A.team.reInviteTeamMember(e);t.success&&window.wp?.hooks.doAction("notification",{type:"success",message:t?.message})}catch(e){console.log(e)}},onPaginationChange:(e,t)=>{h({paged:e,per_page:t})}}}}}]);