import{T as C,a as q,c as _,o as r,d as e,b as d,k as u,t,F as h,h as y,g as x,w as S,e as V,f as p,u as l,i as M,v as G,j as m}from"./app-fEKA3BkQ.js";import{_ as N}from"./PageHeader-DmRLoM5E.js";import{_ as $}from"./Paginate-D_g9VFI3.js";import{_ as I}from"./NoDataFound-Xi4CpDbx.js";import{_ as T}from"./SpinnerBtn-BezRkGQj.js";import{u as B,s as P}from"./assetStore-BSVLrDIW.js";import{_ as Q}from"./UserLayout-D_lxcpvH.js";import"./ValidationErrors-B24rcOPH.js";const R={class:"table-responsive w-full"},j={class:"table"},D={class:"!text-right"},F={key:0,class:"tbody"},E=["href"],U=["src"],A={class:"flex justify-end"},L={class:"dropdown","data-placement":"bottom-start"},O={class:"dropdown-toggle"},z={class:"dropdown-content w-56"},H={class:"dropdown-list"},J={class:"dropdown-list-item"},K=["href"],W={class:"dropdown-list-item"},X=["href"],Y={class:"dropdown-list-item"},Z=["onClick"],ee={class:"w-full"},se={class:"mb-2"},te={class:"mb-2"},oe={value:"SVG"},ae={value:"PNG"},le={class:"mt-2 text-end"},pe=Object.assign({layout:Q},{__name:"Index",props:["device","qrCodes"],setup(n){const f=B(),g=n,{textExcerpt:b,deleteRow:v}=P(),a=C({prefilled_message:"",generate_qr_image:"SVG"}),w=()=>{a.post(route("user.whatsapp.qr-codes.store",g.device.uuid),{onSuccess:()=>{a.reset(),f.close("qrCodeModal")}})};return(s,i)=>{const c=q("Icon");return r(),_(h,null,[e("div",R,[e("table",j,[e("thead",null,[e("tr",null,[e("th",null,t(s.trans("Code")),1),e("th",null,t(s.trans("Prefilled Message")),1),e("th",null,t(s.trans("QR Image")),1),e("th",D,t(s.trans("Action")),1)])]),n.qrCodes.data.length?(r(),_("tbody",F,[(r(!0),_(h,null,y(n.qrCodes.data,(o,k)=>(r(),_("tr",{key:k},[e("td",null,t(o.code),1),e("td",null,t(l(b)(o.prefilled_message,50)),1),e("td",null,[e("a",{href:o.qr_image_url,download:""},[e("img",{src:o.qr_image_url,class:"h-20"},null,8,U)],8,E)]),e("td",null,[e("div",A,[e("div",L,[e("div",O,[d(c,{class:"h-5 text-3xl text-slate-400",icon:"bx:dots-vertical-rounded"})]),e("div",z,[e("ul",H,[e("li",J,[e("a",{class:"dropdown-link",target:"_blank",href:o.deep_link_url},[d(c,{class:"h-5 text-slate-400",icon:"bx:link"}),m(" "+t(s.trans("Try")),1)],8,K)]),e("li",W,[e("a",{class:"dropdown-link",href:o.qr_image_url},[d(c,{class:"h-5 text-slate-400",icon:"bx:download"}),m(" "+t(s.trans("Download")),1)],8,X)]),e("li",Y,[e("button",{class:"dropdown-link delete-confirm",type:"button",onClick:ne=>l(v)(s.route("user.whatsapp.qr-codes.destroy",{device:n.device,qr_code:o.id}))},[d(c,{class:"h-5 text-slate-400",icon:"bx:trash"}),m(" "+t(s.trans("Remove")),1)],8,Z)])])])])])])]))),128))])):(r(),u(I,{key:1,forTable:!0}))]),e("div",ee,[n.qrCodes.data.length?(r(),u($,{key:0,links:n.qrCodes.links},null,8,["links"])):x("",!0)])]),d(N,{"header-state":!0,"header-title":"Create Qr Code",state:"qrCodeModal"},{default:S(()=>[e("form",{onSubmit:V(w,["prevent"])},[e("div",se,[e("label",null,t(s.trans("Prefilled Message")),1),p(e("textarea",{"onUpdate:modelValue":i[0]||(i[0]=o=>l(a).prefilled_message=o),class:"input"},null,512),[[M,l(a).prefilled_message]])]),e("div",te,[e("label",null,t(s.trans("Generate Image Format")),1),p(e("select",{"onUpdate:modelValue":i[1]||(i[1]=o=>l(a).generate_qr_image=o),class:"select"},[e("option",oe,t(s.trans("SVG")),1),e("option",ae,t(s.trans("PNG")),1)],512),[[G,l(a).generate_qr_image]])]),e("div",le,[d(T,{classes:"btn btn-primary",processing:l(a).processing,"btn-text":s.trans("Create QR Code")},null,8,["processing","btn-text"])])],32)]),_:1})],64)}}});export{pe as default};
