"use strict";(globalThis.webpackChunkbooktics=globalThis.webpackChunkbooktics||[]).push([[1437],{3038:(e,t,o)=>{o.d(t,{A:()=>l});var i=o(47143),r=o(47767),c=o(40309),s=o(11534),a=o(56580),n=o(88802);const l=function(){const e=(0,i.useSelect)(e=>e(c.services).getServicesState(),[]),{selectedServices:t}=(0,i.useSelect)(e=>e(c.team).getTeamState(),[]),{setServicesState:o}=(0,i.useDispatch)(c.services),{setTeamState:l}=(0,i.useDispatch)(c.team),d=(0,a.useAdminLicense)(),{searchQuery:u,serviceList:p=[],total:m,singleService:v,selectedTeamMembers:g,selectedExtraServices:b=[],schedule:h,selectedLocations:_}=e,S=(0,r.Zp)(),{id:f}=(0,r.g)(),y=async(e={})=>{e?.resetFilter&&(e={search:"",category_id:"",team_member_id:""});const t={...u,...e};o({isFiltering:!0});try{const e=await(s.A?.service?.allServices(t));e?.success&&o({serviceList:e?.data?.items,total:e?.data?.total,searchQuery:t})}catch(e){console.error("Error fetching services:",e)}finally{return o({isFiltering:!1}),{complete:!0}}};return{createService:async(e,i=!0)=>{try{o({isFiltering:!0});const r=await(s.A?.service?.createService(e));r?.success&&(o({serviceList:[r?.data,...p||[]],total:m+1}),i?S(`/services/update/${r?.data.id}`):(o({visibleCreateServiceModal:!1}),l({selectedServices:[r.data.id,...t]})))}catch(e){console.error("Error creating service:",e)}finally{o({isFiltering:!1})}},updateService:async(e,t="deactive",i=!1)=>{if(i||o({loadingServiceId:!0}),e?.custom_field){let t=Array.isArray(e?.custom_field?.fields)?e?.custom_field?.fields?.map(e=>"global"===e?.from?e:{...e,from:"service"}):void 0;e.custom_field={...e?.custom_field,fields:t}}try{const i={...v,...e,status:t,extra_services:b,team_member:g,schedule:e.enable_custom_schedule?h:{},show_end_time:Number(e.show_end_time)||!1};delete i.extra_service_details,d||(delete i.extra_services,delete i.custom_field);const r=await s.A.service.updateService(f,i);if(r?.success){const e=p?.map(e=>e?.id===r?.data?.id?r?.data:e);o({serviceList:e}),o({loadingServiceId:!1})}return r}catch(e){console.error("Error updating service:",e)}finally{o({loadingServiceId:!1})}},updateStatus:async({id:e,...t})=>{try{delete t.extra_service_details;const o=await(s.A?.service?.updateService(e,t));if(o?.success){const e=(0,i.select)(c.services).getServicesState("serviceList"),t=e?.map(e=>e.id===o.data.id?o.data:e);(0,i.dispatch)(c.services).setServicesState({serviceList:t})}return o}catch(e){console.error("Error updating status:",e)}finally{(0,i.dispatch)(c.services).setServicesState({loadingServiceId:null})}},getServices:y,deleteSingleService:async e=>{try{const t=await(s.A?.service?.deleteSingleService(e));if(t?.success){const{serviceList:t,total:o}=(0,i.select)(c.services).getServicesState();(0,i.dispatch)(c.services).setServicesState({serviceList:t?.filter(t=>t.id!==e),total:o-1})}return t}catch(e){console.error("Error deleting service:",e)}},bulkDeleteService:async(e=[])=>{try{const t=await(s.A?.service?.bulkDeleteService({ids:e}));if(t?.success&&(o({serviceList:p.filter(t=>!e.includes(t.id))}),e.length<m)){const{paged:e="",per_page:t=""}=u;y({paged:e,per_page:t})}}catch(e){console.error("Error bulk deleting services:",e)}finally{return{complete:!0}}},duplicateService:async e=>{try{o({isFiltering:!0});const t=await(s.A?.service?.cloneService(e));if(t?.success){const i=p.findIndex(t=>t.id===e);if(-1===i)throw new Error("Service not found for duplication.");const r=[...p.slice(0,i+1),t.data,...p.slice(i+1)];o({serviceList:r,total:m+1})}}catch(e){console.error("Error duplicating service:",e)}finally{o({isFiltering:!1})}},getSingleService:async()=>{try{const e=await s.A.service.singleService(f);e.success&&o({singleService:{...e?.data,custom_field:{...e?.data?.custom_field,fields:e?.data?.custom_field?.fields?.length?e?.data?.custom_field?.fields:n.defaultFields}}})}catch(e){console.log(e)}},onPaginationChange:(e,t)=>{y({paged:e,per_page:t})}}}},79836:(e,t,o)=>{o.d(t,{Ch:()=>S,Es:()=>g,Kz:()=>f,QB:()=>u,Wb:()=>n,Xd:()=>b,Yz:()=>l,ee:()=>d,ff:()=>_,i5:()=>a,pj:()=>m,rG:()=>v,sI:()=>p});var i=o(59e3),r=o(22564),c=o(2812);const{Dropdown:s}=window?.booktics?.library||{},a=(0,i.A)(r.Flex)`
    margin-bottom: 10px;
`,n=(0,i.A)(r.TextInput)`
    &.ant-form-item {
        width: 100%;
        margin-bottom: 0px;
    }
    .ant-input-group-addon {
        padding-inline: 0px;
    }
`,l=(0,i.A)(r.Flex)`
    margin-bottom: 16px;
`,d=(0,i.A)(r.Card)`
    border-color: #cdd0d6;
    border-radius: 4px;
`,u=i.A.div`
    cursor: pointer;
`,p=(0,i.A)(c.Q)`
    .ant-input-number-group-addon {
        padding: 0;
        width: 80px;
        background-color: white;
        .ant-form-item {
            margin-bottom: 0;
        }
    }
`,m=((0,i.A)(r.Flex)`
    margin-bottom: 10px;
`,i.A.div`
    background-color: white;
    border-radius: 4px;
`),v=(0,i.A)(r.TextInput)`
    width: 100%;
    margin-bottom: 0px;
`,g=(0,i.A)(r.PrimaryOutlinedButton)`
    width: 100%;
    margin-bottom: 0px;
    border: none;
    justify-content: flex-start;
    background-color: #fafffd;
    margin-top: 10px;
`,b=((0,i.A)(s)`
    height: 46px;
    background-color: blue;
`,(0,i.A)(r.Flex)`
    .bkt-publish-btn-dropdown {
        button {
            height: 46px;
            padding: 12px 15px;
            :where(
                    .css-dev-only-do-not-override-mc1tut
                ).ant-btn-variant-outlined:not(:disabled):not(
                    .ant-btn-disabled
                ):hover {
                border-color: ${({theme:e})=>e.colors.primary};
                color: ${({theme:e})=>e.colors.primary};
            }
        }
    }
`),h={pointerEvents:"none",opacity:"0.5",cursor:"not-allowed"},_=i.A.div`
    ${e=>e.disabled&&h};
`,S=(0,i.A)(r.SwitchInput)`
    margin-bottom: 0px;
    margin-top: 10px;
`,f=(0,i.A)(r.Card)`
    .ant-card-body {
        padding: 16px 20px;
    }
`},81437:(e,t,o)=>{o.r(t),o.d(t,{default:()=>S});var i=o(51609),r=o(48876),c=o(86087),s=o(79836),a=o(22564),n=o(56580),l=o(27723);const d=({label:e=(0,l.__)("Select service","booktics"),options:t,onChange:o,openShortCodeModal:r,setOpenShortCodeModal:d})=>{const[u]=a.Form.useForm(),{isMobile:p}=(0,n.useMediaQuery)(),{copy:m,copied:v}=(0,n.useCopyText)(),[g,b]=(0,c.useState)(null);(0,c.useEffect)(()=>{v&&g&&(window.wp?.hooks?.doAction("notification",{type:"success",message:(0,l.__)(`Copied Shortcode - ${g}`,"booktics")}),setTimeout(()=>{h()},500))},[v]);const h=()=>{b(null),u.resetFields(),d(!1)};return(0,i.createElement)(a.Modal,{open:r,title:(0,l.__)("Generate Shortcode","booktics"),width:p?360:600,onClose:h,onCancel:h},(0,i.createElement)(a.Flex,{gap:10,vertical:!0},(0,i.createElement)(a.Form,{layout:"vertical",form:u},(0,i.createElement)(a.FormItem,{label:e,name:"id"},(0,i.createElement)(a.SelectInput,{options:t,onChange:e=>o(e,b)}))),g&&r&&(0,i.createElement)(a.Flex,{vertical:!0,gap:10},(0,i.createElement)(a.Flex,{gap:5},(0,i.createElement)(s.rG,{value:g,readOnly:!0}),(0,i.createElement)(a.PrimaryButton,{text:(0,l.__)("Copy","booktics"),onClick:()=>m(g)})))))},u=o(59e3).A.div`
    border: 1px solid #e4e4e7;
    padding: 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    max-width: 1000px;
`,p=({title:e,description:t,buttonText:o,onClick:r})=>(0,i.createElement)(u,null,(0,i.createElement)("div",null,(0,i.createElement)(a.Title,{text:(0,l.__)(e,"booktics"),level:5}),(0,i.createElement)(a.Description,{text:t})),(0,i.createElement)(a.PrimaryOutlinedButton,{text:(0,l.__)(o,"booktics"),onClick:r})),m=()=>window?.wp?.hooks.applyFilters("booktics_location_shortcode",(0,i.createElement)(a.EmptyScreen,{isPro:!0}),{ShortCodeCard:p,GenerateShortCodeModal:d,handleSelectLocation:(e,t)=>{t(`[booktics_location id="${e}"]`)}});var v=o(47143),g=o(3038),b=o(40309);const h=()=>{const{copy:e,copied:t}=(0,n.useCopyText)(),[o,r]=(0,c.useState)(!1),{getServices:s}=(0,g.A)();(0,c.useEffect)(()=>{t&&window.wp?.hooks?.doAction("notification",{type:"success",message:(0,l.__)("Copied Shortcode - [booktics_booking_form]","booktics")})},[t]);const{serviceList:a}=(0,v.useSelect)(e=>e(b.services).getServicesState(),[]);return(0,c.useEffect)(()=>{a||s()},[a]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(p,{title:(0,l.__)("View all services by short Code","booktics"),description:(0,l.__)("Browse and manage all available services linked to a specific short code.","booktics"),buttonText:(0,l.__)("Copy Shortcode","booktics"),onClick:()=>e("[booktics_booking_form]")}),(0,i.createElement)(p,{title:(0,l.__)("Generate short code based on selected Service","booktics"),description:(0,l.__)("Select a service to generate a corresponding short code for easy reference and access.","booktics"),buttonText:(0,l.__)("Generate","booktics"),onClick:()=>r(!0)}),(0,i.createElement)(d,{openShortCodeModal:o,setOpenShortCodeModal:r,options:a?.map(e=>({label:e?.title,value:e?.id})),onChange:(e,t)=>{t(`[booktics_service_view id="${e}"]`)}}))},_=()=>{const{copy:e,copied:t}=(0,n.useCopyText)();return(0,c.useEffect)(()=>{t&&window.wp?.hooks?.doAction("notification",{type:"success",message:(0,l.__)("Copied Shortcode - [booktics_category_form]","booktics")})},[t]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(p,{title:(0,l.__)("View all categories by short Code","booktics"),description:(0,l.__)("Browse and manage all available categories linked to a specific short code.","booktics"),buttonText:(0,l.__)("Copy Shortcode","booktics"),onClick:()=>e("[booktics_category_form]")}))},S=()=>{const e=(0,n.useAdminLicense)();return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(r.A,{title:(0,l.__)("Shortcodes","booktics")}),(0,i.createElement)(a.ResponsiveContainer,null,(0,i.createElement)(a.Card,null,(0,i.createElement)(a.Flex,{gap:"10px",vertical:!0},(0,i.createElement)(h,null),(0,i.createElement)(_,null),e&&(0,i.createElement)(m,null)))))}}}]);