"use strict";(globalThis.webpackChunkbooktics=globalThis.webpackChunkbooktics||[]).push([[4883],{3038:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(47143),n=r(47767),l=r(40309),s=r(11534),o=r(56580),i=r(88802);const c=function(){const e=(0,a.useSelect)(e=>e(l.services).getServicesState(),[]),{selectedServices:t}=(0,a.useSelect)(e=>e(l.team).getTeamState(),[]),{setServicesState:r}=(0,a.useDispatch)(l.services),{setTeamState:c}=(0,a.useDispatch)(l.team),d=(0,o.useAdminLicense)(),{searchQuery:m,serviceList:u=[],total:p,singleService:g,selectedTeamMembers:b,selectedExtraServices:_=[],schedule:E,selectedLocations:y}=e,v=(0,n.Zp)(),{id:h}=(0,n.g)(),k=async(e={})=>{e?.resetFilter&&(e={search:"",category_id:"",team_member_id:""});const t={...m,...e};r({isFiltering:!0});try{const e=await(s.A?.service?.allServices(t));e?.success&&r({serviceList:e?.data?.items,total:e?.data?.total,searchQuery:t})}catch(e){console.error("Error fetching services:",e)}finally{return r({isFiltering:!1}),{complete:!0}}};return{createService:async(e,a=!0)=>{try{r({isFiltering:!0});const n=await(s.A?.service?.createService(e));n?.success&&(r({serviceList:[n?.data,...u||[]],total:p+1}),a?v(`/services/update/${n?.data.id}`):(r({visibleCreateServiceModal:!1}),c({selectedServices:[n.data.id,...t]})))}catch(e){console.error("Error creating service:",e)}finally{r({isFiltering:!1})}},updateService:async(e,t="deactive",a=!1)=>{if(a||r({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 a={...g,...e,status:t,extra_services:_,team_member:b,schedule:e.enable_custom_schedule?E:{},show_end_time:Number(e.show_end_time)||!1};delete a.extra_service_details,d||(delete a.extra_services,delete a.custom_field);const n=await s.A.service.updateService(h,a);if(n?.success){const e=u?.map(e=>e?.id===n?.data?.id?n?.data:e);r({serviceList:e}),r({loadingServiceId:!1})}return n}catch(e){console.error("Error updating service:",e)}finally{r({loadingServiceId:!1})}},updateStatus:async({id:e,...t})=>{try{delete t.extra_service_details;const r=await(s.A?.service?.updateService(e,t));if(r?.success){const e=(0,a.select)(l.services).getServicesState("serviceList"),t=e?.map(e=>e.id===r.data.id?r.data:e);(0,a.dispatch)(l.services).setServicesState({serviceList:t})}return r}catch(e){console.error("Error updating status:",e)}finally{(0,a.dispatch)(l.services).setServicesState({loadingServiceId:null})}},getServices:k,deleteSingleService:async e=>{try{const t=await(s.A?.service?.deleteSingleService(e));if(t?.success){const{serviceList:t,total:r}=(0,a.select)(l.services).getServicesState();(0,a.dispatch)(l.services).setServicesState({serviceList:t?.filter(t=>t.id!==e),total:r-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&&(r({serviceList:u.filter(t=>!e.includes(t.id))}),e.length<p)){const{paged:e="",per_page:t=""}=m;k({paged:e,per_page:t})}}catch(e){console.error("Error bulk deleting services:",e)}finally{return{complete:!0}}},duplicateService:async e=>{try{r({isFiltering:!0});const t=await(s.A?.service?.cloneService(e));if(t?.success){const a=u.findIndex(t=>t.id===e);if(-1===a)throw new Error("Service not found for duplication.");const n=[...u.slice(0,a+1),t.data,...u.slice(a+1)];r({serviceList:n,total:p+1})}}catch(e){console.error("Error duplicating service:",e)}finally{r({isFiltering:!1})}},getSingleService:async()=>{try{const e=await s.A.service.singleService(h);e.success&&r({singleService:{...e?.data,custom_field:{...e?.data?.custom_field,fields:e?.data?.custom_field?.fields?.length?e?.data?.custom_field?.fields:i.defaultFields}}})}catch(e){console.log(e)}},onPaginationChange:(e,t)=>{k({paged:e,per_page:t})}}}},12017:(e,t,r)=>{r.d(t,{A:()=>O});var a=r(51609),n=r(47143),l=r(86087),s=r(84976),o=r(23973),i=r(3038),c=r(40309),d=r(22564),m=r(87492),u=r(27723);const p=({onCancel:e,onSave:t,isSaving:r=!1})=>(0,a.createElement)(d.Flex,{gap:12,justify:"flex-end"},(0,a.createElement)(d.PrimaryButton,{type:"default",variant:"solid",onClick:e},(0,u.__)("Close","booktics")),(0,a.createElement)(d.PrimaryButton,{type:"primary",onClick:t,loading:r},(0,u.__)("Save Now","booktics")));var g=r(59e3);const b=g.A.div`
    .ant-drawer {
        /* .ant-drawer-content{ */
        .ant-drawer-body {
            background: #f8f9fa !important;
        }

        .ant-drawer-footer {
            padding: 20px !important;
            border-top: 1px solid #e8e9ea !important;
            background: #fff !important;
        }

        .ant-drawer-close {
            color: #8c8c8c;

            &:hover {
                color: #262626;
            }
        }
        /* } */
    }

    .bkt-drawer-content {
        height: 100%;

        .bkt-no-appointment {
            text-align: center;
            padding: 48px 24px;
            color: #8c8c8c;
        }
    }
`,_=g.A.p`
    padding:6px 11px;
    border:1px solid lightgray;
    font-size:14px;
    color:black;
    border-radius:4px;
`,E=g.A.div`
    background: #fff;
    margin-bottom: 1rem;
`,y=g.A.div`
    background: #fff;
    .bkt-title-wrapper {
        border-bottom: 1px solid #e8e9ea;
    }

    .bkt-section-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 0.5rem;
    }
`,v=(g.A.div`
    background: #fff;

    .bkt-section-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
         margin-bottom: 0.5rem;
    }

     /* Payment status select styling */
    .bkt-payment-status {
        .ant-form-item {
            margin-bottom: 0 !important;
            min-width: 150px;
        }

        .ant-select {
            min-width: 150px;
        }
    }

    .bkt-cost-breakdown {
        .bkt-breakdown-title {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
        }

        .bkt-breakdown-items {
            margin-bottom: 16px;

            .bkt-breakdown-item {
                padding: 12px 0;
                border-bottom: 1px solid #f3f4f6;

                &:last-child {
                    border-bottom: none;
                }

                .bkt-item-info {
                    .bkt-item-label {
                        font-size: 14px;
                        color: #1a1a1a;
                        font-weight: 500;
                        margin: 0;
                    }

                    .bkt-item-detail {
                        font-size: 12px;
                        color: #6b7280;
                        margin-top: 2px;
                        margin-bottom: 0;
                    }
                }

                .bkt-item-price {
                    font-size: 14px;
                    font-weight: 500;
                    color: #1a1a1a;
                }
            }
        }

        .bkt-breakdown-total {
            padding-top: 16px;
            border-top: 2px solid #e5e7eb;

            .bkt-total-label,
            .bkt-total-amount {
                font-size: 16px;
                font-weight: 700;
                color: #1a1a1a;
            }
        }
    }
`,g.A.div`    
    .bkt-order-info {
        margin-bottom: 8px;
        
        p {
            margin: 0;
            font-size: 14px;
            color: #4b5563;
            
            strong {
                font-weight: 600;
                color: #1f2937;
            }
        }
        .ant-divider{
            color: #4b5563;
        }
    }
    
    .bkt-status-selects {
        .bkt-status-field {
            flex: 1;
            min-width: 0;
            
            .bkt-status-label {
                display: block;
                margin-bottom: 6px;
                font-size: 14px;
                font-weight: 500;
                color: #4b5563;
            }
        }
    }
`),h=({items:e})=>e?.[0]?.cancel_note?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"bkt-cancel-note-section"},(0,a.createElement)("h4",{className:"bkt-section-title"},(0,u.__)("Cancellation message from customer","booktics")),(0,a.createElement)(_,null,e[0].cancel_note))):null,k=()=>(0,a.createElement)(y,null,(0,a.createElement)("h4",{className:"bkt-section-title"},(0,u.__)("Customer Details","booktics")),(0,a.createElement)(d.Divider,{size:"small"}),(0,a.createElement)(d.Row,{gutter:[16]},(0,a.createElement)(d.Col,{xs:24,md:12},(0,a.createElement)(d.TextInput,{name:["customer","name"],label:(0,u.__)("Full Name","booktics"),placeholder:(0,u.__)("Enter your full name","booktics")})),(0,a.createElement)(d.Col,{xs:24,md:12},(0,a.createElement)(d.EmailInput,{name:["customer","email"],label:(0,u.__)("Email","booktics"),placeholder:(0,u.__)("Enter email","booktics")})),(0,a.createElement)(d.Col,{xs:24,md:12},(0,a.createElement)(d.CountryPhoneInput,{name:["customer","phone"],label:(0,u.__)("Mobile","booktics")})),(0,a.createElement)(d.Col,{xs:24,md:12},(0,a.createElement)(d.NumberInput,{name:"total_attendees",label:(0,u.__)("Total Attendees","booktics"),disabled:!0,readOnly:!0})),(0,a.createElement)(d.Col,{xs:24},(0,a.createElement)(d.TextInput,{name:["customer","note"],label:(0,u.__)("Note","booktics"),placeholder:(0,u.__)("Write notes","booktics")})))),f=({items:e})=>(0,a.createElement)(E,null,(0,a.createElement)(d.SingleBookingBox,{bookingItem:e[0],isEditMode:!0})),x=[{label:(0,u.__)("Open","booktics"),value:"open"},{label:(0,u.__)("Canceled","booktics"),value:"canceled"},{label:(0,u.__)("Completed","booktics"),value:"completed"}];var S=r(76797);const w=({singleOrder:e})=>(0,a.createElement)(v,null,(0,a.createElement)("div",{className:"bkt-order-info"},(0,a.createElement)(d.Flex,{gap:16},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,u.__)("Order ID:","booktics"))," ",e?.id),(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,u.__)("Code:","booktics"))," ",e?.order_no))),(0,a.createElement)(d.Divider,{size:"middle"}),(0,a.createElement)("div",{className:"bkt-status-selects"},(0,a.createElement)(d.Flex,{gap:16,align:"flex-start"},(0,a.createElement)("div",{className:"bkt-status-field"},(0,a.createElement)("label",{className:"bkt-status-label"},(0,u.__)("Order Status","booktics")),(0,a.createElement)(d.FormItem,{name:"status",className:"bkt-status-form-item"},(0,a.createElement)(d.SelectInput,{options:x,placeholder:(0,u.__)("Order Status","booktics"),getPopupContainer:()=>document.body.querySelector(".bkt-status-field")}))),(0,a.createElement)("div",{className:"bkt-status-field"},(0,a.createElement)("label",{className:"bkt-status-label"},(0,u.__)("Payments Status","booktics")),(0,a.createElement)(d.FormItem,{name:"payment_status",className:"bkt-status-form-item"},(0,a.createElement)(d.SelectInput,{options:(0,S.DB)(),placeholder:(0,u.__)("Payment Status","booktics"),getPopupContainer:()=>document.body.querySelector(".bkt-status-field")})))))),{Drawer:A}=window?.booktics?.library||{},O=()=>{const[e]=(0,s.ok)(),{singleOrder:t,singleOrderLoading:r}=(0,n.useSelect)(e=>e(c.orders).getOrdersState(),[]),{serviceList:g}=(e.get("view"),(0,n.useSelect)(e=>e(c.services).getServicesState(),[])),{getServices:_}=(0,i.A)(),{updateOrder:E}=(0,o.A)();(0,l.useEffect)(()=>{g||_()},[g]);const[y]=d.Form.useForm(),{editDrawerOpen:v}=(0,n.useSelect)(e=>e(c?.appointments).getAppointmentState()),{setAppointmentState:x}=(0,n.useDispatch)(c?.appointments),S=()=>{x({editDrawerOpen:!1})};return(0,l.useEffect)(()=>{if(t){const e={customer:t?.customer,payment_status:t?.payment_status,status:t?.status,total_attendees:Number(t?.items?.[0]?.total_attendees),cancel_note:String(t?.items?.[0]?.cancel_note)}||{};y.setFieldsValue(e)}},[t]),t?(0,a.createElement)(b,null,(0,a.createElement)(A,{title:(0,u.__)("Edit Order","booktics"),width:480,placement:"right",onClose:S,open:v,destroyOnHidden:!0,zIndex:999999,footer:(0,a.createElement)(p,{onCancel:S,onSave:y.submit})},r?(0,a.createElement)(d.RowSkeleton,null):(0,a.createElement)("div",{className:"bkt-drawer-content"},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.Form,{form:y,layout:"vertical",onFinish:async e=>{const r={...t,...e,customer:{...e.customer,id:t.customer.id}};(await E(r.id,r)).success&&S()}},(0,a.createElement)(w,{singleOrder:t}),t?.directorist_id&&(0,a.createElement)(m.A,{singleOrder:t}),(0,a.createElement)("br",null),(0,a.createElement)(f,{items:t?.items}),(0,a.createElement)(k,null),(0,a.createElement)(h,{items:t?.items})))))):null}},23973:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(47143),n=r(40309),l=r(11534);const s=function(){const{ordersLists:e,searchQuery:t,total:r}=(0,a.useSelect)(e=>e(n.orders).getOrdersState(),[]),{setOrdersState:s}=(0,a.useDispatch)(n.orders),{setAppointmentState:o}=(0,a.useDispatch)(n?.appointments),{appointments:i}=(0,a.useSelect)(e=>e(n?.appointments).getAppointmentState()),c=async e=>{s({singleOrderLoading:!0});try{const t=await(l.A?.orders.singleOrder(e));return t.success&&s({singleOrder:t?.data}),t}catch(e){console.log(e)}finally{s({singleOrderLoading:!1})}};return{updateOrder:async(t,r)=>{try{const a=await(l.A?.orders?.updateOrder(t,r));if(a?.success){const t=e?.map(e=>e.id===a.data.id?a.data:e),r=i?.items.find(e=>e.order_id===a?.data.id);if(s({ordersLists:t,singleOrder:a.data}),r){const e=i.items.map(e=>e.order_id===a.data.id?{...e,payment_status:a?.data.payment_status}:e);o({appointments:{...i,items:e}})}}return a}catch(e){console.error("Error updating orders:",e)}},getOrders:async(e={})=>{e?.resetFilter&&(e={search:"",paged:"",payment_method:"",payment_status:"",order_date:""});const r={...t,...e};s({isFiltering:!0});try{const e=await(l.A?.orders?.allOrders(r));e?.success&&s({ordersLists:e?.data?.items,total:e?.data?.total,searchQuery:r})}catch(e){console.error("Error fetching services:",e)}finally{return s({isFiltering:!1}),{complete:!0}}},singleOrderDelete:async t=>{try{const a=await(l.A?.orders.deleteSingleOrder(t));a?.success&&s({ordersLists:e?.filter(e=>e.id!==t),total:r-1})}catch(e){console.error("Error deleting service:",e)}},bulkDeleteOrder:async(t=[])=>{try{const r=await(l.A?.orders?.bulkDeleteOrders({ids:t}));if(r?.success&&r?.data){const t=e.map(e=>e.id===id?r.data:e);s({ordersLists:t})}}catch(e){console.error("Error bulk deleting services:",e)}finally{return{complete:!0}}},getSingleOrder:c,onPaginationChange:(e,t)=>{getServices({paged:e,per_page:t})},handleOrderEdit:async e=>{o({editDrawerOpen:!0}),await c(e)}}}},30151:(e,t,r)=>{r.d(t,{Ac:()=>o,DA:()=>s,OV:()=>l});var a=r(59e3),n=r(22564);const l=a.A.div`
    .ant-tag {
        font-size: 12px;
        font-weight: 600;
        padding: 6px 8px;
        margin-right: 0px;
        span{
            line-height: 1.2;
            text-transform: capitalize;
        }
    }
`,s=(0,a.A)(n.Flex)`
    .btk-re-invite-btn{
        height: 36px;
        border-radius: 4px;
        box-shadow: none;
        font-weight: 500;
        font-size: 14px;
    }
    .btk-edit-btn{
        height: 36px !important;
    }
`,o=(0,a.A)(n.SelectInput)`
    min-width: 190px;
    width: 100%;
`},76797:(e,t,r)=>{r.d(t,{DB:()=>n,Dl:()=>s,JZ:()=>l});var a=r(27723);const n=()=>[{label:(0,a.__)("Not Paid","booktics"),value:"not_paid"},{label:(0,a.__)("Fully Paid","booktics"),value:"fully_paid"},{label:(0,a.__)("Processing","booktics"),value:"processing"}],l=[{label:(0,a.__)("Local","booktics"),value:"pay_later"},{label:(0,a.__)("Stripe","booktics"),value:"stripe"},{label:(0,a.__)("Paypal","booktics"),value:"paypal"}],s={not_paid:"#ef4444",partially_paid:"#3b82f6",paid:"#10b981",processing:"#f59e0b"}},87492:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(51609),n=r(22564),l=r(27723);const s=({singleOrder:e})=>(0,a.createElement)("div",null,e?.directorist_id&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(n.Title,{level:5,text:(0,l.__)("Directory Listing","booktics")}),(0,a.createElement)(n.Link,{href:e?.directorist_url,text:e?.directorist_title})))},94883:(e,t,r)=>{r.r(t),r.d(t,{default:()=>G});var a=r(51609),n=r(47143),l=r(86087),s=r(47767),o=r(48876),i=r(40309),c=r(22564),d=r(56580),m=r(12017),u=r(23973),p=r(74353),g=r.n(p),b=r(88802);const{paged:_,per_page:E}=b.pagination,y=()=>{const[e,t]=(0,l.useState)([]),{searchQuery:r}=(0,n.useSelect)(e=>e(i.orders).getOrdersState(),[]),{setOrdersState:a}=(0,n.useDispatch)(i.orders),{getOrders:s}=(0,u.A)();return{searchQuery:r,rowSelection:{selectedRowKeys:e,onChange:e=>t(e)},selectedRowKeys:e,setSelectedRowKeys:t,setOrdersState:a,onPaginationChange:(e,t)=>{s({paged:e,per_page:t})},handleFilterByOrderDate:e=>{if(!e)return;const t=g()(e).format("YYYY-MM-DD")||"",n={...r,paged:1,order_date:t};a({searchQuery:n}),s(n)},handleFilterByPaymentMethod:e=>{const t={...r,paged:1,payment_method:e||""};a({searchQuery:t}),s(t)},handleFilterByPaymentStatus:e=>{const t={...r,paged:1,payment_status:e||""};a({searchQuery:t}),s(t)},handleClearAll:()=>{a({searchQuery:{paged:_,per_page:E},ordersList:null}),s({resetFilter:!0})}}};var v=r(93524),h=r(87492),k=r(76797);const f=({record:e={},isdisabled:t=!1})=>{const{isAdmin:r}=(0,d.useUserRole)(),{payment_status:n="not_paid"}=e,{updateOrder:s}=(0,u.A)(),o=(0,d.useI18nReady)(),i=(0,l.useMemo)(()=>(0,k.DB)().map(e=>({...e,color:k.Dl[e.value]})),[o]);return(0,a.createElement)("div",{onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},(0,a.createElement)(c.ColoredDotedSelectInput,{value:n,onChange:async t=>{let r={...e,payment_status:t};await s(r.id,r)},disabled:t||!r,options:i,colorMap:k.Dl,width:"160px",size:"middle"}))},x={pay_later:"Local",stripe:"Stripe",paypal:"Paypal"},S=({paymentMethod:e})=>e?(0,a.createElement)("span",null,x[e]||null):null;var w=r(59e3);w.A.div`
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px;
    white-space: nowrap;
    color: #525266;
    font-size: 14px;
    font-weight: 500;

    span {
        width: 12px;
        height: 12px;
        border-radius: 50px;
        background-color: ${({color:e})=>e};
    }
`,(0,w.A)(c.PrimaryOutlinedButton)`
    &.ant-btn-lg {
        height: 36px !important;
    }
`,(0,w.A)(c.DatePicker)`
    height: 44px;
`;const A=(0,w.A)(c.Title)`
    margin-block: 0px !important;
    white-space: nowrap;
`,O=(0,w.A)(c.Divider)`
    margin-block: 16px;
`,C=(0,w.A)(c.Card)`
    width: 100%;
    border-radius: 10px;
    border: 1px solid #e2ecf4;
    position: relative;

    .ant-card-body {
        padding: 20px;
    }

    .bkt-booking-service-title {
        font-weight: 600;
        font-size: 16px;
    }

    .bkt-booking-service-date-time {
        color: #3161f1;
        font-weight: 500;
    }
`;var F=r(27723);const D=({singleOrder:e})=>{const{data:t}=(0,n.useSelect)(e=>e(i.settings).getSettingsState(),[]);return(0,a.createElement)("div",null,(0,a.createElement)(c.Flex,{justify:"space-between",align:"center"},(0,a.createElement)(c.Flex,{gap:10,align:"center"},(0,a.createElement)(A,{level:4,text:(0,F.__)("Billing information","booktics")}),(0,a.createElement)(f,{record:e,isdisabled:!0})),(0,a.createElement)(c.Pricing,{settings:t,price:e?.total})),(0,a.createElement)(O,null),(0,a.createElement)(c.Row,{gutter:[16,16]},(0,a.createElement)(c.Col,{xs:24,md:12},(0,a.createElement)(A,{level:5,text:(0,F.__)("Name","booktics")}),(0,a.createElement)(c.Text,{text:e?.customer?.name})),(0,a.createElement)(c.Col,{xs:24,md:12},(0,a.createElement)(A,{level:5,text:(0,F.__)("Registered On","booktics")}),(0,a.createElement)(c.Text,{text:g()(e?.created_at).format("MMM DD, YYYY, hh:mmA")})),(0,a.createElement)(c.Col,{xs:24,md:12},(0,a.createElement)(A,{level:5,text:(0,F.__)("Email","booktics")}),(0,a.createElement)(c.Text,{text:e?.customer?.email})),e?.directorist_id&&(0,a.createElement)(h.A,{singleOrder:e}),0!==Number(e?.total)&&(0,a.createElement)(c.Col,{xs:24,md:12},(0,a.createElement)(A,{level:5,text:(0,F.__)("Payment Gateway","booktics")}),(0,a.createElement)(S,{paymentMethod:e?.payment_gateway})),Array.isArray(e.custom_fields)&&e?.custom_fields.map(e=>(0,a.createElement)(c.Col,{xs:12,key:e.name},(0,a.createElement)(A,{level:5,text:e?.label,className:"bkt-custom-field-title"}),(0,a.createElement)(c.Text,{text:Array.isArray(e.value)?e.value.join(" "):e.value})))))},I=React.memo(({singleOrder:e})=>{const{data:t}=(0,n.useSelect)(e=>e(i.settings).getSettingsState(),[]);return(0,a.createElement)(c.CostBreakdownReusableComp,{invoiceData:e,settings:t})}),P=({settings:e,item:t})=>(0,a.createElement)(C,null,(0,a.createElement)(c.Flex,{vertical:!0,gap:"small"},(0,a.createElement)(c.Flex,{justify:"space-between"},(0,a.createElement)(c.Text,{className:"bkt-booking-service-title",text:t?.service?.title}),(0,a.createElement)(c.Text,{className:"bkt-booking-service-title",text:(0,a.createElement)(c.Pricing,{settings:e,price:t?.price})})),(0,a.createElement)(c.Text,{className:"bkt-booking-service-date-time",text:`${t.date}, ${t.start_time}-${t.end_time}`}),(0,a.createElement)(c.Flex,{justify:"space-between",gap:"small",wrap:!0,align:"center"},(0,a.createElement)(c.Flex,{gap:"small",align:"center"},(0,a.createElement)(c.Avatar,{src:t.team.image,alt:t.team.display_name,size:26}),(0,a.createElement)(c.Text,{text:t.team.display_name}))))),R=({singleOrder:e})=>{const{data:t}=(0,n.useSelect)(e=>e(i.settings).getSettingsState(),[]);return(0,a.createElement)("div",null,(0,a.createElement)(A,{level:5,text:(0,F.__)("Service Summary","booktics")}),(0,a.createElement)(O,null),(0,a.createElement)(c.Flex,{vertical:!0,gap:10},Array.isArray(e.items)&&e.items.map(e=>(0,a.createElement)(P,{item:e,settings:t,key:e.id}))))},N=React.memo(()=>{const{isMobile:e}=(0,v.U)(),{visibleReportModal:t,singleOrder:r}=(0,n.useSelect)(e=>e(i.orders).getOrdersState(),[]),{setOrdersState:l}=(0,n.useDispatch)(i.orders),s=()=>l({visibleReportModal:!1});if(r)return(0,a.createElement)(c.Modal,{open:t,title:`Order ID - ${r?.order_no}`,width:e?350:720,onClose:s,onCancel:s},(0,a.createElement)(c.Flex,{vertical:!0,gap:10},(0,a.createElement)(D,{singleOrder:r}),(0,a.createElement)(R,{singleOrder:r}),(0,a.createElement)(I,{singleOrder:r})))});var M=r(95358),L=r(30151),T=r(46714);const{DeleteOutlined:B}=window?.booktics?.libraryIcons||{},z=({record:e})=>{const{isAdmin:t}=(0,d.useUserRole)(),{singleOrderDelete:r,getSingleOrder:s,handleOrderEdit:o}=(0,u.A)(),{setOrdersState:m}=(0,n.useDispatch)(i?.orders),p=(0,l.useCallback)(()=>{window.wp?.hooks?.doAction("delete_confirmation",{title:(0,F.__)("Are you sure you want to delete the order","booktics"),onOk:()=>r(e.id)})},[e.id]),g=async()=>{m({visibleReportModal:!0}),await s(e.id)},b=(0,l.useMemo)(()=>{const e=[{key:"preview",label:(0,a.createElement)(c.Flex,{gap:6},(0,a.createElement)(T.PreviewIcon,null)," ",(0,F.__)("Preview","booktics")),onClick:g}];return t&&e.push({key:"delete",danger:!0,label:(0,a.createElement)(c.Flex,{gap:6},(0,a.createElement)(B,null)," ",(0,F.__)("Delete","booktics")),onClick:p}),e},[p,g,t]);return(0,a.createElement)(L.DA,{justify:"flex-end",align:"center",gap:8,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},(0,a.createElement)(c.Can,null,(0,a.createElement)(c.Tooltip,{title:(0,F.__)("Edit Order","booktics")},(0,a.createElement)(c.IconButton,{icon:(0,a.createElement)(T.EditIcon,null),className:"btk-edit-btn",onClick:()=>o(e?.id)}))),(0,a.createElement)(c.Dropdown,{menu:{items:b},placement:"bottomRight",arrow:!1,trigger:"hover"},(0,a.createElement)(c.IconButton,{icon:(0,a.createElement)(T.ThreeDotIcon,null)})))},Q=({record:e})=>{const{data:t}=(0,n.useSelect)(e=>e(i.settings).getSettingsState(),[]);return(0,a.createElement)(c.Pricing,{settings:t,price:e?.total})},K=[{title:(0,F.__)("Order ID","booktics"),dataIndex:"order_no",key:"order_no",fixed:"left",width:"200px",render:(e,t)=>(0,a.createElement)(c.Flex,{vertical:!0},(0,a.createElement)(c.Title,{text:t?.order_no,level:5}),(0,a.createElement)(c.Description,{text:(0,M.formattedDate)(t?.created_at)}))},{title:(0,F.__)("Customer","booktics"),dataIndex:"customer",key:"customer",width:"200px",render:(e,t)=>(0,a.createElement)(c.Flex,{vertical:!0},(0,a.createElement)(c.Title,{text:t?.customer?.display_name,level:5}),(0,a.createElement)(c.Description,{text:t?.customer?.email}))},{title:(0,F.__)("Total Service","booktics"),dataIndex:"total_services",key:"total_services",width:"150px",render:(e,t)=>(0,a.createElement)("span",null,t?.total_services)},{title:(0,F.__)("Method","booktics"),dataIndex:"payment_method",key:"payment_method",width:"100px",render:(e,t)=>(0,a.createElement)(S,{paymentMethod:t?.payment_method})},{title:(0,F.__)("Amount","booktics"),dataIndex:"total",key:"total",width:"100px",render:(e,t)=>(0,a.createElement)(Q,{record:t})},{title:(0,F.__)("Payment Status","booktics"),dataIndex:"payment_status",key:"payment_status",width:"160px",render:(e,t)=>(0,a.createElement)(f,{record:t})},{title:(0,F.__)("Action","booktics"),dataIndex:"action",key:"action",fixed:"right",width:"150px",render:(e,t)=>(0,a.createElement)(z,{record:t})}];var Y=r(4581);const{__}=wp.i18n||{},j=({setIsFiltered:e,selectedRowKeys:t,setSelectedRowKeys:r})=>{const{getOrders:n,bulkDeleteOrder:l}=(0,u.A)();return(0,a.createElement)(a.Fragment,null,t.length?(0,a.createElement)(c.BulkDelete,{selectedRowKeys:t,setSelectedRowKeys:r,deleteApi:l}):(0,a.createElement)(c.Flex,{gap:6},(0,a.createElement)(c.SecondaryOutlineButton,{icon:(0,a.createElement)(T.FilterIcon,null),text:__("Filter","booktics"),onClick:()=>e(e=>!e),className:"bkt-filter-button"}),(0,a.createElement)(Y.A,{searchFunc:n})))},$=()=>{const{searchQuery:e,handleFilterByPaymentStatus:t}=y(),r=(0,d.useI18nReady)(),n=(0,l.useMemo)(()=>(0,k.DB)(),[r]);return(0,a.createElement)(c.Col,{xs:24,md:4},(0,a.createElement)(c.SelectInput,{allowClear:!0,showSearch:!0,optionFilterProp:"label",value:e.payment_status||void 0,placeholder:(0,F.__)("Select payment status","booktics"),options:n,onChange:t}))},Z=()=>{const{searchQuery:e,handleFilterByPaymentMethod:t}=y();return(0,d.useI18nReady)(),(0,a.createElement)(c.Col,{xs:24,md:4},(0,a.createElement)(c.SelectInput,{allowClear:!0,showSearch:!0,optionFilterProp:"label",value:e.payment_method||void 0,placeholder:(0,F.__)("Select payment method","booktics"),options:k.JZ,onChange:t}))},U=()=>{const{getOrders:e}=(0,u.A)();return window?.wp?.hooks.applyFilters("booktics_order_filter_by_location",null,{getOrders:e})},V=()=>{const{searchQuery:e,handleClearAll:t}=y();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)($,null),(0,a.createElement)(Z,null),(0,a.createElement)(U,null),(e?.payment_status||e?.payment_method||e?.order_date)&&(0,a.createElement)(c.Col,{xs:24,md:4},(0,a.createElement)(c.Button,{color:"red",variant:"link",onClick:t},(0,F.__)("All Clear","booktics"))))},{PlusOutlined:q}=window?.booktics?.libraryIcons||{},J=({selectedRowKeys:e,setSelectedRowKeys:t})=>{const[r,n]=(0,l.useState)(!1),o=(0,s.Zp)();return(0,a.createElement)(c.SecondaryMenu,{selectedView:"table",filteredTopMenu:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(j,{setIsFiltered:n,selectedRowKeys:e,setSelectedRowKeys:t}),(0,a.createElement)(c.PrimaryButton,{icon:(0,a.createElement)(q,null),text:(0,F.__)("New Booking","booktics"),onClick:()=>o("/appointments/create")})),isFiltered:r,filteredOptions:(0,a.createElement)(V,null)})},G=()=>{const{rowSelection:e,selectedRowKeys:t,setSelectedRowKeys:r,onPaginationChange:p}=y(),{getOrders:g,handleOrderEdit:b}=(0,u.A)(),_=(0,s.Zp)(),{ordersLists:E,searchQuery:v,total:h}=(0,n.useSelect)(e=>e(i.orders).getOrdersState(),[]),{isQueried:k}=(0,d.useSearchEmptyState)(v),{resetOrders:f}=(0,n.useDispatch)(i.orders),{isAdmin:x}=(0,d.useUserRole)();return(0,l.useEffect)(()=>{E||g()},[v]),E?k||0!==E.length?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.A,{title:(0,F.__)("Manage Order","booktics")}),(0,a.createElement)(c.ResponsiveContainer,null,(0,a.createElement)(J,{selectedRowKeys:t,setSelectedRowKeys:r}),k&&0===E.length?(0,a.createElement)(c.SearchNotFoundScreen,{searchQuery:v?.search||"",onClear:()=>f()}):(0,a.createElement)(c.Table,{total:h,pageSize:v.per_page||h,currentPage:v.paged,dataSource:E,columns:K,scroll:{x:1e3},rowSelection:!!x&&e,onPaginationChange:p,onRow:e=>({onClick:()=>{b(e?.id)}})}),(0,a.createElement)(N,null),(0,a.createElement)(m.A,null))):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.A,{title:(0,F.__)("Manage Order","booktics")}),(0,a.createElement)(c.ResponsiveContainer,null,(0,a.createElement)(c.EmptyScreen,{title:(0,F.__)("No orders found","booktics"),description:(0,F.__)("Create a new appointment to get started.","booktics"),addButtonText:(0,F.__)("Add New Appointment","booktics"),onAddButtonClick:()=>_("/appointments/create")}))):(0,a.createElement)(c.RowSkeleton,null)}}}]);