1import{A as M}from"./AuthenticatedLayout-Daa8gXOU.js";import{_ as k}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{Z as r,_ as n,$ as l,a0 as e,a4 as c,a5 as m,a1 as a,a2 as V,a3 as b,a7 as u}from"./index-D3cKegYi.js";import{s as A}from"./function-call-BnVNH0d2.js";import"./SplashScreen-DMoN78i-.js";const N={layout:M,props:{meals:{type:Array,default:()=>[]}},data(){return{isLoading:!0,togglingMealId:null,localMeals:this.meals||[]}},mounted(){this.localMeals=this.meals||[],setTimeout(()=>{this.isLoading=!1},500)},watch:{meals:{handler(t){this.localMeals=t||[]},immediate:!0}},methods:{async toggleFavorite(t){var i;if(this.togglingMealId===null){this.togglingMealId=t.id;try{(await(await fetch(route("tenant.customer.favorites.toggle"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":((i=document.querySelector('meta[name="csrf-token"]'))==null?void 0:i.getAttribute("content"))||"","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({meal_id:t.id}),credentials:"same-origin"})).json()).favorited===!1&&(this.localMeals=this.localMeals.filter(o=>o.id!==t.id))}catch{A({type:"danger",message:__("An error occurred, please try again later.")})}finally{this.togglingMealId=null}}}}},B={class:"favorites-page shop-page"},I={class:"page-content container"},F={key:0,class:"empty-message"},R={key:1,class:"favorites-list"},S={class:"content"},T={class:"name-desc"},j={class:"name"},q={class:"desc"},x={class:"price"},O={class:"actions"},X=["disabled","aria-label","onClick"],Z={class:"image"},E=["src","alt"];function P(t,i,d,v,o,y){var p;const L=r("Link"),w=r("font-awesome-icon"),C=r("van-skeleton");return l(),n("div",B,[e("div",I,[c(C,{title:"",row:5,loading:o.isLoading&&((p=t.$page.props.theme)==null?void 0:p.skeleton_screen)==1},{default:m(()=>[!o.isLoading&&o.localMeals.length===0?(l(),n("p",F,a(t.__("No favorites yet")),1)):(l(),n("div",R,[(l(!0),n(V,null,b(o.localMeals,(s,D)=>{var _,h,g,f;return l(),n("div",{class:"food-box list",key:s.id},[e("div",S,[e("div",T,[e("p",j,a(s.name),1),e("p",q,a(s.description),1),e("p",x,[u(a(s.price>0?s.price:(f=(g=(h=(_=s.optionGroups)==null?void 0:_[0])==null?void 0:h.optionItems)==null?void 0:g[0])==null?void 0:f.additional_price)+" ",1),i[0]||(i[0]=e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("g",{"clip-path":"url(#clip0_fav_16575)"},[e("path",{d:"M10.7886 15.0766C10.5277 15.6342 10.3552 16.2393 10.2891 16.8738L15.8119 15.7426C16.0729 15.1851 16.2453 14.5799 16.3115 13.9453L10.7886 15.0766Z",fill:"#343B42"}),e("path",{d:"M15.8129 12.3547C16.0739 11.7972 16.2464 11.192 16.3125 10.5574L12.0104 11.4391V9.74419L15.8128 8.96559C16.0738 8.40812 16.2463 7.80288 16.3124 7.16831L12.0102 8.04921V1.954C11.351 2.31065 10.7656 2.78538 10.2897 3.34536V8.40172L8.56911 8.75411V1.125C7.9099 1.48152 7.32445 1.95638 6.84855 2.51636V9.10637L2.99877 9.89463C2.73779 10.4521 2.56515 11.0573 2.49893 11.6919L6.84855 10.8012V12.9356L2.18708 13.8901C1.9261 14.4475 1.75359 15.0528 1.6875 15.6873L6.56675 14.6882C6.96394 14.6086 7.30532 14.3824 7.52727 14.071L8.4221 12.7927V12.7924C8.51499 12.6602 8.56911 12.5007 8.56911 12.329V10.4488L10.2897 10.0965V13.4862L15.8128 12.3544L15.8129 12.3547Z",fill:"#343B42"})]),e("defs",null,[e("clipPath",{id:"clip0_fav_16575"},[e("rect",{width:"14.625",height:"15.75",fill:"white",transform:"translate(1.6875 1.125)"})])])],-1))])]),e("div",O,[c(L,{href:t.route("tenant.customer.shop"),class:"btn-style select"},{default:m(()=>[u(a(t.__("Add")),1)]),_:1},8,["href"]),e("button",{type:"button",class:"btn-style select unfavorite",disabled:o.togglingMealId===s.id,"aria-label":t.__("Remove from favorites"),onClick:G=>y.toggleFavorite(s)},[c(w,{icon:"fa-solid fa-heart"}),e("span",null,a(t.__("Remove from favorites")),1)],8,X)])]),e("div",Z,[e("img",{src:s.image,alt:s.name,class:"img-fluid"},null,8,E)])])}),128))]))]),_:1},8,["loading"])])])}const z=k(N,[["render",P]]);export{z 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.