import{d as c,g as l,a as u,u as m,b as e,h as b,i as g,B as _,n as p,F as v,y as r,C as x,o as n,Z as f}from"./app-4c91af5c.js";const h={class:"bg-orange-600 p-6 relative sm:flex sm:justify-center sm:items-center min-h-screen bg-dots-darker bg-center dark:bg-dots-lighter dark:bg-gray-900 selection:bg-red-500 selection:text-white"},y={class:"max-w-xl mx-auto p-6 lg:p-8 bg-white rounded-lg shadow-lg"},C={class:"flex flex-col items-center"},k={key:0,class:"mx-auto p-5 border-4 rounded-lg"},w=["src"],N={key:1},B=["disabled"],F={key:2,class:"text-center"},j=c({__name:"QrCode",setup(V){const o=r(null),a=r(null),d=()=>{x.post(route("storeNic"),{nic:o.value}).then(t=>{console.log(t),t.data&&t.status==200&&(a.value=t.data.qrCode,o.value=null)}).catch(t=>{console.log(t),alert(t.response.data.error)})};return(t,s)=>(n(),l(v,null,[u(m(f),{title:"Barista - 20% OFF Promotion"}),e("div",h,[e("div",y,[e("div",C,[s[2]||(s[2]=e("h3",{class:"text-center text-4xl"},"Enter your NIC below to grab 20% off on coffee based beverages",-1)),a.value?(n(),l("div",k,[e("img",{class:"mx-auto",src:a.value},null,8,w)])):b("",!0),a.value?(n(),l("div",F,[...s[1]||(s[1]=[e("h5",{class:"mt-4 text-lg"},"Show this coupon to any barista cashier to enjoy 20% off on coffee based beverages",-1),e("br",null,null,-1),e("a",{class:"text-blue-400 underline",href:"https://barista.lk"},"Home",-1)])])):(n(),l("div",N,[g(e("input",{type:"text",placeholder:"Enter your NIC",class:"mt-3 rounded","onUpdate:modelValue":s[0]||(s[0]=i=>o.value=i)},null,512),[[_,o.value]]),e("button",{disabled:!o.value,class:p([{"opacity-60 cursor-not-allowed":!o.value},"bg-orange-500 rounded px-4 py-2 ml-3"]),type:"button",onClick:d},"Submit",10,B)]))])])])],64))}});export{j as default};
