import{j as e,r as d,_ as s,s as re,d as ge}from"./wp-i18n-shim-DUX0OV_V.js";import{B as E}from"./Button-BveKhP38.js";import{I as D}from"./input-Dw-69aYW.js";import{S as L,a as V,b as q,c as F,f as m,C as we}from"./select-BFNitOb0.js";import{D as Ye,a as Je,E as Ke,b as Qe,c as Ie}from"./dropdown-menu-EYEjuOIn.js";import{S as l}from"./skeleton-DfFmlQ5i.js";import{C as Xe,a as De}from"./card-CNcjg1NV.js";import{a as xe,u as ee,s as T}from"./store-rDqSxbzb.js";import{C as es}from"./ConfirmDialog-Bbm_78dn.js";import{a as ss,C as ts}from"./CategorySelect-LE4jZ1Fs.js";import{C as is}from"./Clock-BniMcYQJ.js";import{S as as}from"./Search-Deq4yX7o.js";import{P as he}from"./Plus-CUBr-Nma.js";import{E as Te}from"./Edit-ChdaRnpE.js";import{T as ve}from"./Trash-BkcPMnbK.js";import{C as $e}from"./checkbox-CQ-dG0Dh.js";import{u as Ee,L as Ue,f as ns,d as ls,R as rs,e as be}from"./index-D01LF5Le.js";import{c as Le,X as ke}from"./utils-Bl0WAcve.js";import{u as os,A as ds}from"./ActionButton-Cr4Z2a1F.js";import{C as cs}from"./CrudLayout-DRSWmVk9.js";import{M as ms}from"./Tabs-CqSp1R3E.js";import{L as P}from"./label-CwRAQd0m.js";import{T as xs}from"./textarea-CG8MgAEa.js";import{I as us}from"./ImageUpload-CcSoaEux.js";import{S as me}from"./switch-I41RT0Bn.js";import{B as ie}from"./badge-DBj5X-b5.js";import{S as de}from"./separator-BQS_7xs6.js";import{u as hs}from"./useMediaUploader-DCuR6epV.js";import{C as fe,I as Q,U as le}from"./withIconDefaults-BJCqj2oX.js";import{S as ps,a as gs,b as bs,c as js,d as fs}from"./time-input-with-popover-DLwBMQVI.js";import{E as Ns}from"./EmployeeForm-NgdGPFLx.js";import{P as te}from"./ProFeatureCard-BWfAwmAZ.js";import{C as pe}from"./circle-alert-COuSc4NK.js";import{U as Be}from"./user-plus-Cb8A9Lwo.js";import{G as ks,C as Ne,S as ys,b as ws,V as vs}from"./CalenderCheck-2TB2QVYq.js";import{R as Cs}from"./repeat-CasMt-Ba.js";import{D as ye}from"./dollar-sign-Bnksw8VW.js";import{C as J,M as Ce,a as Se,b as _e,c as Pe,B as Ss}from"./collapsible-mVZCwGgq.js";import{C as _s}from"./crown-CcV7MJml.js";import{L as Ps}from"./lock-ws9wrevH.js";import{S as Es,P as Ms,G as As}from"./GoogleCalender-BNhy3hJ_.js";import{G as Is,Z as Ts}from"./Zoom-B_DWzU5-.js";import{P as $s}from"./ProBadge-CmJaWZjE.js";import{C as Bs}from"./circle-check-Af-sR4AZ.js";import{R as Rs}from"./refresh-cw-DB5brqih.js";import{C as Os}from"./calendar-Cz3-D5io.js";import{P as Ve}from"./plus-WPVVS3Qe.js";import{E as zs}from"./external-link--Gk3o8ZG.js";import{U as Us}from"./Users-BVCyUeBv.js";import{D as Ls}from"./DollarCircle-CqTu8Ult.js";import{C as Vs}from"./Cogs-Cnkf43Xi.js";import{u as qs}from"./useValidation-B5n8rnWA.js";import{D as Fs,a as Gs,b as Hs,c as Zs,e as Ws,d as Ys}from"./dialog-EtKUcLIM.js";import{S as Re}from"./save-BecwuxKD.js";import"./vendor-DDjlQeP6.js";import"./Combination-BuKwnoTc.js";import"./index-Bl84CzKv.js";import"./index-CcfXrftP.js";import"./circle-DNYav3qT.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./apiConfig-BA13wrqF.js";import"./index-CLZ4-rw6.js";import"./toast-1-c8k_LJ.js";import"./preload-helper-Dp1pzeXC.js";import"./tag-8m_NofXN.js";import"./shield-DVSNyXBB.js";import"./proxy-CtW-P0pQ.js";import"./circle-check-big-Bxgqw2u9.js";import"./loader-circle-CcSu72zH.js";import"./ArrowLeftIcon-C8q2jgKs.js";import"./progress-CI0J5mUA.js";import"./index-BrYiunaL.js";import"./index-f2RCAr_u.js";import"./tabs-7R76dlGV.js";import"./arrow-right-DztcoQ91.js";import"./trash-2-CS5zm_gd.js";import"./command-Cf7PHIDr.js";import"./search-P9p39fmP.js";import"./popover-D8UtFi-E.js";import"./scroll-area-JhQW4-1L.js";import"./dateTimeFormat-yH4yHSCh.js";import"./phone-input-BRAt4Ybc.js";import"./AddLocationForm-tGWpYZPP.js";import"./FormField-8HG4dTZR.js";import"./StatusSwitcher-BMMLTfxu.js";import"./WpUserSelectField-JRPQcyDm.js";import"./phoneValidation-RUqJw3r3.js";import"./priceFormatter-Dg4GlACg.js";import"./service-input-C9nQ3b7b.js";import"./copy-CujkJL51.js";import"./grip-vertical-KUq1h8IO.js";import"./Calender-GA8AQSPY.js";import"./date-picker-q5NTWWN-.js";import"./format-KhiMdRwp.js";import"./Layers-JNsy7EZN.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 Js=[["path",{d:"M5 12h14",key:"1ays0h"}]],Ks=Le("minus",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 Qs=[["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"}]],Xs=Le("shapes",Qs);function Ds(){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(t=>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(i=>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"})]},i))})]},t))]})}function Oe(t){if(t===0)return"0min";const i=Math.floor(t/3600),a=Math.floor(t%3600/60);let k="";return i>0&&(k+=`${i}h `),(a>0||i===0)&&(k+=`${a}min`),k.trim()}function ze(t,i=null){const a=i;if(a==null)return t;const k=a.currency,b=a.currency_symbol||k.symbol;if(t===0&&k.hideBreakdownIfZero)switch(k.symbolPosition){case"before":return`${b}0`;case"before_with_space":return`${b} 0`;case"after_with_space":return`0 ${b}`;default:return`0${b}`}const j=Math.abs(t).toFixed(k.decimals),[p,w]=j.split("."),f=p.replace(/\B(?=(\d{3})+(?!\d))/g,k.thousand),C=w?`${f}${k.decimal}${w}`:f,S=t<0?"-":"";switch(k.symbolPosition){case"before":return`${S}${b}${C}`;case"before_with_space":return`${S}${b} ${C}`;case"after_with_space":return`${S}${C} ${b}`;case"after":default:return`${S}${C}${b}`}}function oe(t){var i;return t?typeof t=="string"?t:(i=t==null?void 0:t.messages)!=null&&i.first_message?t.messages.first_message:Array.isArray(t==null?void 0:t.messages)?t.messages[0]:typeof(t==null?void 0:t.messages)=="string"?t.messages:null:null}function et(){const t=xe(),i=Ee(),{filters:a,services:k,loading:b,pagination:j}=ee(n=>{const r=n(T);return{filters:r.getServiceFilters(),services:r.getAllServices(),loading:r.getServiceloading(),pagination:r.getServicePagination()}},[]),p=d.useMemo(()=>JSON.stringify(a),[a]),[w,f]=d.useState([]),[C,S]=d.useState(0);d.useEffect(()=>{t(T).getAllServices(a)},[t,p,C]);const[y,_]=d.useState({});d.useEffect(()=>{f(k);const n={};k.forEach((r,o)=>{n[o]=!0}),_(n)},[k]);const[c,$]=d.useState(""),[z,B]=d.useState("name-ascending"),[G,M]=d.useState(!1),[A,I]=d.useState(null),x=d.useCallback(n=>{f(r=>r.findIndex(v=>parseInt(v.id)===parseInt(n.id))>-1?r.map(v=>parseInt(v.id)===parseInt(n.id)?n:v):[...r,n])},[]);d.useCallback(n=>{f(r=>r.map(o=>o.services.findIndex(Y=>Y.id===n.id)>-1?{...o,services:o.services.map(Y=>Y.id===n.id?n:Y)}:o.id===n.categoryId?{...o,services:[...o.services,n]}:o))},[]);const g=()=>{I(null),M(!0)},R=n=>{I(n),M(!0)},O=n=>{i(n+"/edit")},ce=n=>{_(r=>({...r,[n]:!r[n]}))},ae=d.useMemo(()=>{let n=w.map(r=>({...r,services:[...r.services]}));if(c){const r=c.toLowerCase();n=n.map(o=>({...o,services:o.services.filter(v=>v.name.toLowerCase().includes(r)||Oe(v.duration).toLowerCase().includes(r)||ze(v.price).toLowerCase().includes(r))}))}return n=n.map(r=>{const o=[...r.services].sort((v,Y)=>{switch(z){case"name-ascending":return v.name.localeCompare(Y.name);case"name-descending":return Y.name.localeCompare(v.name);case"price-ascending":return v.price-Y.price;case"price-descending":return Y.price-v.price;default:return 0}});return{...r,services:o}}),n},[w,c,z]),[H,Z]=d.useState(!1),[W,X]=d.useState(null),[K,ne]=d.useState(null),[u,N]=d.useState([]),h=(n,r)=>{X(n),ne(r),Z(!0)},U=()=>{u.length!==0&&(X(null),ne("bulk"),Z(!0))},se=n=>{N(r=>r.includes(n)?r.filter(o=>o!==n):[...r,n])},ue=n=>{const r=n.services.map(v=>v.id);if(r.length===0)return;const o=r.every(v=>u.includes(v));N(v=>o?v.filter(Y=>!r.includes(Y)):Array.from(new Set([...v,...r])))},qe=n=>u.includes(n),Fe=n=>{const r=n.services.map(v=>v.id);if(r.length===0)return"none";const o=r.filter(v=>u.includes(v)).length;return o===0?"none":o===r.length?"all":"some"},Me=()=>N([]),Ge=()=>{if(K==="service"){for(const n of w){const r=n.services.find(o=>o.id===W);if((r==null?void 0:r.source_type)==="classified_listing")return s("This service is linked to a Classified Listing. Deleting it will also disable booking on that listing.","radius-booking")}return s("This action will permanently delete this service","radius-booking")}if(K==="bulk"){const n=w.some(o=>o.services.some(v=>u.includes(v.id)&&v.source_type==="classified_listing")),r=re(s("This action will permanently delete %d selected service(s).","radius-booking"),u.length);return n?r+" "+s("One or more selected services are linked to Classified Listings — deleting them will also disable booking on those listings.","radius-booking"):r}return s("This action will permanently delete this category","radius-booking")},He=n=>{i("/services/create?categoryId="+n.id)},Ze=()=>{if(K==="category")t(T).removeCategory(W),f(n=>n.filter(r=>r.id!==W));else if(K==="service")t(T).removeService(W),f(n=>n.map(r=>({...r,services:r.services.filter(o=>o.id!==W)}))),N(n=>n.filter(r=>r!==W));else if(K==="bulk"){const n=[...u];t(T).bulkRemoveServices(n),f(r=>r.map(o=>({...o,services:o.services.filter(v=>!n.includes(v.id))}))),Me(),S(r=>r+1)}Z(!1)},Ae=w.reduce((n,r)=>n+r.services.length,0);Ae>0&&w.reduce((n,r)=>n+r.services.reduce((o,v)=>o+v.price,0),0)/Ae;const We=`https://ui-avatars.com/api/?name=${encodeURIComponent(name)}`;return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"min-h-screen",children:b?e.jsx("div",{children:e.jsx(Ds,{})}):e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-40 p-0",children:e.jsxs("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(as,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-small-font"}),e.jsx(D,{placeholder:s("Search across all services...","radius-booking"),className:"h-[45px] bg-white rounded-[8px]",value:c,onChange:n=>$(n.target.value)})]}),e.jsxs(L,{value:z,onValueChange:B,children:[e.jsx(V,{className:"w-[220px] h-[45px] shadow-none bg-white",children:e.jsx(q,{})}),e.jsxs(F,{children:[e.jsx(m,{value:"name-ascending",children:s("Name: A → Z","radius-booking")}),e.jsx(m,{value:"name-descending",children:s("Name: Z → A","radius-booking")}),e.jsx(m,{value:"price-ascending",children:s("Price: Low → High","radius-booking")}),e.jsx(m,{value:"price-descending",children:s("Price: High → Low","radius-booking")})]})]}),e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs(E,{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(he,{size:"12px"}),s("Add Category","radius-booking")]})})]}),u.length>0&&e.jsxs("div",{className:"mt-4 flex items-center justify-between bg-red-50 border border-red-100 rounded-lg px-4 py-3",children:[e.jsx("span",{className:"text-sm text-red-700",children:re(s("%d service(s) selected","radius-booking"),u.length)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{variant:"ghost",size:"sm",onClick:Me,children:s("Clear","radius-booking")}),e.jsxs(E,{variant:"destructive",size:"sm",onClick:U,children:[e.jsx(ve,{className:"w-4 h-4 mr-1"}),s("Delete selected","radius-booking")]})]})]})]})}),e.jsx("div",{className:"py-8 space-y-6",children:ae.length>0?ae.map((n,r)=>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 ${y[r]?"bg-lighter-2":"bg-gradient-to-r from-slate-50 to-white hover:bg-slate-50"}`,onClick:()=>ce(r),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:`flex items-center gap-3 ${n.name==="Uncategorized"?"mt-2":""}`,children:[n.services.length>0&&e.jsx($e,{"aria-label":s("Select all services in this category","radius-booking"),checked:Fe(n)==="all",onClick:o=>o.stopPropagation(),onCheckedChange:()=>ue(n)}),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(E,{variant:"ghost",size:"icon",className:"h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:o=>{o.stopPropagation(),He(n)},children:e.jsx(he,{className:"text-primary"})}),e.jsx(E,{variant:"ghost",size:"icon",className:"h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:o=>{o.stopPropagation(),R(n)},children:e.jsx(Te,{className:"text-primary"})}),e.jsx(E,{variant:"ghost",size:"icon",className:"mx-[2px] h-10 w-5 rounded-xl hover:scale-110 hover:bg-transparent",onClick:o=>{o.stopPropagation(),h(n.id,"category")},children:e.jsx(ve,{color:"E4002D"})})]}),e.jsx("div",{className:` transition-transform ${y[r]?"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"})})})]})]})}),y[r]&&e.jsx("div",{className:"p-6",children:n.services.length>0?e.jsx("div",{className:"space-y-2",children:n.services.map(o=>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($e,{"aria-label":s("Select service","radius-booking"),checked:qe(o.id),onCheckedChange:()=>se(o.id)}),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:o.color||"#334155"},children:o.picture_thumb_path?e.jsx("img",{className:"w-full h-full object-cover",alt:o.name,src:o.picture_thumb_path||We,loading:"lazy"}):o.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{onClick:()=>O(o.id),className:"font-semibold text-primary-dark cursor-pointer hover:text-primary truncate",children:o.name}),(o==null?void 0:o.description)&&e.jsx("p",{className:"two-line-clamp text-title2",children:o.description.length>100?o.description.slice(0,100)+"...":o.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(is,{className:"w-4 h-4 text-title"}),e.jsx("span",{className:"text-sm text-title",children:Oe(o.duration)})]}),e.jsx("div",{className:"flex items-center gap-1 text-title w-28",children:e.jsx("span",{className:"font-semibold",children:ze(o.price,o.currency)})})]}),e.jsxs(Ye,{children:[e.jsx(Je,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"icon",className:"h-9 w-9 transition-opacity rounded-lg bg-gray-50 group-hover:bg-gray-100",children:e.jsx(Ke,{className:"w-4 h-4"})})}),e.jsxs(Qe,{align:"end",className:"w-48",children:[e.jsxs(Ie,{onClick:()=>O(o.id),className:"cursor-pointer",children:[e.jsx(Te,{}),s("Edit Service","radius-booking")]}),e.jsxs(Ie,{onClick:()=>h(o.id,"service"),className:"cursor-pointer text-red-600 focus:text-red-600",children:[e.jsx(ve,{}),s("Delete Service","radius-booking")]})]})]})]},o.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(Xs,{className:"w-10 h-10 text-slate-400"})}),e.jsx("p",{className:"text-title font-medium mb-1",children:s("No services yet","radius-booking")}),e.jsx("p",{className:"text-sm text-small-font",children:s("Add your first service to this category","radius-booking")})]})})]},r)):e.jsx(Xe,{className:"border-border shadow-sm",children:e.jsx(De,{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(Ue,{className:"w-8 h-8 text-blue-600"})}),e.jsx("h3",{className:"text-lg font-bold text-title mb-2",children:s("No Service Found","radius-booking")})]})})})})]})}),e.jsx(ss,{isOpen:G,onOpenChange:M,categoryToEdit:A,onCategorySaved:x}),e.jsx(es,{open:H,onClose:()=>Z(!1),onConfirm:Ze,title:s("Are you sure?","radius-booking"),description:Ge(),confirmText:s("Delete","radius-booking")})]})}function st(){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 tt({value:t=[],onChange:i=()=>{},employees:a=[],placeholder:k="Select staffs...",disabled:b=!1}){const[j,p]=d.useState(!1),w=d.useRef(null);d.useEffect(()=>{const y=_=>{w.current&&!w.current.contains(_.target)&&p(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const f=y=>{t.includes(y)?i(t.filter(_=>_!==y)):i([...t,y])},C=y=>{i(t.filter(_=>_!==y))},S=a.filter(y=>t.includes(y.value));return e.jsxs("div",{ref:w,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:()=>!b&&p(!j),children:[S.length>0?e.jsx(e.Fragment,{children:S.map(y=>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:y.label}),e.jsx("button",{onClick:_=>{_.stopPropagation(),C(y.value)},className:"hover:bg-blue-200 rounded p-0.5 transition-colors",children:e.jsx(ke,{size:14})})]},y.value))}):e.jsx("span",{className:"text-title2",children:k}),e.jsx("div",{className:"ml-auto flex items-center",children:e.jsx(fe,{size:20,className:`text-gray-400 transition-transform ${j?"rotate-180":""}`})})]}),j&&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(y=>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:t.includes(y.value),onChange:()=>f(y.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:y.label})]},y.value)):e.jsx("div",{className:"px-4 py-3 text-sm text-title2",children:"No Staff available"})})]})}function it({open:t,onOpenChange:i,onEmployeeCreated:a}){const{setEmployeeData:k,setEmployeeError:b}=xe(T),j=ee(f=>f(T).getEmployee(),[]);d.useEffect(()=>{t&&(k({user_type:"employee"}),b({}))},[t,k,b]);const p=d.useCallback(()=>{(j!=null&&j.first_name||j!=null&&j.last_name||j!=null&&j.email)&&!window.confirm(s("You have unsaved changes. Are you sure you want to close?","radius-booking"))||i(!1)},[j,i]),w=d.useCallback(()=>{p()},[p]);return e.jsx(ps,{open:t,onOpenChange:p,children:e.jsxs(gs,{side:"right",className:"w-full sm:max-w-[800px] lg:max-w-[1000px] p-0 flex flex-col overflow-hidden",children:[e.jsx(bs,{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(js,{className:"text-xl font-semibold text-slate-900",children:s("Create New Staff","radius-booking")}),e.jsx(fs,{className:"text-sm text-slate-600 mt-1",children:s("Add a new team member to your business","radius-booking")})]}),e.jsx(E,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 rounded-full hover:bg-slate-100",children:e.jsx(ke,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsx(Ns,{onBack:w,resource:"sheet"})})]})})}function at({serviceData:t,updateField:i,errors:a,loading:k}){var I,x;const b=xe(T),{getServiceEmployees:j}=xe(T),p=Ee(),w=ee(g=>g(T).getServiceEmployee(),[]),f=ee(g=>g(T).getIsEmployeeSheetOpen(),[]),[C]=ns(),S=C.get("categoryId");d.useEffect(()=>{S&&i("category_id",S)},[S,i]),d.useEffect(()=>{b.getServiceEmployees()},[b,f]);const y=hs(),_=((I=window.radius_booking_param)==null?void 0:I.is_pro)||!1,c=d.useCallback(()=>{y({title:s("Select Service Photo","radius-booking"),onSelect:({url:g,sizes:R})=>{var O;i("picture_full_path",g),i("picture_thumb_path",((O=R==null?void 0:R.thumbnail)==null?void 0:O.url)||g)}})},[y,i]),$=d.useCallback(()=>{["picture_full_path","picture_thumb_path"].forEach(R=>i(R,""))},[i]),z=g=>{i("assigned_employee_id",g)};d.useCallback(()=>{p("/employees/create")},[p]);const B=d.useCallback(()=>{b.setIsEmployeeSheetOpen(!0)},[]),G=d.useCallback(g=>{if(b.getServiceEmployees(),g!=null&&g.id){const R=(t==null?void 0:t.assigned_employee_id)||[],O=Array.isArray(R)?[...R,g.id]:[g.id];i("assigned_employee_id",O)}},[b,t==null?void 0:t.assigned_employee_id,i]),M=w&&w.length>0;if(k)return e.jsx("div",{className:"space-y-6",children:e.jsx(st,{})});const A="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(it,{open:f,onOpenChange:b.setIsEmployeeSheetOpen,onEmployeeCreated:G,serviceId:t==null?void 0:t.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:[s("Basic Information","radius-booking"),e.jsx(ie,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:s("Required","radius-booking")})]})}),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(P,{htmlFor:"name",className:"text-sm font-medium text-slate-700 flex items-center gap-1",children:[s("Service Name","radius-booking")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"relative",children:e.jsx(D,{id:"name",required:!0,value:(t==null?void 0:t.name)||"",onChange:g=>i("name",g.target.value),placeholder:s("e.g., Haircut & Styling","radius-booking"),className:`text-base transition-all ${a!=null&&a.name?"border-red-300 focus:border-red-500 focus:ring-red-200 bg-red-50":""}`})}),t!=null&&t.name?e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("Choose a clear, descriptive name for your service","radius-booking")]}):oe(a==null?void 0:a.name)&&e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),oe(a==null?void 0:a.name)]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{htmlFor:"category",className:"text-sm font-medium text-slate-700 flex items-center gap-1",children:[s("Category","radius-booking")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"relative",children:e.jsx(ts,{onChange:g=>i("category_id",g),value:t==null?void 0:t.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":t!=null&&t.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(pe,{className:"h-3 w-3"}),s("This field is required","radius-booking")]}):e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("Categorize your service for better organization","radius-booking")]})]})]})]}),e.jsx(de,{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:[s("Staff Assignment","radius-booking"),M&&e.jsx(ie,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:s("Required","radius-booking")})]})}),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:A,children:e.jsx(le,{className:"h-5 w-5 text-[#1d4ed8]"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:s("Assign Staff","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Select which employees can provide this service","radius-booking")})]})]}),M?e.jsxs("div",{className:"space-y-3",children:[e.jsx(P,{className:"text-sm font-medium text-slate-700",children:s("Available Employees","radius-booking")}),e.jsx(tt,{value:t==null?void 0:t.assigned_employee_id,onChange:z,employees:w,placeholder:s("Select staffs...","radius-booking")}),a!=null&&a.assigned_employee_id?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),oe(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"}),s("Select one or more employees who can provide this service","radius-booking")]})]}):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(Be,{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:s("No Staffs Found","radius-booking")}),e.jsx("p",{className:"text-sm text-slate-500 max-w-sm",children:s("You need to create at least one staff before you can assign them to services.","radius-booking")})]}),e.jsxs(E,{type:"button",onClick:B,className:"bg-[#1d4ed8] hover:bg-[#1e40af] text-white rounded-[8px] h-11 px-6 flex items-center gap-1",children:[e.jsx(Be,{className:"h-4 w-4"}),s("Create New Staff","radius-booking")]})]})})]})]}),e.jsx(de,{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:[s("Service Settings","radius-booking"),e.jsx(ie,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:s("Optional","radius-booking")})]})}),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:A,children:e.jsx(ks,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:s("Show service on site","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Make this service visible to customers","radius-booking")})]})]}),e.jsx(me,{checked:t==null?void 0:t.is_visible,onCheckedChange:g=>i("is_visible",g),className:"data-[state=checked]:bg-[#1d4ed8]"})]})}),e.jsx(te,{icon:e.jsx(Cs,{className:"h-5 w-5 text-primary"}),title:s("Recurring Appointments","radius-booking"),description:_?s("Enable repeat bookings for this service","radius-booking"):s("Upgrade to PRO to enable recurring appointments","radius-booking"),isPro:_,showSwitch:!1,children:e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs(L,{value:t==null?void 0:t.recurring_cycle,onValueChange:g=>i("recurring_cycle",g),children:[e.jsx(V,{className:"h-11 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px] bg-white",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px] border-border shadow-lg",children:[e.jsx(m,{value:"disabled",children:s("Disabled","radius-booking")}),e.jsx(m,{value:"all",children:s("All","radius-booking")}),e.jsx(m,{value:"daily",children:s("Daily","radius-booking")}),e.jsx(m,{value:"weekly",children:s("Weekly","radius-booking")}),e.jsx(m,{value:"monthly",children:s("Monthly","radius-booking")}),e.jsx(m,{value:"yearly",children:s("Yearly","radius-booking")})]})]}),(t==null?void 0:t.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(P,{className:"text-sm font-medium text-slate-700",children:s("Handle unavailable dates","radius-booking")}),e.jsxs(L,{value:t==null?void 0:t.recurring_sub,onValueChange:g=>i("recurring_sub",g),children:[e.jsx(V,{className:"h-11 border-slate-300 rounded-[8px] bg-white",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"future",children:s("Closest date after","radius-booking")}),e.jsx(m,{value:"past",children:s("Closest date before","radius-booking")}),e.jsx(m,{value:"both",children:s("Closest date before or after","radius-booking")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{className:"text-sm font-medium text-slate-700",children:s("Payment handling","radius-booking")}),e.jsxs(L,{value:(x=t==null?void 0:t.recurring_payment)==null?void 0:x.toString(),onValueChange:g=>i("recurring_payment",g),children:[e.jsx(V,{className:"h-11 border-slate-300 rounded-[8px] bg-white",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"0",children:s("Pay first appointment only","radius-booking")}),e.jsx(m,{value:"1",children:s("Pay all appointments at once","radius-booking")})]})]})]})]})})]})})]})]})]}),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:[s("Description & Media","radius-booking"),e.jsx(ie,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:s("Optional","radius-booking")})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(P,{className:"text-sm font-medium text-slate-700 mb-3 block",children:s("Service Image","radius-booking")})}),e.jsx(us,{imagePath:t==null?void 0:t.picture_full_path,onUpload:c,onRemove:$}),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"}),s("Upload a professional image that represents your service (recommended: 800x600px)","radius-booking")]})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-sm font-medium text-slate-700 mb-3 block",children:s("Service Description","radius-booking")}),e.jsx(xs,{placeholder:s("Describe your service in detail. Include what clients can expect, benefits, and any special instructions...","radius-booking"),value:(t==null?void 0:t.description)||"",onChange:g=>i("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"}),s("A detailed description helps customers understand your service better","radius-booking")]})]})]})})]})]})}function nt({serviceData:t,updateField:i}){var b;const a=((b=window.radius_booking_param)==null?void 0:b.is_pro)||!1,k=t==null?void 0:t.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:[s("Deposit Payment","radius-booking"),e.jsx(ie,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:s("Optional","radius-booking")})]})}),e.jsx(te,{icon:e.jsx(ye,{className:"h-5 w-5 text-primary"}),title:s("Require Deposit Payment","radius-booking"),description:a?s("Collect payment upfront to secure bookings","radius-booking"):s("Upgrade to PRO to enable deposit payments","radius-booking"),checked:t==null?void 0:t.deposit_payment,onCheckedChange:j=>i("deposit_payment",j),isPro:a}),k&&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(P,{className:"text-sm font-medium text-slate-700",children:s("Deposit Type","radius-booking")}),e.jsxs(L,{value:t.deposit_type??"percentage",onValueChange:j=>i("deposit_type",j),children:[e.jsx(V,{className:"h-11 bg-white border-slate-300 rounded-[8px]",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"percentage",children:s("Percentage","radius-booking")}),e.jsx(m,{value:"fixed",children:s("Fixed Amount","radius-booking")})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700",children:[s("Deposit Amount","radius-booking")," ",t.deposit_type==="percentage"?"(%)":`(${(t==null?void 0:t.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:t.deposit_type==="percentage"?"%":(t==null?void 0:t.currency_symbol)||"$"}),e.jsx(D,{type:"number",value:t.deposit,onChange:j=>i("deposit",j.target.value),className:"pl-10 h-11 bg-white border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",step:t.deposit_type==="percentage"?"1":"0.01",min:"0",max:t.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:s("Allow full payment option","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Let customers pay the total amount upfront","radius-booking")})]}),e.jsx(me,{checked:t==null?void 0:t.full_payment,onCheckedChange:j=>i("full_payment",j),className:"data-[state=checked]:bg-[#1d4ed8]"})]})}),t.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:s("Charge deposit for each person in the booking","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Customers will pay the combined deposit amount upfront","radius-booking")})]}),e.jsx(me,{checked:t==null?void 0:t.deposit_per_person,onCheckedChange:j=>i("deposit_per_person",j),className:"data-[state=checked]:bg-[#1d4ed8]"})]})})]})]})}function lt({serviceData:t,updateField:i,errors:a}){var C,S,y,_;const k=ee(c=>c(T).getSettings(),[]),b=((C=k==null?void 0:k.dateTime)==null?void 0:C.selectableInterval)||30,j=d.useMemo(()=>{const c=Math.max(5,Number(b)||30),$=480,z=[];for(let B=c;B<=$;B+=c){const G=B*60,M=Math.floor(B/60),A=B%60;let I;M===0?I=re(ge("%d minute","%d minutes",A,"radius-booking"),A):A===0?I=re(ge("%d hour","%d hours",M,"radius-booking"),M):I=re(s("%1$s %2$s","radius-booking"),re(ge("%d hour","%d hours",M,"radius-booking"),M),re(ge("%d minute","%d minutes",A,"radius-booking"),A)),z.push({value:String(G),label:I})}return z},[b]),p=((S=window.radius_booking_param)==null?void 0:S.is_pro)||!1,w="h-[45px] w-[45px] basis-[45px] rounded-[8px] border-[#BDCFFF] bg-[#F5FAFF] hover:bg-[#EBF5FF]",f=()=>{const c=t.price;return c===""||c===null||c===void 0?!0:parseFloat(c)===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:[s("Duration & Price","radius-booking"),e.jsx(ie,{className:"text-xs bg-[#FFE5E5] border-none text-[#E4002D] shadow-none font-normal",children:s("Required","radius-booking")})]})}),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(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4 text-slate-600"}),s("Duration","radius-booking")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(L,{value:t.duration?t.duration.toString():"",onValueChange:c=>i("duration",c),children:[e.jsx(V,{className:"h-12 text-base border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(q,{placeholder:s("Select duration","radius-booking")})}),e.jsx(F,{className:"rounded-[8px]",children:j.map(c=>e.jsx(m,{value:c.value,children:c.label},c.value))})]}),oe(a==null?void 0:a.duration)?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),oe(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"}),s("How long does this service typically take?","radius-booking")]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-slate-600"}),s("Price","radius-booking")]}),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:(t==null?void 0:t.currency_symbol)||"$"}),e.jsx(D,{type:"number",value:t.price,onChange:c=>{(parseFloat(c.target.value)>=0||c.target.value==="")&&i("price",c.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"})]}),oe(a==null?void 0:a.price)?e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),oe(a==null?void 0:a.price)]}):f()?e.jsxs("p",{className:"text-xs text-amber-600 flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("This service will be listed as Free","radius-booking")]}):e.jsxs("p",{className:"text-xs text-small-font flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("Set the base price for this service","radius-booking")]})]})]})]}),e.jsx(de,{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:[s("Buffer Times","radius-booking"),e.jsx(ie,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:s("Optional","radius-booking")})]})}),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(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4 text-slate-600"}),s("Buffer Time Before","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:(y=t.time_before)==null?void 0:y.toString(),onValueChange:c=>i("time_before",c),children:[e.jsx(V,{className:"h-12 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"0",children:s("No buffer","radius-booking")}),e.jsx(m,{value:"300",children:s("5 minutes","radius-booking")}),e.jsx(m,{value:"600",children:s("10 minutes","radius-booking")}),e.jsx(m,{value:"900",children:s("15 minutes","radius-booking")}),e.jsx(m,{value:"1800",children:s("30 minutes","radius-booking")})]})]}),e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("Time needed before the appointment starts","radius-booking")]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4 text-slate-600"}),s("Buffer Time After","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:(_=t.time_after)==null?void 0:_.toString(),onValueChange:c=>i("time_after",c),children:[e.jsx(V,{className:"h-12 border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200 rounded-[8px]",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"0",children:s("No buffer","radius-booking")}),e.jsx(m,{value:"300",children:s("5 minutes","radius-booking")}),e.jsx(m,{value:"600",children:s("10 minutes","radius-booking")}),e.jsx(m,{value:"900",children:s("15 minutes","radius-booking")}),e.jsx(m,{value:"1800",children:s("30 minutes","radius-booking")})]})]}),e.jsxs("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(Q,{className:"h-3 w-3"}),s("Time needed after the appointment ends","radius-booking")]})]})]})]}),e.jsx(de,{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:[s("Capacity Settings","radius-booking"),e.jsx(ie,{className:"text-xs bg-light-bg border-none text-title shadow-none font-normal",children:s("Optional","radius-booking")})]})}),e.jsxs("div",{className:`relative rounded-[8px] border p-5 transition-all overflow-hidden ${p?"bg-gradient-to-r from-slate-50 to-white border-border hover:shadow-sm":"bg-slate-50/50 border-slate-200"}`,children:[!p&&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 ${p?"bg-white border-blue-200":"bg-slate-100 border-slate-200"}`,children:e.jsx(le,{className:`h-5 w-5 ${p?"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 ${p?"text-title":"text-slate-400"}`,children:s("Capacity Settings","radius-booking")}),!p&&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(_s,{className:"h-2.5 w-2.5"}),s("PRO","radius-booking")]})]}),e.jsx("p",{className:`text-xs mt-0.5 ${p?"text-slate-600":"text-slate-400"}`,children:p?s("Configure minimum and maximum booking capacity","radius-booking"):s("Upgrade to PRO to configure booking capacity","radius-booking")})]})]}),!p&&e.jsx(Ps,{className:"h-4 w-4 text-slate-300"})]}),e.jsxs("div",{className:`space-y-6 mt-5 relative ${p?"":"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(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-slate-600"}),s("Minimum Capacity","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{variant:"outline",size:"icon",disabled:!p,onClick:()=>i("min_capacity",Math.max(1,t.min_capacity-1)),className:w,children:e.jsx(Ce,{className:"text-primary"})}),e.jsx(D,{type:"number",value:t.min_capacity,disabled:!p,onChange:c=>i("min_capacity",Number.parseInt(c.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(E,{variant:"outline",size:"icon",disabled:!p,onClick:()=>i("min_capacity",t.min_capacity+1),className:w,children:e.jsx(he,{className:"text-primary"})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-slate-600"}),s("Maximum Capacity","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{variant:"outline",size:"icon",disabled:!p,onClick:()=>i("max_capacity",Math.max(1,t.max_capacity-1)),className:w,children:e.jsx(Ce,{className:"text-primary"})}),e.jsx(D,{type:"number",value:t.max_capacity,disabled:!p,onChange:c=>i("max_capacity",Number.parseInt(c.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(E,{variant:"outline",size:"icon",disabled:!p,onClick:()=>i("max_capacity",t.max_capacity+1),className:w,children:e.jsx(he,{className:"text-primary"})})]})]})]}),(t.max_capacity>1||!p)&&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(le,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:s('Show "Bringing anyone with you" option',"radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Allow customers to add additional people","radius-booking")})]})]}),e.jsx(me,{checked:t==null?void 0:t.bringing_anyone,onCheckedChange:c=>i("bringing_anyone",c),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!p})]})}),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(ye,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:s("Multiply price by number of people","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Charge per person instead of flat rate","radius-booking")})]})]}),e.jsx(me,{checked:t==null?void 0:t.aggregated_price,onCheckedChange:c=>i("aggregated_price",c),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!p})]})}),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(le,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-title text-sm",children:s("Limit for the extra people","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Set a maximum number of additional attendees","radius-booking")})]})]}),e.jsx(me,{checked:(t==null?void 0:t.max_extra_people)>0,onCheckedChange:c=>i("max_extra_people",c?1:0),className:"data-[state=checked]:bg-[#1d4ed8]",disabled:!p})]}),(t==null?void 0:t.max_extra_people)>0&&p&&e.jsxs("div",{className:"space-y-3 mt-4 pt-4 border-t border-slate-100",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-slate-600"}),s("Set limit for additional people:","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{variant:"outline",size:"icon",onClick:()=>i("max_extra_people",Math.max(1,t.max_extra_people-1)),className:"h-[45px] w-[45px] rounded-[8px] border-slate-300 hover:bg-slate-50",children:e.jsx(Ce,{className:"text-primary"})}),e.jsx(D,{type:"number",value:t.max_extra_people,onChange:c=>{c.target.value<t.max_capacity&&i("max_extra_people",Number.parseInt(c.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:t.max_capacity-1}),e.jsx(E,{variant:"outline",size:"icon",onClick:()=>i("max_extra_people",t.max_extra_people+1),className:w,disabled:t.max_extra_people>=t.max_capacity-1,children:e.jsx(he,{className:"text-primary"})})]})]})]})]})]})]})]}),e.jsx(de,{className:"bg-slate-200"}),e.jsx(nt,{serviceData:t,updateField:i})]})}function rt({serviceData:t,updateField:i}){var f,C,S,y,_,c,$,z,B,G,M,A,I,x,g,R,O,ce,ae,H,Z,W,X,K,ne;const[a,k]=d.useState({general:!0,payments:!1,integrations:!1}),b=((f=window.radius_booking_param)==null?void 0:f.is_pro)||!1,j=u=>{k(N=>({...N,[u]:!N[u]}))},p="h-[45px] w-[45px] basis-[45px] rounded-[8px] border-[#BDCFFF] bg-[#F5FAFF] hover:bg-[#EBF5FF]",w="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(Se,{open:a.general,onOpenChange:()=>j("general"),children:[e.jsxs(_e,{className:w,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(ys,{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:[s("General Settings","radius-booking"),e.jsx($s,{show:!b})]}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:b?s("Override global booking restrictions for this service","radius-booking"):s("Per-service overrides require Pro — using global settings","radius-booking")})]})]}),a.general?e.jsx(fe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(we,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(Pe,{children:e.jsxs("div",{className:`p-6 space-y-6 bg-white ${b?"":"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(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Bs,{className:"h-4 w-4 text-slate-600"}),s("Default Appointment Status","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:(S=(C=t==null?void 0:t.settings)==null?void 0:C.general)==null?void 0:S.defaultStatus,onValueChange:u=>i("settings.general.defaultStatus",u),children:[e.jsx(V,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"global",children:s("Use Global Setting","radius-booking")}),e.jsx(m,{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"}),s("Confirmed","radius-booking")]})}),e.jsx(m,{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"}),s("Pending","radius-booking")]})}),e.jsx(m,{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"}),s("Cancelled","radius-booking")]})}),e.jsx(m,{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"}),s("Completed","radius-booking")]})})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:s("Initial status for new bookings","radius-booking")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4 text-slate-600"}),s("Minimum Booking Time","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:(_=(y=t==null?void 0:t.settings)==null?void 0:y.general)==null?void 0:_.minBookingTime,onValueChange:u=>i("settings.general.minBookingTime",u),children:[e.jsx(V,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"disabled",children:s("Use Global Setting","radius-booking")}),e.jsx(m,{value:"3600",children:s("1 hour","radius-booking")}),e.jsx(m,{value:"7200",children:s("2 hours","radius-booking")}),e.jsx(m,{value:"86400",children:s("24 hours","radius-booking")}),e.jsx(m,{value:"172800",children:s("48 hours","radius-booking")})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:s("How far in advance bookings are required","radius-booking")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{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"}),s("Minimum Cancel Time","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:($=(c=t==null?void 0:t.settings)==null?void 0:c.general)==null?void 0:$.minCancelTime,onValueChange:u=>i("settings.general.minCancelTime",u),children:[e.jsx(V,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"disabled",children:s("Use Global Setting","radius-booking")}),e.jsx(m,{value:"3600",children:s("1 hour","radius-booking")}),e.jsx(m,{value:"7200",children:s("2 hours","radius-booking")}),e.jsx(m,{value:"86400",children:s("24 hours","radius-booking")}),e.jsx(m,{value:"172800",children:s("48 hours","radius-booking")})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:s("Notice required before cancellation","radius-booking")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Rs,{className:"h-4 w-4 text-slate-600"}),s("Minimum Reschedule Time","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsxs(L,{value:(B=(z=t==null?void 0:t.settings)==null?void 0:z.general)==null?void 0:B.minRescheduleTime,onValueChange:u=>i("settings.general.minRescheduleTime",u),children:[e.jsx(V,{className:"h-11 rounded-[8px] border-slate-300 focus:border-[#1d4ed8] focus:ring-blue-200",children:e.jsx(q,{})}),e.jsxs(F,{className:"rounded-[8px]",children:[e.jsx(m,{value:"disabled",children:s("Use Global Setting","radius-booking")}),e.jsx(m,{value:"3600",children:s("1 hour","radius-booking")}),e.jsx(m,{value:"7200",children:s("2 hours","radius-booking")}),e.jsx(m,{value:"86400",children:s("24 hours","radius-booking")}),e.jsx(m,{value:"172800",children:s("48 hours","radius-booking")})]})]}),e.jsx("p",{className:"text-xs text-small-font",children:s("Notice required before rescheduling","radius-booking")})]})]}),e.jsx(de,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(Os,{className:"h-4 w-4 text-slate-600"}),s("Booking Advance Period (days)","radius-booking"),e.jsx(J,{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(E,{variant:"outline",size:"icon",onClick:()=>{var u,N;return i("settings.general.bookingAdvancePeriod",Math.max(1,((N=(u=t==null?void 0:t.settings)==null?void 0:u.general)==null?void 0:N.bookingAdvancePeriod)-1))},className:p,children:e.jsx(Ks,{className:"h-4 w-4"})}),e.jsx(D,{type:"number",value:(M=(G=t==null?void 0:t.settings)==null?void 0:G.general)==null?void 0:M.bookingAdvancePeriod,onChange:u=>i("settings.general.bookingAdvancePeriod",Number.parseInt(u.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(E,{variant:"outline",size:"icon",onClick:()=>{var u,N;return i("settings.general.bookingAdvancePeriod",((N=(u=t==null?void 0:t.settings)==null?void 0:u.general)==null?void 0:N.bookingAdvancePeriod)+1)},className:p,children:e.jsx(Ve,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-small-font",children:s("How far in advance customers can book","radius-booking")})]}),e.jsx(de,{className:"bg-slate-200"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(P,{className:"text-sm font-medium text-slate-700 flex items-center gap-2",children:[e.jsx(zs,{className:"h-4 w-4 text-slate-600"}),s("Redirect URL After Booking","radius-booking"),e.jsx(J,{className:"h-3.5 w-3.5 text-slate-400"})]}),e.jsx(D,{type:"url",value:((I=(A=t==null?void 0:t.settings)==null?void 0:A.general)==null?void 0:I.redirectUrl)||"",onChange:u=>i("settings.general.redirectUrl",u.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:s("Where to send customers after successful booking","radius-booking")})]})]})})]})}),e.jsx("div",{className:"bg-white rounded-[15px] border border-border overflow-hidden shadow-none",children:e.jsxs(Se,{open:a.payments,onOpenChange:()=>j("payments"),children:[e.jsxs(_e,{className:w,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(ws,{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:s("Payment Methods","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Select accepted payment options","radius-booking")})]})]}),a.payments?e.jsx(fe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(we,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"p-6 space-y-4 bg-white",children:[e.jsx(te,{icon:e.jsx(Es,{size:"26px"}),title:s("Stripe","radius-booking"),description:s("Accept credit and debit cards","radius-booking"),checked:(g=(x=t==null?void 0:t.settings)==null?void 0:x.paymentMethods)==null?void 0:g.stripe,onCheckedChange:u=>i("settings.paymentMethods.stripe",u),isPro:b}),e.jsx(te,{icon:e.jsx(Ms,{size:"26px"}),title:s("PayPal","radius-booking"),description:s("Accept PayPal payments","radius-booking"),checked:(O=(R=t==null?void 0:t.settings)==null?void 0:R.paymentMethods)==null?void 0:O.paypal,onCheckedChange:u=>i("settings.paymentMethods.paypal",u),isPro:!0}),e.jsx(te,{icon:e.jsx(ye,{className:"h-5 w-5 text-primary"}),title:s("Cash Payment","radius-booking"),description:s("Accept offline payments on-site","radius-booking"),checked:(ae=(ce=t==null?void 0:t.settings)==null?void 0:ce.paymentMethods)==null?void 0:ae.offline,onCheckedChange:u=>i("settings.paymentMethods.offline",u),isPro:!0})]})})]})}),e.jsx("div",{className:"bg-white rounded-[15px] border border-border overflow-hidden shadow-none",children:e.jsxs(Se,{open:a==null?void 0:a.integrations,onOpenChange:()=>j("integrations"),children:[e.jsxs(_e,{className:w,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(vs,{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:s("Integrations","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-600 mt-0.5",children:s("Connect with external services","radius-booking")})]})]}),a!=null&&a.integrations?e.jsx(fe,{className:"h-7 w-5 text-title-2 transition-transform"}):e.jsx(we,{className:"h-7 w-5 text-title-2 transition-transform"})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"p-6 space-y-4 bg-white",children:[e.jsx(te,{icon:e.jsx(As,{size:"24px"}),title:s("Google Calendar","radius-booking"),description:s("Create calendar events and auto-generate meeting links","radius-booking"),checked:(Z=(H=t==null?void 0:t.settings)==null?void 0:H.integrations)==null?void 0:Z.googleCalender,onCheckedChange:u=>i("settings.integrations.googleCalender",u),isPro:!0}),e.jsx(te,{icon:e.jsx(Is,{size:"24px"}),title:s("Google Meet","radius-booking"),description:s("Auto-create video meeting links","radius-booking"),checked:(X=(W=t==null?void 0:t.settings)==null?void 0:W.integrations)==null?void 0:X.googleMeet,onCheckedChange:u=>i("settings.integrations.googleMeet",u),isPro:!0}),e.jsx(te,{icon:e.jsx(Ts,{size:"27px"}),title:s("Zoom","radius-booking"),description:s("Create Zoom meeting rooms","radius-booking"),checked:(ne=(K=t==null?void 0:t.settings)==null?void 0:K.integrations)==null?void 0:ne.zoom,onCheckedChange:u=>i("settings.integrations.zoom",u),isPro:b})]})})]})})]})}const ot={details:["name","category_id","assigned_employee_id"],pricing:["duration"],settings:[]};function dt(t,i){const a=Ee(),{setServiceFormField:k,getService:b,setServiceError:j,setDefaultService:p,getServiceEmployees:w}=xe(T),{id:f}=ls(),C=d.useMemo(()=>f!==void 0,[f]),[S,y]=d.useState(!1),[_,c]=d.useState(!1),$=d.useRef(null),z=xe(T),B=ee(N=>N(T).isServiceSaving(),[]),G=ee(N=>N(T).getServiceEmployee(),[]);d.useEffect(()=>{w()},[]);const M=G&&G.length>0,A=d.useMemo(()=>{const N={name:[{check:h=>!!(h!=null&&h.trim()),message:s("Service name is required","radius-booking")},{check:h=>(h==null?void 0:h.length)>=2,message:s("Min 2 characters","radius-booking")}],category_id:[{check:h=>!!h,message:s("Please select a category","radius-booking")}],duration:[{check:h=>!!h,message:s("Duration is required","radius-booking")},{check:h=>Number(h)>=1,message:s("Min 1 minute","radius-booking")}]};return M&&(N.assigned_employee_id=[{check:h=>Array.isArray(h)&&h.length>0,message:s("Please assign at least one employee","radius-booking")}]),N},[M]),{validate:I}=qs(A,j),{serviceData:x,errors:g,loading:R}=ee(N=>{const h=N(T);return{serviceData:h.getService(),errors:h.getServiceError(),loading:h.getServiceloading()}},[]);d.useEffect(()=>(C&&b(f),()=>{p({}),j({})}),[]),d.useEffect(()=>{C&&(x!=null&&x.id)&&$.current===null&&x.price!==void 0&&x.price!==null&&!Number.isNaN(Number(x.price))&&($.current=Number(x.price))},[C,x==null?void 0:x.id,x==null?void 0:x.price]);const O=d.useCallback((N,h)=>{k({field:N,value:h})},[k]),ce=d.useCallback(N=>{const{isValid:h}=I(x,ot[N]);return h},[x,I]),ae=d.useMemo(()=>{if(g&&Object.keys(g).length>0)return!1;const N=(h,U)=>U.split(".").reduce((se,ue)=>se==null?void 0:se[ue],h);for(const h of Object.keys(A)){const U=A[h];if(!U)continue;const se=N(x,h);for(const ue of U)if(!ue.check(se,x))return!1}return!0},[A,x,g]),H=d.useCallback(async N=>{y(!0);try{const h={...x};C&&$.current!==null&&(h.original_price=$.current,h.apply_price_to_employees=!!N),await z.saveService(h)&&a("/services")}catch(h){console.error("Error saving:",h)}finally{y(!1)}},[x,C,z,a]),Z=d.useCallback(async()=>{const{isValid:N}=I(x);if(!N)return;const h=$.current;if(C&&h!==null&&Number(h)!==Number(x.price??0)){c(!0);return}await H(!1)},[x,I,C,H]);d.useImperativeHandle(i,()=>({requestSave:Z}),[Z]);const W=d.useMemo(()=>{const N=$.current;return N===null?0:Number((x==null?void 0:x.price)??0)-Number(N)},[x==null?void 0:x.price,_]),X=N=>{const h=(x==null?void 0:x.currency_symbol)||"$",U=Number(N||0);return`${U<0?"-":U>0?"+":""}${h}${Math.abs(U).toFixed(2)}`},K=d.useCallback(async()=>{c(!1),await H(!0)},[H]),ne=d.useCallback(async()=>{c(!1),await H(!1)},[H]),u=d.useMemo(()=>[{id:"details",title:s("Service Details","radius-booking"),label:s("Details","radius-booking"),icon:Us,description:s("Basic information","radius-booking"),content:e.jsx(at,{serviceData:x,updateField:O,errors:g,loading:R})},{id:"pricing",title:s("Duration & Pricing","radius-booking"),label:s("Pricing","radius-booking"),icon:Ls,description:s("Time and cost","radius-booking"),content:e.jsx(lt,{serviceData:x,updateField:O,errors:g})},{id:"settings",title:"",icon:Vs,label:s("Settings","radius-booking"),description:s("Advanced options","radius-booking"),content:e.jsx(rt,{serviceData:x,updateField:O,errors:g})}],[x,O,g,R]);return e.jsxs("div",{className:"p-0",children:[e.jsx("main",{children:e.jsx(ms,{tabs:u,showProgress:!1,allowSkipSteps:ae,navigationPosition:"bottom",onTabChange:()=>{},onStepComplete:ce,onComplete:Z,completeButtonText:C?s("Update Service","radius-booking"):s("Create Service","radius-booking"),nextButtonText:s("Next","radius-booking"),prevButtonText:s("Back","radius-booking"),isCompleting:B})}),e.jsx(Fs,{open:_,onOpenChange:c,children:e.jsxs(Gs,{className:"sm:max-w-md",children:[e.jsxs(Hs,{children:[e.jsx(Zs,{children:s("Update employee prices?","radius-booking")}),e.jsxs(Ws,{className:"pt-2 space-y-2",children:[e.jsxs("span",{className:"block",children:[s("You changed the service price from","radius-booking")," ",e.jsx("strong",{children:X($.current)})," ",s("to","radius-booking")," ",e.jsx("strong",{children:X(x==null?void 0:x.price)})," ","(",e.jsx("strong",{children:X(W)}),")."]}),e.jsx("span",{className:"block",children:s("Apply the same change to employees who have this service? Each employee's custom override stays relative to the new price.","radius-booking")})]})]}),e.jsxs(Ys,{className:"gap-2 sm:gap-2",children:[e.jsx(E,{variant:"outline",onClick:ne,disabled:B||S,children:s("Keep employee prices","radius-booking")}),e.jsx(E,{onClick:K,disabled:B||S,children:s("Adjust to employees","radius-booking")})]})]})})]})}const ct=d.forwardRef(dt);function mt(){const t=os("/services"),{mode:i}=t,a=ee(f=>f(T).isServiceSaving(),[]),k=d.useRef(null),b=()=>{var f;(f=k.current)==null||f.requestSave()},j=()=>{switch(i){case"list":return e.jsx(et,{});case"edit":case"create":return e.jsx(ct,{ref:k});default:return null}},w=({list:[{key:"add-service",label:s("Add Service","radius-booking"),icon:Ve,onClick:t.navigateTo.create,variant:"primary"}],create:[{key:"save-service",label:s("Save","radius-booking"),icon:Re,onClick:b,loading:a,variant:"primary"},{key:"cancel-service",label:s("Cancel","radius-booking"),icon:ke,onClick:t.navigateTo.list,variant:"cancel"}],edit:[{key:"update-service",label:s("Update","radius-booking"),icon:Re,onClick:b,loading:a,variant:"primary"},{key:"cancel-service",label:s("Cancel","radius-booking"),icon:ke,onClick:t.navigateTo.list,variant:"cancel"}]}[i]||[]).map(f=>e.jsx(ds,{label:f.label,icon:f.icon,onClick:f.onClick,loading:f.loading||!1,variant:f.variant||"primary"},f.key));return e.jsx(cs,{title:s("Services","radius-booking"),description:s("Manage your business services","radius-booking"),showBack:i!=="list",onBack:t.navigateTo.list,actions:w,icon:e.jsx(Ue,{className:"w-5 h-5 text-primary-colordefault"}),children:j()})}const je=d.memo(mt);function sa(){return e.jsxs(rs,{children:[e.jsx(be,{path:"/",element:e.jsx(je,{})}),e.jsx(be,{path:"create",element:e.jsx(je,{})}),e.jsx(be,{path:":id",element:e.jsx(je,{})}),e.jsx(be,{path:":id/edit",element:e.jsx(je,{})})]})}export{sa as default};
//# sourceMappingURL=index-f6n5L5uu.js.map
