PageSourceSearch

https://faf.co.ao/assets/OrderConfirmation-CUCVMT-Z.js

js faf.co.ao collected 2026-10-02 19:10:46 UTC 6,462 bytes, 1 lines download raw bytes

1import{r as y,b as v,j as e,L as c}from"./vendor-react-core-_0sZDOLQ.js";import{c as l,B as t,b as m}from"./index-j07E1qHv.js";import{C as w,b as C,c as P,a as _}from"./card-DHmBnTdH.js";import{B as E}from"./badge-BXqwvh8U.js";import{A as x,a as h}from"./alert-C9akKxmM.js";import{t as i}from"./index-CDqomOa1.js";import{J as p,a3 as j,aO as k,ap as A,r as L}from"./vendor-lucide-Ddz0eB7N.js";import{m as z}from"./vendor-framer-motion-C1oRD-X5.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-utils-BRu4i-LD.js";import"./vendor-supabase-Ca6cp8v2.js";function Q(){const n=new URLSearchParams(window.location.search).get("id"),[d,o]=y.useState(!1),{data:s,isLoading:g,isError:f,refetch:u}=v({queryKey:["order",n],queryFn:async()=>(await m.entities.Order.filter({id:n}))[0],enabled:!!n}),b=async()=>{if(s!=null&&s.payment_reference){o(!0);try{const a=await m.functions.invoke("multicaixaCheckPayment",{reference:s.payment_reference}),r=(a==null?void 0:a.data)??a;r!=null&&r.paid?(i.success("Pagamento confirmado!"),u()):i.info("Pagamento ainda pendente")}catch{i.error("Erro ao verificar pagamento")}finally{o(!1)}}},N=()=>{s!=null&&s.payment_reference&&(navigator.clipboard.writeText(s.payment_reference),i.success("Referência copiada!"))};return g?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-red-600 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"A carregar encomenda..."})]})}):!n||f||!s?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4",children:e.jsxs("div",{className:"max-w-lg text-center",children:[e.jsx(p,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Encomenda não disponível"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Não foi possível localizar esta encomenda. Confirme a ligação ou regresse à loja."}),e.jsx(c,{to:l("Shop"),children:e.jsx(t,{className:"bg-red-600 hover:bg-red-700",children:"Voltar à Loja"})})]})}):e.jsx("main",{className:"min-h-screen bg-gray-50 py-12",children:e.jsx("div",{className:"container mx-auto px-4 max-w-3xl",children:e.jsxs(z.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(j,{className:"w-12 h-12 text-green-600"})}),e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Encomenda Confirmada!"}),e.jsxs("p",{className:"text-gray-600",children:["Número: ",s.order_number]})]}),s.status==="pending"&&s.payment_reference&&e.jsxs(x,{className:"mb-6 border-blue-200 bg-blue-50",children:[e.jsx(k,{className:"w-5 h-5 text-blue-600"}),e.jsx(h,{className:"ml-2 text-blue-900",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"font-semibold",children:"Efetue o pagamento usando Multicaixa Express"}),e.jsxs("div",{className:"bg-white p-4 rounded-lg",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Referência de Pagamento:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-2xl font-bold text-gray-900 flex-1",children:s.payment_reference}),e.jsx(t,{variant:"outline",size:"icon",onClick:N,children:e.jsx(A,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm",children:["Valor: ",e.jsxs("strong",{children:[s.total_amount.toLocaleString("pt-AO")," Kz"]})]}),e.jsxs(t,{variant:"outline",size:"sm",onClick:b,disabled:d,children:[e.jsx(L,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Verificar Pagamento"]})]})]})})]}),s.status==="paid"&&e.jsxs(x,{className:"mb-6 border-green-200 bg-green-50",children:[e.jsx(j,{className:"w-5 h-5 text-green-600"}),e.jsxs(h,{className:"ml-2 text-green-900",children:[e.jsx("p",{className:"font-semibold",children:"Pagamento confirmado!"}),e.jsx("p",{className:"text-sm",children:"A sua encomenda será processada em breve."})]})]}),e.jsxs(w,{className:"mb-6",children:[e.jsx(C,{children:e.jsxs(P,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"w-5 h-5"}),"Detalhes da Encomenda"]}
1)}),e.jsxs(_,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Estado"}),e.jsx(E,{className:s.status==="paid"?"bg-green-100 text-green-800":s.status==="pending"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800",children:s.status==="paid"?"Pago":s.status==="pending"?"Pendente":s.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Método de Pagamento"}),e.jsx("p",{className:"font-semibold",children:"Multicaixa Express"})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h3",{className:"font-semibold mb-3",children:"Produtos"}),e.jsx("div",{className:"space-y-3",children:s.items.map((a,r)=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:a.product_name}),e.jsxs("p",{className:"text-gray-600",children:["Tamanho: ",a.size," • Qty: ",a.quantity]})]}),e.jsxs("p",{className:"font-semibold",children:[(a.price*a.quantity).toLocaleString("pt-AO")," Kz"]})]},r))})]}),e.jsx("div",{className:"border-t pt-4",children:e.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{className:"text-red-600",children:[s.total_amount.toLocaleString("pt-AO")," Kz"]})]})}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h3",{className:"font-semibold mb-2",children:"Morada de Entrega"}),e.jsxs("p",{className:"text-sm text-gray-600",children:[s.customer_name,e.jsx("br",{}),s.shipping_address.street,e.jsx("br",{}),s.shipping_address.city,", ",s.shipping_address.province]})]})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(c,{to:l("Shop"),className:"flex-1",children:e.jsx(t,{variant:"outline",className:"w-full",children:"Continuar a Comprar"})}),e.jsx(c,{to:l("Home"),className:"flex-1",children:e.jsx(t,{className:"w-full bg-red-600 hover:bg-red-700",children:"Voltar ao Início"})})]})]})})})}export{Q 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.