import{r as l,o as A,a as i,b as u,d as e,f as C,m as _,F as M,j as E,t as v,p as g,q as f,v as b}from"./app-kAt5lVqd.js";const S={class:"p-6"},j={class:"grid grid-cols-1 md:grid-cols-4 gap-4"},N={class:"flex justify-between items-start mb-2"},B={class:"font-semibold text-gray-900"},V={class:"text-sm text-orange-600 font-medium"},I={class:"flex gap-2"},q=["onClick"],D=["onClick"],F={class:"bg-white rounded-lg p-6 w-full max-w-md"},H={class:"text-xl font-bold mb-4"},J={class:"mb-4"},L={class:"mb-4"},z={__name:"Addons",setup(O){const o=l([{name:"Extra Egg",price:50},{name:"Extra Fish Curry",price:100},{name:"Extra Chicken",price:150},{name:"Extra Cheese",price:75},{name:"Extra Spicy",price:0}]),a=l(!1),s=l({name:"",price:0}),d=l(!1),p=l(-1),x=()=>{d.value=!1,s.value={name:"",price:0},a.value=!0},y=r=>{d.value=!0,p.value=r,s.value={...o.value[r]},a.value=!0},c=()=>{a.value=!1},h=()=>{s.value.name&&(d.value?o.value[p.value]={...s.value}:o.value.push({...s.value}),localStorage.setItem("customAddons",JSON.stringify(o.value)),c())},k=r=>{confirm(`Delete add-on "${o.value[r].name}"?`)&&(o.value.splice(r,1),localStorage.setItem("customAddons",JSON.stringify(o.value)))};return A(()=>{const r=localStorage.getItem("customAddons");r&&(o.value=JSON.parse(r))}),(r,t)=>(u(),i("div",S,[e("div",{class:"flex justify-between items-center mb-6"},[t[3]||(t[3]=e("h1",{class:"text-2xl font-bold text-gray-800"},"Manage Add-ons",-1)),e("button",{onClick:x,class:"bg-gradient-to-r from-orange-500 to-orange-600 text-white px-5 py-2.5 rounded-lg flex items-center gap-2 text-sm hover:shadow-lg transition"},[...t[2]||(t[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),_(" Add Add-on ",-1)])])]),e("div",j,[(u(!0),i(M,null,E(o.value,(n,m)=>(u(),i("div",{key:m,class:"bg-white rounded-lg shadow p-4"},[e("div",N,[e("div",null,[e("h3",B,v(n.name),1),e("p",V,"Rs "+v(n.price),1)]),e("div",I,[e("button",{onClick:w=>y(m),class:"text-blue-600 hover:text-blue-800"},[...t[4]||(t[4]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)])],8,q),e("button",{onClick:w=>k(m),class:"text-red-600 hover:text-red-800"},[...t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,D)])])]))),128))]),a.value?(u(),i("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",onClick:g(c,["self"])},[e("div",F,[e("h2",H,v(d.value?"Edit Add-on":"Add Add-on"),1),e("form",{onSubmit:g(h,["prevent"])},[e("div",J,[t[6]||(t[6]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Add-on Name *",-1)),f(e("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>s.value.name=n),type:"text",required:"",placeholder:"e.g., Extra Egg",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent"},null,512),[[b,s.value.name]])]),e("div",L,[t[7]||(t[7]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Price (Rs) *",-1)),f(e("input",{"onUpdate:modelValue":t[1]||(t[1]=n=>s.value.price=n),type:"number",step:"0.01",required:"",placeholder:"50",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent"},null,512),[[b,s.value.price,void 0,{number:!0}]])]),e("div",{class:"flex justify-end gap-2"},[e("button",{type:"button",onClick:c,class:"px-5 py-2.5 border border-gray-300 rounded-lg text-sm hover:bg-gray-50"},"Cancel"),t[8]||(t[8]=e("button",{type:"submit",class:"bg-gradient-to-r from-orange-500 to-orange-600 text-white px-5 py-2.5 rounded-lg text-sm"},"Save",-1))])],32)])])):C("",!0)]))}};export{z as default};
