1import{j as e}from"./vendor-motion-CAS9Mrr8.js";import{a as b}from"./vendor-charts-CCcpKWTT.js";import{t as ot,p as Kt,d as Yt}from"./localDate-CPk2M2LN.js";import{c as ft,Y as _e,u as _t,b as Mt,d as pe,_ as fe,Z as xe,$ as be,I as de,o as we,B as y,S as Le,F as We,Q as g,U as Oe,e as nt,s as Vt,R as it,X as $e,P as Ee,a0 as wt,ad as lt,a as Qt,f as De,L as at,aa as Jt,n as ct,r as It,G as xt,i as st,q as Zt,l as Xt,ae as ea,z as ta}from"./index-CeXJ5Cxq.js";import{A as aa,a as sa,b as ra}from"./avatar-D5RKPY_r.js";import{S as zt}from"./skeleton-B_1E6-k4.js";import{Q as Rt}from"./query-boundary-sNOiyDGD.js";import{B as ue}from"./badge-J8K6GgpI.js";import{S as Ft}from"./scroll-area-CLr2_4wh.js";import{T as H}from"./textarea-DxDtDp6P.js";import{B as oa,C as na,a as ia,b as la}from"./collapsible-DvkOjFP4.js";import{S as ye,a as ve,b as je,c as Ne,d as Y}from"./select-CSGBNsH8.js";import{D as ca,a as da,b as ua,d as ma,e as pa,c as Ct}from"./dropdown-menu-BWGogLBi.js";import{u as ha}from"./use-tier-access-D3Rh1Kh3.js";import{P as Be}from"./printer-CBHPcJ1X.js";import{S as ga}from"./save-B9ESvsYB.js";import{S as fa}from"./settings-BX_hN7c-.js";import{T as xa}from"./trending-up-BMHnN66s.js";import{P as ba}from"./pencil-DjNKs2LI.js";import{C as dt}from"./clock-OFpvfMwW.js";import{W as bt}from"./wine-D0eblUkk.js";import{B as yt}from"./briefcase-VSsHh4ir.js";import{D as Lt}from"./download-CIY2AAnE.js";import{C as He}from"./copy-B1dMprRD.js";import{P as _,A as ge,T as M,B as ut,H as mt,F as ya,a as va,b as ja}from"./vendor-docs-Cr7IOb0T.js";import{L as Na,I as W}from"./lamplit-sheet-DBfx0skq.js";import{U as wa}from"./user-cog-BDJODrSl.js";import{L as Ca}from"./log-out-MbbmZnG8.js";import{S as ie}from"./sparkles-BpXvDPzp.js";import{U as ka}from"./upload-Ccmcto0v.js";import{S as Bt}from"./square-check-big-DIkJAr74.js";import{C as pt}from"./circle-check-C-WLoukx.js";import{M as vt}from"./index-BRVomuJP.js";import{T as Ht}from"./trash-2-DFXU2ju4.js";import{P as Sa}from"./pen-line-DdboCTBG.js";import{S as qt}from"./sticky-note-C7zd8R3o.js";import{U as Ta}from"./user-plus-DWwIV_OI.js";import{A as Pa}from"./award-CyUo9ENg.js";import"./vendor-pdf-C9TCjkzL.js";import"./refresh-cw-DxbP_BBL.js";import"./index-BdQq_4o_.js";import"./index-DnlpHmlc.js";import"./Combination-sXljVKit.js";const Wt=ft("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);const Aa=ft("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);const Ea=ft("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]),Da=["Thanksgiving Day","Christmas Day","Easter Sunday"],$a=["Grill","Sauté","Fry","Salad","Expo","Dish"],kt=[{key:"attendance",label:"Attendance & Punctuality",desc:"Late policy, no-call/no-show consequences, call-in procedures"},{key:"discipline",label:"Progressive Discipline",desc:"Verbal warning, written warning, suspension, termination steps"},{key:"harassment",label:"Harassment & Discrimination",desc:"Zero-tolerance policy, reporting procedures, investigation process"},{key:"substance",label:"Substance Abuse Policy",desc:"Drug-free workplace, testing policy, consequences"},{key:"cellPhone",label:"Cell Phone Policy",desc:"Phone usage during shifts, emergency exceptions"},{key:"cashHandling",label:"Cash Handling Procedures",desc:"Till management, cash drops, shortage accountability"},{key:"foodSafety",label:"Food Safety & Hygiene",desc:"Handwashing, temperature control, cross-contamination prevention"},{key:"scheduling",label:"Scheduling & Shift Swaps",desc:"Schedule posting, swap procedures, availability requirements"},{key:"resignation",label:"Resignation & Termination",desc:"Notice period, final paycheck, return of property"},{key:"socialMedia",label:"Social Media Policy",desc:"Online conduct, restaurant mentions, photo/video guidelines"},{key:"alcohol",label:"Alcohol Service Policy",desc:"ID checking, intoxication signs, refusal procedures"},{key:"tipPolicy",label:"Tip Policy",desc:"Pooled vs individual tips, tip-out percentage, reporting requirements"}],St=[{value:"homebase",label:"Homebase"},{value:"7shifts",label:"7shifts"},{value:"hotschedules",label:"HotSchedules"},{value:"sling",label:"Sling"}
1,{value:"when_i_work",label:"When I Work"},{value:"deputy",label:"Deputy"},{value:"other",label:"Other"},{value:"none",label:"None / Paper Schedule"}],Oa=[{value:"toast",label:"Toast"},{value:"square",label:"Square"},{value:"clover",label:"Clover"},{value:"lightspeed",label:"Lightspeed"},{value:"touchbistro",label:"TouchBistro"},{value:"aloha",label:"Aloha"},{value:"other",label:"Other"}],Tt=[{value:"individual",label:"Individual Tips"},{value:"pool_all",label:"Tip Pool (all staff)"},{value:"pool_foh",label:"Tip Pool (FOH only)"},{value:"service_charge",label:"Service Charge Included"},{value:"no_tips",label:"No Tips"}],_a=["Breakfast","Brunch","Lunch","Happy Hour","Dinner","Late Night","Catering","Events"],Ma=[{value:"full_service",label:"Full Service (sit-down, server-attended)"},{value:"fast_casual",label:"Fast Casual (counter order, table delivery)"},{value:"bar_forward",label:"Bar-Forward (bar revenue > 40% of sales)"},{value:"fine_dining",label:"Fine Dining"},{value:"cafe",label:"Café"},{value:"other",label:"Other"}],Ia=["Gluten-Free","Vegetarian","Vegan","Dairy-Free","Nut-Free","Halal","Kosher"],Gt="handbook-custom-policies";function za(){try{if(typeof window>"u")return[];const s=localStorage.getItem(Gt);return s?JSON.parse(s):[]}catch{return[]}}function rt(s){localStorage.setItem(Gt,JSON.stringify(s))}const Pt=["restaurantName","ownerNames","restaurantAddress","restaurantPhone","restaurantEmail","missionStatement","conceptCuisine","generalManager","posSystem","operatingHours","uniformDiningRoom","uniformKitchen","employeeMealPolicy","signatureDishesFoh","brandVoice"],At=["weeklyRevenue","avgCheck","weeklyCovers","foodCostTarget","foodCostActual","laborTargetPct","laborCostActual","serviceModel","topChallenge"];function Ra(s){const r=T=>{const v=s[T];return v!=null&&String(v).trim().length>0},x=Pt.filter(r).length,i=At.filter(r).length,p=.4,C=.6,P=x/Pt.length,k=i/At.length;return Math.round((P*p+k*C)*100)}function h(s){return s==null?!1:typeof s=="number"?!0:Array.isArray(s)?s.length>0:String(s).trim().length>0}function oe({icon:s,title:r,subtitle:x}){return e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(s,{className:"h-5 w-5 shrink-0",style:{color:"#a9702f"}}),e.jsx("h3",{className:"font-bold text-white text-[16px]",children:r})]}),e.jsx("p",{className:"text-[13px] mb-2",style:{color:"#8a7d66"},children:x}),e.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.07)",marginTop:8}})]})}function u({children:s,filled:r,label:x,helper:i,required:p}){return e.jsxs("div",{className:"space-y-1",style:{borderLeft:r?"2px solid rgba(169, 112, 47,0.4)":"2px solid transparent",paddingLeft:10},children:[x&&e.jsxs("label",{className:"block text-[12px] uppercase tracking-widest font-medium",style:{color:"#a99a82",letterSpacing:"0.08em"},children:[x,p&&e.jsx("span",{style:{color:"#a9702f"},children:" *"})]}),s,i&&e.jsx("p",{className:"text-[13px] italic",style:{color:"#8a7d66"},children:i})]})}function Et({items:s,onAdd:r,onRemove:x,placeholder:i,addLabel:p,chipId:C}){const[P,k]=b.useState(""),T=()=>{P.trim()&&!s.includes(P.trim())&&(r(P.trim()),k(""))};return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:s.map(v=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 text-[13px] text-white",style:{background:"#241812",border:"1px solid rgba(169, 112, 47,0.4)",borderRadius:20,animation:"chipScaleIn 150ms ease"},children:[v,e.jsx("button",{onClick:()=>x(v),className:"ml-1 transition-colors",style:{color:"#a9702f"},onMouseEnter:A=>A.currentTarget.style.color="#e07a66",onMouseLeave:A=>A.currentTarget.style.color="#a9702f","data-testid":`button-remove-chip-${v.replace(/\s+/g,"-").toLowerCase()}`,children:e.jsx($e,{className:"h-3 w-3"})})]},v))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{placeholder:i,value:P,onChange:v=>k(v.target.value),onKeyDown:v=>v.key==="Enter"&&(v.preventDefault(),T()),className:"flex-1 h-9 px-3 text-sm text-white rounded-lg",style:{background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)",outline:"none"},onFocus:v=>{v.currentTarget.style.outline="1.5px solid #a9702f",v.currentTarget.style.boxShadow="0 0 0 3px rgba(169, 112, 47,0.1)"},onBlur:v=>{v.currentTarget.style.outline="none",v.currentTarget.style.boxShadow="none"},"data-testid":`input-add-${C}`}),e.jsx(y,{variant:"outline",size:"sm",onClick:T,className:"border-[rgba(169, 112, 47,0.4)] text-[#a9702f]",style:{background:"transparent"},"data-testid":`button-add-${C}`,children:p||"Add"})]})]})}function Dt({options:s,selected:r,onToggle:x}){return e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(i=>{const p=r.includes(i);return e.jsxs("button",{onClick:()=>x(i),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[13px] transition-all",style:{background:p?"rgba(169, 112, 47,0.12)":"#241812",border:p?"1px solid #a9702f":"1px solid rgba(255,255,255,0.1)",borderRadius:20,color:p?"#fff":"#8a7d66"},"data-testid":`toggle-chip-${i.replace(/\s+/g,"-").toLowerCase()}`,children:[p&&e.jsx(it,{className:"h-3 w-3",style:{color:"#a9702f"}}),i]},i)})})}const c={background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,color:"#fff"},d="focus-visible:outline-[1.5px] focus-visible:outline-[#a9702f] focus-visible:shadow-[0_0_0_3px_rgba(169, 112, 47,0.1)]";function Fa({user:s}){const{toast:r}=_e(),{onboardingStep:x,isOnboarding:i,advanceStep:p}=_t(),[,C]=Mt(),[P,k]=b.useState(null);b.useEffect(()=>()=>{P&&clearTimeout(P)},[P]);const[T,v]=b.useState("setup"),[A,D]=b.useState(!1),[m,I]=b.useState(""),[N,R]=b.useState(""),[z,J]=b.useState(za),[B,Z]=b.useState({attendance:!0,discipline:!0,harassment:!0,substance:!0,cellPhone:!0,cashHandling:!0,foodSafety:!0,scheduling:!0,resignation:!0,socialMedia:!0,alcohol:!0,tipPolicy:!0}),{data:G,isLoading:V}=pe({queryKey:["/api/handbook-settings"]}),[a,F]=b.useState({restaurantName:"",restaurantAddress:"",restaurantPhone:"",restaurantEmail:"",restaurantWebsite:"",ownerNames:"",missionStatement:"",conceptCuisine:"",yearEstablished:"",socialMediaHandles:"",generalManager:"",kitchenManager:"",executiveChef:"",floorManager:"",hrContactEmail:"",totalStaff:void 0,staffPerDinnerShift:void 0,uniformDiningRoom:`Shoes - non-slip, close-toed shoes 2Pants - jeans, black, or khaki pants, shorts, or skirt with solid color belt 3Shirts - clean restaurant-branded t-shirt 4Appearance - Clean and well-groomed hair, pulled back off shoulder. Well-groomed hands and fingernails. 5Accessories - No excessive cologne, perfume, make-up or jewelry. No earrings longer than 1 inch.`,uniformKitchen:`Shoes - Black work shoes with non-slip soles, no tennis shoes 6Pants - Black pants or jeans, no shorts 7Shirts - Black t-shirt or restaurant-branded shirt 8Appearance - Clean, well-groomed hair, hands and fingernails 9Hats - A hat or hair net required at all times when working with food`,employeeMealPolicy:"Employees receive a $5 discount off the regular price of all menu items during each shift. Employee meals can be purchased either before or after your shift or on a scheduled break.",parkingPolicy:"Park in employee designated parking areas only.",schedulingApp:"homebase",posSystem:"",posSystemOther:"",servicePeriods:[],operatingHours:"",seatingCapacity:void 0,tippingStructure:"",breakPolicy:"",evaluationSchedule:"January and June",orientationDays:30,closedHolidays:Da,signatureDishesFoh:"",signatureDishesBoh:"",kitchenStations:$a,allergenOptions:[],brandVoice:"",weeklySpecials:"",happyHourDetails:"",alcoholPolicy:"",socialMediaPolicy:"",additionalPolicies:"",barManager:"",headBartender:"",alcoholPermit:"",signatureCocktail1:"",signatureCocktail2:"",signatureCocktail3:"",draftBeerCount:void 0,closingTime:"",weeklyRevenue:"",avgCheck:"",weeklyCovers:void 0,foodCostActual:"",laborCostActual:"",operatingDays:void 0,serviceModel:"",topChallenge:""});b.useEffect(()=>{G&&F(t=>({...t,...G}))},[G]),b.useEffect(()=>{!G&&s&&F(t=>({...t,restaurantName:t.restaurantName||s.restaurantName||"",restaurantEmail:t.restaurantEmail||s.email||"",restaurantAddress:t.restaurantAddress||s.address||"",restaurantPhone:t.restaurantPhone||s.phone||"",ownerNames:t.ownerNames||(s.firstName&&s.lastName?`${s.firstName} ${s.lastName}`:""),generalManager:t.generalManager||(s.firstName&&s.lastName?`${s.firstName} ${s.lastName}`:""),hrContactEmail:t.hrContactEmail||s.email||""}))},[G,s]);const L=fe({mutationFn:async t=>(await be("POST","/api/handbook-settings",t)).json(),onSuccess:async()=>
9{if(xe.invalidateQueries({queryKey:["/api/handbook-settings"]}),i&&x===0)try{await p(1),r({title:"Setup saved. Your restaurant is personalized.",description:"Next: Generate your first training manual."});const t=setTimeout(()=>C("/templates"),4e3);k(t)}catch{r({title:"Settings saved",description:"Fill in Restaurant Name, Owner Name, and at least one manager to continue."})}else r({title:"Settings saved",description:"Your handbook settings have been saved."})},onError:()=>{r({title:"Error",description:"Failed to save handbook settings.",variant:"destructive"})}}),te=()=>{L.mutate(a)},Ce=t=>{t.trim()&&!a.closedHolidays?.includes(t.trim())&&F({...a,closedHolidays:[...a.closedHolidays||[],t.trim()]})},me=t=>{F({...a,closedHolidays:a.closedHolidays?.filter(f=>f!==t)||[]})},n=t=>{t.trim()&&!a.kitchenStations?.includes(t.trim())&&F({...a,kitchenStations:[...a.kitchenStations||[],t.trim()]})},$=t=>{F({...a,kitchenStations:a.kitchenStations?.filter(f=>f!==t)||[]})},q=t=>{const f=a.servicePeriods||[];F({...a,servicePeriods:f.includes(t)?f.filter(w=>w!==t):[...f,t]})},ae=t=>{const f=a.allergenOptions||[];F({...a,allergenOptions:f.includes(t)?f.filter(w=>w!==t):[...f,t]})},S=()=>{if(!m.trim())return;const t={id:`custom-${Date.now()}`,label:m.trim(),desc:N.trim(),enabled:!0},f=[...z,t];J(f),rt(f),I(""),R(""),D(!1),r({title:"Custom policy added"})},E=t=>{const f=z.map(w=>w.id===t?{...w,enabled:!w.enabled}:w);J(f),rt(f)},U=t=>{const f=z.filter(w=>w.id!==t);J(f),rt(f)},[Q,ke]=b.useState(!1),le=b.useMemo(()=>Ra(a),[a]),l=(t,f)=>{F({...a,[t]:f})},se=()=>{const t=a.restaurantName||"[Restaurant Name]",f=a.restaurantAddress||"[Address]",w=a.restaurantPhone||"[Phone]",ne=a.restaurantEmail||"[Email]",Te=a.restaurantWebsite||"[Website]",ce=a.ownerNames||"[Owner Names]",Pe=a.missionStatement||"To consistently provide our customers with exceptional food, beverages, and service by demonstrating warmth, efficiency, knowledge, and professionalism in our work.",Ue=a.orientationDays||30,Ke=St.find(X=>X.value===a.schedulingApp)?.label||"scheduling app",Ye=a.evaluationSchedule||"twice a year",Ve=a.closedHolidays?.join(", ")||"Thanksgiving Day, Christmas Day, Easter Sunday",Qe=a.uniformDiningRoom||"",Je=a.uniformKitchen||"",Ze=a.employeeMealPolicy||"",Xe=a.parkingPolicy||"",et=a.conceptCuisine?`, a ${a.conceptCuisine} restaurant`:"",o=a.yearEstablished?` (Est. ${a.yearEstablished})`:"",j=Tt.find(X=>X.value===a.tippingStructure)?.label||"",O=a.breakPolicy||"",he=a.operatingHours||"";return`${t.toUpperCase()}${o} 10EMPLOYEE HANDBOOK 11 12âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 13 14WELCOME TO OUR TEAM! 15 16We welcome you to ${t}${et} and look forward to the opportunity to work with you. We want you to know that we recognize our employees as our most valuable asset. Our continued success in providing the highest quality of food, beverages, and service to our customers depends on having quality people like yourself and your fellow employees. 17 18We want you to enjoy your time here and are committed to helping you succeed in your new job. We have prepared this handbook to answer some of the questions that you may have concerning ${t} and its policies. This handbook is intended solely as a guide. Read it thoroughly. If you have questions about anything, contact a manager for assistance. 19 20We hope you find your time with us to be an enjoyable and rewarding experience! 21 22Sincerely, 23${ce} 24 25âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 26 27COMPANY INFORMATION 28 29${t} 30${f} 31Phone: ${w} 32Email: ${ne} 33Website: ${Te} 34${he?` 35Operating Hours: ${he}`:""} 36 37âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 38 39MISSION STATEMENT 40 41${Pe} 42 43âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 44 45OUR WAY OF DOING BUSINESS 46 47${t}'s success depends on our people. Our restaurant can only prosper and provide opportunities for employment and growth when we continually improve ourselves and the work that we do. 48 49We believe that a commitment to uncompromising values and integrity should always guide our decisions and actions as we pursue our goals. Following are the core values that form the foundation of our success: 50 51⢠We believe in providing all customers with exceptional service 52⢠We believe in honesty and trust 53⢠We believe in ongoing training and development of our people 54⢠We believe our continued success depends on teamwork 55⢠We believe in doing business in a professional and orderly manner 56 57âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 58 59EMPLOYMENT POLICIES 60 61It is the policy of ${t} to hire only United States citizens and aliens who are authorized to work in this country. As required by law, employees will be required to provide original documents that establish this authorization within three days of their date of hire. 62 63NON-DISCRIMINATION 64 65${t} is an equal opportunity employer. We will not tolerate discrimination based on race, sex, age, national origin, religion, sexual orientation, or disability. Employment decisions will be made only for legitimate business reasons based upon qualifications and other nondiscriminatory factors. 66 67AGE REQUIREMENTS 68 69All servers and bartenders must be at least 18 years of age. Employees under the age of 18 must comply with all federal wage and hour guidelines. No employees under 18 years can take orders for or serve alcoholic beverages. 70 71âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 72 73ORIENTATION PERIOD 74 75You have been through our employee selection process and have been selected for employment. We have a ${Ue}-day Orientation Period that allows both you and the Company to determine if it's a good fit. During this period you will begin your training and be observed by management. 76 77TRAINING 78 79To help you be successful in your job you will receive adequate training. You will not be expected to be on your own until you are ready. We want you to be a knowledgeable and productive member of our staff. 80 81EVALUATIONS 82 83All employees receive written and verbal performance evaluations ${Ye}
83. The evaluation process is intended to let you know how well you're performing and help you be more effective and productive. 84 85âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 86 87SCHEDULES 88 89Schedules are prepared to meet the work demands of the restaurant. Schedules are posted weekly through ${Ke}. Each employee is responsible for working their shifts. 90 91⢠Arrive 10-15 minutes before your shift begins 92⢠Clock in when your shift begins and be ready to start work immediately 93⢠Schedule changes may be allowed only if you find a replacement and get manager approval 94 95OVERTIME 96 97In accordance with Federal Minimum Wage Law, employees are paid overtime when they work more than 40 hours in one week at one and one-half times their basic straight time rate. 98${O?` 99BREAK POLICY 100 101${O}`:""} 102 103âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 104 105STANDARDS OF CONDUCT 106 107In order to work together as a team and maintain a positive working environment, everyone must conform to standards of reasonable conduct. The following conduct may result in disciplinary action up to and including immediate termination: 108 1091. Invalid Work Authorization (I-9 form) 1102. Supplying false or misleading information 1113. No call, no show (not showing up without notifying Manager on duty) 1124. Clocking another employee in or out 1135. Leaving before scheduled time without permission 1146. Arrest or conviction of a felony offense 1157. Use of foul or abusive language 1168. Disorderly or indecent conduct 1179. Gambling on restaurant property 11810. Theft of customer, employee, or restaurant property 11911. Theft, dishonesty, or mishandling of restaurant funds 12012. Refusal to follow instructions 12113. Harassment of any kind toward another employee or customer 12214. Use, distribution, or possession of illegal drugs on restaurant property 12315. Waste or destruction of restaurant property 12416. Actions or threats of violence 12517. Excessive tardiness 12618. Disclosing confidential information 12719. Rude or improper behavior with customers 12820. Smoking or eating in unapproved areas 129 130âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 131 132HARASSMENT POLICY 133 134It is this restaurant's policy to treat all personnel with dignity and respect. We strive to provide everyone a workplace that is free of harassment of any kind. Employees are encouraged to promptly report incidents of harassment. 135 136SEXUAL HARASSMENT 137 138All employees have a right to be free from sexual harassment. ${t} does not condone actions, words, jokes, or comments that a reasonable person would regard as sexually harassing or coercive. Anyone who experiences harassment should report it promptly to management. 139 140âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 141 142ATTENDANCE & ABSENCES 143 144All employees are expected to work on a regular, consistent basis. Excessive absenteeism may result in disciplinary action. 145 146⢠Call and talk to a manager at least 2 hours before your scheduled shift if you will be late or absent 147⢠Any employee who does not call or report to work for two consecutive shifts will be considered to have voluntarily resigned 148⢠Submit leave requests at least two weeks prior to the scheduled leave date 149 150TARDINESS 151 152Always arrive at the restaurant 10-15 minutes before your shift. Your scheduled time is when you are expected to be on your job, not when you arrive at the restaurant. Repeated tardiness is grounds for termination. 153 154RESIGNATIONS 155 156You are requested to give a two-week notice of your plans to leave. This is a professional courtesy that ensures you are eligible for re-hire. 157 158âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 159 160TIME CLOCK & PAYROLL 161 162⢠Arrive 10-15 minutes before your scheduled start time 163⢠You may clock in within 5 minutes of the start of your shift 164⢠Tampering or falsifying time records may result in termination 165 166TIP REPORTING 167 168All tips you receive are taxable income. You are required by federal law to report and record your actual tips for each shift. We strongly encourage you to accurately report your tip income. 169${j?` 170Tipping Structure: ${j}`:""} 171 172PAYROLL 173 174Paychecks are available every other week. Federal and state withholding taxes are authorized based on your W
174-4 form. 175 176âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 177 178HOLIDAYS & VACATIONS 179 180Due to the nature of the restaurant business you may be required to work holidays. The restaurant is closed on: ${Ve}. 181 182VACATIONS 183 184Full-time salaried employees who have been with the restaurant for 12 consecutive months are eligible for one week paid vacation. Vacation requests should be submitted at least one month in advance. 185 186âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 187 188EMPLOYEE MEALS 189 190${Ze} 191 192âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 193 194DRESS CODE 195 196DINING ROOM DRESS CODE: 197${Qe} 198 199KITCHEN DRESS CODE: 200${Je} 201 202âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 203 204PARKING 205 206${Xe} 207 208âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 209 210SAFETY & SANITATION 211 212${t} is committed to maintaining a safe workplace for all employees. Safety is everyone's responsibility. 213 214Basic Safety Guidelines: 215⢠Wipe up spills immediately 216⢠Never run in hallways or kitchen 217⢠Wear shoes with non-slip soles 218⢠Report defective equipment to management immediately 219⢠Never operate equipment without proper training 220⢠Let people know when carrying anything hot 221⢠Use proper lifting techniques 222 223SANITATION 224 225We are committed to sanitation and food safety. Follow safe food handling procedures at all times: 226⢠Keep your hands washed 227⢠Sanitize everything 228⢠Prevent cross-contamination 229⢠Keep food at proper temperatures (below 45°F or above 140°F) 230⢠Store food correctly 231 232âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 233 234ALCOHOL SERVICE POLICY 235 236As a restaurant that sells alcoholic beverages, we are committed to responsible alcohol service: 237 2381. We will not serve alcoholic beverages to an intoxicated person 2392. We will not knowingly serve a person under the legal drinking age 2403. Card anyone who appears to be under 30 years old 2414. Offer nonalcoholic alternatives 2425. Provide taxi service for intoxicated customers if needed 243 244${a.alcoholPolicy||""} 245 246âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 247 248SOCIAL MEDIA POLICY 249 250Employees may use social media in any way they choose as long as it does not: 251⢠Impair the work of any employee 252⢠Harass or demean any employee 253⢠Disrupt the flow of work 254⢠Disclose confidential or proprietary information 255⢠Harm the goodwill and reputation of ${t} 256 257${a.socialMediaPolicy||""} 258 259âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 260 261CUSTOMER SERVICE 262 263Our restaurant exists only because of customers. Taking care of our customers is our highest priority. At ${t}, the customer always comes first! 264 265HANDLING COMPLAINTS 266⢠Don't get defensive 267⢠Remove the offending item immediately 268⢠Apologize and tell the customer you will take care of the problem 269⢠Don't hesitate to ask a manager for assistance 270 271TELEPHONE COURTESY 272⢠Answer the phone promptly, within two rings 273⢠Always answer in a friendly, polite manner 274⢠Thank the person for calling 275 276âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 277 278TEAMWORK 279 280We cannot achieve our goals without working together as a team. If a co-worker is overloaded and you're not, help them. Pitch in to help a customer whether they are technically yours or not. Genuine teamwork makes for a much more enjoyable work experience. 281 282âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 283 284EMERGENCY PROCEDURES 285 286ACCIDENTS 287Report all accidents, no matter how minor, to the manager on duty. 288 289ROBBERY 290DO NOT RESIST. Your safety is our highest priority. Always cooperate fully. 291 292FIRE 293Know the location of fire extinguishers. If the fire alarm sounds, assist guests to the nearest exit immediately. 294 295âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 296 297${a.additionalPolicies?`ADDITIONAL POLICIES 298 299${a.additionalPolicies} 300 301âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 302 303`:""}ACKNOWLEDGMENT 304 305I acknowledge receipt of, and have read, the Employee Handbook that outlines my benefits and obligations as an employee of ${t}. I understand the Standards of Conduct and each of the rules and regulations which I am expected to follow. I agree to abide by all of them. 306 307This handbook is a general guide and does not constitute an employment agreement or guarantee of continued employment. Employment is at-will and can be terminated at any time by either party. 308 309 310Employee Name: ________________________________ 311 312Employee Signature: ________________________________ 313 314Date: ________________________________ 315 316Manager Signature: ________________________________ 317 318Date: ________________________________ 319`},Ge=t=>{const f={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,w=>f[w])},re=()=>{const t=se(),f=Ge(t),w=Ge(a.restaurantName||"Restaurant"),ne=window.open("","_blank");ne&&(ne.document.write(` 320 <!DOCTYPE html> 321 <html> 322 <head> 323 <title>${w} Employee Handbook</title> 324 <style> 325 @page { 326 size: letter; 327 margin: 0.75in 1in; 328 } 329 * { 330 box-sizing: border-box; 331 } 332 body { 333 font-family: 'Georgia', 'Times New Roman', serif; 334 font-size: 11pt; 335 line-height: 1.5; 336 color: #000; 337 margin: 0; 338 padding: 0; 339 } 340 .handbook-content { 341 white-space: pre-wrap; 342 word-wrap: break-word; 343 font-family: 'Georgia', 'Times New Roman', serif; 344 font-size: 11pt; 345 line-height: 1.5; 346 } 347 h1, h2, h3 { 348 font-family: 'Georgia', 'Times New Roman', serif; 349 margin-top: 1.5em; 350 margin-bottom: 0.5em; 351 } 352 @media screen { 353 body { 354 max-width: 8.5in; 355 margin: 0 auto; 356 padding: 40px 60px; 357 background: #fff; 358 box-shadow: 0 0 10px rgba(0,0,0,0.1); 359 } 360 .print-only { display: none; } 361 } 362 @media print { 363 body { 364 padding: 0; 365 background: none; 366 box-shadow: none; 367 } 368 .screen-only { display: none; } 369 .handbook-content { 370 orphans: 3; 371 widows: 3; 372 } 373 .page-break { 374 page-break-before: always; 375 } 376 .no-break { 377 page-break-inside: avoid; 378 } 379 } 380 .print-header { 381 text-align: center; 382 margin-bottom: 2em; 383 padding-bottom: 1em; 384 border-bottom: 2px solid #333; 385 } 386 .print-header h1 { 387 font-size: 24pt; 388 margin: 0 0 0.25em 0; 389 } 390 .print-header p { 391 font-size: 14pt; 392 margin: 0; 393 color: #555; 394 } 395 .print-button { 396 position: fixed; 397 top: 20px; 398 right: 20px; 399 background: #a9702f; 400 color: white; 401 border: none; 402 padding: 12px 24px; 403 font-size: 14pt; 404 border-radius: 6px; 405 cursor: pointer; 406 box-shadow: 0 2px 8px rgba(0,0,0,0.2); 407 } 408 .print-button:hover { 409 background: #a9702f; 410 } 411 </style> 412 </head> 413 <body> 414 <button class="print-button screen-only" onclick="window.print()">Print Handbook</button> 415 <div class="print-header"> 416 <h1>${w}</h1> 417 <p>Employee Handbook</p> 418 </div> 419 <pre class="handbook-content">${f}</pre> 420 </body> 421 </html> 422 `),ne.document.close())},Se=()=>{re()},Me=()=>{const t=se();navigator.clipboard.writeText(t).then(()=>{r({title:"Copied to clipboard",description:"Handbook content has been copied."})}).catch(()=>{r({title:"Copy failed",description:"Unable to copy content.",variant:"destructive"})})};if(V)return e.jsx("div",{className:"rounded-md p-8 flex items-center justify-center",style:{background:"#1c1210",minHeight:256},children:e.jsx(de,{className:"h-8 w-8 animate-spin",style:{color:"#a9702f"}})});const Ie=[{id:"setup",label:"Setup",icon:fa},{id:"policies",label:"Policies",icon:Le},{id:"preview",label:"Preview",icon:We}
422],ze=Object.values(B).filter(Boolean).length,Re=z.filter(t=>t.enabled).length;return e.jsx("div",{className:"space-y-0",children:e.jsxs("div",{className:"rounded-md p-5",style:{background:"#241812"},children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"flex flex-wrap items-center gap-2 text-lg font-bold text-white",children:[e.jsx(we,{className:"h-5 w-5",style:{color:"#a9702f"}}),"Employee Handbook Builder"]}),e.jsx("p",{className:"text-sm mt-1",style:{color:"#8a7d66"},children:"Create a customized employee handbook for your restaurant"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:re,className:"transition-colors",style:{background:"#241812",border:"1px solid rgba(255,255,255,0.2)",color:"#fff"},"data-testid":"button-print-handbook",children:[e.jsx(Be,{className:"h-4 w-4 mr-2"}),"Print"]}),e.jsxs("button",{onClick:te,disabled:L.isPending,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md text-white transition-all",style:{background:L.isPending?"#a9702f":"linear-gradient(135deg, #a9702f, #c8934e)",backgroundImage:L.isPending?void 0:"linear-gradient(135deg, #a9702f 0%, #c8934e 100%)",opacity:L.isPending?.7:1,cursor:L.isPending?"not-allowed":"pointer"},"data-testid":"button-save-handbook",children:[L.isPending?e.jsx(de,{className:"h-4 w-4 animate-spin"}):e.jsx(ga,{className:"h-4 w-4"}),L.isPending?"Saving...":"Save Settings"]})]})]}),e.jsx("div",{className:"flex gap-1 mb-5","data-testid":"handbook-tab-bar",children:Ie.map(t=>{const f=T===t.id,w=t.icon;return e.jsxs("button",{onClick:()=>v(t.id),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md transition-colors ${f?"text-white":"text-stone-400"}`,style:{background:f?"#1c1210":"transparent",borderBottom:f?"2px solid #a9702f":"2px solid transparent"},"data-testid":`tab-handbook-${t.id}`,children:[e.jsx(w,{className:"h-4 w-4",style:f?{color:"#a9702f"}:{}}),t.label]},t.id)})}),T==="setup"&&e.jsxs("div",{className:"space-y-8",style:{animation:"scheduleStaggerIn 0.3s ease-out"},children:[i&&x===0&&e.jsxs("div",{className:"rounded-lg p-5",style:{background:"#1b160f",borderLeft:"3px solid #a9702f"},"data-testid":"onboarding-setup-banner",children:[e.jsx("p",{className:"text-sm font-semibold text-white mb-1",children:"Step 1 of 3 â Tell us about your restaurant"}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#a99a82"},children:"The more you fill in here, the more your training manuals, financial tools, and Consultant advice will be personalized to your specific operation."}),e.jsx("p",{className:"text-xs mt-2",style:{color:"#c8934e"},children:"Required to continue: Restaurant Name, Owner Name, and at least one management contact."})]}),e.jsxs("div",{className:"rounded-md p-3",style:{background:"#1c1210"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-[13px]",style:{color:"#8a7d66"},children:"Setup Completion"}),e.jsx("span",{className:"text-[13px] font-medium",style:{color:le===100?"#a9702f":"#a99a82"},children:le===100?"Setup Complete â Ready to Generate":`${le}% complete`})]}),e.jsx("div",{className:"w-full rounded-full",style:{height:6,background:"#241812"},children:e.jsx("div",{className:"rounded-full transition-all duration-500",style:{height:6,width:`${le}%`,background:le===100?"#a9702f":"linear-gradient(90deg, #a9702f, #c8934e)"}})}),e.jsx("p",{className:"text-[13px] mt-1.5",style:{color:"#8a7d66"},children:le<100?"Complete your Financial Profile to unlock personalized financial advice from the Consultant.":"All required fields are complete."})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:oa,title:"Restaurant Information",subtitle:"Basic details about your restaurant"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.restaurantName),label:"Restaurant Name",required:!0,children:e.jsx(g,{placeholder:"e.g., The Golden Fork",value:a.restaurantName||"",onChange:t=>l("restaurantName",t.target.value),className:d,style:c,"data-testid":"input-restaurant-name"})}),e.jsx(u,{filled:h(a.ownerNames),label:"Owner Name(s)",required:!0,children:e.jsx(g,{placeholder:"e.g., John and Jane Smith",value:a.ownerNames||"",onChange:t=>l("ownerNames",t.target.value),className:d,style:c,"data-testid":"input-owner-names"})})]}),e.jsx(u,{filled:h(a.restaurantAddress),label:"Address",required:!0,children:e.jsx(g,{placeholder:"e.g., 123 Main Street, Austin, TX 78701",value:a.restaurantAddress||"",onChange:t=>l("restaurantAddress",t.target.value),className:d,style:c,"data-testid":"input-restaurant-address"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsx(u,{filled:h(a.restaurantPhone),label:"Phone",required:!0,children:e.jsx(g,{placeholder:"(512) 555-1234",value:a.restaurantPhone||"",onChange:t=>l("restaurantPhone",t.target.value),className:d,style:c,"data-testid":"input-restaurant-phone"})}),e.jsx(u,{filled:h(a.restaurantEmail),label:"Email",required:!0,children:e.jsx(g,{placeholder:"[email protected]",value:a.restaurantEmail||"",onChange:t=>l("restaurantEmail",t.target.value),className:d,style:c,"data-testid":"input-restaurant-email"})}),e.jsx(u,{filled:h(a.restaurantWebsite),label:"Website",children:e.jsx(g,{placeholder:"www.restaurant.com",value:a.restaurantWebsite||"",onChange:t=>l("restaurantWebsite",t.target.value),className:d,style:c,"data-testid":"input-restaurant-website"})})]}),e.jsx(u,{filled:h(a.missionStatement),label:"Mission Statement",required:!0,children:e.jsx(H,{placeholder:"Your restaurant's mission and values...",value:a.missionStatement||"",onChange:t=>l("missionStatement",t.target.value),className:`min-h-[100px] ${d}
422`,style:c,"data-testid":"textarea-mission-statement"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-5",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsx(u,{filled:h(a.conceptCuisine),label:"Concept & Cuisine Type",required:!0,helper:"Describes your concept in 2-5 words. Used throughout your training documents.",children:e.jsx(g,{placeholder:"e.g., Southern Cajun Bistro, Fast-Casual Mexican, Fine Dining Italian",value:a.conceptCuisine||"",onChange:t=>l("conceptCuisine",t.target.value),className:d,style:c,"data-testid":"input-concept-cuisine"})})}),e.jsx(u,{filled:h(a.yearEstablished),label:"Year Established",children:e.jsx(g,{placeholder:"e.g., 2019",value:a.yearEstablished||"",onChange:t=>l("yearEstablished",t.target.value),className:d,style:c,"data-testid":"input-year-established"})}),e.jsx(u,{filled:h(a.socialMediaHandles),label:"Social Media (optional)",helper:"Used in the Social Media Policy section of your handbook.",children:e.jsx(g,{placeholder:"@moutonsbistrobar",value:a.socialMediaHandles||"",onChange:t=>l("socialMediaHandles",t.target.value),className:d,style:c,"data-testid":"input-social-media-handles"})})]})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:xa,title:"Financial Profile",subtitle:"These numbers power your Consultant. The more accurate they are, the more specific the advice."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.weeklyRevenue),label:"Average Weekly Revenue",helper:"Your typical total sales in a 7-day period. Use a 4-week rolling average if revenue varies seasonally.",children:e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"$"}),e.jsx(g,{placeholder:"e.g. 18,500",value:a.weeklyRevenue||"",onChange:t=>l("weeklyRevenue",t.target.value),className:d,style:{...c,paddingLeft:24},"data-testid":"input-weekly-revenue"})]})}),e.jsx(u,{filled:h(a.avgCheck),label:"Average Guest Check (per person)",helper:"Total revenue divided by total covers for a typical week. Includes food and beverage.",children:e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"$"}),e.jsx(g,{placeholder:"e.g. 28",value:a.avgCheck||"",onChange:t=>l("avgCheck",t.target.value),className:d,style:{...c,paddingLeft:24},"data-testid":"input-avg-check"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.weeklyCovers),label:"Average Weekly Covers",helper:"Total number of guests served in a typical week across all dayparts and days.",children:e.jsx(g,{type:"number",placeholder:"e.g. 650",value:a.weeklyCovers??"",onChange:t=>l("weeklyCovers",t.target.value?Number(t.target.value):void 0),className:d,style:c,"data-testid":"input-weekly-covers"})}),e.jsx(u,{filled:h(a.operatingDays),label:"Days Open Per Week",helper:"How many days per week the restaurant operates.",children:e.jsx(g,{type:"number",min:1,max:7,placeholder:"e.g. 6",value:a.operatingDays??"",onChange:t=>l("operatingDays",t.target.value?Number(t.target.value):void 0),className:d,style:c,"data-testid":"input-operating-days"})})]}),e.jsx("div",{style:{height:1,background:"rgba(169, 112, 47,0.15)",margin:"4px 0"}}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.foodCostTarget),label:"Target Food Cost %",helper:"Your goal for food cost as a percentage of food sales. Industry standard for full-service: 28-32%.",children:e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"number",placeholder:"e.g. 30",value:a.foodCostTarget||"",onChange:t=>l("foodCostTarget",t.target.value),className:d,style:c,"data-testid":"input-food-cost-target"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"%"})]})}),e.jsxs(u,{filled:h(a.foodCostActual),label:"Current Actual Food Cost %",helper:"Your food cost percentage from your most recent full week or accounting period.",children:[e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"number",placeholder:"e.g. 33",value:a.foodCostActual||"",onChange:t=>l("foodCostActual",t.target.value),className:d,style:c,"data-testid":"input-food-cost-actual"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"%"})]}),a.foodCostActual&&a.foodCostTarget&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[14px] font-medium mt
422-1",style:{background:Number(a.foodCostActual)>Number(a.foodCostTarget)?"rgba(245,158,11,0.15)":"rgba(34,197,94,0.15)",color:Number(a.foodCostActual)>Number(a.foodCostTarget)?"#e0b24e":"#7E8A55",border:`1px solid ${Number(a.foodCostActual)>Number(a.foodCostTarget)?"rgba(245,158,11,0.3)":"rgba(34,197,94,0.3)"}`},"data-testid":"badge-food-cost-status",children:Number(a.foodCostActual)>Number(a.foodCostTarget)?"Over target":"On target"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.laborTargetPct),label:"Target Labor Cost %",helper:"Your goal for total labor (FOH + BOH + management) as a percentage of total sales. Full-service target: 28-35%.",children:e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"number",placeholder:"e.g. 30",value:a.laborTargetPct||"",onChange:t=>l("laborTargetPct",t.target.value),className:d,style:c,"data-testid":"input-labor-cost-target"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"%"})]})}),e.jsxs(u,{filled:h(a.laborCostActual),label:"Current Actual Labor Cost %",helper:"Your labor cost percentage from your most recent full week or accounting period.",children:[e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"number",placeholder:"e.g. 32",value:a.laborCostActual||"",onChange:t=>l("laborCostActual",t.target.value),className:d,style:c,"data-testid":"input-labor-cost-actual"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"%"})]}),a.laborCostActual&&a.laborTargetPct&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[14px] font-medium mt-1",style:{background:Number(a.laborCostActual)>Number(a.laborTargetPct)?"rgba(245,158,11,0.15)":"rgba(34,197,94,0.15)",color:Number(a.laborCostActual)>Number(a.laborTargetPct)?"#e0b24e":"#7E8A55",border:`1px solid ${Number(a.laborCostActual)>Number(a.laborTargetPct)?"rgba(245,158,11,0.3)":"rgba(34,197,94,0.3)"}`},"data-testid":"badge-labor-cost-status",children:Number(a.laborCostActual)>Number(a.laborTargetPct)?"Over target":"On target"})]})]}),e.jsx("div",{style:{height:1,background:"rgba(169, 112, 47,0.15)",margin:"4px 0"}}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.primeCostTarget),label:"Target Prime Cost %",helper:"Food cost + labor cost combined. The single most important number in your restaurant. Target: 55-62% for full-service.",children:Q?e.jsxs("div",{className:"relative",children:[e.jsx(g,{type:"number",placeholder:"e.g. 60",value:a.primeCostTarget||"",onChange:t=>l("primeCostTarget",t.target.value),className:d,style:c,"data-testid":"input-prime-cost-target"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm",style:{color:"#8a7d66"},children:"%"})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 h-9 px-3 flex items-center text-sm rounded-lg",style:{background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)",color:"#a99a82"},"data-testid":"display-prime-cost-target",children:a.foodCostTarget&&a.laborTargetPct?`${a.foodCostTarget}% + ${a.laborTargetPct}% = ${(Number(a.foodCostTarget)+Number(a.laborTargetPct)).toFixed(0)}%`:"Enter food cost & labor targets above"}),e.jsxs("button",{onClick:()=>{a.foodCostTarget&&a.laborTargetPct&&l("primeCostTarget",String(Number(a.foodCostTarget)+Number(a.laborTargetPct))),ke(!0)},className:"text-[14px] flex items-center gap-1",style:{color:"#a9702f"},"data-testid":"button-edit-prime-cost",children:[e.jsx(ba,{className:"h-3 w-3"})," Edit"]})]})}),e.jsxs(u,{filled:!!(a.foodCostActual&&a.laborCostActual),label:"Current Actual Prime Cost %",helper:"Auto-calculated from your actual food cost + labor cost above.",children:[e.jsx("div",{className:"h-9 px-3 flex items-center text-sm rounded-lg",style:{background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)",color:"#a99a82"},"data-testid":"display-prime-cost-actual",children:a.foodCostActual&&a.laborCostActual?`${(Number(a.foodCostActual)+Number(a.laborCostActual)).toFixed(1)}%`:"Enter actual food cost & labor cost above"}),a.foodCostActual&&a.laborCostActual&&(a.primeCostTarget||a.foodCostTarget&&a.laborTargetPct)&&(()=>{const t=Number(a.foodCostActual)+Number(a.laborCostActual),f=a.primeCostTarget?Number(a.primeCostTarget):Number(a.foodCostTarget)+Number(a.laborTargetPct),w=t>f;return e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[14px] font-medium mt
422-1",style:{background:w?"rgba(245,158,11,0.15)":"rgba(34,197,94,0.15)",color:w?"#e0b24e":"#7E8A55",border:`1px solid ${w?"rgba(245,158,11,0.3)":"rgba(34,197,94,0.3)"}`},"data-testid":"badge-prime-cost-status",children:w?`${(t-f).toFixed(1)} pts over target`:"On target"})})()]})]}),e.jsx("div",{style:{height:1,background:"rgba(169, 112, 47,0.15)",margin:"4px 0"}}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.serviceModel),label:"Service Model",helper:"Your primary service format â affects labor benchmarks and ticket time standards.",children:e.jsxs(ye,{value:a.serviceModel||"",onValueChange:t=>l("serviceModel",t),children:[e.jsx(ve,{className:d,style:c,"data-testid":"select-service-model",children:e.jsx(je,{placeholder:"Select service type"})}),e.jsx(Ne,{children:Ma.map(t=>e.jsx(Y,{value:t.value,children:t.label},t.value))})]})}),e.jsx(u,{filled:h(a.conceptCuisine),label:"Cuisine & Concept",helper:"A brief description of your restaurant's food identity. Used by the Consultant to give relevant menu and food cost advice.",children:e.jsx(g,{placeholder:'e.g. "Southern Cajun bistro and bar, full liquor, dinner service"',value:a.conceptCuisine||"",onChange:t=>l("conceptCuisine",t.target.value),className:d,style:c,"data-testid":"input-cuisine-concept"})})]}),e.jsx(u,{filled:h(a.topChallenge),label:"Biggest Operational Challenge Right Now",helper:"Be specific. The Consultant uses this as a starting point for every conversation.",children:e.jsx(H,{rows:3,placeholder:`e.g. "Food cost is running 4 points over target. I think it's portion control on the line but I'm not sure."`,value:a.topChallenge||"",onChange:t=>l("topChallenge",t.target.value),className:d,style:{...c,resize:"vertical"},"data-testid":"input-top-challenge"})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:e.jsx(u,{filled:h(a.totalStaff),label:"Total Staff Count",helper:"Approximate total number of employees across all roles and shifts.",children:e.jsx(g,{type:"number",placeholder:"e.g. 24",value:a.totalStaff??"",onChange:t=>l("totalStaff",t.target.value?Number(t.target.value):void 0),className:d,style:c,"data-testid":"input-total-staff"})})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:Oe,title:"Your Team",subtitle:"Key names used in your training manuals and handbook."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.generalManager),label:"General Manager / Owner",required:!0,children:e.jsx(g,{placeholder:"e.g., Ben Mouton",value:a.generalManager||"",onChange:t=>l("generalManager",t.target.value),className:d,style:c,"data-testid":"input-general-manager"})}),e.jsx(u,{filled:h(a.kitchenManager),label:"Kitchen Manager",children:e.jsx(g,{placeholder:"e.g., Chef Marcus",value:a.kitchenManager||"",onChange:t=>l("kitchenManager",t.target.value),className:d,style:c,"data-testid":"input-kitchen-manager"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.executiveChef),label:"Executive Chef",children:e.jsx(g,{placeholder:"e.g., Chef Daniel",value:a.executiveChef||"",onChange:t=>l("executiveChef",t.target.value),className:d,style:c,"data-testid":"input-executive-chef"})}),e.jsx(u,{filled:h(a.floorManager),label:"Floor Manager / Shift Lead",children:e.jsx(g,{placeholder:"e.g., Sarah",value:a.floorManager||"",onChange:t=>l("floorManager",t.target.value),className:d,style:c,"data-testid":"input-floor-manager"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsx(u,{filled:h(a.hrContactEmail),label:"HR / Support Contact Email",children:e.jsx(g,{placeholder:"e.g., [email protected]",value:a.hrContactEmail||"",onChange:t=>l("hrContactEmail",t.target.value),className:d,style:c,"data-testid":"input-hr-contact-email"})}),e.jsx(u,{filled:h(a.totalStaff),label:"Total Staff (approx.)",children:e.jsx(g,{type:"number",placeholder:"e.g., 24",value:a.totalStaff??"",onChange:t=>l("totalStaff",t.target.value?parseInt(t.target.value):void 0),className:d,style:c,"data-testid":"input-total-staff"})}),e.jsx(u,{filled:h(a.staffPerDinnerShift),label:"Staff Per Dinner Shift",helper:"Used in kitchen training materials.",children:e.jsx(g,{type:"number",placeholder:"e.g., 5",value:a.staffPerDinnerShift??"",onChange:t=>l("staffPerDinnerShift",t.target.value?parseInt(t.target.value):void 0),className:d,style:c,"data-testid":"input-staff-per-dinner-shift"})})]})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:dt,title:"Operations",subtitle:"Scheduling, service periods, and operational details."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsx(u,{filled:h(a.schedulingApp),label:"Scheduling App",children:e.jsxs(ye,{value:a.schedulingApp||"",onValueChange:t=>l("schedulingApp",t),children:[e.jsx(ve,{className:d,style:c,"data-testid":"select-scheduling-app",children:e.jsx(je,{placeholder:"Select app"})}),e.jsx(Ne,{style:{background:"#241812",border:"1px solid rgba(255,255,255,0.1)"},children:St.map(t=>e.jsx(Y,{value:t.value,children:t.label},t.value))})]})}),e.jsx(u,{filled:h(a.orientationDays),label:"Orientation Period (days)",children:e.jsx(g,{type:"number",min:1,max:90,value:a.orientationDays||30,onChange:t=>l("orientationDays",parseInt(t.target.value)||30),className:d,style:c,"data-testid":"input-orientation-days"})}),e.jsx(u,{filled:h(a.evaluationSchedule),label:"Evaluation Schedule",children:e.jsx(g,{placeholder:"e.g., January and June",value:a.evaluationSchedule||"",onChange:t=>l("evaluationSchedule",t.target.value),className:d,style:c,"data-testid":"input-evaluation-schedule"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs(u,{filled:h(a.posSystem),label:"POS System",required:!0,helper:"Referenced in server training for POS-specific procedures.",children:[e.jsxs(ye,{value:a.posSystem||"",onValueChange:t=>l("posSystem",t),children:[e.jsx(ve,{className:d,style:c,"data-testid":"select-pos-system",children:e.jsx(je,{placeholder:"Select POS system"})}),e.jsx(Ne,{style:{background:"#241812",border:"1px solid rgba(255,255,255,0.1)"},children:Oa.map(t=>e.jsx(Y,{value:t.value,children:t.label},t.value))})]}),a.posSystem==="other"&&e.jsx(g,{placeholder:"Specify POS system...",value:a.posSystemOther||"",onChange:t=>l("posSystemOther",t.target.value),className:`mt-2 ${d}`,style:c,"data-testid":"input-pos-system-other"})]}),e.jsx(u,{filled:h(a.tippingStructure),label:"Tipping Structure",children:e.jsxs(ye,{value:a.tippingStructure||"",onValueChange:t=>l("tippingStructure",t),children:[e.jsx(ve,{className:d,style:c,"data-testid":"select-tipping-structure",children:e.jsx(je,{placeholder:"Select tipping structure"})}),e.jsx(Ne,{style:{background:"#241812",border:"1px solid rgba(255,255,255,0.1)"},children:Tt.map(t=>e.jsx(Y,{value:t.value,children:t.label},t.value))})]})})]}),e.jsx(u,{filled:h(a.servicePeriods),label:"Service Periods",children:e.jsx(Dt,{options:_a,selected:a.servicePeriods||[],onToggle:q})}),e.jsx(u,{filled:h(a.operatingHours),label:"Operating Hours",required:!0,children:e.jsx(g,{placeholder:"e.g., Tue-Thu 11am-10pm, Fri-Sat 11am-11pm, Sun 10am-9pm, Closed Mon",value:a.operatingHours||"",onChange:t=>l("operatingHours",t.target.value),className:d,style:c,"data-testid":"input-operating-hours"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.seatingCapacity),label:"Seating Capacity",children:e.jsx(g,{type:"number",placeholder:"e.g., 85",value:a.seatingCapacity??"",onChange:t=>l("seatingCapacity",t.target.value?parseInt(t.target.value):void 0),className:d,style:c,"data-testid":"input-seating-capacity"})}),e.jsx(u,{filled:h(a.breakPolicy),label:"Break Policy",children:e.jsx(g,{placeholder:"e.g., 30-min unpaid break for shifts over 6 hours",value:a.breakPolicy||"",onChange:t=>l("breakPolicy",t.target.value),className:d,style:c,"data-testid":"input-break-policy"})})]}),e.jsx(u,{filled:(a.closedHolidays||[]).length>0,label:"Closed Holidays",children:e.jsx(Et,{items:a.closedHolidays||[],onAdd:Ce,onRemove:me,placeholder:"Add a holiday...",addLabel:"Add",chipId:"holiday"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:nt,title:"Menu & Kitchen",subtitle:"Used to personalize kitchen and server training content."}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{filled:h(a.signatureDishesFoh),label:"Signature / Featured Dishes (FOH)",required:!0,helper:"Server training Day 2 references your actual menu items.",children:e.jsx(H,{placeholder:"e.g., Shrimp & Grits (Cajun sauce), Chicken Fried Steak (white gravy), Gumbo Fridays special",value:a.signatureDishesFoh||"",onChange:t=>l("signatureDishesFoh",t.target.value),className:`min-h-[80px] ${d}`,style:c,"data-testid":"textarea-signature-dishes-foh"})}),e.jsx(u,{filled:h(a.signatureDishesBoh),label:"Signature / Featured Dishes (BOH)",helper:"Kitchen training Day 2 (Prep) and Day 3 (Stations) reference these.",children:e.jsx(H,{placeholder:"e.g., Grillades & Grits, Maque Choux, Jambalaya Pasta",value:a.signatureDishesBoh||"",onChange:t=>l("signatureDishesBoh",t.target.value),className:`min-h-[80px] ${d}`,style:c,"data-testid":"textarea-signature-dishes-boh"})}),e.jsx(u,{filled:(a.kitchenStations||[]).length>0,label:"Kitchen Stations",helper:"Kitchen training materials reference your specific stations.",children:e.jsx(Et,{items:a.kitchenStations||[],onAdd:n,onRemove:$,placeholder:"Add a station...",addLabel:"Add",chipId:"station"})}),e.jsx(u,{filled:(a.allergenOptions||[]).length>0,label:"Dietary Options Available",children:e.jsx(Dt,{options:Ia,selected:a.allergenOptions||[],onToggle:ae})}),e.jsx(u,{filled:h(a.brandVoice),label:"Brand Voice / Cultural Identity",required:!0,helper:"Used in training manual welcome language and service standards tone.",children:e.jsx(g,{placeholder:"e.g., Southern hospital
422ity, Fast and Flavorful, Louisiana roots",value:a.brandVoice||"",onChange:t=>l("brandVoice",t.target.value),className:d,style:c,"data-testid":"input-brand-voice"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:Vt,title:"Events & Specials",subtitle:"Used in training materials for event prep days."}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{filled:h(a.weeklySpecials),label:"Weekly Specials / Recurring Events",helper:"Server Day 2 and Kitchen Day 5 reference your specific events.",children:e.jsx(H,{placeholder:"e.g., Gumbo Fridays, Crawfish Boil Thursdays, Happy Hour Tue-Fri 3-6pm",value:a.weeklySpecials||"",onChange:t=>l("weeklySpecials",t.target.value),className:`min-h-[80px] ${d}`,style:c,"data-testid":"textarea-weekly-specials"})}),e.jsx(u,{filled:h(a.happyHourDetails),label:"Happy Hour (if applicable)",helper:"Used in Server Day 5 (Happy Hour POS codes) and Kitchen Day 5 (batch appetizers).",children:e.jsx(g,{placeholder:"e.g., Tue-Fri 3-6pm, $2 off drinks, half-price appetizers",value:a.happyHourDetails||"",onChange:t=>l("happyHourDetails",t.target.value),className:d,style:c,"data-testid":"input-happy-hour-details"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:bt,title:"Bar Program",subtitle:"Used in the Bartender Training Manual for bar operations, cocktails, and compliance."}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{filled:h(a.barManager),label:"Bar Manager / GM Name",helper:"Referenced in Bartender Day 1 orientation and chain of command.",children:e.jsx(g,{placeholder:"e.g., Sarah Mitchell",value:a.barManager||"",onChange:t=>l("barManager",t.target.value),className:d,style:c,"data-testid":"input-bar-manager"})}),e.jsx(u,{filled:h(a.headBartender),label:"Head Bartender",helper:"Lead trainer for bartender onboarding and Day 7 certification.",children:e.jsx(g,{placeholder:"e.g., Jake Rivera",value:a.headBartender||"",onChange:t=>l("headBartender",t.target.value),className:d,style:c,"data-testid":"input-head-bartender"})}),e.jsx(u,{filled:h(a.alcoholPermit),label:"Alcohol License / Permit Type",helper:"Displayed on Bartender Day 1 TABC compliance section.",children:e.jsxs(ye,{value:a.alcoholPermit||"",onValueChange:t=>l("alcoholPermit",t),children:[e.jsx(ve,{className:d,style:c,"data-testid":"select-alcohol
422-permit",children:e.jsx(je,{placeholder:"Select permit type"})}),e.jsxs(Ne,{children:[e.jsx(Y,{value:"tabc_mixed",children:"TABC Mixed Beverage Permit"}),e.jsx(Y,{value:"beer_wine",children:"Beer & Wine Only"}),e.jsx(Y,{value:"full_liquor",children:"Full Liquor License"}),e.jsx(Y,{value:"other",children:"Other"})]})]})}),e.jsx(u,{filled:h(a.signatureCocktail1),label:"Signature Cocktail #1",helper:"Featured in Bartender Day 3 and assessment questions.",children:e.jsx(g,{placeholder:"e.g., Smoky Old Fashioned",value:a.signatureCocktail1||"",onChange:t=>l("signatureCocktail1",t.target.value),className:d,style:c,"data-testid":"input-signature-cocktail-1"})}),e.jsx(u,{filled:h(a.signatureCocktail2),label:"Signature Cocktail #2",children:e.jsx(g,{placeholder:"e.g., House Margarita",value:a.signatureCocktail2||"",onChange:t=>l("signatureCocktail2",t.target.value),className:d,style:c,"data-testid":"input-signature-cocktail-2"})}),e.jsx(u,{filled:h(a.signatureCocktail3),label:"Signature Cocktail #3",children:e.jsx(g,{placeholder:"e.g., Bourbon Peach Smash",value:a.signatureCocktail3||"",onChange:t=>l("signatureCocktail3",t.target.value),className:d,style:c,"data-testid":"input-signature-cocktail-3"})}),e.jsx(u,{filled:h(a.draftBeerCount),label:"Number of Draft Lines",helper:"Used in Bartender Day 2 beer knowledge section.",children:e.jsx(g,{type:"number",placeholder:"e.g., 12",value:a.draftBeerCount??"",onChange:t=>l("draftBeerCount",t.target.value?parseInt(t.target.value):void 0),className:d,style:c,"data-testid":"input-draft-beer-count"})}),e.jsx(u,{filled:h(a.closingTime),label:"Bar Closing Time",helper:"Used in Bartender Day 6 close checklist and last call timing.",children:e.jsx(g,{placeholder:"e.g., 12:00 AM, 2:00 AM",value:a.closingTime||"",onChange:t=>l("closingTime",t.target.value),className:d,style:c,"data-testid":"input-closing-time"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:yt,title:"Manager Operations",subtitle:"Used in the Manager Training Manual for financial targets, vendor management, and emergency procedures."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(u,{filled:h(a.laborTargetPct),label:"Labor Target %",children:e.jsx(g,{placeholder:"e.g., 30%",value:a.laborTargetPct||"",onChange:t=>l("laborTargetPct",t.target.value),className:d,style:c,"data-testid":"input-labor-target-pct"})}),e.jsx(u,{filled:h(a.foodCostTarget),label:"Food Cost Target %",children:e.jsx(g,{placeholder:"e.g., 28-32%",value:a.foodCostTarget||"",onChange:t=>l("foodCostTarget",t.target.value),className:d,style:c,"data-testid":"input-food-cost-target"})}),e.jsx(u,{filled:h(a.primeCostTarget),label:"Prime Cost Target %",children:e.jsx(g,{placeholder:"e.g., 55-60%",value:a.primeCostTarget||"",onChange:t=>l("primeCostTarget",t.target.value),className:d,style:c,"data-testid":"input-prime-cost-target"})}),e.jsx(u,{filled:h(a.reservationSystem),label:"Reservation System",children:e.jsx(g,{placeholder:"e.g., OpenTable, Resy, Yelp Reservations",value:a.reservationSystem||"",onChange:t=>l("reservationSystem",t.target.value),className:d,style:c,"data-testid":"input-reservation-system"})}),e.jsx(u,{filled:h(a.totalCovers),label:"Total Covers (Max Seated)",children:e.jsx(g,{type:"number",placeholder:"e.g., 120",value:a.totalCovers||"",onChange:t=>l("totalCovers",t.target.value?parseInt(t.target.value):null),className:d,style:c,"data-testid":"input-total-covers"})}),e.jsx(u,{filled:h(a.avgTurnTime),label:"Average Table Turn Time (minutes)",children:e.jsx(g,{type:"number",placeholder:"e.g., 45",value:a.avgTurnTime||"",onChange:t=>l("avgTurnTime",t.target.value?parseInt(t.target.value):null),className:d,style:c,"data-testid":"input-avg-turn-time"})}),e.jsx(u,{filled:h(a.openingTime),label:"Opening Time",children:e.jsx(g,{placeholder:"e.g., 11:00 AM",value:a.openingTime||"",onChange:t=>l("openingTime",t.target.value),className:d,style:c,"data-testid":"input-opening-time"})}),e.jsx(u,{filled:h(a.safeDropProcedure),label:"Safe Drop Procedure",children:e.jsx(g,{placeholder:"e.g., Count drawer, complete drop slip, deposit in safe",value:a.safeDropProcedure||"",onChange:t=>l("safeDropProcedure",t.target.value),className:d,style:c,"data-testid":"input-safe-drop-procedure"})})]}),e.jsxs("div",{className:"mt-5 space-y-5",children:[e.jsx(u,{filled:h(a.vendorList),label:"Vendor List",children:e.jsx(H,{placeholder:"List your primary vendors (food, beverage, linen, cleaning, etc.)...",value:a.vendorList||"",onChange:t=>l("vendorList",t.target.value),className:`min-h-[100px] font-mono text-sm ${d}`,style:c,"data-testid":"textarea-vendor-list"})}),e.jsx(u,{filled:h(a.emergencyContacts),label:"Emergency Contacts",children:e.jsx(H,{placeholder:"List emergency contacts: fire, police, plumber, electrician, HVAC, etc...",value:a.emergencyContacts||"",onChange:t=>l("emergencyContacts",t.target.value),className:`min-h-[100px] font-mono text-sm ${d}`,style:c,"data-testid":"textarea-emergency-contacts"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:Ea,title:"Uniform Policy",subtitle:"Dress code requirements for front and back of house."}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{filled:h(a.uniformDiningRoom),label:"Dining Room Dress Code",required:!0,children:e.jsx(H,{placeholder:"Describe the uniform requirements for dining room staff...",value:a.uniformDiningRoom||"",onChange:t=>l("uniformDiningRoom",t.target.value),className:`min-h-[120px] font-mono text-sm ${d}`,style:c,"data-testid":"textarea-uniform-dining"})}),e.jsx(u,{filled:h(a.uniformKitchen),label:"Kitchen Dress Code",required:!0,children:e.jsx(H,{placeholder:"Describe the uniform requirements for kitchen staff...",value:a.uniformKitchen||"",onChange:t=>l("uniformKitchen",t.target.value),className:`min-h-[120px] font-mono text-sm ${d}`,style:c,"data-testid":"textarea-uniform-kitchen"})})]})]}),e.jsxs("div",{className:"rounded-md p-5",style:{background:"#1c1210"},children:[e.jsx(oe,{icon:Aa,title:"Employee Benefits",subtitle:"Meal policies, parking, and other employee benef
422its."}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(u,{filled:h(a.employeeMealPolicy),label:"Employee Meal Policy",required:!0,children:e.jsx(H,{placeholder:"Describe your employee meal discount or policy...",value:a.employeeMealPolicy||"",onChange:t=>l("employeeMealPolicy",t.target.value),className:`min-h-[80px] ${d}`,style:c,"data-testid":"textarea-meal-policy"})}),e.jsx(u,{filled:h(a.parkingPolicy),label:"Parking Policy",children:e.jsx(g,{placeholder:"e.g., Park in employee designated areas only",value:a.parkingPolicy||"",onChange:t=>l("parkingPolicy",t.target.value),className:d,style:c,"data-testid":"input-parking-policy"})})]})]})]}),T==="policies"&&e.jsxs("div",{className:"space-y-5",style:{animation:"scheduleStaggerIn 0.3s ease-out"},children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("h3",{className:"font-semibold text-white flex flex-wrap items-center gap-2",children:[e.jsx(Le,{className:"h-4 w-4",style:{color:"#a9702f"}}),"Standard Policies"]}),e.jsxs(ue,{variant:"secondary","data-testid":"badge-policy-count",children:[ze+Re," of ",kt.length+z.length," included"]})]}),e.jsx("p",{className:"text-sm",style:{color:"#8a7d66"},children:"Toggle policies on or off to include them in your handbook. Add custom notes where needed."}),e.jsx("div",{className:"space-y-3",children:kt.map(t=>{const f=B[t.key]??!0;return e.jsxs("div",{className:"rounded-md p-3 space-y-2 transition-colors",style:{background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)"},"data-testid":`policy-section-${t.key}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{className:"shrink-0 mt-0.5 rounded-md flex items-center justify-center transition-colors",style:{width:28,height:28,background:f?"#a9702f":"transparent",border:f?"none":"1px solid rgba(255,255,255,0.15)",color:f?"#1c1210":"#8a7d66"},onClick:()=>Z(w=>({...w,[t.key]:!w[t.key]})),"data-testid":`toggle-policy-${t.key}`,children:f?e.jsx(it,{className:"h-4 w-4"}):e.jsx($e,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm text-white",children:t.label}),e.jsx("div",{className:"text-xs",style:{color:"#8a7d66"},children:t.desc})]})]}),f&&t.key==="alcohol"&&e.jsxs("div",{className:"pl-10 space-y-1",children:[e.jsx(Ee,{htmlFor:"alcoholPolicy",className:"text-xs",style:{color:"#8a7d66"},children:"Custom notes (optional)"}),e.jsx(H,{id:"alcoholPolicy",placeholder:"Any additional alcohol service policies specific to your restaurant...",value:a.alcoholPolicy||"",onChange:w=>l("alcoholPolicy",w.target.value),className:`min-h-[80px] text-sm ${d}`,style:c,"data-testid":"textarea-alcohol-policy"})]}),f&&t.key==="socialMedia"&&e.jsxs("div",{className:"pl-10 space-y-1",children:[e.jsx(Ee,{htmlFor:"socialMediaPolicy",className:"text-xs",style:{color:"#8a7d66"},children:"Custom notes (optional)"}),e.jsx(H,{id:"socialMediaPolicy",placeholder:"Any additional social media guidelines specific to your restaurant...",value:a.socialMediaPolicy||"",onChange:w=>l("socialMediaPolicy",w.target.value),className:`min-h-[80px] text-sm ${d}`,style:c,"data-testid":"textarea-social-media-policy"})]})]},t.key)})}),z.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(wt,{className:"h-3 w-3",style:{color:"#a9702f"}}),"Custom Policies"]}),z.map(t=>e.jsx("div",{className:"rounded-md p-3 space-y-2 transition-colors",style:{background:"#1c1210",border:"1px solid rgba(255,255,255,0.1)"},"data-testid":`policy-section-${t.id}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{className:"shrink-0 mt-0.5 rounded-md flex items-center justify-center transition-colors",style:{width:28,height:28,background:t.enabled?"#a9702f":"transparent",border:t.enabled?"none":"1px solid rgba(255,255,255,0.15)",color:t.enabled?"#1c1210":"#8a7d66"},onClick:()=>E(t.id),"data-testid":`toggle-custom-policy-${t.id}`,children:t.enabled?e.jsx(it,{className:"h-4 w-4"}):e.jsx($e,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm text-white",children:t.label}),t.desc&&e.jsx("div",{className:"text-xs",style:{color:"#8a7d66"},children:t.desc})]}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>U(t.id),"data-testid":`button-remove-custom-policy-${t.id}`,children:e.jsx($e,{className:"h-4 w-4 text-muted-foreground"})})]})},t.id))]}),e.jsx("div",{className:"pt-2",children:A?e.jsxs("div",{className:"rounded-md p-4 space-y-3",style:{background:"#1c1210",border:"1px solid #a9702f"},children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Add Custom Policy"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"text-sm text-stone-300",children:"Policy Name"}),e.jsx(g,{placeholder:"e.g., Technology Usage",value:m,onChange:t=>I(t.target.value),className:d,style:c,"data-testid":"input-custom-policy-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"text-sm text-stone-300",children:"Description (optional)"}),e.jsx(g,{placeholder:"Brief description of the policy...",value:N,onChange:t=>R(t.target.value),className:d,style:c,"data-testid":"input-custom-policy-desc"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(y,{size:"sm",onClick:S,disabled:!m.trim(),"data-testid":"button-submit-custom-policy",children:"Add Policy"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>{D(!1),I(""),R("")},"data-testid":"button-cancel-custom-policy",children:"Cancel"})]})]}):e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>D(!0),style:{color:"#a9702f",borderColor:"rgba(169, 112, 47,0.4)"},"data-testid":"button-add-custom-policy",children:[e.jsx(wt,{className:"h-4 w-4 mr-2"}),"Add Custom Policy"]})}),e.jsx("div",{className:"border-t pt-4",style:{borderColor:"rgba(255,255,255,0.1)"},children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"additionalPolicies",className:"text-sm text-stone-300",children:"Other Policies"}),e.jsx("p",{className:"text-xs",style:{color:"#8a7d66"},children:"Any other policies you want to include in your handbook."}),e.jsx(H,{id:"additionalPolicies",placeholder:"Any other policies you want to include in your handbook...",value:a.additionalPolicies||"",onChange:t=>l("additionalPolicies",t.target.value),className:`min-h-[120px] ${d}`,style:c,"data-testid":"textarea-additional-policies"})]})})]}),T==="preview"&&e.jsxs("div",{className:"space-y-4",style:{animation:"scheduleStaggerIn 0.3s ease-out"},children:[e.jsx("div",{className:"rounded-md p-6",style:{background:"#efe7d8",border:"2px s
422olid #a9702f"},children:e.jsx(Ft,{className:"h-[60vh]",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",style:{color:"#1f1310"},children:se()})})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3 p-3 rounded-md",style:{background:"#1c1210"},"data-testid":"preview-action-bar",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:re,style:{background:"#241812",border:"1px solid rgba(255,255,255,0.2)",color:"#fff"},"data-testid":"button-preview-print",children:[e.jsx(Be,{className:"h-4 w-4 mr-2"}),"Print"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:Se,style:{background:"#241812",border:"1px solid rgba(255,255,255,0.2)",color:"#fff"},"data-testid":"button-preview-download",children:[e.jsx(Lt,{className:"h-4 w-4 mr-2"}),"Download PDF"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:Me,style:{background:"#241812",border:"1px solid rgba(255,255,255,0.2)",color:"#fff"},"data-testid":"button-preview-copy",children:[e.jsx(He,{className:"h-4 w-4 mr-2"}),"Copy All Text"]})]})]})]})})}function K(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function La(s){let r=K(s);return r=r.replace(/^(â{3,}.*?)$/gm,'<hr class="thick-rule" />'),r=r.replace(/^(âââââââ.*?)$/gm,'<hr class="thin-rule" />'),r=r.replace(/^(DAY \d+.*?)$/gm,'<h2 class="day-heading">$1</h2>'),r=r.replace(/^([A-Z][A-Z\s&,/:â\-']{5,})$/gm,'<h3 class="section-heading">$1</h3>'),r=r.replace(/^â¡\s(.*)$/gm,'<div class="checklist-item">$1</div>'),r=r.replace(/^â¢\s(.*)$/gm,'<div class="bullet-item">$1</div>'),r=r.replace(/^(â.*$[\s\S]*?â.*$)/gm,'<div class="table-block">$1</div>'),r=r.replace(/^(\d+)\.\s(.*?)$/gm,'<div class="numbered-item"><span class="num">$1.</span> $2</div>'),r=r.replace(/^"([\s\S]*?)"$/gm,'<blockquote class="quote">$1</blockquote>'),r}function ht(s){const r=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),x=s.templates.sort((p,C)=>p.sequenceOrder-C.sequenceOrder).map((p,C)=>` 423 <div class="template-section ${C>0?"day-section":""}"> 424 <h2 class="template-title">${K(p.title)}</h2> 425 <div class="template-meta">${K(p.section)} | ${K(p.contentType)}</div> 426 ${p.keyPoints?.length?`<div class="key-points">${p.keyPoints.map(P=>`<span class="badge">${K(P)}</span>`).join("")}</div>`:""} 427 <div class="template-content">${La(p.content)}</div> 428 </div> 429 `).join(""),i=window.open("","_blank");if(!i)throw new Error("Unable to open print window. Please check your popup blocker settings.");i.document.write(` 430 <!DOCTYPE html> 431 <html> 432 <head> 433 <title>${K(s.manualTitle)} - ${K(s.restaurantName)}</title> 434 <style> 435 * { box-sizing: border-box; margin: 0; padding: 0; } 436 body { 437 font-family: Georgia, 'Times New Roman', serif; 438 font-size: 11pt; 439 line-height: 1.6; 440 color: #000; 441 background: #fff; 442 max-width: 800px; 443 margin: 0 auto; 444 padding: 40px; 445 } 446 447 .cover-page { 448 text-align: center; 449 padding-top: 3in; 450 page-break-after: always; 451 min-height: 90vh; 452 } 453 .cover-page h1 { 454 font-size: 28pt; 455 margin-bottom: 12pt; 456 letter-spacing: 1px; 457 } 458 .cover-page .subtitle { 459 font-size: 16pt; 460 color: #333; 461 margin-bottom: 24pt; 462 } 463 .cover-page .prepared-for { 464 font-size: 12pt; 465 color: #555; 466 margin-bottom: 8pt; 467 } 468 .cover-page .date { 469 font-size: 11pt; 470 color: #777; 471 margin-bottom: 48pt; 472 } 473 .cover-page .confidential { 474 font-size: 9pt; 475 color: #999; 476 border-top: 1px solid #ccc; 477 padding-top: 12pt; 478 position: absolute; 479 bottom: 40px; 480 left: 40px; 481 right: 40px; 482 } 483 484 .template-section { 485 margin-bottom: 24pt; 486 } 487 .day-section { 488 page-break-before: always; 489 } 490 .template-title { 491 font-size: 16pt; 492 border-bottom: 1.5pt solid #000; 493 padding-bottom: 4pt; 494 margin-bottom: 8pt; 495 page-break-after: avoid; 496 } 497 .template-meta { 498 font-size: 9pt; 499 color: #666; 500 margin-bottom: 12pt; 501 text-transform: uppercase; 502 letter-spacing: 0.5px; 503 } 504 .key-points { 505 margin-bottom: 16pt; 506 } 507 .badge { 508 display: inline-block; 509 background: #efe7d8; 510 padding: 3pt 8pt; 511 border-radius: 3pt; 512 font-size: 9pt; 513 margin-right: 6pt; 514 margin-bottom: 4pt; 515 border: 0.5pt solid #ddd; 516 } 517 .template-content { 518 white-space: pre-wrap; 519 font-family: 'Calibri', 'Helvetica Neue', sans-serif; 520 font-size: 10.5pt; 521 line-height: 1.5; 522 } 523 524 hr.thick-rule { 525 border: none; 526 border-top: 2pt solid #000; 527 margin: 16pt 0; 528 } 529 hr.thin-rule { 530 border: none; 531 border-top: 0.5pt solid #999; 532 margin: 12pt 0; 533 } 534 535 h2.day-heading { 536 font-size: 14pt; 537 margin: 16pt 0 8pt; 538 page-break-after: avoid; 539 } 540 h3.section-heading { 541 font-size: 11pt; 542 font-weight: bold; 543 margin: 12pt 0 6pt; 544 letter-spacing: 0.5px; 545 page-break-after: avoid; 546 } 547 548 .checklist-item { 549 padding-left: 20pt; 550 position: relative; 551 margin: 3pt 0; 552 } 553 .checklist-item::before { 554 content: "\\2610 "; 555 position: absolute; 556 left: 0; 557 } 558 559 .bullet-item { 560 padding-left: 16pt; 561 position: relative; 562 margin: 2pt 0; 563 } 564 .bullet-item::before { 565 content: "\\2022 "; 566 position: absolute; 567 left: 0; 568 } 569 570 .numbered-item { 571 margin: 3pt 0; 572 } 573 .numbered-item .num { 574 font-weight: bold; 575 display: inline-block; 576 min-width: 20pt; 577 } 578 579 .table-block { 580 font-family: 'Courier New', monospace; 581 font-size: 9pt; 582 line-height: 1.3; 583 background: #f9f9f9; 584 border: 0.5pt solid #ccc; 585 padding: 8pt; 586 margin: 8pt 0; 587 page-break-inside: avoid; 588 overflow-x: auto; 589 } 590 591 blockquote.quote { 592 font-style: italic; 593 color: #333; 594 border-left: 3pt solid #000; 595 padding-left: 12pt; 596 margin: 10pt 0; 597 } 598 599 @media print { 600 body { padding: 0; max-width: none; } 601 @page { 602 size: letter portrait; 603 margin: 0.75in 0.75in 1in 0.75in; 604 @bottom-center { 605 content: "${K(s.restaurantName)} - ${K(s.manualTitle)}"; 606 font-size: 8pt; 607 color: #999; 608 } 609 } 610 .cover-page .confidential { 611 position: relative; 612 bottom: auto; 613 left: auto; 614 right: auto; 615 margin-top: 2in; 616 } 617 } 618 </style> 619 </head> 620 <body> 621 <div class="cover-page"> 622 <h1>${K(s.restaurantName)}</h1> 623 <div class="subtitle">${K(s.manualTitle)}</div> 624 <div class="prepared-for">Prepared for: ${K(s.ownerName)}</div> 625 <div class="date">${r}</div> 626 <div class="confidential">Confidential - ${K(s.restaurantName)} Internal Use Only</div> 627 </div> 628 ${x} 629 </body> 630 </html> 631 `),i.document.close(),lt(),setTimeout(()=>i.print(),500)}async function Ba(s){ht(s)}function Ha(s){const r=s.split(` 632`),x=[];for(let i=0;i<r.length;i++){const p=r[i];if(!/^â{3,}/.test(p)){if(/^âââ/.test(p)){x.push(new _({border:{bottom:{style:ut.SINGLE,size:1,color:"999999"}},spacing:{before:200,after:200}}));continue}if(/^(DAY \d+|WEEK \d+)/.test(p.trim())){x.push(new _({children:[new M({text:p.trim(),bold:!0,size:28,font:"Calibri"})],heading:mt.HEADING_1,spacing:{before:400,after:200},pageBreakBefore:x.length>3}));continue}if(/^[A-Z][A-Z\s&,/:â\-']{5,}$/.test(p.trim())&&p.trim().length>5){x.push(new _({children:[new M({text:p.trim(),bold:!0,size:24,font:"Calibri"})],heading:mt.HEADING_2,spacing:{before:300,after:150}}));continue}if(p.startsWith("â¡ ")||p.startsWith("â¡ ")){x.push(new _({children:[new M({text:"â ",font:"Calibri",size:22}),new M({text:p.replace(/^â¡\s*/,""),font:"Calibri",size:22})],spacing:{before:60,after:60},indent:{left:360}}));continue}if(p.startsWith("⢠")){x.push(new _({children:[new M({text:p.replace(/^â¢\s*/,""),font:"Calibri",size:22})],bullet:{level:0},spacing:{before:40,after:40}}));continue}if(/^\d+\.\s/.test(p)){const C=p.match(/^(\d+)\.\s(.*)$/);if(C){x.push(new _({children:[new M({text:`${C[1]}. `,bold:!0,font:"Calibri",size:22}),new M({text:C[2],font:"Calibri",size:22})],spacing:{before:60,after:60},indent:{left:360}}));continue}}if(p.startsWith("â")||p.startsWith("â")||p.startsWith("â")||p.startsWith("â")){x.push(new _({children:[new M({text:p,font:"Courier New",size:18})],spacing:{before:20,after:20},shading:{type:"clear",fill:"F5F5F5"}}));continue}if(p.startsWith('"')&&p.endsWith('"')){x.push(new _({children:[new M({text:p,italics:!0,font:"Calibri",size:22,color:"333333"})],spacing:{before:120,after:120},indent:{left:480},border:{left:{style:ut.SINGLE,size:6,color:"000000"}}}));continue}if(p.trim()===""){x.push(new _({spacing:{before:80,after:80}}));continue}x.push(new _({children:[new M({text:p,font:"Calibri",size:22})],spacing:{before:40,after:40}}))}}return x}async function qa(s){const r=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),x=ot(),i=[new _({spacing:{before:3e3}}),new _({children:[new M({text:s.restaurantName,bold:!0,size:56,font:"Calibri"})],alignment:ge.CENTER,spacing:{after:200}}),new _({children:[new M({text:s.manualTitle,size:32,font:"Calibri",color:"333333"})],alignment:ge.CENTER,spacing:{after:400}}),new _({children:[new M({text:`Prepared for: ${s.ownerName}`,size:24,font:"Calibri",color:"555555"})],alignment:ge.CENTER,spacing:{after:100}}),new _({children:[new M({text:r,size:22,font:"Calibri",color:"777777"})],alignment:ge.CENTER,spacing:{after:3e3}}),new _({children:[new M({text:`Confidential - ${s.restaurantName} Internal Use Only`,size:18,font:"Calibri",color:"999999"})],alignment:ge.CENTER,border:{top:{style:ut.SINGLE,size:1,color:"CCCCCC"}},spacing:{before:200}}),new _({children:[new M({text:"",break:1})],pageBreakBefore:!1})],p=[],C=s.templates.sort((D,m)=>
632D.sequenceOrder-m.sequenceOrder);for(let D=0;D<C.length;D++){const m=C[D];p.push(new _({children:[new M({text:m.title,bold:!0,size:32,font:"Calibri"})],heading:mt.HEADING_1,spacing:{before:400,after:100},pageBreakBefore:D>0})),p.push(new _({children:[new M({text:`${m.section} | ${m.contentType}`.toUpperCase(),size:18,font:"Calibri",color:"666666"})],spacing:{after:200}})),m.keyPoints?.length&&p.push(new _({children:[new M({text:"Key Points: ",bold:!0,size:20,font:"Calibri"}),new M({text:m.keyPoints.join(" | "),size:20,font:"Calibri",color:"555555"})],spacing:{after:200},shading:{type:"clear",fill:"F3F4F6"}}));const I=Ha(m.content);p.push(...I)}const P=new ya({styles:{default:{document:{run:{font:"Calibri",size:22}}}},sections:[{properties:{page:{margin:{top:1440,right:1440,bottom:1440,left:1440}}},footers:{default:new va({children:[new _({children:[new M({text:`${s.restaurantName} - ${s.manualTitle} | Confidential`,size:16,font:"Calibri",color:"999999"})],alignment:ge.CENTER})]})},children:[...i,...p]}]}),k=await ja.toBlob(P),T=`${s.restaurantName.replace(/\s+/g,"-")}-${s.manualTitle.replace(/\s+/g,"-")}-${x}.docx`;if(typeof navigator<"u"&&navigator.share&&navigator.canShare){const D=new File([k],T,{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"});try{if(navigator.canShare({files:[D]})){await navigator.share({files:[D]}),lt();return}}catch{}}const v=URL.createObjectURL(k),A=document.createElement("a");A.href=v,A.download=T,document.body.appendChild(A),A.click(),document.body.removeChild(A),URL.revokeObjectURL(v),lt()}async function $t(s){if(s.length===0)return new Map;const r=await fetch(`/api/templates/content?ids=${s.join(",")}`,{credentials:"include"});if(!r.ok)throw new Error("Failed to load template content");const x=await r.json();return new Map(x.map(i=>[i.id,i.content]))}function ee(s,r){return s.replace(/Mouton's Bistro & Bar|Mouton's Bistro|Mouton's/gi,r||"our restaurant")}const Wa={overview:we,procedure:We,checklist:It,assessment:Bt},Fe={overview:{bg:"rgba(200, 147, 78,0.15)",text:"#c8934e",label:"Overview"},procedure:{bg:"rgba(200, 147, 78,0.15)",text:"#c8934e",label:"Procedure"},policy:{bg:"rgba(245,158,11,0.15)",text:"#e0b24e",label:"Policy"},quiz:{bg:"rgba(34,197,94,0.15)",text:"#7E8A55",label:"Quiz"},checklist:{bg:"rgba(200, 147, 78,0.15)",text:"#c8934e",label:"Checklist"},assessment:{bg:"rgba(34,197,94,0.15)",text:"#7E8A55",label:"Assessment"}},Ga={1:"Orientation",2:"Menu Knowledge",3:"Beverage & Compliance",4:"Service Steps",5:"Advanced Service",6:"Complex Scenarios",7:"Final Evaluation"},Ua={1:"Kitchen Orientation",2:"Station Training",3:"Prep & Production",4:"Line Operations",5:"Plating & Quality",6:"Rush Management",7:"Final Assessment"},Ka={1:"Bar Orientation & Compliance",2:"Spirits, Beer & Wine",3:"Cocktails & Signature Drinks",4:"POS, Cash & Speed Bar",5:"Guest Experience & De-escalation",6:"Bar Close & Sanitation",7:"Assessment & Certification"},Ya={1:"Orientation & Leadership Philosophy",2:"FOH Operations",3:"BOH Operations & Food Safety",4:"Bar Operations & TABC",5:"POS Mastery & Cash Handling",6:"Labor Management & Prime Cost",7:"Food Cost & Vendor Management",8:"HR & TWC Compliance",9:"Guest Experience & Crisis Management",10:"Opening/Closing & Certification"};function Va(s,r){return(s==="server"?Ga:s==="bartender"?Ka:s==="manager"?Ya:Ua)[r]||`Day ${r}`}const Qa={host:{icon:Oe,description:"Structured training for hosts and hostesses covering reservation management, seating flow, guest experience, and waitlist management.",responsibilities:"Greeting guests, managing reservations, seating rotation, waitlist management, phone handling, first impression standards"},bartender:{icon:bt,description:"Comprehensive bartender training covering cocktail preparation, speed techniques, responsible alcohol service, and bar inventory management.",responsibilities:"Cocktail preparation, speed bartending, responsible alcohol service, bar inventory, guest interaction, bar cleanliness"},manager:{icon:yt,description:"Shift lead and manager training covering labor management, conflict resolution, opening/closing procedures, and operational decision-making.",responsibilities:"Shift management, labor cost control, conflict resolution, opening/closing procedures, team leadership, operational decisions"},busser:{icon:Wt,description:"Food runner and busser training covering table turnover, support service, dish handling, and team coordination during peak service.",responsibilities:"Table clearing, resetting, food running, dish handling, team coordination, cleanliness standards"}};function Ja(){const{data:s}=pe({queryKey:["/api/training-assignments"]}),{data:r}=pe({queryKey:["/api/templates"]}),x=r?new Set(r.map(k=>
632k.category)).size:0,i=s?.length||0,P=[{label:"Roles with Manuals",value:`${x}`,icon:we},{label:"Handbook Status",value:"Not Started",icon:Le},{label:"Staff Assigned",value:`${i}`,icon:Oe},{label:"Handbook Policies",value:"0",icon:We}];return e.jsx("div",{className:"flex gap-3 mb-6 overflow-x-auto pb-2","data-testid":"training-intelligence-strip",children:P.map((k,T)=>e.jsxs("div",{className:"flex-shrink-0 min-w-[150px] rounded-lg p-4",style:{backgroundColor:"#241812",borderLeft:"3px solid #c8934e",animation:`scheduleStaggerIn 0.3s ease-out ${T*30}ms both`},"data-testid":`metric-${k.label.toLowerCase().replace(/ /g,"-")}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(k.icon,{className:"h-3.5 w-3.5",style:{color:"#a99a82"}}),e.jsx("span",{className:"text-xs",style:{color:"#a99a82"},children:k.label})]}),e.jsx("div",{className:"text-lg font-bold text-white",children:k.value})]},k.label))})}function Za({activeCategory:s}){const{toast:r}=_e(),[x,i]=b.useState(!0),[p,C]=b.useState(!1),[P,k]=b.useState(null),[T,v]=b.useState(""),[A,D]=b.useState(""),[m,I]=b.useState(()=>ot()),{data:N,isLoading:R,isError:z,refetch:J}=pe({queryKey:["/api/training-assignments"]}),B=N?.filter(n=>n.templateCategory===s)||[],Z=fe({mutationFn:async n=>(await be("POST","/api/training-assignments",n)).json(),onSuccess:()=>{xe.invalidateQueries({queryKey:["/api/training-assignments"]}),C(!1),v(""),D(""),I(ot()),r({title:"Training assigned successfully"})},onError:n=>{r({title:"Failed to assign training",description:n.message,variant:"destructive"})}}),G=fe({mutationFn:async({assignmentId:n,dayNumber:$,signedOffBy:q})=>(await be("POST",`/api/training-assignments/${n}/days`,{dayNumber:$,signedOffBy:q,notes:null})).json(),onSuccess:()=>{xe.invalidateQueries({queryKey:["/api/training-assignments"]}),r({title:"Day marked as complete"})},onError:n=>{r({title:"Failed to mark day complete",description:n.message,variant:"destructive"})}}),V=fe({mutationFn:async({completionId:n})=>{await be("DELETE",`/api/training-day-completions/${n}`)},onSuccess:()=>{xe.invalidateQueries({queryKey:["/api/training-assignments"]}),r({title:"Day completion removed"})},onError:n=>{r({title:"Failed to remove completion",description:n.message,variant:"destructive"})}}),a=fe({mutationFn:async({assignmentId:n})=>(await be("PATCH",`/api/training-assignments/${n}`,{status:"completed",completedDate:new Date().toISOString()})).json(),onSuccess:()=>{xe.invalidateQueries({queryKey:["/api/training-assignments"]}),r({title:"Employee certified successfully"})},onError:n=>{r({title:"Failed to certify employee",description:n.message,variant:"destructive"})}}),F=fe({mutationFn:async({assignmentId:n})=>{await be("DELETE",`/api/training-assignments/${n}`)},onSuccess:()=>{xe.invalidateQueries({queryKey:["/api/training-assignments"]}),r({title:"Assignment removed"})},onError:n=>{r({title:"Failed to remove assignment",description:n.message,variant:"destructive"})}});function L(n){const $=Yt(n.startDate),q=n.status!=="completed"&&$>14;return n.status==="completed"?e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate",style:{backgroundColor:"rgba(34,197,94,0.15)",color:"#7E8A55"},"data-testid":`badge-status-${n.id}`,children:"Completed"}):q?e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate",style:{backgroundColor:"rgba(239,68,68,0.15)",color:"#e07a66"},"data-testid":`badge-status-${n.id}`,children:"Overdue"}):e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate",style:{backgroundColor:"rgba(200, 147, 78,0.15)",color:"#c8934e"},"data-testid":`badge-status-${n.id}`,children:"In Progress"})}function te(n){const q={server:{bg:"rgba(200, 147, 78,0.15)",text:"#c8934e"},kitchen:{bg:"rgba(245,158,11,0.15)",text:"#e0b24e"}}[n]||{bg:"rgba(169, 154, 130,0.15)",text:"#a99a82"};return e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate",style:{backgroundColor:q.bg,color:q.text},children:n.charAt(0).toUpperCase()+n.slice(1)})}function Ce(n){n.preventDefault(),T.trim()&&Z.mutate({employeeName:T.trim(),trainerName:A.trim(),templateCategory:s,totalDays:s==="manager"?10:7,startDate:m})}const me=s==="server"?"Server Training":s==="bartender"?"Bartender Training":s==="manager"?"Manager Training":"Kitchen Training";return e.jsx(na,{open:x,onOpenChange:i,className:"mb-6",children:e.jsxs("div",{className:"rounded-lg",style:{backgroundColor:"#241812",border:"1px solid #382019"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap p-4 pb-2",children:[e.jsx(ia,{asChild:!0,children:e.jsxs(y,{variant:"ghost",className:"flex items-center gap-2 p-0 text-white","data-testid":"button-toggle-progress-panel",children:[e.jsx(xt,{className:"h-5 w-5",style:{color:"#c8934e"}}),e.jsx("span",{className:"text-lg font-semibold",children:"Employee Training Progress"}),e.jsx(ct,{className:`h-4 w-4 transition-transform ${x?"rotate-180":""}`,style:{color:"#a99a82"}})]})}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>C(!p),style:{borderColor:"#c8934e",color:"#c8934e"},"data-testid":"button-assign-training",children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"Assign Training"]})]}),e.jsx(la,{children:e.jsxs("div",{className:"px-4 pb-4 pt-2",children:[p&&e.jsx("div",{className:"rounded-lg p-4 mb-4",style:{backgroundColor:"#1c1210",border:"1px solid #382019"},children:e.jsxs("form",{onSubmit:Ce,className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-[180px]",children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",style:{color:"#a99a82"}
632,children:"Employee Name"}),e.jsx(g,{value:T,onChange:n=>v(n.target.value),placeholder:"Employee name",required:!0,className:"border-[#382019] text-white focus:ring-[#c8934e]",style:{backgroundColor:"#1c1210"},"data-testid":"input-employee-name"})]}),e.jsxs("div",{className:"flex-1 min-w-[180px]",children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",style:{color:"#a99a82"},children:"Trainer Name"}),e.jsx(g,{value:A,onChange:n=>D(n.target.value),placeholder:"Who will sign off",className:"border-[#382019] text-white focus:ring-[#c8934e]",style:{backgroundColor:"#1c1210"},"data-testid":"input-trainer-name"})]}),e.jsxs("div",{className:"min-w-[160px]",children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",style:{color:"#a99a82"},children:"Start Date"}),e.jsx(g,{type:"date",value:m,onChange:n=>I(n.target.value),className:"border-[#382019] text-white focus:ring-[#c8934e]",style:{backgroundColor:"#1c1210"},"data-testid":"input-start-date"})]}),e.jsx(y,{type:"submit",disabled:Z.isPending||!T.trim(),style:{backgroundColor:"#c8934e",color:"#1c1210"},"data-testid":"button-submit-assignment",children:Z.isPending?"Assigning...":"Submit"})]})}),R?e.jsx("div",{className:"space-y-3",children:[...Array(2)].map((n,$)=>e.jsx(zt,{className:"h-16 w-full",style:{backgroundColor:"#382019"}},$))}):z?e.jsx(Rt,{onRetry:()=>J(),title:"Couldn't load training assignments",testId:"assignments-error"}):B.length===0?e.jsxs("div",{className:"text-center py-6 text-sm",style:{color:"#a99a82"},children:[e.jsx(dt,{className:"h-8 w-8 mx-auto mb-2",style:{color:"#5a4e3a"}}),"No training assignments for ",me,'. Click "Assign Training" to get started.']}):e.jsx("div",{className:"space-y-3",children:B.map(n=>{const $=n.completions.length,q=Math.round($/n.totalDays*100),ae=P===n.id,S=n.completions.some(E=>E.dayNumber===7);return e.jsxs("div",{className:"rounded-lg p-4",style:{backgroundColor:"#1c1210",border:"1px solid #382019"},"data-testid":`assignment-card-${n.id}`,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"font-semibold text-sm truncate text-white","data-testid":`text-employee-name-${n.id}`,children:n.employeeName}),te(n.templateCategory),e.jsxs("span",{className:"text-sm",style:{color:"#a99a82"},children:["Day ",$," of ",n.totalDays," (",q,"%)"]}),L(n)]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[S&&n.status!=="completed"&&e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>a.mutate({assignmentId:n.id}),disabled:a.isPending,style:{borderColor:"#c8934e",color:"#c8934e"},"data-testid":`button-certify-${n.id}`,children:[e.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Certify"]}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>k(ae?null:n.id),className:"text-white","data-testid":`button-expand-${n.id}`,children:e.jsx(ct,{className:`h-4 w-4 transition-transform ${ae?"rotate-180":""}`})}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>F.mutate({assignmentId:n.id}),disabled:F.isPending,"data-testid":`button-delete-assignment-${n.id}`,children:e.jsx(Ht,{className:"h-4 w-4",style:{color:"#a99a82"}})})]})]}),e.jsx("div",{className:"h-2 rounded-full overflow-hidden",style:{backgroundColor:"#382019"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${q}%`,backgroundColor:n.status==="completed"?"#7E8A55":"#c8934e"}})}),ae&&e.jsx("div",{className:"mt-4 space-y-2",children:Array.from({length:n.totalDays},(E,U)=>U+1).map(E=>{const U=n.completions.find(ke=>ke.dayNumber===E),Q=Va(n.templateCategory,E);return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2",style:{borderBottom:"1px solid #382019"},"data-testid":`day-row-${n.id}-${E}`,children:[U?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-0",children:[e.jsx(pt,{className:"h-4 w-4 shrink-0",style:{color:"#7E8A55"}}),e.jsxs("span",{className:"text-sm text-white",children:["Day ",E,": ",Q]}),e.jsxs("span",{className:"text-xs",style:{color:"#a99a82"}
632,children:["Completed by ",U.signedOffBy," on ",Kt(U.completedAt).toLocaleDateString()]})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-0",children:[e.jsx(dt,{className:"h-4 w-4 shrink-0",style:{color:"#5a4e3a"}}),e.jsxs("span",{className:"text-sm",style:{color:"#a99a82"},children:["Day ",E,": ",Q]})]}),e.jsx("div",{children:U?e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>V.mutate({completionId:U.id}),disabled:V.isPending,className:"text-white","data-testid":`button-uncomplete-day-${n.id}-${E}`,children:"Undo"}):e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>G.mutate({assignmentId:n.id,dayNumber:E,signedOffBy:n.trainerName||"Manager"}),disabled:G.isPending,style:{borderColor:"#382019",color:"#c8934e"},"data-testid":`button-complete-day-${n.id}-${E}`,children:[e.jsx(Bt,{className:"h-3 w-3 mr-1"}),"Mark Complete"]})})]},E)})})]},n.id)})})]})})]})})}function Xa({role:s}){const{toast:r}=_e(),x=Qa[s],i=x?.icon||xt,[p,C]=b.useState(x?.responsibilities||""),[P,k]=b.useState("5 days"),[T,v]=b.useState(""),[A,D]=b.useState(!1),m=async()=>{if(!A){D(!0),v("");try{const I=await fetch("/api/training/generate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({role:s.charAt(0).toUpperCase()+s.slice(1),responsibilities:p.trim()||void 0,duration:P})});if(!I.ok)throw new Error("Failed to generate");const N=I.body?.getReader();if(!N)throw new Error("No reader");const R=new TextDecoder;let z="";for(;;){const{done:J,value:B}=await N.read();if(J)break;const G=R.decode(B).split(` 633`);for(const V of G)if(V.startsWith("data: "))try{const a=JSON.parse(V.slice(6));a.content&&(z+=a.content,v(z))}catch{}}}catch{r({title:"Failed to generate training content",variant:"destructive"})}finally{D(!1)}}};return e.jsxs("div",{className:"space-y-6",style:{animation:"scheduleStaggerIn 0.3s ease-out both"},children:[e.jsxs("div",{className:"rounded-lg p-6",style:{backgroundColor:"#241812",border:"1px solid #382019"},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:"rgba(200, 147, 78,0.15)"},children:e.jsx(ie,{className:"h-5 w-5",style:{color:"#c8934e"}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-white text-lg",children:"Quick-Start Outline"}),e.jsx("p",{className:"text-sm",style:{color:"#a99a82"},children:"Generate a training outline for this role instantly"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1.5 block",style:{color:"#a99a82"},children:"Key Responsibilities"}),e.jsx(H,{value:p,onChange:I=>C(I.target.value),placeholder:"Describe the key responsibilities for this role...",rows:3,className:"border-[#382019] text-white focus:ring-[#c8934e] resize-none",style:{backgroundColor:"#1c1210"},"data-testid":`textarea-responsibilities-${s}`})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{className:"text-sm font-medium mb-1.5 block",style:{color:"#a99a82"},children:"Training Duration"}),e.jsxs(ye,{value:P,onValueChange:k,children:[e.jsx(ve,{className:"border-[#382019] text-white",style:{backgroundColor:"#1c1210"},"data-testid":`select-duration-${s}`,children:e.jsx(je,{})}),e.jsxs(Ne,{children:[e.jsx(Y,{value:"3 days",children:"3 Days"}),e.jsx(Y,{value:"5 days",children:"5 Days"}),e.jsx(Y,{value:"7 days",children:"7 Days"}),e.jsx(Y,{value:"10 days",children:"10 Days"}),e.jsx(Y,{value:"14 days",children:"14 Days"})]})]})]}),e.jsx(y,{onClick:m,disabled:A,style:{backgroundColor:"#c8934e",color:"#1c1210"},"data-testid":`button-generate-${s}`,children:A?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Generate"]})})]})]}),T&&e.jsxs("div",{className:"mt-6",children:[e.jsx("div",{className:"rounded-lg p-4",style:{backgroundColor:"#1c1210",border:"1px solid #382019",borderLeftWidth:"3px",borderLeftColor:"#c8934e",animation:A?"goldStreamBorder 2s ease-in-out infinite":"none"},children:e.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:e.jsx(vt,{children:T})})}),e.jsx("div",{className:"flex gap-2 mt-3",children:e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(T),r({title:"Copied to clipboard"})},style:{borderColor:"#382019",color:"#a99a82"},"data-testid":`button-copy-generated-${s}`,children:[e.jsx(He,{className:"h-3 w-3 mr-1"}),"Copy"]})})]})]}),e.jsxs("div",{className:"rounded-lg p-6",style:{backgroundColor:"#241812",border:"1px solid #382019"},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(i,{className:"h-6 w-6 gold-text"}),e.jsxs("h3",{className:"font-semibold text-white text-lg",children:[s.charAt(0).toUpperCase()+s.slice(1)," Training"]}),e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate italic",style:{backgroundColor:"rgba(169, 154, 130,0.15)",color:"#a99a82"}
633,children:"Soon"})]}),e.jsx("p",{className:"text-sm mb-3",style:{color:"#a99a82"},children:x?.description}),e.jsx("p",{className:"text-xs",style:{color:"#8a7d66"},children:"Until this track is available, use the Server or Kitchen training programs as a starting framework and customize with your own notes."})]})]})}const gt=["restaurantName","ownerNames","restaurantAddress","restaurantPhone","restaurantEmail","missionStatement","conceptCuisine","generalManager","posSystem","operatingHours","uniformDiningRoom","uniformKitchen","employeeMealPolicy","signatureDishesFoh","brandVoice"];function es(s){return s?gt.filter(r=>{const x=s[r];return x&&String(x).trim().length>0}).length:0}function ts(s,r,x){const i=[];return s.restaurantName&&i.push(`Restaurant Name: ${s.restaurantName}`),s.conceptCuisine&&i.push(`Concept/Cuisine: ${s.conceptCuisine}`),s.missionStatement&&i.push(`Mission: ${s.missionStatement}`),s.brandVoice&&i.push(`Brand Voice: ${s.brandVoice}`),s.operatingHours&&i.push(`Operating Hours: ${s.operatingHours}`),s.posSystem&&i.push(`POS System: ${s.posSystem}`),s.schedulingApp&&i.push(`Scheduling App: ${s.schedulingApp}`),s.uniformDiningRoom&&i.push(`Dining Room Uniform: ${s.uniformDiningRoom}`),s.uniformKitchen&&i.push(`Kitchen Uniform: ${s.uniformKitchen}`),s.employeeMealPolicy&&i.push(`Meal Policy: ${s.employeeMealPolicy}`),s.tippingStructure&&i.push(`Tipping: ${s.tippingStructure}`),s.signatureDishesFoh&&i.push(`Signature Dishes (FOH): ${s.signatureDishesFoh}`),s.signatureDishesBoh&&i.push(`Signature Dishes (BOH): ${s.signatureDishesBoh}`),s.breakPolicy&&i.push(`Break Policy: ${s.breakPolicy}`),s.alcoholPolicy&&i.push(`Alcohol Policy: ${s.alcoholPolicy}`),s.kitchenStations?.length&&i.push(`Kitchen Stations: ${s.kitchenStations.join(", ")}`),s.servicePeriods?.length&&i.push(`Service Periods: ${s.servicePeriods.join(", ")}`),s.allergenOptions?.length&&i.push(`Allergen Options: ${s.allergenOptions.join(", ")}`),`You are a restaurant training consultant. Rewrite the following training content so it is fully personalized for this specific restaurant. Replace all generic references with the restaurant's actual details. Keep the same structure and training objectives but make every example, policy reference, and procedure specific to this restaurant. 634 635RESTAURANT INFO: 636${i.join(` 637`)} 638 639ORIGINAL TRAINING CONTENT (Title: "${r.title}", Section: "${r.section}"): 640${x} 641 642Rewrite this content personalized for ${s.restaurantName||"this restaurant"}. Output in markdown format.`}function qe(s){return`personalized-template-${s}`}function as(s){return!!localStorage.getItem(qe(s))}function Ot(s){return localStorage.getItem(qe(s))}function ss({template:s,content:r,restaurantName:x,onClose:i}){const{toast:p}=_e(),[C,P]=b.useState(""),[k,T]=b.useState(""),[v,A]=b.useState(!1),D=async()=>{if(!(!C.trim()||v)){A(!0),T("");try{const N=`Original training content for "${s.title}" (${s.section}): 643 644${r.slice(0,1500)}`,R=await fetch("/api/consultant/ask",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({question:`Customize this training content based on: ${C}`,context:N})});if(!R.ok)throw new Error("Failed");const z=R.body?.getReader();if(!z)throw new Error("No reader");const J=new TextDecoder;let B="";for(;;){const{done:Z,value:G}=await z.read();if(Z)break;const V=J.decode(G);for(const a of V.split(` 645`))if(a.startsWith("data: "))try{const F=JSON.parse(a.slice(6));F.content&&(B+=F.content,T(B))}catch{}}}catch{p({title:"Failed to customize",variant:"destructive"})}finally{A(!1)}}},m=()=>{if(!k)return;const N=`template-notes-${s.id}`;localStorage.setItem(N,k),p({title:"Content saved as notes"}),i()},I=()=>{if(!k)return;const N=`template-notes-${s.id}`,R=localStorage.getItem(N)||"";localStorage.setItem(N,R?`${R} 646 647--- 648 649${k}`:k),p({title:"Added to notes"}),i()};return e.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",style:{animation:"scheduleStaggerIn 0.2s ease-out both"},children:[e.jsxs("div",{className:"w-[380px] max-w-full h-full overflow-y-auto",style:{backgroundColor:"#241812",borderLeft:"1px solid #382019"},children:[e.jsxs("div",{className:"p-4 flex items-center justify-between",style:{borderBottom:"1px solid #382019"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-4 w-4",style:{color:"#c8934e"}}),e.jsx("span",{className:"font-semibold text-white",children:"Customize This Section"})]}),e.jsx(y,{variant:"ghost",size:"icon",onClick:i,className:"text-white","data-testid":"button-close-customize",children:e.jsx($e,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"rounded-lg p-3",style:{backgroundColor:"#1c1210",border:"1px solid #382019"},children:[e.jsxs("p",{className:"text-xs",style:{color:"#a99a82"}
649,children:["Customizing: ",e.jsx("span",{className:"text-white font-medium",children:s.title})]}),x&&e.jsxs("p",{className:"text-xs mt-1",style:{color:"#a99a82"},children:["For: ",e.jsx("span",{style:{color:"#c8934e"},children:x})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1.5 block",style:{color:"#a99a82"},children:"What would you like to change?"}),e.jsx(H,{value:C,onChange:N=>P(N.target.value),placeholder:"e.g., Adjust for a fast-casual concept with counter service...",rows:4,className:"border-[#382019] text-white focus:ring-[#c8934e] resize-none",style:{backgroundColor:"#1c1210"},"data-testid":"textarea-customize-prompt"})]}),e.jsx(y,{onClick:D,disabled:v||!C.trim(),className:"w-full",style:{backgroundColor:"#c8934e",color:"#1c1210"},"data-testid":"button-customize-generate",children:v?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Generate Customization"]})}),k&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg p-3",style:{backgroundColor:"#1c1210",border:"1px solid #382019",borderLeftWidth:"3px",borderLeftColor:"#c8934e"},children:e.jsx("div",{className:"prose prose-sm prose-invert max-w-none text-sm",children:e.jsx(vt,{children:k})})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:I,style:{borderColor:"#382019",color:"#c8934e"},"data-testid":"button-add-as-notes",children:[e.jsx(qt,{className:"h-3 w-3 mr-1"}),"Add as Notes"]}),e.jsx(y,{variant:"outline",size:"sm",onClick:m,style:{borderColor:"#382019",color:"#a99a82"},"data-testid":"button-replace-section",children:"Replace Section"})]})]})]})]}),e.jsx("div",{className:"flex-1 bg-black/50",onClick:i})]})}function Ys(){const[,s]=Mt(),{user:r,logout:x}=Qt(),{toast:i}=_e(),{isFreeTier:p}=ha(),{onboardingStep:C,isOnboarding:P,advanceStep:k}=_t(),[T,v]=b.useState(!1),[A,D]=b.useState(""),[m,I]=b.useState(null),[N,R]=b.useState("server"),[z,J]=b.useState(!1),[B,Z]=b.useState(""),[G,V]=b.useState(!1),[a,F]=b.useState(!1),[L,te]=b.useState(""),[Ce,me]=b.useState(!1),[n,$]=b.useState(!1),[q,ae]=b.useState({}),[S,E]=b.useState({print:"idle",pdf:"idle",docx:"idle"}),[U]=b.useState(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("from")==="signup");b.useEffect(()=>{U&&De("signup_manuals_viewed")},[U]);const{data:Q,isLoading:ke,isError:le,refetch:l}=pe({queryKey:["/api/templates"]}),{data:se}=pe({queryKey:["/api/handbook-settings"]}),re=pe({queryKey:["/api/templates/content",m?.id],enabled:m!=null,queryFn:async()=>(await $t([m.id])).get(m.id)??""}).data??"",Se=es(se),Me=Se>=5;b.useEffect(()=>{const o={};Q?.forEach(j=>{as(j.id)&&(o[j.id]=!0)}),ae(o)},[Q]),b.useEffect(()=>{if(m){const o=Ot(m.id);o?(te(o),$(!0)):(te(""),$(!1))}},[m]);const Ie=Q?.filter(o=>o.category==="server")||[],ze=Q?.filter(o=>o.category==="kitchen")||[],Re=Q?.filter(o=>o.category==="bartender")||[],t=Q?.filter(o=>o.category==="manager")||[],f=N==="server"?Ie:N==="bartender"?Re:N==="manager"?t:ze;b.useEffect(()=>{f.length>0&&!m&&I(f[0])},[Q]),b.useEffect(()=>{f.length>0?I(f[0]):I(null)},[N]),b.useEffect(()=>{if(m){const o=`template-notes-${m.id}`;Z(localStorage.getItem(o)||"")}},[m]);const w=f.reduce((o,j)=>(o[j.section]||(o[j.section]=[]),o[j.section].push(j),o),{}),ne=()=>N==="server"?"Server Training Manual":N==="bartender"?"Bartender Training Manual":N==="manager"?"Manager Training Manual":"Kitchen Training Manual",Te=async()=>{const o=await $t(f.map(j=>j.id));return{restaurantName:se?.restaurantName||r?.restaurantName||"Restaurant",ownerName:se?.ownerNames||r?.firstName||"Owner",manualTitle:ne(),templates:f.map(j=>({title:ee(j.title,r?.restaurantName),section:j.section,content:ee(o.get(j.id)??"",r?.restaurantName),keyPoints:j.keyPoints?.map(O=>ee(O,r?.restaurantName)),contentType:j.contentType,sequenceOrder:j.sequenceOrder}))}},ce=(o,j=2e3)=>{setTimeout(()=>E(O=>({...O,[o]:"idle"})),j)},Pe=async o=>{if(P&&C===1){try{await k(2)}catch{}D(o),v(!0);return}!p||st()||typeof window<"u"&&localStorage.getItem("hasSeenPostGenerationModal")||(D(o),v(!0),typeof window<"u"&&(localStorage.setItem("hasSeenPostGenerationModal","true"),localStorage.setItem("hasExportedManual","true")))},Ue=async()=>{E(o=>({...o,print:"loading"}));try{ht(await Te()),E(o=>({...o,print:"success"})),ce("print"),De("manual_exported",{format:"print",template:m?.title}),Pe(m?.title||"Training Manual")}catch{E(o=>({...o,print:"error"})),i({title:"Print failed. Please try again.",variant:"destructive"}),ce("print",3e3)}},Ke=async()=>{E(o=>({...o,pdf:"loading"}));try{await Ba(await Te()),E(o=>({...o,pdf:"success"})),i({title:"In the print dialog, select 'Save as PDF' as your destination"}),ce("pdf"),De("manual_exported",{format:"pdf",template:m?.title}),Pe(m?.title||"Training Manual")}catch{E(o=>({...o,pdf:"error"})),i({title:"PDF generation failed. Please try again.",variant:"destructive"}),ce("pdf",3e3)}},Ye=async()=>{E(o=>({...o,docx:"loading"}));try{await qa(await Te()),E(o=>({...o,docx:"success"})),i({title:"Document exported successfully"}),ce("docx"),De("manual_exported",{format:"docx",template:m?.title}),Pe(m?.title||"Training Manual")}catch{E(o=>({...o,docx:"error"})),i({title:"Export failed. Please try again.",variant:"destructive"}),ce("docx",3e3)}},Ve=async()=>
649{if(!(!m||a)){if(!Me){me(!0);return}me(!1),F(!0),te(""),$(!0);try{const o=ts(se,m,re),j=await fetch("/api/consultant/ask",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({question:o})});if(!j.ok)throw new Error("Failed to generate");const O=j.body?.getReader();if(!O)throw new Error("No reader");const he=new TextDecoder;let X="";for(;;){const{done:Ae,value:tt}=await O.read();if(Ae)break;const Ut=he.decode(tt).split(` 650`);for(const jt of Ut)if(jt.startsWith("data: "))try{const Nt=JSON.parse(jt.slice(6));Nt.content&&(X+=Nt.content,te(X))}catch{}}De("manual_generated",{template:m.title})}catch{i({title:"Failed to personalize content",variant:"destructive"}),$(!1)}finally{F(!1)}}},Qe=()=>{!m||!L||(localStorage.setItem(qe(m.id),L),ae(o=>({...o,[m.id]:!0})),i({title:"Personalized version saved"}))},Je=()=>{m&&(localStorage.removeItem(qe(m.id)),ae(o=>{const j={...o};return delete j[m.id],j}),te(""),$(!1),i({title:"Personalized version removed"}))},Ze=()=>{if(!m)return;const o=`template-notes-${m.id}`;B.trim()?localStorage.setItem(o,B):localStorage.removeItem(o),i({title:"Notes saved"})},Xe=["host","busser"].includes(N),et=o=>o==="server"?Ie.length>0:o==="kitchen"?ze.length>0:o==="bartender"?Re.length>0:o==="manager"?t.length>0:!1;return e.jsxs("div",{className:"min-h-screen",style:{backgroundColor:"#1c1210"},children:[e.jsx("header",{className:"border-b sticky top-0 z-50 backdrop-blur",style:{borderColor:"#382019",backgroundColor:"rgba(28, 18, 16,0.95)",paddingTop:"env(safe-area-inset-top, 0px)"},children:e.jsxs("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(at,{href:"/",children:e.jsx(y,{variant:"ghost",size:"icon","data-testid":"button-back",className:"text-white",children:e.jsx(Jt,{className:"h-4 w-4"})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(nt,{className:"h-6 w-6",style:{color:"#c8934e"}}),e.jsx("span",{className:"font-bold text-white",children:"Training Templates"})]})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(ca,{children:[e.jsxs(da,{className:"flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer","data-testid":"button-user-menu",children:[e.jsxs(aa,{className:"h-8 w-8",children:[e.jsx(sa,{src:r?.profileImageUrl||void 0}),e.jsx(ra,{style:{backgroundColor:"#382019",color:"#c8934e"},children:r?.firstName?.[0]||r?.email?.[0]||"U"})]}),e.jsx("span",{className:"text-sm hidden md:inline text-white",children:r?.firstName||r?.email||"User"}),e.jsx(ct,{className:"h-4 w-4",style:{color:"#a99a82"}})]}),e.jsxs(ua,{align:"end",className:"w-56",children:[e.jsx(ma,{children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:[r?.firstName," ",r?.lastName]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r?.email})]})}),e.jsx(pa,{}),e.jsxs(Ct,{onClick:()=>s("/profile"),className:"cursor-pointer","data-testid":"button-profile",children:[e.jsx(wa,{className:"mr-2 h-4 w-4"}),"Account Settings"]}),e.jsxs(Ct,{onClick:()=>x(),className:"text-destructive focus:text-destructive cursor-pointer","data-testid":"button-logout",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"Sign Out"]})]})]})})]})}),e.jsxs("main",{className:"container mx-auto px-4 py-6",children:[U&&e.jsxs("div",{className:"mb-6 p-5 rounded-xl",style:{background:"rgba(169, 112, 47,0.08)",border:"1px solid rgba(169, 112, 47,0.35)"},"data-testid":"banner-signup-welcome",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ie,{className:"h-4 w-4",style:{color:"#c8934e"}}),e.jsxs("p",{className:"text-base font-semibold text-white",children:[r?.firstName?`${r.firstName}, your`:"Your"," training manuals are ready."]})]}),e.jsxs("p",{className:"text-sm",style:{color:"#a99a82"},children:["Every manual below is already written for"," ",e.jsx("strong",{style:{color:"#c8934e"},children:r?.restaurantName||"your restaurant"})," ","â open one, then print it or hand it to a new hire today."]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2 text-white",children:"Training Templates"}),e.jsx("p",{style:{color:"#a99a82"}
650,children:r?.restaurantName?e.jsxs(e.Fragment,{children:["Personalized for ",e.jsx("strong",{style:{color:"#c8934e"},children:r.restaurantName}),". Build consistent, repeatable training systems."]}):e.jsx(e.Fragment,{children:"Build consistent, repeatable training systems using proven restaurant frameworks."})})]}),P&&C===1&&e.jsxs("div",{className:"mb-6 rounded-lg p-5",style:{background:"#1b160f",borderLeft:"3px solid #a9702f"},"data-testid":"onboarding-step2-spotlight",children:[e.jsx("p",{className:"text-sm font-semibold text-white mb-1",children:"Step 2 of 3 â Generate your first training manual"}),e.jsxs("p",{className:"text-xs leading-relaxed mb-3",style:{color:"#a99a82"},children:["Pick any manual below and click Generate. It will be personalized to ",r?.restaurantName||"your restaurant"," automatically. Most operators start with the Server Manual. It's the most used and takes about 30 seconds."]}),e.jsx(y,{size:"sm",style:{backgroundColor:"#a9702f",color:"white"},onClick:()=>R("server"),"data-testid":"button-goto-server-manual",children:"Go to Server Manual"})]}),e.jsx(Ja,{}),e.jsx("div",{className:"mb-6 overflow-x-auto",children:e.jsx("div",{className:"flex gap-1 min-w-max pb-2",children:[{value:"training-log",label:"Training Log",icon:It,isLink:!0},{value:"server",label:"Server",icon:Oe},{value:"kitchen",label:"Kitchen",icon:nt},{value:"host",label:"Host",icon:Oe,comingSoon:!0},{value:"bartender",label:"Bartender",icon:bt,comingSoon:!1},{value:"manager",label:"Manager",icon:yt,comingSoon:!1},{value:"busser",label:"Busser",icon:Wt,comingSoon:!0},{value:"handbook",label:"Handbook",icon:we}].map(o=>{const j=N===o.value,O=et(o.value);return o.isLink?e.jsx(at,{href:"/training-log",children:e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2.5 rounded-lg text-sm font-medium transition-colors whitespace-nowrap",style:{backgroundColor:"transparent",borderBottom:"2px solid transparent",color:"#c8934e"},"data-testid":`tab-${o.value}`,children:[e.jsx(o.icon,{className:"h-4 w-4"}),o.label]})},o.value):e.jsxs("button",{onClick:()=>R(o.value),className:"flex items-center gap-2 px-4 py-2.5 rounded-lg text-sm font-medium transition-colors whitespace-nowrap",style:{backgroundColor:j?"#241812":"transparent",borderBottom:j?"2px solid #c8934e":"2px solid transparent",color:j?"#efe7d8":o.comingSoon?"#8a7d66":"#a99a82",fontStyle:o.comingSoon?"italic":"normal"},"data-testid":`tab-${o.value}`,children:[e.jsx(o.icon,{className:"h-4 w-4"}),o.label,o.comingSoon&&e.jsx(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate text-[13px] px-1.5 py-0",style:{backgroundColor:"rgba(169, 154, 130,0.15)",color:"#8a7d66"},children:"Soon"}),!o.comingSoon&&!j&&O&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:"#c8934e"}})]},o.value)})})}),N==="handbook"?e.jsx(Fa,{user:r}):Xe?e.jsx(Xa,{role:N}):e.jsxs("div",{children:[e.jsx(Za,{activeCategory:N}),!Me&&e.jsxs("div",{className:"rounded-lg p-4 mb-6 flex flex-wrap items-center justify-between gap-3",style:{backgroundColor:"rgba(200, 147, 78,0.08)",border:"1px solid rgba(200, 147, 78,0.25)"},"data-testid":"setup-completeness-gate",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Le,{className:"h-5 w-5 shrink-0",style:{color:"#c8934e"}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Complete Your Restaurant Setup"}),e.jsxs("p",{className:"text-xs",style:{color:"#a99a82"},children:["Fill in at least 5 required fields in the Handbook Setup tab to unlock personalized training content. Currently ",Se," of ",gt.length," fields completed."]})]})]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>R("handbook"),style:{borderColor:"#c8934e",color:"#c8934e"},"data-testid":"button-go-to-setup-banner",children:"Go to Setup"})]}),f.length>0&&e.jsxs("div",{className:"rounded-lg flex flex-wrap items-center gap-3 mb-6 sticky z-30",style:{backgroundColor:"#241812",borderBottom:"1px solid #a9702f",padding:"12px 24px",top:"73px"},"data-testid":"manual-action-bar",children:[e.jsx("span",{className:"text-sm font-semibold text-white mr-2 hidden sm:inline",children:ne()}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:Ue,disabled:S.print==="loading",style:{borderColor:S.print==="error"?"#c8934e":S.print==="success"?"#7E8A55":"#a9702f",color:S.print==="error"?"#c8934e":S.print==="success"?"#7E8A55":"#c8934e",backgroundColor:"transparent"},"data-testid":"btn-print-full-manual",children:[S.print==="loading"?e.jsx(de,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),S.print==="loading"?"Preparing...":S.print==="success"?"Done":S.print==="error"?"Try Again":"Print"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:Ke,disabled:S.pdf==="loading",style:{borderColor:S.pdf==="error"?"#c8934e":S.pdf==="success"?"#7E8A55":"#a9702f",color:S.pdf==="error"?"#c8934e":S.pdf==="success"?"#7E8A55":"#c8934e",backgroundColor:"transparent"},"data-testid":"btn-download-pdf",children:[S.pdf==="loading"?e.jsx(de,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(Lt,{className:"h-3.5 w-3.5 mr-1.5"}),S.pdf==="loading"?"Generating...":S.pdf==="success"?"Done":S.pdf==="error"?"Try Again":"Download PDF"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:Ye,disabled:S.docx==="loading",style:{borderColor:S.docx==="error"?"#c8934e":S.docx==="success"?"#7E8A55":"#a9702f",color:S.docx==="error"?"#c8934e":S.docx==="success"?"#7E8A55":"#c8934e",backgroundColor:"transparent"},"data-testid":"btn-export-docx",children:[S.docx==="loading"?e.jsx(de,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(ka,{className:"h-3.5 w-3.5 mr-1.5"}),S.docx==="loading"?"Preparing...":S.docx==="success"?"Done":S.docx==="error"?"Try Again":"Share / Export"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsxs("div",{className:"rounded-lg",style:{backgroundColor:"#241812",border:"1px solid #382019"},children:[e.jsxs("div",{className:"p-4",style:{borderBottom:"1px solid #382019"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-5 w-5",style:{color:"#c8934e"}}),e.jsx("span",{className:"font-semibold text-white text-lg",children:N==="server"?"Server Manual":N==="bartender"?"Bartender Manual":N==="manager"?"Manager Manual":"Kitchen Manual"})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:"#a99a82"}
650,children:N==="manager"?"10-day certification program with structured daily objectives":"7-day training program with structured daily objectives"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:Ve,disabled:a||!m,className:"mt-3 w-full",style:{borderColor:"#c8934e",color:"#c8934e",border:"1px solid rgba(200, 147, 78,0.4)"},"data-testid":"button-regenerate-personalized",children:a?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"h-4 w-4 mr-2 animate-spin"}),"Personalizing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Regenerate with My Restaurant Info"]})}),Ce&&e.jsxs("div",{className:"mt-3 rounded-lg p-3",style:{backgroundColor:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.25)"},"data-testid":"setup-callout",children:[e.jsxs("p",{className:"text-xs mb-2",style:{color:"#e89484"},children:["You need at least 5 required fields filled in the Handbook Setup to personalize content. Currently ",Se," of ",gt.length," completed."]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>{me(!1),R("handbook")},style:{borderColor:"#c8934e",color:"#c8934e"},"data-testid":"button-go-to-setup-callout",children:"Go to Setup"})]})]}),e.jsx(Ft,{className:"h-[60vh]",children:ke?e.jsx("div",{className:"p-4 space-y-4",children:[...Array(6)].map((o,j)=>e.jsx(zt,{className:"h-16 w-full",style:{backgroundColor:"#382019"}},j))}):le?e.jsx("div",{className:"p-4",children:e.jsx(Rt,{onRetry:()=>l(),title:"Couldn't load templates",testId:"templates-error"})}):e.jsx("div",{className:"p-2",children:Object.entries(w).map(([o,j])=>e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"px-2 py-1 text-xs font-semibold uppercase tracking-wide",style:{color:"#c8934e"},children:o}),j.map(O=>{const he=Wa[O.contentType]||We,X=m?.id===O.id,Ae=Fe[O.contentType]||Fe.overview,tt=q[O.id];return e.jsx("button",{onClick:()=>I(O),className:"w-full text-left p-3 rounded-md transition-colors",style:{backgroundColor:X?"rgba(200, 147, 78,0.08)":"transparent",borderLeft:X?"3px solid #c8934e":"3px solid transparent"},"data-testid":`template-item-${O.id}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{style:{color:X?"#c8934e":"#a99a82"},children:e.jsx(he,{className:"h-4 w-4 mt-0.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-sm truncate",style:{color:X?"#efe7d8":"#c0c0c0"},children:O.title}),tt&&e.jsx(pt,{className:"h-3.5 w-3.5 shrink-0",style:{color:"#c8934e"},"data-testid":`personalized-check-${O.id}`})]}),e.jsx("span",{className:"inline-block mt-1 text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:Ae.bg,color:Ae.text},children:Ae.label})]})]})},O.id)})]},o))})})]})}),e.jsx("div",{className:"lg:col-span-2",children:m?e.jsxs(Na,{title:N==="server"?"Server Manual":N==="bartender"?"Bartender Manual":N==="manager"?"Manager Manual":"Kitchen Manual",meta:m.section,testid:"template-sheet",folio:e.jsx("span",{children:n&&L?"Personalized · read it before you print it":"Stock copy · make it yours"}),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsx("h2",{className:"text-[26px] leading-tight font-semibold",style:{fontFamily:"'Fraunces', Georgia, serif",color:W.full},children:ee(m.title,r?.restaurantName)}),(()=>{const o=Fe[m.contentType]||Fe.overview;return e.jsx("span",{className:"text-[11px] uppercase px-1.5 py-0.5 mt-1.5",style:{border:"1px solid rgba(41,34,26,0.28)",borderRadius:"2px",color:W.mid,letterSpacing:"0.14em"},children:o.label})})()]}),m.keyPoints&&m.keyPoints.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h4",{className:"paper-title mb-2",children:"Key Points"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:m.keyPoints.map((o,j)=>e.jsx("span",{className:"text-[12px] px-2 py-0.5",style:{border:"1px solid rgba(41,34,26,0.22)",borderRadius:"2px",color:W.mid},children:ee(o,r?.restaurantName)},j))})]}),n&&L?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mt-5 mb-3",children:[e.jsxs(ue,{variant:"secondary",className:"no-default-hover-elevate no-default-active-elevate",style:{backgroundColor:"transparent",border:"1px solid rgba(41,34,26,0.28)",borderRadius:"2px",color:W.mid},children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Personalized"]}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>$(!1),style:{color:W.mid,borderRadius:"2px"},"data-testid":"button-show-original",children:"View Original"})]}),e.jsx("div",{className:"pl-4",style:{borderLeft:"3px solid var(--ledger-red)",animation:a?"goldStreamBorder 2s ease-in-out infinite":"none"},"data-testid":"personalized-content",children:e.jsx("div",{className:"prose prose-sm max-w-none consultant-ink text-[15px] leading-[1.75]",children:e.jsx(vt,{children:L})})}),!a&&L&&e.jsxs("div",{className:"flex flex-wrap gap-2 mt-4",children:[e.jsxs(y,{size:"sm",onClick:Qe,style:{backgroundColor:"var(--oxblood)",color:"#f2e9d8",borderRadius:"2px"},"data-testid":"button-save-personalized",children:[e.jsx(pt,{className:"h-3 w-3 mr-1"}),"Save Personalized Version"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(L),i({title:"Copied to clipboard"})},style:{borderColor:"rgba(41,34,26,0.28)",color:W.full,backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"button-copy-personalized",children:[e.jsx(He,{className:"h-3 w-3 mr-1"}),"Copy"]}),q[m.id]&&e.jsxs(y,{variant:"ghost",size:"sm",onClick:Je,style:{color:W.mid,borderRadius:"2px"},"data-testid":"button-clear-personalized",children:[e.jsx(Ht,{className:"h-3 w-3 mr-1"}),"Remove Saved"]})]})]}):e.jsxs("div",{children:[q[m.id]&&e.jsx("div",{className:"flex items-center gap-2 mt-5",children:e.jsxs(y,{variant:"ghost",size:"sm",onClick:()=>{const o=Ot(m.id);o&&(te(o),$(!0))},style:{color:"var(--brass-line)",borderRadius:"2px"}
650,"data-testid":"button-show-personalized",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"View Personalized Version"]})}),e.jsx("div",{className:"whitespace-pre-wrap text-[15px] leading-[1.75] mt-5 pt-5",style:{color:W.full,borderTop:"1px solid rgba(41,34,26,0.12)"},"data-testid":"template-content",children:ee(re,r?.restaurantName)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-6 pt-4",style:{borderTop:"1px solid rgba(41,34,26,0.22)"},children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(ee(re,r?.restaurantName)),i({title:"Copied to clipboard"})},style:{borderColor:"rgba(41,34,26,0.28)",color:W.full,backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"btn-copy-template",children:[e.jsx(He,{className:"h-3 w-3 mr-1"}),"Copy"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>J(!z),style:{borderColor:z?"var(--brass-line)":"rgba(41,34,26,0.28)",color:z?"var(--brass-line)":W.full,backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"btn-edit-notes",children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"Edit Notes"]}),st()&&e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>{Xt(),ea({title:m.title,text:`Training Template: ${m.title} 651 652${re.slice(0,200)}...`,url:"https://restaurantai.consulting/templates"})},style:{borderColor:"rgba(41,34,26,0.28)",color:W.full,backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"btn-share-template",children:[e.jsx(Zt,{className:"h-3 w-3 mr-1"}),"Share"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>{ht({restaurantName:se?.restaurantName||r?.restaurantName||"Restaurant",ownerName:se?.ownerNames||r?.firstName||"Owner",manualTitle:ne(),templates:[{title:ee(m.title,r?.restaurantName),section:m.section,content:ee(re,r?.restaurantName),keyPoints:m.keyPoints?.map(o=>ee(o,r?.restaurantName)),contentType:m.contentType,sequenceOrder:1}]})},style:{borderColor:"rgba(41,34,26,0.28)",color:W.full,backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"btn-print-template",children:[e.jsx(Be,{className:"h-3 w-3 mr-1"}),"Print"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>V(!0),style:{borderColor:"var(--ledger-red)",color:"var(--ledger-red)",backgroundColor:"transparent",borderRadius:"2px"},"data-testid":"btn-customize-template",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Customize"]})]}),z&&e.jsxs("div",{className:"mt-4",style:{animation:"scheduleStaggerIn 0.2s ease-out both"},children:[e.jsx(H,{value:B,onChange:o=>Z(o.target.value),placeholder:"Add your notes for this template...",rows:4,className:"resize-none mb-2 placeholder:text-[rgba(41,34,26,0.38)] focus-visible:ring-[#8a744c]",style:{backgroundColor:"rgba(255,255,255,0.45)",borderColor:"rgba(41,34,26,0.28)",color:W.full,borderRadius:"2px"},"data-testid":"textarea-edit-notes"}),e.jsx(y,{size:"sm",onClick:Ze,style:{backgroundColor:"var(--oxblood)",color:"#f2e9d8",borderRadius:"2px"},"data-testid":"btn-save-notes",children:"Save Notes"}),B&&e.jsxs("div",{className:"mt-3 p-3",style:{backgroundColor:"rgba(41,34,26,0.05)",borderLeft:"2px solid var(--brass-line)",borderRadius:"2px"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(qt,{className:"h-3 w-3",style:{color:"var(--brass-line)"}}),e.jsx("span",{className:"text-xs font-medium",style:{color:W.mid},children:"Saved Notes"})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",style:{color:W.full},children:B})]})]})]}):e.jsx("div",{className:"rounded-lg h-full flex items-center justify-center min-h-[400px]",style:{backgroundColor:"#241812",border:"1px solid #382019"},children:e.jsxs("div",{className:"text-center",children:[e.jsx(we,{className:"h-12 w-12 mx-auto mb-4",style:{color:"#5a4e3a"}}),e.jsx("h3",{className:"font-semibold text-lg mb-2 text-white",children:"Select a Template"}),e.jsx("p",{className:"text-sm max-w-xs",style:{color:"#a99a82"},children:"Choose a training template from the list to view its contents."})]})})})]})]})]}),G&&m&&e.jsx(ss,{template:m,content:ee(re,r?.restaurantName),restaurantName:r?.restaurantName,onClose:()=>V(!1)}),T&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},"data-testid":"modal-post-generation",children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-8 rounded-xl text-center",style:{backgroundColor:"#241812",border:"1px solid rgba(200, 147, 78,0.3)"}
652,children:[e.jsx("div",{className:"mx-auto w-14 h-14 rounded-full flex items-center justify-center mb-5",style:{backgroundColor:"rgba(200, 147, 78,0.1)"},children:e.jsx(we,{className:"h-7 w-7",style:{color:"#c8934e"}})}),P&&C===2?e.jsxs(e.Fragment,{children:[e.jsxs("h2",{className:"text-xl font-bold mb-2 text-white","data-testid":"text-post-gen-title",children:["Your ",A," is ready."]}),e.jsxs("p",{className:"text-sm mb-2",style:{color:"#a99a82"},children:["It's personalized to ",r?.restaurantName||"your restaurant"," and ready to print."]}),e.jsx("p",{className:"text-sm mb-6",style:{color:"#c8934e"},children:"One more step â meet your Consultant. The Consultant knows your restaurant now. Ask it anything."}),e.jsx(y,{className:"w-full mb-4 font-semibold",style:{backgroundColor:"#c8934e",color:"#1c1210"},onClick:()=>{v(!1),s("/consultant")},"data-testid":"btn-post-gen-consultant",children:"Ask the Consultant"}),e.jsx("button",{onClick:()=>v(!1),className:"text-xs underline underline-offset-4 bg-transparent border-none cursor-pointer",style:{color:"#8a7d66"},"data-testid":"btn-post-gen-stay",children:"Stay here"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("h2",{className:"text-xl font-bold mb-2 text-white","data-testid":"text-post-gen-title",children:["Nice work on your ",A]}),e.jsxs("p",{className:"text-sm mb-6",style:{color:"#a99a82"},children:["You just built one manual. Paid members get all four role manuals, the full operations consultant, staff scheduling, food costing, and ",ta," operational domains."]}),e.jsx(at,{href:"/pricing",children:e.jsx(y,{className:"w-full mb-4 font-semibold",style:{backgroundColor:"#c8934e",color:"#1c1210"},"data-testid":"btn-post-gen-upgrade",children:st()?"See what's included":"See what's included â $9.99/month"})}),e.jsx("button",{onClick:()=>v(!1),className:"text-xs underline underline-offset-4 bg-transparent border-none cursor-pointer",style:{color:"#8a7d66"},"data-testid":"btn-post-gen-dismiss",children:"Not right now"})]})]})})]})}export{Ys as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.