import{u as b,r as N,j as s,e as g}from"./vendor-BKmmeuxg.js";import{B as c}from"./button-BpNwv2aE.js";import{C as y,b as C}from"./card-D9_SJYq6.js";import{I as v}from"./input-DM0goJrn.js";import{S as w}from"./separator-_3LZ_wAA.js";import{s as F}from"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const z=()=>{const{props:n}=b(),[r,x]=N.useState(""),{cart:d,subtotal:i,coupon:a,discountedPrice:o,taxAmount:l,totalPrice:m,translate:p}=n,{frontend:t,button:u,input:j}=p,h=l>0&&o>0?(l/o*100).toFixed(0):0,e=F(n.system.fields.selling_currency);return s.jsx(y,{className:"sticky top-24",children:s.jsxs(C,{className:"p-6",children:[s.jsx("h2",{className:"mb-4 text-xl font-bold",children:t.payment_summary}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:t.sub_total}),s.jsxs("span",{children:[i," ",e==null?void 0:e.symbol]})]}),a&&s.jsxs("div",{className:"flex justify-between text-green-600",children:[s.jsxs("span",{children:[t.discount," (",a.code,")"]}),s.jsxs("span",{children:["- ",(i-o).toFixed(2)," ",e==null?void 0:e.symbol]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-muted-foreground",children:[t.tax," (",h??0,"%)"]}),s.jsxs("span",{children:["+ ",l.toFixed(2)," ",e==null?void 0:e.symbol]})]}),s.jsx(w,{}),s.jsxs("div",{className:"flex justify-between font-bold",children:[s.jsx("span",{children:t.total}),s.jsxs("span",{children:[m.toFixed(2)," ",e==null?void 0:e.symbol]})]}),s.jsx("div",{className:"pt-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(v,{value:r,defaultValue:a?a.code:"",onChange:f=>x(f.target.value),placeholder:j.coupon_placeholder})}),s.jsx(c,{type:"button",onClick:()=>g.get(route("course-cart.index",{coupon:r})),children:u.apply})]})}),d.length>0&&s.jsx(c,{asChild:!0,size:"lg",type:"button",className:"mt-4 w-full",disabled:d.length===0,children:"Test"})]})]})})};export{z as default};