1import{A as G,c as P,E as W,B as O,d as A,e as d,f as _,g as r,F as C,H as V,t,v as x,X as H,r as f,h as c,w as u,q as T,aN as J,j as I,n as U,i as k,K as Q,D as q,o as X,av as Y}from"./index.adc62cbc.js";import{u as E,_ as Z}from"./SumUpReaderPaymentModal.vue_vue_type_script_setup_true_lang.0aa27fb7.js";import{f as ee}from"./index.6640317a.js";import"./useMutation.debe159b.js";const F=G("posStore",{state:()=>({cartItems:[],shop:null,event:null,localServiceAvailable:!1,localServiceSocket:null,checkingIdCardUid:!1}),actions:{resetCart(){this.cartItems=[],this.idCardUid=void 0,this.existingTicketsCount=void 0},async placeOrder(){var v,e,i;try{return(await P.api.ordersControllerCreate(this.event.id,{shopId:this.shop.id,tickets:this.cartItems,idCardUid:this.idCardUid})).data}catch(l){l instanceof W?O.error(`Fehler beim Erstellen der Bestellung: ${(i=(e=(v=l.response)==null?void 0:v.data)==null?void 0:e.message)!=null?i:l.message}`):O.error(`Fehler beim Erstellen der Bestellung: ${l}`)}}}}),te={class:"w-full h-full flex flex-col"},se={class:"flex-1 overflow-y-auto p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},oe=["onClick"],re={class:"text-xl font-semibold text-center"},le=A({__name:"pos-shop-selector",setup(v){const e=F(),{data:i}=E({queryKey:["events",e.event.id,"shops"],queryFn:()=>P.api.shopsControllerFindAll(e.event.id).then(l=>l.data),initialData:[]});return(l,g)=>(d(),_("div",te,[g[0]||(g[0]=r("div",{class:"w-full px-4 py-4 border-b border-b-gray-600 flex flex-row justify-between"},[r("h1",{class:"text-lg"},"Shop ausw\xE4hlen")],-1)),r("div",se,[(d(!0),_(C,null,V(t(i).filter(s=>s.posOrdersAllowed),s=>(d(),_("div",{key:s.id,onClick:o=>t(e).shop=s,class:"w-full h-32 bg-gray-200 dark:bg-gray-800 rounded-lg shadow-md flex items-center justify-center hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors"},[r("h2",re,x(s.name),1)],8,oe))),128))])]))}}),z=(v,e)=>E({queryKey:["events",v,"shops",e,"ticket-types"],staleTime:5*60*1e3,queryFn:async()=>P.api.ticketTypesControllerFindAll(v).then(i=>i.data),placeholderData:[]}),ne=(v,e,i,l)=>E({queryKey:["events",v,"unpaid-orders",e,"page",i,"items-per-page",l],queryFn:()=>P.api.ordersControllerFindAll(v,{itemsPerPage:l.value,search:e.value,page:i.value}).then(g=>g.data)});var j;const K=(j=window.localStorage.getItem("pos-base-url"))!=null?j:"127.0.0.1:8080",B=H.create({baseURL:`http://${K}`}),N=async(v,e)=>{try{if((await B.get("/status")).data.printer_status!=="READY"){O.error("Drucker nicht bereit!");return}const l=await P.api.ordersControllerGetEscPosData(v,e);try{await B.post("/print",{escpos:l.data.hex})}catch{O.warning("Fehler beim Drucken!")}}catch{console.log("No printer available")}},ae={class:"w-full h-full flex flex-col"},ie={class:"flex-1 overflow-y-auto p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},de=["onClick"],ce={class:"text-xl font-semibold text-center"},ue={class:"text font-medium"},pe=A({__name:"pos-ticket-type-selector",setup(v){const e=F(),{data:i,isSuccess:l}=z(e.event.id,e.shop.id),g=s=>{var o;if(e.idCardUid&&e.cartItems.length+((o=e.existingTicketsCount)!=null?o:0)===e.shop.ticketLimitPerOrder){O.error(`Das Ticket-Limit pro Kunde von ${e.shop.ticketLimitPerOrder} Tickets wurde erreicht.`);return}e.cartItems.push({email:"",firstName:"POS Kunde",lastName:"",ticketTypeId:s.id,price:s.price,id:J(),meta:{},createdAt:new Date().toISOString()})};return(s,o)=>{const y=f("v-card"),p=f("v-dialog");return d(),_(C,null,[c(p,{"model-value":t(e).shop.meta.posIdCardRequired&&!t(e).idCardUid,persistent:"","content-class":"!w-1/3"},{default:u(()=>[c(y,null,{default:u(()=>[...o[0]||(o[0]=[r("div",{class:"flex flex-col justify-center items-center py-20"},[r("p",{class:"text-2xl"},"Bitte Ausweis einlesen!")],-1)])]),_:1})]),_:1},8,["model-value"]),r("div",ae,[o[1]||(o[1]=r("div",{class:"w-full px-4 py-4 border-b border-b-gray-600 flex flex-row justify-between"},[r("h1",{class:"text-lg"},"Ticket Art ausw\xE4hlen")],-1)),r("div",ie,[t(l)?(d(!0),_(C,{key:0},V(t(i),m=>(d(),_("div",{key:m.id,onClick:a=>g(m),class:"w-full h-32 bg-gray-200 dark:bg-gray-800 rounded-lg shadow-md flex flex-col items-center justify-center hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors"},[r("h2",ce,x(m.name),1),r("h3",ue,x(Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(m.price)),1)],8,de))),128)):T("",!0)])])],64)}}}),me={class:"flex flex-col justify-center items-center py-10 px-5"},ve={class:"text-2xl font-bold"},fe={class:"grid grid-cols-1 md:grid-cols-2 gap-5 p-5"},L=A({__name:"pos-payment-modal",props:{order:{type:Object,required:!0}},emits:["close"],setup(v,{emit:e}){const i=Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format,l=F(),g=e,s=v,o=I(!1),y=async()=>
1{if(!!confirm("M\xF6chten Sie die Bestellung als bar bezahlt markieren?")){o.value=!0;try{await P.api.ordersControllerMarkAsPaid(s.order.eventId,s.order.id,{paymentMethod:"cash"}),await N(s.order.eventId,s.order.id),l.resetCart(),g("close")}catch(a){O.error("Fehler beim Markieren der Bestellung als bezahlt"),console.error(a)}o.value=!1}},p=I(!1),m=async()=>{p.value=!1,await N(s.order.eventId,s.order.id),setTimeout(()=>{g("close"),l.resetCart()},100)};return(a,n)=>{const $=f("v-dialog"),S=f("v-btn"),w=f("v-card");return d(),_(C,null,[c($,{modelValue:p.value,"onUpdate:modelValue":n[1]||(n[1]=b=>p.value=b),"content-class":"!w-1/3"},{default:u(()=>[c(Z,{"order-id":v.order.id,"event-id":v.order.eventId,onCancel:n[0]||(n[0]=b=>p.value=!1),onSuccess:m},null,8,["order-id","event-id"])]),_:1},8,["modelValue"]),c(w,{title:"Bestellung bezahlen"},{default:u(()=>[r("div",me,[n[3]||(n[3]=r("p",{class:"text-lg"},"zu zahlen",-1)),r("p",ve,x(t(i)(v.order.totalSum)),1)]),r("div",fe,[t(l).shop.cashPayment?(d(),U(S,{key:0,size:"x-large",onClick:y},{default:u(()=>[...n[4]||(n[4]=[k("Barzahlung",-1)])]),_:1})):T("",!0),c(S,{size:"x-large",onClick:n[2]||(n[2]=b=>p.value=!0)},{default:u(()=>[...n[5]||(n[5]=[k("Kartenzahlung",-1)])]),_:1})])]),_:1})],64)}}}),ge={class:"w-full h-full flex flex-col"},_e={key:0,class:"flex-1 overflow-y-auto p-4"},ye={key:1,class:"flex flex-col justify-between h-full"},he={class:"flex flex-row justify-end items-center gap-3"},ke={class:"w-full p-4"},xe={class:"flex flex-row justify-between mb-4"},be={class:"font-semibold"},Ce=A({__name:"pos-cart",setup(v){const e=F(),{data:i}=z(e.event.id,e.shop.id),l=Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format,g=m=>{e.cartItems=e.cartItems.filter(a=>a.id!==m)},s=I(!1),o=async()=>{s.value=!0;const m=await e.placeOrder();m&&(y.value=m),s.value=!1},y=I(),p=Q(()=>e.cartItems.reduce((m,a)=>m+a.price,0));return(m,a)=>{const n=f("v-dialog"),$=f("v-btn"),S=f("v-list-item"),w=f("v-list");return d(),_(C,null,[c(n,{"model-value":!!y.value,"onUpdate:modelValue":a[1]||(a[1]=b=>y.value=void 0),"content-class":"!w-2/3"},{default:u(()=>[c(L,{order:y.value,onClose:a[0]||(a[0]=b=>y.value=void 0)},null,8,["order"])]),_:1},8,["model-value"]),r("div",ge,[a[5]||(a[5]=r("div",{class:"w-full px-4 py-4 border-b border-b-gray-600 flex flex-row justify-between"},[r("h1",{class:"text-lg"},"Warenkorb")],-1)),t(e).cartItems?(d(),_(C,{key:0},[t(e).cartItems.length===0?(d(),_("div",_e,[...a[2]||(a[2]=[r("p",null,"Der Warenkorb ist derzeit leer.",-1)])])):(d(),_("div",ye,[c(w,null,{default:u(()=>[(d(!0),_(C,null,V(t(e).cartItems,b=>(d(),U(S,{key:b.id,title:t(i).find(D=>D.id===b.ticketTypeId).name},{append:u(()=>[r("div",he,[k(x(t(l)(t(i).find(D=>D.id===b.ticketTypeId).price))+" ",1),c($,{onClick:D=>g(b.id),variant:"tonal",color:"error",icon:"mdi-trash-can"},null,8,["onClick"])])]),_:2},1032,["title"]))),128))]),_:1}),r("div",ke,[r("div",xe,[a[3]||(a[3]=r("span",{class:"font-semibold"},"Gesamt:",-1)),r("span",be,x(t(l)(p.value)),1)]),c($,{color:"primary",class:"w-full",loading:s.value,onClick:o},{default:u(()=>[...a[4]||(a[4]=[k("Zur Kasse",-1)])]),_:1},8,["loading"])])]))],64)):T("",!0)])],64)}}}),we={colspan:"5"},Se=A({__name:"pos-orders",setup(v){var m;const e=F(),i=I((m=e.idCardUid)!=null?m:""),l=ee(i,1e3),g=I(1),s=I(10);q(()=>e.idCardUid,a=>{i.value=a!=null?a:""});const{data:o,refetch:y}=ne(e.event.id,l,g,s),p=I();return(a,n)=>{const $=f("v-dialog"),S=f("v-progress-circular"),w=f("v-text-field"),b=f("v-btn"),D=f("v-data-table-server"),R=f("v-card");return d(),_(C,null,[c($,{"model-value":!!p.value,"onUpdate:modelValue":n[1]||(n[1]=h=>p.value=void 0),"content-class":"!w-2/3"},{default:u(()=>[c(L,{order:p.value,onClose:n[0]||(n[0]=h=>{p.value=void 0,t(y)()})},null,8,["order"])]),_:1},8,["model-value"]),c(R,{title:"Bestellungen"},{default:u(()=>[t(o)?(d(),U(D,{key:1,page:g.value,"onUpdate:page":n[3]||(n[3]=h=>g.value=h),search:"Hallo",headers:[{title:"Bestellnummer",value:"shortPaymentId",sortable:!1},{title:"Kunde",value:"customer",sortable:!1},{title:"Gesamtbetrag",value:"totalSum",sortable:!1},{title:"Erstellt am",value:"placedAt",sortable:!1},{title:"Aktionen",value:"actions",sortable:!1,align:"end"}],items:t(o).items,"items-length":t(o).totalItems,"items-per-page":t(o).itemsPerPage},{thead:u(()=>[r("tr",null,[r("td",we,[c(w,{modelValue:i.value,"onUpdate:modelValue":n[2]||(n[2]=h=>i.value=h),placeholder:"Nach Name oder OrderID suchen...",density:"compact","hide-details":"",class:"p-3"},null,8,["modelValue"])])])]),"item.customer":u(({item:h})=>[k(x(h.customer.firstName)+" "+x(h.customer.lastName),1)]),"item.totalSum":u(({item:h})=>[k(x(Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(h.totalSum)),1)]),"item.placedAt":u(({item:h})=>
1[k(x(new Date(h.placedAt).toLocaleString("de-DE")),1)]),"item.actions":u(({item:h})=>[h.paidAt?(d(),U(b,{key:0,variant:"tonal",color:"default","prepend-icon":"mdi-printer",onClick:M=>t(N)(h.eventId,h.id)},{default:u(()=>[...n[4]||(n[4]=[k("Drucken",-1)])]),_:1},8,["onClick"])):(d(),U(b,{key:1,variant:"tonal","prepend-icon":"mdi-cash",onClick:M=>p.value=h},{default:u(()=>[...n[5]||(n[5]=[k("Bezahlen",-1)])]),_:1},8,["onClick"]))]),_:1},8,["page","items","items-length","items-per-page"])):(d(),U(S,{key:0,indeterminate:""}))]),_:1})],64)}}}),Ie={class:"w-full px-4 py-4 border-b border-b-gray-600 flex flex-row justify-between"},$e={class:"text-lg"},Ue={class:"flex flex-row gap-3 justify-end items-center"},Pe={key:1,class:"w-full h-full grid grid-cols-4 divide-x"},Oe={class:"col-span-3"},De={class:"col-span-1"},Be=A({__name:"pos",props:{eventId:{type:String,required:!0}},setup(v){const e=F(),i=v,{data:l}=E({queryKey:["events",i.eventId],queryFn:async()=>P.api.eventsControllerFindOne(i.eventId).then(s=>s.data),initialData:void 0});X(async()=>{try{await B.get("/status");const s=new WebSocket(`ws://${K}/ws`);s.onopen=()=>{console.log("Connected to local POS service"),e.localServiceSocket=s},s.onclose=()=>
1{console.log("Disconnected from local POS service"),e.localServiceSocket=null},s.onmessage=async o=>{const y=JSON.parse(o.data);if(console.log("Received message from local POS service:",y),y.event==="nfc_read"&&!!e.shop){e.checkingIdCardUid=!0;try{const p=y.uid;e.idCardUid=p;const m=await P.api.ticketsControllerFindAll(e.event.id,{page:1,itemsPerPage:1,nfcUid:p,shopId:e.shop.id});e.existingTicketsCount=m.data.totalItems,console.log("Existing tickets for UID",p,":",e.existingTicketsCount)}catch(p){O.error(p.message)}e.checkingIdCardUid=!1}}}catch{console.warn("Local POS service not available")}}),Y(()=>{e.localServiceSocket&&(e.localServiceSocket.close(),e.localServiceSocket=null)}),q(l,s=>{s?e.event=s:e.event=null});const g=I(!1);return(s,o)=>{var S;const y=f("v-progress-circular"),p=f("v-card"),m=f("v-dialog"),a=f("v-btn"),n=f("v-chip"),$=f("VProgressCircular");return d(),_(C,null,[c(m,{modelValue:t(e).checkingIdCardUid,"onUpdate:modelValue":o[0]||(o[0]=w=>t(e).checkingIdCardUid=w),persistent:"","content-class":"!w-1/3"},{default:u(()=>[c(p,{class:"py-20 flex flex-col justify-center items-center gap-5"},{default:u(()=>[c(y,{indeterminate:"",size:"30"}),o[3]||(o[3]=r("p",null,"Ausweis wird validiert...",-1))]),_:1})]),_:1},8,["modelValue"]),c(m,{modelValue:g.value,"onUpdate:modelValue":o[1]||(o[1]=w=>g.value=w)},{default:u(()=>[c(Se)]),_:1},8,["modelValue"]),t(l)?(d(),_(C,{key:0},[r("div",Ie,[r("h1",$e,[k("POS f\xFCr "+x(t(l).name),1),t(e).shop?(d(),_(C,{key:0},[k(" - "+x((S=t(e).shop)==null?void 0:S.name),1)],64)):T("",!0)]),r("div",Ue,[t(e).idCardUid&&t(e).shop?(d(),_(C,{key:0},[c(a,{variant:"tonal",onClick:t(e).resetCart},{default:u(()=>[...o[4]||(o[4]=[k("Abmelden",-1)])]),_:1},8,["onClick"]),c(n,{color:t(e).existingTicketsCount===t(e).shop.ticketLimitPerOrder?"error":"success"},{default:u(()=>[k("Ausweis-ID eingelesen - "+x(t(e).existingTicketsCount)+"/"+x(t(e).shop.ticketLimitPerOrder)+" Tickets",1)]),_:1},8,["color"])],64)):T("",!0),c(a,{variant:"tonal",onClick:o[2]||(o[2]=w=>g.value=!0)},{default:u(()=>[...o[5]||(o[5]=[k("Bestellungen",-1)])]),_:1})])]),t(e).shop?(d(),_("div",Pe,[r("div",Oe,[c(pe,{"shop-id":t(e).shop,"event-id":t(l).id},null,8,["shop-id","event-id"])]),r("div",De,[c(Ce)])])):(d(),U(le,{key:0}))],64)):(d(),U($,{key:1,indeterminate:""}))],64)}}});export{Be 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.