import{j as e,r as m}from"./client-BbMi5ewG.js";import{B as $}from"./Button-1dacbE2T.js";import{I as Z}from"./input-DhCVOJC-.js";import{S as B,a as R,b as z,c as O,f as r}from"./select-CPHcJnpt.js";import{D as Re,a as ze,E as Oe,b as Ue,c as ve}from"./dropdown-menu-B1ZTMBvw.js";import{S as l}from"./skeleton-ImO4uxQ7.js";import{C as Le,a as Ve}from"./card-CZBIFpqn.js";import{a as D,u as G,s as _}from"./store-jX25q14N.js";import{C as qe}from"./ConfirmDialog-C2asEKXG.js";import{a as Ge,C as Fe}from"./CategorySelect-C2tAEr7d.js";import{C as He}from"./Clock-BstuuuXu.js";import{S as Ze}from"./Search-BPdeYakj.js";import{P as le}from"./Plus-DGCB3awO.js";import{E as Ce}from"./Edit-C8qVzzd7.js";import{T as Se}from"./Trash-AmoyyqPS.js";import{u as ge,L as Me,h as We,f as Ye,R as Je,g as oe}from"./index-CM0LBdHD.js";import{c as Ae,X as pe}from"./utils-Q0fnGDhj.js";import{u as Qe,A as Xe}from"./ActionButton-CK3Uoxvt.js";import{C as Ke}from"./CrudLayout-Cx6KhKUY.js";import{M as De}from"./Tabs-CCGdXr30.js";import{L as k}from"./label-1wXMewvs.js";import{T as es}from"./textarea-QytFj8hO.js";import{I as ss}from"./ImageUpload-DbfzQEp2.js";import{S as te}from"./switch-BXH9Uq5p.js";import{B as J}from"./badge-C2Ir4HoT.js";import{S as K}from"./separator-DZRbPm0x.js";import{u as ts}from"./useMediaUploader-lszBTVoc.js";import{C as xe,I as q,U as Q}from"./withIconDefaults-C8UfSjn1.js";import{S as as,a as ls,b as ns,c as is,d as rs}from"./time-input-with-popover-a0RixVgg.js";import{E as cs}from"./EmployeeForm-Dw-pCVzi.js";import{P as Y}from"./ProFeatureCard-jTC0MhR9.js";import{C as ne}from"./circle-alert-CG2uW-Df.js";import{U as ke}from"./user-plus-DOttN1Rg.js";import{G as ds,C as he,S as os,b as ms,V as xs}from"./CalenderCheck-BuHSX8YD.js";import{R as hs}from"./repeat-D-c0bjv8.js";import{D as ue}from"./dollar-sign-DRtWdm2i.js";import{C as L,M as je,a as fe,b as Ne,c as be,B as ps}from"./collapsible-LCw4ZN5Z.js";import{C as us}from"./crown-BdDHOvET.js";import{L as gs}from"./lock-DbcYKLM6.js";import{S as js,P as fs,G as Ns}from"./GoogleCalender-V160dMVJ.js";import{G as bs,Z as ys}from"./Zoom-BvAPmLs4.js";import{P as ws}from"./ProBadge-Dxcpp0NN.js";import{C as ye}from"./index-BbWn2ja9.js";import{C as vs}from"./circle-check-B35mPstZ.js";import{R as Cs}from"./refresh-cw-Drw5C3fI.js";import{C as Ss}from"./calendar-CjyQ6Zau.js";import{P as Ie}from"./plus-DcvXjop0.js";import{E as ks}from"./external-link-DaS0YMlL.js";import{U as _s}from"./Users-D3Mtn5jq.js";import{D as Es}from"./DollarCircle-DjPBQZLr.js";import{C as Ps}from"./Cogs-DGuXlZ5Z.js";import{u as Ms}from"./useValidation-ETdGTgzi.js";import{S as _e}from"./save-CE8wXkbA.js";import"./vendor-DDjlQeP6.js";import"./index-CeptMk_f.js";import"./check-DMod5j-l.js";import"./dialog-C9IQloQy.js";import"./index-BE6isdVb.js";import"./circle-CwRJMw1I.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./apiConfig-D-T4C2Ae.js";import"./index-D59bwJy3.js";import"./toast-1-c8k_LJ.js";import"./preload-helper-Dp1pzeXC.js";import"./tag-CvsOfBQf.js";import"./shield-Bmp_421z.js";import"./proxy-DChtKkEh.js";import"./circle-check-big-uMTsaxsq.js";import"./loader-circle--S58donA.js";import"./ArrowLeftIcon-DrGyoHe_.js";import"./progress-LiitFnHM.js";import"./index-B5gX5Cyp.js";import"./index-C4Ytkwtd.js";import"./tabs-sf64UEkO.js";import"./arrow-right-B8h6q6X7.js";import"./trash-2-wbt0ZJUy.js";import"./command-BMJPUla5.js";import"./search-C6CI7Qpa.js";import"./popover-C75zZF26.js";import"./scroll-area-BldTLQYj.js";import"./phone-input-CK3GNas0.js";import"./AddLocationForm-9N2H0iL8.js";import"./FormField-66vt2hZL.js";import"./StatusSwitcher-C3TepXSt.js";import"./WpUserSelectField-C3EtiAes.js";import"./phoneValidation-D89G1rc_.js";import"./priceFormatter-Dg4GlACg.js";import"./service-input-Bmu8OLOk.js";import"./copy-C2TM1za3.js";import"./grip-vertical-tAen9Usk.js";import"./Calender-DPznisyw.js";import"./date-picker-Dhqqi79b.js";import"./format-KhiMdRwp.js";import"./Layers-CYFToaHS.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const As=[["path",{d:"M5 12h14",key:"1ays0h"}]],Is=Ae("minus",As);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $s=[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]],Ts=Ae("shapes",$s);function Bs(){return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[e.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-4 mb-8",children:[e.jsx(l,{className:"h-[45px] w-full max-w-md rounded-[8px]"}),e.jsx(l,{className:"h-[45px] w-[220px] rounded-[8px]"}),e.jsx("div",{className:"flex-1"}),e.jsx(l,{className:"h-[45px] w-[140px] rounded-[8px]"})]}),[1,2,3].map(s=>e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-8 py-2 h-[60px] border-b border-slate-100 bg-slate-50/50 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"h-6 w-48 rounded"}),e.jsx(l,{className:"h-5 w-8 rounded-full"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"h-8 w-8 rounded-lg"}),e.jsx(l,{className:"h-8 w-8 rounded-lg"}),e.jsx(l,{className:"h-5 w-5 rounded"})]})]}),e.jsx("div",{className:"p-6 space-y-3",children:[1,2].map(t=>e.jsxs("div",{className:"p-3 flex items-center gap-4 border border-transparent rounded-xl",children:[e.jsx(l,{className:"w-10 h-10 rounded-xl flex-shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(l,{className:"h-5 w-1/3 rounded"}),e.jsx(l,{className:"h-4 w-2/3 rounded"})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[e.jsxs("div",{className:"flex items-center gap-2 w-28",children:[e.jsx(l,{className:"h-4 w-4 rounded-full"}),e.jsx(l,{className:"h-4 w-16 rounded"})]}),e.jsx("div",{className:"w-28",children:e.jsx(l,{className:"h-5 w-20 rounded"})})]}),e.jsx(l,{className:"h-9 w-9 rounded-lg"})]},t))})]},s))]})}function Ee(s){if(s===0)return"0min";const t=Math.floor(s/3600),a=Math.floor(s%3600/60);let j="";return t>0&&(j+=`${t}h `),(a>0||t===0)&&(j+=`${a}min`),j.trim()}function Pe(s,t=null){const a=t;if(a==null)return s;const j=a.currency,h=a.currency_symbol||j.symbol;if(s===0&&j.hideBreakdownIfZero)switch(j.symbolPosition){case"before":return`${h}0`;case"before_with_space":return`${h} 0`;case"after_with_space":return`0 ${h}`;default:return`0${h}`}const x=Math.abs(s).toFixed(j.decimals),[d,b]=x.split("."),w=d.replace(/\B(?=(\d{3})+(?!\d))/g,j.thousand),v=b?`${w}${j.decimal}${b}`:w,u=s<0?"-":"";switch(j.symbolPosition){case"before":return`${u}${h}${v}`;case"before_with_space":return`${u}${h} ${v}`;case"after_with_space":return`${u}${v} ${h}`;case"after":default:return`${u}${v}${h}`}}function X(s){var t;return s?typeof s=="string"?s:(t=s==null?void 0:s.messages)!=null&&t.first_message?s.messages.first_message:Array.isArray(s==null?void 0:s.messages)?s.messages[0]:typeof(s==null?void 0:s.messages)=="string"?s.messages:null:null}function Rs(){const s=D(),t=ge(),{filters:a,services:j,loading:h,pagination:x}=G(n=>{const o=n(_);return{filters:o.getServiceFilters(),services:o.getAllServices(),loading:o.getServiceloading(),pagination:o.getServicePagination()}},[]),d=m.useMemo(()=>JSON.stringify(a),[a]),[b,w]=m.useState([]),[v,u]=m.useState(0);m.useEffect(()=>{s(_).getAllServices(a)},[s,d,v]);const[N,C]=m.useState({});m.useEffect(()=>{w(j);const n={};j.forEach((o,c)=>{n[c]=!0}),C(n)},[j]);const[i,U]=m.useState(""),[P,S]=m.useState("name-ascending"),[T,E]=m.useState(!1),[M,I]=m.useState(null),F=m.useCallback(n=>{w(o=>o.findIndex(A=>parseInt(A.id)===parseInt(n.id))>-1?o.map(A=>parseInt(A.id)===parseInt(n.id)?n:A):[...o,n])},[]);m.useCallback(n=>{w(o=>o.map(c=>c.services.findIndex(H=>H.id===n.id)>-1?{...c,services:c.services.map(H=>H.id===n.id?n:H)}:c.id===n.categoryId?{...c,services:[...c.services,n]}:c))},[]);const g=()=>{I(null),E(!0)},y=n=>{I(n),E(!0)},p=n=>{t(n+"/edit")},ie=n=>{C(o=>({...o,[n]:!o[n]}))},ae=m.useMemo(()=>{let n=b.map(o=>({...o,services:[...o.services]}));if(i){const o=i.toLowerCase();n=n.map(c=>({...c,services:c.services.filter(A=>A.name.toLowerCase().includes(o)||Ee(A.duration).toLowerCase().includes(o)||Pe(A.price).toLowerCase().includes(o))}))}return n=n.map(o=>{const c=[...o.services].sort((A,H)=>{switch(P){case"name-ascending":return A.name.localeCompare(H.name);case"name-descending":return H.name.localeCompare(A.name);case"price-ascending":return A.price-H.price;case"price-descending":return H.price-A.price;default:return 0}});return{...o,services:c}}),n},[b,i,P]),[re,ee]=m.useState(!1),[W,ce]=m.useState(null),[se,de]=m.useState(null),f=(n,o)=>{ce(n),de(o),ee(!0)},V=()=>{if(se==="service"){for(const n of b){const o=n.services.find(c=>c.id===W);if((o==null?void 0:o.source_type)==="classified_listing")return"This service is linked to a Classified Listing. Deleting it will also disable booking on that listing."}return"This action will permanently delete this service"}return"This action will permanently delete this category"},$e=n=>{t("/services/create?categoryId="+n.id)},Te=()=>{se==="category"?(s(_).removeCategory(W),w(n=>n.filter(o=>o.id!==W)),u(n=>n+1)):se==="service"&&(s(_).removeService(W),w(n=>n.map(o=>({...o,services:o.services.filter(c=>c.id!==W)})))),ee(!1)},we=b.reduce((n,o)=>n+o.services.length,0);we>0&&b.reduce((n,o)=>n+o.services.reduce((c,A)=>c+A.price,0),0)/we;const Be=`https://ui-avatars.com/api/?name=${encodeURIComponent(name)}`;return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"min-h-screen",children:h?e.jsx("div",{children:e.jsx(Bs,{})}):e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-40 p-0",children:e.jsx("div",{className:"rtrb-card p-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-md mr-auto",children:[e.jsx(Ze,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-small-font"}),e.jsx(Z,{placeholder:"Search across all services...",className:"h-[45px] bg-white rounded-[8px]",value:i,onChange:n=>U(n.target.value)})]}),e.jsxs(B,{value:P,onValueChange:S,children:[e.jsx(R,{className:"w-[220px] h-[45px] shadow-none bg-white",children:e.jsx(z,{})}),e.jsxs(O,{children:[e.jsx(r,{value:"name-ascending",children:"Name: A → Z"}),e.jsx(r,{value:"name-descending",children:"Name: Z → A"}),e.jsx(r,{value:"price-ascending",children:"Price: Low → High"}),e.jsx(r,{value:"price-descending",children:"Price: High → Low"})]})]}),e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs($,{onClick:g,className:"bg-small-font hover:bg-primary text-white px-8 h-[45px] rounded-[8px] text-sm transition-all",size:"sm",children:[e.jsx(le,{size:"12px"}),"Add Category"]})})]})})}),e.jsx("div",{className:"py-8 space-y-6",children:ae.length>0?ae.map((n,o)=>e.jsxs("div",{className:"bg-white rounded-2xl rtrb-card overflow-hidden hover:shadow-md transition-shadow",children:[e.jsx("div",{className:`px-8 py-2 h-[60px] border-b border-border cursor-pointer transition-all ${N[o]?"bg-lighter-2":"bg-gradient-to-r from-slate-50 to-white hover:bg-slate-50"}`,onClick:()=>ie(o),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsx("div",{className:`flex items-center gap-3 ${n.name==="Uncategorized"?"mt-2":""}`,children:e.jsxs("h2",{className:"text-[18px] font-semibold text-title",children:[n.name," (",n.services.length,")"]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.name!=="Uncategorized"&&e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"ghost",size:"icon",className:"h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:c=>{c.stopPropagation(),$e(n)},children:e.jsx(le,{className:"text-primary"})}),e.jsx($,{variant:"ghost",size:"icon",className:"h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:c=>{c.stopPropagation(),y(n)},children:e.jsx(Ce,{className:"text-primary"})}),e.jsx($,{variant:"ghost",size:"icon",className:"mx-[2px] h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:c=>{c.stopPropagation(),f(n.id,"category")},children:e.jsx(Se,{color:"E4002D"})})]}),e.jsx("div",{className:` transition-transform ${N[o]?"rotate-180":""}`,children:e.jsx("svg",{className:"w-5 h-5 text-title-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]})}),N[o]&&e.jsx("div",{className:"p-6",children:n.services.length>0?e.jsx("div",{className:"space-y-2",children:n.services.map(c=>e.jsxs("div",{className:"group rtrb-card p-3 flex items-center gap-4  hover:bg-blue-50/50 rounded-xl transition-all",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl overflow-hidden flex items-center justify-center text-white font-bold flex-shrink-0",style:{backgroundColor:c.color||"#334155"},children:c.picture_thumb_path?e.jsx("img",{className:"w-full h-full object-cover",alt:c.name,src:c.picture_thumb_path||Be,loading:"lazy"}):c.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{onClick:()=>p(c.id),className:"font-semibold text-primary-dark cursor-pointer hover:text-primary truncate",children:c.name}),(c==null?void 0:c.description)&&e.jsx("p",{className:"two-line-clamp text-title2",children:c.description.length>100?c.description.slice(0,100)+"...":c.description})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-600 w-28",children:[e.jsx(He,{className:"w-4 h-4 text-title"}),e.jsx("span",{className:"text-sm text-title",children:Ee(c.duration)})]}),e.jsx("div",{className:"flex items-center gap-1 text-title w-28",children:e.jsx("span",{className:"font-semibold",children:Pe(c.price,c.currency)})})]}),e.jsxs(Re,{children:[e.jsx(ze,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"icon",className:"h-9 w-9 transition-opacity rounded-lg bg-gray-50 group-hover:bg-gray-100",children:e.jsx(Oe,{className:"w-4 h-4"})})}),e.jsxs(Ue,{align:"end",className:"w-48",children:[e.jsxs(ve,{onClick:()=>p(c.id),className:"cursor-pointer",children:[e.jsx(Ce,{}),"Edit Service"]}),e.jsxs(ve,{onClick:()=>f(c.id,"service"),className:"cursor-pointer text-red-600 focus:text-red-600",children:[e.jsx(Se,{}),"Delete Service"]})]})]})]},c.id))}):e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-slate-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(Ts,{className:"w-10 h-10 text-slate-400"})}),e.jsx("p",{className:"text-title font-medium mb-1",children:"No services yet"}),e.jsx("p",{className:"text-sm text-small-font",children:"Add your first service to this category"})]})})]},o)):e.jsx(Le,{className:"border-border shadow-sm",children:e.jsx(Ve,{className:"flex items-center justify-center py-16",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Me,{className:"w-8 h-8 text-blue-600"})}),e.jsx("h3",{className:"text-lg font-bold text-title mb-2",children:"No Service Found"})]})})})})]})}),e.jsx(Ge,{isOpen:T,onOpenChange:E,categoryToEdit:M,onCategorySaved:F}),e.jsx(qe,{open:re,onClose:()=>ee(!1),onConfirm:Te,title:"Are you sure?",description:V(),confirmText:"Delete"})]})}function zs(){return e.jsxs("div",{className:"xl:flex gap-[40px] animate-in fade-in duration-500",children:[e.jsxs("div",{className:"rtrb-card space-y-8 flex-1 p-[30px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-7 w-48 rounded"}),e.jsx(l,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(l,{className:"h-4 w-24 rounded"}),e.jsx(l,{className:"h-12 w-full rounded-[8px]"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"h-3 w-3 rounded-full"}),e.jsx(l,{className:"h-3 w-48 rounded"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(l,{className:"h-4 w-20 rounded"}),e.jsx(l,{className:"h-12 w-full rounded-[8px]"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"h-3 w-3 rounded-full"}),e.jsx(l,{className:"h-3 w-52 rounded"})]})]})]})]}),e.jsx(l,{className:"h-px w-full bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-7 w-56 rounded"}),e.jsx(l,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"bg-[#F5FAFF] rounded-[8px] border border-blue-200 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx(l,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(l,{className:"h-4 w-32 rounded"}),e.jsx(l,{className:"h-3 w-64 rounded"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(l,{className:"h-4 w-36 rounded"}),e.jsx(l,{className:"h-11 w-full rounded-[8px]"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"h-3 w-3 rounded-full"}),e.jsx(l,{className:"h-3 w-72 rounded"})]})]})]})]}),e.jsx(l,{className:"h-px w-full bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-7 w-40 rounded"}),e.jsx(l,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsx(l,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(l,{className:"h-4 w-40 rounded"}),e.jsx(l,{className:"h-3 w-56 rounded"})]})]}),e.jsx(l,{className:"h-6 w-11 rounded-full"})]})}),e.jsxs("div",{className:"bg-[#F5FAFF] rounded-[8px] border border-blue-200 p-5 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(l,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-4 w-44 rounded"}),e.jsx(l,{className:"h-5 w-12 rounded-full"})]}),e.jsx(l,{className:"h-3 w-64 rounded"})]})]})}),e.jsx(l,{className:"h-11 w-full rounded-[8px]"}),e.jsx("div",{className:"bg-white rounded-[8px] p-5 border border-blue-200 space-y-4 mt-4 shadow-sm",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{className:"h-4 w-40 rounded"}),e.jsx(l,{className:"h-11 w-full rounded-[8px]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{className:"h-4 w-32 rounded"}),e.jsx(l,{className:"h-11 w-full rounded-[8px]"})]})]})}),e.jsx("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 rounded-[8px] border border-amber-200 p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(l,{className:"h-4 w-48 rounded"}),e.jsx(l,{className:"h-3 w-full rounded"})]}),e.jsx(l,{className:"h-9 w-24 rounded-[8px]"})]})})]}),e.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsx(l,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(l,{className:"h-4 w-36 rounded"}),e.jsx(l,{className:"h-3 w-48 rounded"})]})]}),e.jsx(l,{className:"h-6 w-11 rounded-full"})]})})]})]})]}),e.jsx("div",{className:"rtrb-card max-w-[300px] basis-[350px] p-[30px] mt-8 xl:mt-0",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-7 w-52 rounded"}),e.jsx(l,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{children:[e.jsx(l,{className:"h-4 w-28 rounded mb-3"}),e.jsx("div",{className:"border-2 border-dashed border-slate-300 rounded-[8px] bg-slate-50 aspect-[4/3] flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx(l,{className:"h-12 w-12 rounded-full mx-auto"}),e.jsx(l,{className:"h-4 w-32 rounded mx-auto"}),e.jsx(l,{className:"h-9 w-28 rounded-[8px] mx-auto"})]})}),e.jsxs("div",{className:"flex items-start gap-1 mt-2",children:[e.jsx(l,{className:"h-3 w-3 rounded-full mt-0.5"}),e.jsx(l,{className:"h-3 w-full rounded"})]})]}),e.jsxs("div",{children:[e.jsx(l,{className:"h-4 w-36 rounded mb-3"}),e.jsx(l,{className:"h-[220px] w-full rounded-[8px]"}),e.jsxs("div",{className:"flex items-start gap-1 mt-2",children:[e.jsx(l,{className:"h-3 w-3 rounded-full mt-0.5"}),e.jsx(l,{className:"h-3 w-full rounded"})]})]})]})})]})}function Os({value:s=[],onChange:t=()=>{},employees:a=[],placeholder:j="Select staffs...",disabled:h=!1}){const[x,d]=m.useState(!1),b=m.useRef(null);m.useEffect(()=>{const N=C=>{b.current&&!b.current.contains(C.target)&&d(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);const w=N=>{s.includes(N)?t(s.filter(C=>C!==N)):t([...s,N])},v=N=>{t(s.filter(C=>C!==N))},u=a.filter(N=>s.includes(N.value));return e.jsxs("div",{ref:b,className:"relative w-full",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-3 border-2 border-blue-200 rounded-[8px] bg-white cursor-pointer hover:border-blue-300 transition-colors",onClick:()=>!h&&d(!x),children:[u.length>0?e.jsx(e.Fragment,{children:u.map(N=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-blue-100 text-primary rounded-lg text-sm font-medium",children:[e.jsx("span",{children:N.label}),e.jsx("button",{onClick:C=>{C.stopPropagation(),v(N.value)},className:"hover:bg-blue-200 rounded p-0.5 transition-colors",children:e.jsx(pe,{size:14})})]},N.value))}):e.jsx("span",{className:"text-title2",children:j}),e.jsx("div",{className:"ml-auto flex items-center",children:e.jsx(xe,{size:20,className:`text-gray-400 transition-transform ${x?"rotate-180":""}`})})]}),x&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-2 bg-white border-2 border-border rounded-[8px] shadow-lg z-50 max-h-64 overflow-y-auto",children:a&&a.length>0?a.map(N=>e.jsxs("label",{className:"flex items-center gap-3 px-4 py-2.5 hover:bg-blue-50 cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:s.includes(N.value),onChange:()=>w(N.value),className:"w-4 h-4 rounded border-border text-primary focus:ring-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-title",children:N.label})]},N.value)):e.jsx("div",{className:"px-4 py-3 text-sm text-title2",children:"No Staff available"})})]})}function Us({open:s,onOpenChange:t,onEmployeeCreated:a}){const{setEmployeeData:j,setEmployeeError:h}=D(_),x=G(w=>w(_).getEmployee(),[]);m.useEffect(()=>{s&&(j({user_type:"employee"}),h({}))},[s,j,h]);const d=m.useCallback(()=>{(x!=null&&x.first_name||x!=null&&x.last_name||x!=null&&x.email)&&!window.confirm("You have unsaved changes. Are you sure you want to close?")||t(!1)},[x,t]),b=m.useCallback(()=>{d()},[d]);return e.jsx(as,{open:s,onOpenChange:d,children:e.jsxs(ls,{side:"right",className:"w-full sm:max-w-[800px] lg:max-w-[1000px] p-0 flex flex-col overflow-hidden",children:[e.jsx(ns,{className:"px-6 py-4 border-b border-slate-200 bg-gradient-to-r from-blue-50 to-white flex-shrink-0 pt-[50px]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(is,{className:"text-xl font-semibold text-slate-900",children:"Create New Staff"}),e.jsx(rs,{className:"text-sm text-slate-600 mt-1",children:"Add a new team member to your business"})]}),e.jsx($,{variant:"ghost",size:"icon",onClick:d,className:"h-8 w-8 rounded-full hover:bg-slate-100",children:e.jsx(pe,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsx(cs,{onBack:b,resource:"sheet"})})]})})}function Ls({serviceData:s,updateField:t,errors:a,loading:j}){var I,F;const h=D(_),{getServiceEmployees:x}=D(_),d=ge(),b=G(g=>g(_).getServiceEmployee(),[]),w=G(g=>g(_).getIsEmployeeSheetOpen(),[]),[v]=We(),u=v.get("categoryId");m.useEffect(()=>{u&&t("category_id",u)},[u,t]),m.useEffect(()=>{h.getServiceEmployees()},[h,w]);const N=ts(),C=((I=window.radius_booking_param)==null?void 0:I.is_pro)||!1,i=m.useCallback(()=>{N({title:"Select Service Photo",onSelect:({url:g,sizes:y})=>{var p;t("picture_full_path",g),t("picture_thumb_path",((p=y==null?void 0:y.thumbnail)==null?void 0:p.url)||g)}})},[N,t]),U=m.useCallback(()=>{["picture_full_path","picture_thumb_path"].forEach(y=>t(y,""))},[t]),P=g=>{t("assigned_employee_id",g)};m.useCallback(()=>{d("/employees/create")},[d]);const S=m.useCallback(()=>{h.setIsEmployeeSheetOpen(!0)},[]),T=m.useCallback(g=>{if(h.getServiceEmployees(),g!=null&&g.id){const y=(s==null?void 0:s.assigned_employee_id)||[],p=Array.isArray(y)?[...y,g.id]:[g.id];t("assigned_employee_id",p)}},[h,s==null?void 0:s.assigned_employee_id,t]),E=b&&b.length>0;if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(zs,{})});const M="h-11 w-11 bg-white rounded-[8px] flex items-center justify-center border border-blue-200 shadow-sm";return e.jsxs(e.Fragment,{children:[e.jsx(Us,{open:w,onOpenChange:h.setIsEmployeeSheetOpen,onEmployeeCreated:T,serviceId:s==null?void 0:s.id}),e.jsxs("div",{className:"xl:flex gap-[40px]",children:[e.jsxs("div",{className:"rtrb-card space-y-8 flex-1 p-[30px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Basic Information",e.jsx(J,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:"Required"})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{htmlFor:"name",className:"text-sm font-medium text-slate-700 flex items-center gap-1",children:["Service Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"relative",children:e.jsx(Z,{id:"name",required:!0,value:(s==null?void 0:s.name)||"",onChange:g=>t("name",g.target.value),placeholder:"e.g., Haircut & Styling",className:`text-base transition-all ${a!=null&&a.name?"border-red-300 focus:border-red-500 focus:ring-red-200 bg-red-50":""}`})}),s!=null&&s.name?e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Choose a clear, descriptive name for your service"]}):X(a==null?void 0:a.name)&&e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),X(a==null?void 0:a.name)]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{htmlFor:"category",className:"text-sm font-medium text-slate-700 flex items-center gap-1",children:["Category ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"relative",children:e.jsx(Fe,{onChange:g=>t("category_id",g),value:s==null?void 0:s.category_id,errors:a==null?void 0:a.category_id,className:`h-12 rounded-[8px] rtrb-input ${a!=null&&a.category_id?"border-red-300 focus:border-red-500 bg-red-50":s!=null&&s.category_id?"border-green-300 bg-green-50/30":"border-slate-300"}`})}),a!=null&&a.category_id?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),"This field is required"]}):e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Categorize your service for better organization"]})]})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Staff Assignment",E&&e.jsx(J,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:"Required"})]})}),e.jsxs("div",{className:"bg-[#F5FAFF] rounded-[8px] border border-blue-200 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:M,children:e.jsx(Q,{className:"h-5 w-5 text-[#1d4ed8]"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Assign Staff"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Select which employees can provide this service"})]})]}),E?e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{className:"text-sm font-medium text-slate-700",children:"Available Employees"}),e.jsx(Os,{value:s==null?void 0:s.assigned_employee_id,onChange:P,employees:b,placeholder:"Select staffs..."}),a!=null&&a.assigned_employee_id?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),X(a==null?void 0:a.assigned_employee_id)]}):e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Select one or more employees who can provide this service"]})]}):e.jsx("div",{className:"bg-white rounded-[8px] border border-dashed border-slate-300 p-6",children:e.jsxs("div",{className:"flex flex-col items-center text-center space-y-4",children:[e.jsx("div",{className:"h-14 w-14 bg-slate-100 rounded-full flex items-center justify-center",children:e.jsx(ke,{className:"h-7 w-7 text-slate-400"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"font-medium text-title",children:"No Staffs Found"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-sm",children:"You need to create at least one staff before you can assign them to services."})]}),e.jsxs($,{type:"button",onClick:S,className:"bg-[#1d4ed8] hover:bg-[#1e40af] text-white rounded-[8px] h-11 px-6 flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4"}),"Create New Staff"]})]})})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Service Settings",e.jsx(J,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:"Optional"})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-white rounded-[8px] border border-border p-5 hover:shadow-sm transition-all",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:M,children:e.jsx(ds,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Show service on site"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Make this service visible to customers"})]})]}),e.jsx(te,{checked:s==null?void 0:s.is_visible,onCheckedChange:g=>t("is_visible",g),className:"data-[state=checked]:bg-[#1d4ed8]"})]})}),e.jsx(Y,{icon:e.jsx(hs,{className:"h-5 w-5 text-primary"}),title:"Recurring Appointments",description:C?"Enable repeat bookings for this service":"Upgrade to PRO to enable recurring appointments",isPro:C,showSwitch:!1,children:e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs(B,{value:s==null?void 0:s.recurring_cycle,onValueChange:g=>t("recurring_cycle",g),children:[e.jsx(R,{className:"h-11 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px] bg-white",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px] border-border shadow-lg",children:[e.jsx(r,{value:"disabled",children:"Disabled"}),e.jsx(r,{value:"all",children:"All"}),e.jsx(r,{value:"daily",children:"Daily"}),e.jsx(r,{value:"weekly",children:"Weekly"}),e.jsx(r,{value:"monthly",children:"Monthly"}),e.jsx(r,{value:"yearly",children:"Yearly"})]})]}),(s==null?void 0:s.recurring_cycle)!=="disabled"&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50/50 to-white rounded-[8px] p-5 border border-blue-200 space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium text-slate-700",children:"Handle unavailable dates"}),e.jsxs(B,{value:s==null?void 0:s.recurring_sub,onValueChange:g=>t("recurring_sub",g),children:[e.jsx(R,{className:"h-11 border-slate-300 rounded-[8px] bg-white",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"future",children:"Closest date after"}),e.jsx(r,{value:"past",children:"Closest date before"}),e.jsx(r,{value:"both",children:"Closest date before or after"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"text-sm font-medium text-slate-700",children:"Payment handling"}),e.jsxs(B,{value:(F=s==null?void 0:s.recurring_payment)==null?void 0:F.toString(),onValueChange:g=>t("recurring_payment",g),children:[e.jsx(R,{className:"h-11 border-slate-300 rounded-[8px] bg-white",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"0",children:"Pay first appointment only"}),e.jsx(r,{value:"1",children:"Pay all appointments at once"})]})]})]})]})})]})})]})]})]}),e.jsx("div",{className:"rtrb-card max-w-[300] basis-[350px] p-[30px]",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Description & Media",e.jsx(J,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:"Optional"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(k,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Service Image"})}),e.jsx(ss,{imagePath:s==null?void 0:s.picture_full_path,onUpload:i,onRemove:U}),e.jsxs("p",{className:"text-xs text-title2 mt-2 flex items-center gap-1",children:[e.jsx(q,{className:"h-5 w-7 text-title"}),"Upload a professional image that represents your service (recommended: 800x600px)"]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-sm font-medium text-slate-700 mb-3 block",children:"Service Description"}),e.jsx(es,{placeholder:"Describe your service in detail. Include what clients can expect, benefits, and any special instructions...",value:(s==null?void 0:s.description)||"",onChange:g=>t("description",g.target.value),className:"min-h-[220px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px] resize-none text-base"}),e.jsxs("p",{className:"text-xs text-small-font mt-2 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"A detailed description helps customers understand your service better"]})]})]})})]})]})}function Vs({serviceData:s,updateField:t}){var h;const a=((h=window.radius_booking_param)==null?void 0:h.is_pro)||!1,j=s==null?void 0:s.deposit_payment;return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Deposit Payment",e.jsx(J,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:"Optional"})]})}),e.jsx(Y,{icon:e.jsx(ue,{className:"h-5 w-5 text-primary"}),title:"Require Deposit Payment",description:a?"Collect payment upfront to secure bookings":"Upgrade to PRO to enable deposit payments",checked:s==null?void 0:s.deposit_payment,onCheckedChange:x=>t("deposit_payment",x),isPro:a}),j&&a&&e.jsxs("div",{className:"bg-gradient-to-r from-blue-50/50 to-white rounded-[8px] border border-blue-200 p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(k,{className:"text-sm font-medium text-slate-700",children:"Deposit Type"}),e.jsxs(B,{value:s.deposit_type??"percentage",onValueChange:x=>t("deposit_type",x),children:[e.jsx(R,{className:"h-11 bg-white border-slate-300 rounded-[8px]",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"percentage",children:"Percentage"}),e.jsx(r,{value:"fixed",children:"Fixed Amount"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700",children:["Deposit Amount ",s.deposit_type==="percentage"?"(%)":`(${(s==null?void 0:s.currency_symbol)||"$"})`]}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-small-font font-medium",children:s.deposit_type==="percentage"?"%":(s==null?void 0:s.currency_symbol)||"$"}),e.jsx(Z,{type:"number",value:s.deposit,onChange:x=>t("deposit",x.target.value),className:"pl-10 h-11 bg-white border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",step:s.deposit_type==="percentage"?"1":"0.01",min:"0",max:s.deposit_type==="percentage"?"100":void 0})]})]})]}),e.jsx("div",{className:"bg-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Allow full payment option"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Let customers pay the total amount upfront"})]}),e.jsx(te,{checked:s==null?void 0:s.full_payment,onCheckedChange:x=>t("full_payment",x),className:"data-[state=checked]:bg-[#1d4ed8]"})]})}),s.max_capacity>1&&e.jsx("div",{className:"bg-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Charge deposit for each person in the booking"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Customers will pay the combined deposit amount upfront"})]}),e.jsx(te,{checked:s==null?void 0:s.deposit_per_person,onCheckedChange:x=>t("deposit_per_person",x),className:"data-[state=checked]:bg-[#1d4ed8]"})]})})]})]})}function qs({serviceData:s,updateField:t,errors:a}){var v,u,N,C;const j=G(i=>i(_).getSettings(),[]),h=((v=j==null?void 0:j.dateTime)==null?void 0:v.selectableInterval)||30,x=m.useMemo(()=>{const i=Math.max(5,Number(h)||30),U=480,P=[];for(let S=i;S<=U;S+=i){const T=S*60,E=Math.floor(S/60),M=S%60;let I;E===0?I=`${M} minutes`:M===0?I=E===1?"1 hour":`${E} hours`:I=`${E} hour${E>1?"s":""} ${M} minutes`,P.push({value:String(T),label:I})}return P},[h]),d=((u=window.radius_booking_param)==null?void 0:u.is_pro)||!1,b="h-[45px] w-[45px] basis-[45px] rounded-[8px] border-[#BDCFFF] bg-[#F5FAFF] hover:bg-[#EBF5FF]",w=()=>{const i=s.price;return i===""||i===null||i===void 0?!0:parseFloat(i)===0};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Duration & Price",e.jsx(J,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:"Required"})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-slate-600"}),"Duration ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(B,{value:s.duration?s.duration.toString():"",onValueChange:i=>t("duration",i),children:[e.jsx(R,{className:"h-12 text-base border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(z,{placeholder:"Select duration"})}),e.jsx(O,{className:"rounded-[8px]",children:x.map(i=>e.jsx(r,{value:i.value,children:i.label},i.value))})]}),X(a==null?void 0:a.duration)?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),X(a==null?void 0:a.duration)]}):e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"How long does this service typically take?"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4 text-slate-600"}),"Price"]}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-small-font font-medium text-base",children:(s==null?void 0:s.currency_symbol)||"$"}),e.jsx(Z,{type:"number",value:s.price,onChange:i=>{(parseFloat(i.target.value)>=0||i.target.value==="")&&t("price",i.target.value)},className:"h-12 text-base border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px] pl-10",step:"0.01",min:"0",placeholder:"0.00"})]}),X(a==null?void 0:a.price)?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"}),X(a==null?void 0:a.price)]}):w()?e.jsxs("p",{className:"text-xs text-amber-600 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"This service will be listed as Free"]}):e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Set the base price for this service"]})]})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Buffer Times",e.jsx(J,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:"Optional"})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-slate-600"}),"Buffer Time Before",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(N=s.time_before)==null?void 0:N.toString(),onValueChange:i=>t("time_before",i),children:[e.jsx(R,{className:"h-12 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"0",children:"No buffer"}),e.jsx(r,{value:"300",children:"5 minutes"}),e.jsx(r,{value:"600",children:"10 minutes"}),e.jsx(r,{value:"900",children:"15 minutes"}),e.jsx(r,{value:"1800",children:"30 minutes"})]})]}),e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Time needed before the appointment starts"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-slate-600"}),"Buffer Time After",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(C=s.time_after)==null?void 0:C.toString(),onValueChange:i=>t("time_after",i),children:[e.jsx(R,{className:"h-12 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"0",children:"No buffer"}),e.jsx(r,{value:"300",children:"5 minutes"}),e.jsx(r,{value:"600",children:"10 minutes"}),e.jsx(r,{value:"900",children:"15 minutes"}),e.jsx(r,{value:"1800",children:"30 minutes"})]})]}),e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(q,{className:"h-3 w-3"}),"Time needed after the appointment ends"]})]})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("h3",{className:"service-step-title mb-2 flex gap-1 items-center",children:["Capacity Settings",e.jsx(J,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:"Optional"})]})}),e.jsxs("div",{className:`relative rounded-[8px] border p-5 transition-all overflow-hidden ${d?"bg-gradient-to-r from-slate-50 to-white border-border hover:shadow-sm":"bg-slate-50/50 border-slate-200"}`,children:[!d&&e.jsx("div",{className:"absolute inset-0 opacity-[0.025] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(135deg, transparent, transparent 10px, #64748b 10px, #64748b 11px)"}}),e.jsxs("div",{className:"flex items-center justify-between relative",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`h-11 w-11 rounded-[8px] flex items-center justify-center border shadow-sm ${d?"bg-white border-blue-200":"bg-slate-100 border-slate-200"}`,children:e.jsx(Q,{className:`h-5 w-5 ${d?"text-primary":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:`font-medium text-sm ${d?"text-title":"text-slate-400"}`,children:"Capacity Settings"}),!d&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-amber-400 to-orange-500 px-2 py-0.5 text-[10px] font-semibold text-white shadow-sm",children:[e.jsx(us,{className:"h-2.5 w-2.5"}),"PRO"]})]}),e.jsx("p",{className:`text-xs mt-0.5 ${d?"text-slate-600":"text-slate-400"}`,children:d?"Configure minimum and maximum booking capacity":"Upgrade to PRO to configure booking capacity"})]})]}),!d&&e.jsx(gs,{className:"h-4 w-4 text-slate-300"})]}),e.jsxs("div",{className:`space-y-6 mt-5 relative ${d?"":"opacity-50 pointer-events-none select-none"}`,children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-slate-600"}),"Minimum Capacity",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($,{variant:"outline",size:"icon",disabled:!d,onClick:()=>t("min_capacity",Math.max(1,s.min_capacity-1)),className:b,children:e.jsx(je,{className:"text-primary"})}),e.jsx(Z,{type:"number",value:s.min_capacity,disabled:!d,onChange:i=>t("min_capacity",Number.parseInt(i.target.value)||1),className:"text-center h-11 rounded-[8px] flex-1 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",min:"1"}),e.jsx($,{variant:"outline",size:"icon",disabled:!d,onClick:()=>t("min_capacity",s.min_capacity+1),className:b,children:e.jsx(le,{className:"text-primary"})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-slate-600"}),"Maximum Capacity",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($,{variant:"outline",size:"icon",disabled:!d,onClick:()=>t("max_capacity",Math.max(1,s.max_capacity-1)),className:b,children:e.jsx(je,{className:"text-primary"})}),e.jsx(Z,{type:"number",value:s.max_capacity,disabled:!d,onChange:i=>t("max_capacity",Number.parseInt(i.target.value)||1),className:"text-center flex-1 h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",min:"1"}),e.jsx($,{variant:"outline",size:"icon",disabled:!d,onClick:()=>t("max_capacity",s.max_capacity+1),className:b,children:e.jsx(le,{className:"text-primary"})})]})]})]}),(s.max_capacity>1||!d)&&e.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-100",children:[e.jsx("div",{className:"bg-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-10 w-10 bg-blue-50 rounded-[8px] flex items-center justify-center border border-blue-100",children:e.jsx(Q,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:'Show "Bringing anyone with you" option'}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Allow customers to add additional people"})]})]}),e.jsx(te,{checked:s==null?void 0:s.bringing_anyone,onCheckedChange:i=>t("bringing_anyone",i),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!d})]})}),e.jsx("div",{className:"bg-white rounded-[8px] border border-border p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-10 w-10 bg-blue-50 rounded-[8px] flex items-center justify-center border border-blue-100",children:e.jsx(ue,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Multiply price by number of people"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Charge per person instead of flat rate"})]})]}),e.jsx(te,{checked:s==null?void 0:s.aggregated_price,onCheckedChange:i=>t("aggregated_price",i),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!d})]})}),e.jsxs("div",{className:"bg-white rounded-[8px] border border-border p-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-10 w-10 bg-blue-50 rounded-[8px] flex items-center justify-center border border-blue-100",children:e.jsx(Q,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:"Limit for the extra people"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Set a maximum number of additional attendees"})]})]}),e.jsx(te,{checked:(s==null?void 0:s.max_extra_people)>0,onCheckedChange:i=>t("max_extra_people",i?1:0),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!d})]}),(s==null?void 0:s.max_extra_people)>0&&d&&e.jsxs("div",{className:"space-y-3 mt-4 pt-4 border-t border-slate-100",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 text-slate-600"}),"Set limit for additional people:",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($,{variant:"outline",size:"icon",onClick:()=>t("max_extra_people",Math.max(1,s.max_extra_people-1)),className:"h-[45px] w-[45px] rounded-[8px] border-slate-300 hover:bg-slate-50",children:e.jsx(je,{className:"text-primary"})}),e.jsx(Z,{type:"number",value:s.max_extra_people,onChange:i=>{i.target.value<s.max_capacity&&t("max_extra_people",Number.parseInt(i.target.value)||1)},className:"text-center flex-1 h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 w-24",min:"1",max:s.max_capacity-1}),e.jsx($,{variant:"outline",size:"icon",onClick:()=>t("max_extra_people",s.max_extra_people+1),className:b,disabled:s.max_extra_people>=s.max_capacity-1,children:e.jsx(le,{className:"text-primary"})})]})]})]})]})]})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsx(Vs,{serviceData:s,updateField:t})]})}function Gs({serviceData:s,updateField:t}){var w,v,u,N,C,i,U,P,S,T,E,M,I,F,g,y,p,ie,ae,re,ee,W,ce,se,de;const[a,j]=m.useState({general:!0,payments:!1,integrations:!1}),h=((w=window.radius_booking_param)==null?void 0:w.is_pro)||!1,x=f=>{j(V=>({...V,[f]:!V[f]}))},d="h-[45px] w-[45px] basis-[45px] rounded-[8px] border-[#BDCFFF] bg-[#F5FAFF] hover:bg-[#EBF5FF]",b="flex items-center justify-between w-full p-6 bg-lighter-2 hover:bg-light-bg transition-all border-b border-border";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-white rounded-[15px] border border-border overflow-hidden shadow-none",children:e.jsxs(fe,{open:a.general,onOpenChange:()=>x("general"),children:[e.jsxs(Ne,{className:b,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-11 w-11 bg-white rounded-[8px] flex items-center justify-center border border-border shadow-sm",children:e.jsx(os,{className:"h-5 w-5 text-[#1d4ed8]"})}),e.jsxs("div",{className:"text-left",children:[e.jsxs("h3",{className:"font-semibold text-title text-base flex items-center gap-2",children:["General Settings",e.jsx(ws,{show:!h})]}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:h?"Override global booking restrictions for this service":"Per-service overrides require Pro — using global settings"})]})]}),a.general?e.jsx(xe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(ye,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(be,{children:e.jsxs("div",{className:`p-6 space-y-6 bg-white ${h?"":"pointer-events-none select-none opacity-50"}`,children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(vs,{className:"h-4 w-4 text-slate-600"}),"Default Appointment Status",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(u=(v=s==null?void 0:s.settings)==null?void 0:v.general)==null?void 0:u.defaultStatus,onValueChange:f=>t("settings.general.defaultStatus",f),children:[e.jsx(R,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"global",children:"Use Global Setting"}),e.jsx(r,{value:"confirmed",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),"Confirmed"]})}),e.jsx(r,{value:"pending",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),"Pending"]})}),e.jsx(r,{value:"cancelled",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),"Cancelled"]})}),e.jsx(r,{value:"completed",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary"}),"Completed"]})})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:"Initial status for new bookings"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-slate-600"}),"Minimum Booking Time",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(C=(N=s==null?void 0:s.settings)==null?void 0:N.general)==null?void 0:C.minBookingTime,onValueChange:f=>t("settings.general.minBookingTime",f),children:[e.jsx(R,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"disabled",children:"Use Global Setting"}),e.jsx(r,{value:"3600",children:"1 hour"}),e.jsx(r,{value:"7200",children:"2 hours"}),e.jsx(r,{value:"86400",children:"24 hours"}),e.jsx(r,{value:"172800",children:"48 hours"})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:"How far in advance bookings are required"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(ps,{className:"h-4 w-4 text-slate-600"}),"Minimum Cancel Time",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(U=(i=s==null?void 0:s.settings)==null?void 0:i.general)==null?void 0:U.minCancelTime,onValueChange:f=>t("settings.general.minCancelTime",f),children:[e.jsx(R,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"disabled",children:"Use Global Setting"}),e.jsx(r,{value:"3600",children:"1 hour"}),e.jsx(r,{value:"7200",children:"2 hours"}),e.jsx(r,{value:"86400",children:"24 hours"}),e.jsx(r,{value:"172800",children:"48 hours"})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:"Notice required before cancellation"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Cs,{className:"h-4 w-4 text-slate-600"}),"Minimum Reschedule Time",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(B,{value:(S=(P=s==null?void 0:s.settings)==null?void 0:P.general)==null?void 0:S.minRescheduleTime,onValueChange:f=>t("settings.general.minRescheduleTime",f),children:[e.jsx(R,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(z,{})}),e.jsxs(O,{className:"rounded-[8px]",children:[e.jsx(r,{value:"disabled",children:"Use Global Setting"}),e.jsx(r,{value:"3600",children:"1 hour"}),e.jsx(r,{value:"7200",children:"2 hours"}),e.jsx(r,{value:"86400",children:"24 hours"}),e.jsx(r,{value:"172800",children:"48 hours"})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:"Notice required before rescheduling"})]})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Ss,{className:"h-4 w-4 text-slate-600"}),"Booking Advance Period (days)",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3 max-w-xs",children:[e.jsx($,{variant:"outline",size:"icon",onClick:()=>{var f,V;return t("settings.general.bookingAdvancePeriod",Math.max(1,((V=(f=s==null?void 0:s.settings)==null?void 0:f.general)==null?void 0:V.bookingAdvancePeriod)-1))},className:d,children:e.jsx(Is,{className:"h-4 w-4"})}),e.jsx(Z,{type:"number",value:(E=(T=s==null?void 0:s.settings)==null?void 0:T.general)==null?void 0:E.bookingAdvancePeriod,onChange:f=>t("settings.general.bookingAdvancePeriod",Number.parseInt(f.target.value)||1),className:"flex-1 text-center h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",min:"1"}),e.jsx($,{variant:"outline",size:"icon",onClick:()=>{var f,V;return t("settings.general.bookingAdvancePeriod",((V=(f=s==null?void 0:s.settings)==null?void 0:f.general)==null?void 0:V.bookingAdvancePeriod)+1)},className:d,children:e.jsx(Ie,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-small-font",children:"How far in advance customers can book"})]}),e.jsx(K,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(ks,{className:"h-4 w-4 text-slate-600"}),"Redirect URL After Booking",e.jsx(L,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsx(Z,{type:"url",value:((I=(M=s==null?void 0:s.settings)==null?void 0:M.general)==null?void 0:I.redirectUrl)||"",onChange:f=>t("settings.general.redirectUrl",f.target.value),placeholder:"https://example.com/thank-you",className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200"}),e.jsx("p",{className:"text-xs text-small-font",children:"Where to send customers after successful booking"})]})]})})]})}),e.jsx("div",{className:"bg-white rounded-[15px] border border-border overflow-hidden shadow-none",children:e.jsxs(fe,{open:a.payments,onOpenChange:()=>x("payments"),children:[e.jsxs(Ne,{className:b,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-11 w-11 bg-white rounded-[8px] flex items-center justify-center border border-border shadow-sm",children:e.jsx(ms,{className:"h-5 w-5 text-[#1d4ed8]"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h3",{className:"font-semibold text-title text-base",children:"Payment Methods"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Select accepted payment options"})]})]}),a.payments?e.jsx(xe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(ye,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(be,{children:e.jsxs("div",{className:"p-6 space-y-4 bg-white",children:[e.jsx(Y,{icon:e.jsx(js,{size:"26px"}),title:"Stripe",description:"Accept credit and debit cards",checked:(g=(F=s==null?void 0:s.settings)==null?void 0:F.paymentMethods)==null?void 0:g.stripe,onCheckedChange:f=>t("settings.paymentMethods.stripe",f),isPro:h}),e.jsx(Y,{icon:e.jsx(fs,{size:"26px"}),title:"PayPal",description:"Accept PayPal payments",checked:(p=(y=s==null?void 0:s.settings)==null?void 0:y.paymentMethods)==null?void 0:p.paypal,onCheckedChange:f=>t("settings.paymentMethods.paypal",f),isPro:!0}),e.jsx(Y,{icon:e.jsx(ue,{className:"h-5 w-5 text-primary"}),title:"Cash Payment",description:"Accept offline payments on-site",checked:(ae=(ie=s==null?void 0:s.settings)==null?void 0:ie.paymentMethods)==null?void 0:ae.offline,onCheckedChange:f=>t("settings.paymentMethods.offline",f),isPro:!0})]})})]})}),e.jsx("div",{className:"bg-white rounded-[15px] border border-border overflow-hidden shadow-none",children:e.jsxs(fe,{open:a==null?void 0:a.integrations,onOpenChange:()=>x("integrations"),children:[e.jsxs(Ne,{className:b,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-11 w-11 bg-white rounded-[8px] flex items-center justify-center border border-border shadow-sm",children:e.jsx(xs,{className:"h-5 w-5 text-[#1d4ed8]"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h3",{className:"font-semibold text-title text-base",children:"Integrations"}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:"Connect with external services"})]})]}),a!=null&&a.integrations?e.jsx(xe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(ye,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(be,{children:e.jsxs("div",{className:"p-6 space-y-4 bg-white",children:[e.jsx(Y,{icon:e.jsx(Ns,{size:"24px"}),title:"Google Calendar",description:"Create calendar events and auto-generate meeting links",checked:(ee=(re=s==null?void 0:s.settings)==null?void 0:re.integrations)==null?void 0:ee.googleCalender,onCheckedChange:f=>t("settings.integrations.googleCalender",f),isPro:!0}),e.jsx(Y,{icon:e.jsx(bs,{size:"24px"}),title:"Google Meet",description:"Auto-create video meeting links",checked:(ce=(W=s==null?void 0:s.settings)==null?void 0:W.integrations)==null?void 0:ce.googleMeet,onCheckedChange:f=>t("settings.integrations.googleMeet",f),isPro:!0}),e.jsx(Y,{icon:e.jsx(ys,{size:"27px"}),title:"Zoom",description:"Create Zoom meeting rooms",checked:(de=(se=s==null?void 0:s.settings)==null?void 0:se.integrations)==null?void 0:de.zoom,onCheckedChange:f=>t("settings.integrations.zoom",f),isPro:h})]})})]})})]})}const Fs={details:["name","category_id","assigned_employee_id"],pricing:["duration"],settings:[]};function Hs(){const s=ge(),{setServiceFormField:t,getService:a,setServiceError:j,setDefaultService:h,getServiceEmployees:x}=D(_),{id:d}=Ye(),b=m.useMemo(()=>d!==void 0,[d]),[w,v]=m.useState(!1),u=D(_),N=G(y=>y(_).isServiceSaving(),[]),C=G(y=>y(_).getServiceEmployee(),[]);m.useEffect(()=>{x()},[]);const i=C&&C.length>0,U=m.useMemo(()=>{const y={name:[{check:p=>!!(p!=null&&p.trim()),message:"Service name is required"},{check:p=>(p==null?void 0:p.length)>=2,message:"Min 2 characters"}],category_id:[{check:p=>!!p,message:"Please select a category"}],duration:[{check:p=>!!p,message:"Duration is required"},{check:p=>Number(p)>=1,message:"Min 1 minute"}]};return i&&(y.assigned_employee_id=[{check:p=>Array.isArray(p)&&p.length>0,message:"Please assign at least one employee"}]),y},[i]),{validate:P}=Ms(U,j),{serviceData:S,errors:T,loading:E}=G(y=>{const p=y(_);return{serviceData:p.getService(),errors:p.getServiceError(),loading:p.getServiceloading()}},[]);m.useEffect(()=>(b&&a(d),()=>{h({}),j({})}),[]);const M=m.useCallback((y,p)=>{t({field:y,value:p})},[t]),I=m.useCallback(y=>{const{isValid:p}=P(S,Fs[y]);return p},[S,P]),F=m.useCallback(async()=>{const{isValid:y}=P(S);if(y){v(!0);try{await u.saveService(S)&&s("/services")}catch(p){console.error("Error saving:",p)}finally{v(!1)}}},[S,P,u,s]),g=m.useMemo(()=>[{id:"details",title:"Service Details",label:"Details",icon:_s,description:"Basic information",content:e.jsx(Ls,{serviceData:S,updateField:M,errors:T,loading:E})},{id:"pricing",title:"Duration & Pricing",label:"Pricing",icon:Es,description:"Time and cost",content:e.jsx(qs,{serviceData:S,updateField:M,errors:T})},{id:"settings",title:"",icon:Ps,label:"Settings",description:"Advanced options",content:e.jsx(Gs,{serviceData:S,updateField:M,errors:T})}],[S,M,T,E]);return e.jsx("div",{className:"p-0",children:e.jsx("main",{children:e.jsx(De,{tabs:g,showProgress:!1,allowSkipSteps:!1,navigationPosition:"bottom",onTabChange:()=>{},onStepComplete:I,onComplete:F,completeButtonText:b?"Update Service":"Create Service",nextButtonText:"Next",prevButtonText:"Back",isCompleting:N})})})}function Zs(){const s=Qe("/services"),{mode:t}=s,a=ge(),j=D(),h=G(u=>u(_).getService(),[]),x=G(u=>u(_).isServiceSaving(),[]),d=async()=>{const u=await j(_).saveService(h);u&&a(`/services/${u}/edit`)},b=()=>{switch(t){case"list":return e.jsx(Rs,{});case"edit":case"create":return e.jsx(Hs,{});default:return null}},v=({list:[{key:"add-service",label:"Add Service",icon:Ie,onClick:s.navigateTo.create,variant:"primary"}],create:[{key:"save-service",label:"Save",icon:_e,onClick:d,loading:x,variant:"primary"},{key:"cancel-service",label:"Cancel",icon:pe,onClick:s.navigateTo.list,variant:"cancel"}],edit:[{key:"update-service",label:"Update",icon:_e,onClick:d,loading:x,variant:"primary"},{key:"cancel-service",label:"Cancel",icon:pe,onClick:s.navigateTo.list,variant:"cancel"}]}[t]||[]).map(u=>e.jsx(Xe,{label:u.label,icon:u.icon,onClick:u.onClick,loading:u.loading||!1,variant:u.variant||"primary"},u.key));return e.jsx(Ke,{title:"Services",description:"Manage your business services",showBack:t!=="list",onBack:s.navigateTo.list,actions:v,icon:e.jsx(Me,{className:"w-5 h-5 text-primary-colordefault"}),children:b()})}const me=m.memo(Zs);function Ba(){return e.jsxs(Je,{children:[e.jsx(oe,{path:"/",element:e.jsx(me,{})}),e.jsx(oe,{path:"create",element:e.jsx(me,{})}),e.jsx(oe,{path:":id",element:e.jsx(me,{})}),e.jsx(oe,{path:":id/edit",element:e.jsx(me,{})})]})}export{Ba as default};
//# sourceMappingURL=index-BpDYB6F0.js.map
