PageSourceSearch

https://printarex.com/assets/StorePendingApprovalOrderDetailPage-D1jFK8ku.js

js printarex.com collected 2026-09-24 20:06:04 UTC 47,799 bytes, 5 lines download raw bytes

1import{aO as we,d as ye,a as le,a7 as m,t as ie,h as Ce,j as e,B as C,P as $,aM as se,M as Ie,aI as Se,n as Ae,a0 as Pe,b4 as ze,b5 as Oe,b6 as Te,b7 as Re,b8 as De,b9 as ke,ba as Be,bb as $e,a$ as Fe,b3 as Ee}from"./index-CmenFvy0.js";import{B as N}from"./badge-CFa2-thk.js";import{T as Le}from"./textarea-DaONNPjA.js";import{a as T,A as Me,b as Ue,R as Ve}from"./store-integration-GAB4azby.js";import{u as _e}from"./personalization-CLHajVIA.js";import{c as Ge,T as We}from"./store-order-line-totals-FnztmzRT.js";import{u as qe}from"./use-toast-Vrr_3tL9.js";import{C as F}from"./circle-alert-BPOZbYR-.js";import{A as re}from"./arrow-left-CJS58dLz.js";import{S as He}from"./store-DOMsFHQX.js";import{S as Ke}from"./shopping-cart-Cs-5C7GV.js";import{G as Qe}from"./gift-xiaTiCir.js";import{T as Ye}from"./tag-BLO2gzSo.js";import{B as ae}from"./brush-CBi8GcPI.js";import{I as Je}from"./image-CIt07Au_.js";import{L as E}from"./loader-circle-C1v0nX7W.js";import{R as Xe}from"./receipt-Bm1TpAoK.js";import{B as Ze}from"./building-2-33Pck1Ir.js";import{E as es}from"./external-link-7j5vgFDd.js";import{W as ss}from"./wallet--5UG96Jf.js";import{T as rs}from"./trending-up-D1BB3HAe.js";import{U as as}from"./user-BTNSjasP.js";import{C as ts}from"./calendar-BDFxiBs9.js";import{C as ls}from"./circle-check-BccD9LVl.js";import{C as is}from"./circle-x-Bz94nwn2.js";import{T as ds}from"./timer-DW1wZ1KY.js";import{u as L}from"./useMutation-Bxnq73gW.js";import"./useIsomorphicLayoutEffect-Cs7ln62M.js";const ns=()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"w-6 h-6",fill:"currentColor",children:e.jsx("path",{d:"M15.337 4.142l-.063-.003a.673.673 0 0 0-.545.27c-.047.059-.1.164-.139.295-.054.182-.115.46-.172.81-.115.7-.23 1.597-.34 2.51l-1.91.415c-.161-.93-.38-1.81-.648-2.485-.41-1.035-1.024-1.74-1.816-1.74-.075 0-.15.006-.226.018-.034-.042-.07-.082-.108-.12C9.06 3.794 8.68 3.64 8.232 3.64c-1.42 0-2.83 1.188-3.978 3.344-.808 1.517-1.42 3.427-1.596 4.9l-1.635.427c-.482.126-.497.139-.56.593-.047.34-1.303 10.06-1.303 10.06L12.51 24l6.927-1.5s-3.024-20.5-3.043-20.615a.436.436 0 0 0-.057-.243zm-2.746 1.072c-.007.06-.017.12-.025.181-.205 1.093-.527 2.594-.8 3.58l-2.376.516c.282-1.41.823-2.905 1.482-3.856.246-.356.592-.755 1-.97.166.106.47.34.719.549zm-1.905-1.018c.325 0 .6.147.84.432-.696.385-1.44 1.362-1.946 2.62-.405.098-.8.194-1.16.28.395-1.83 1.455-3.332 2.266-3.332zm.56 8.438c.088 1.203.09 2.196-.017 2.888-.116.745-.358 1.114-.625 1.226-.63.263-1.254-.168-1.79-.842-.577-.726-.983-1.737-1.109-2.87-.127-1.13.09-2.115.535-2.77.405-.594.97-.883 1.513-.883.29 0 .567.085.81.248.603.405 1.066 1.194 1.133 2.113.038.518.008 1.103-.05 1.74zm-.68-6.26l-.002.015c-.213.073-.44.152-.684.238.177-.866.505-1.727.903-2.373.148-.243.356-.516.601-.713.24.51.392 1.308.392 2.108-.004.05-.01.1-.016.15-.394.136-.787.28-1.193.424v.15zm2.57-.89c-.016.09-.03.182-.044.276l-1.93.506c.213-.8.477-1.66.678-2.328.187-.627.44-1.19.706-1.572-.015.073-.027.147-.037.223-.07.51-.067 1.142.017 1.835.042.348.108.7.193 1.044.14.012.28.02.417.015zm4.38 14.99l-2.76.597-.003-.02c.036-.213.07-.446.098-.694.058-.5.09-1.064.076-1.655-.032-1.28-.283-2.426-.76-3.27-.253-.446-.553-.794-.888-1.035-.314-.226-.66-.357-1.03-.41l-.058-.008-.01-.087c-.05-.45-.042-.898.017-1.32l.012-.086-.022-.084c-.132-.5-.345-.96-.627-1.342-.56-.759-1.38-1.244-2.355-1.244h-.112l-.08.005c-.94.06-1.81.59-2.48 1.446-.677.862-1.148 2.04-1.276 3.387-.056.594-.042 1.175.036 1.72l-.086.02C4.61 17.14 3.97 17.3 3.39 17.45c.172-1.4.75-3.18 1.507-4.6 1.04-1.956 2.295-3.01 3.334-3.01.265 0 .502.073.723.222l.113.076.108-.082a.63.63 0 0 1 .11-.068c.256-.124.537-.188.83-.188 1.125 0 2.094.95 2.54 2.47.127.43.22.903.278 1.398l2.03-.524c.1-.693.194-1.364.28-1.97l.008-.055-.008-.055c-.03-.22-.044-.395-.044-.535 0-.173.02-.315.058-.423.013-.04.026-.07.038-.09a.
109.09 0 0 1 .02-.016l.04-.01c.058 0 .09.018.11.034.054.047.1.14.135.28z"})}),os=()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"w-6 h-6",fill:"currentColor",children:e.jsx("path",{d:"M2.227 4.857A2.228 2.228 0 0 0 0 7.094v7.457c0 1.236 1.001 2.237 2.237 2.237h3.31l-.672 2.355 3.478-2.355h11.418c1.236 0 2.237-1.001 2.237-2.237V7.085c0-1.236-1.001-2.237-2.237-2.237H2.237l-.01.01zm3.07 2.097c.753 0 1.381.473 1.69 1.263.638 1.64.947 2.907 1.043 3.826.191-1.171.574-2.605 1.149-4.306.191-.575.605-.783 1.149-.783.67 0 1.073.32 1.073.991 0 .236-.037.446-.116.629a17.08 17.08 0 0 1-1.149 2.48c-.638 1.171-1.254 1.774-1.796 1.774-.526 0-1.001-.345-1.351-1.034-.085-.17-.16-.361-.223-.57-.446 1.064-.998 1.604-1.655 1.604-.766 0-1.287-.518-1.54-1.562-.16-.648-.239-1.445-.239-2.383 0-1.297.345-2.054 1.034-2.267.127-.036.26-.055.405-.055l-.002-.007h.528zm11.81 0c.753 0 1.381.473 1.69 1.263.638 1.64.947 2.907 1.043 3.826.191-1.171.574-2.605 1.149-4.306.191-.575.605-.783 1.149-.783.67 0 1.073.32 1.073.991 0 .236-.037.446-.116.629a17.08 17.08 0 0 1-1.149 2.48c-.638 1.171-1.254 1.774-1.796 1.774-.526 0-1.001-.345-1.351-1.034-.085-.17-.16-.361-.223-.57-.446 1.064-.998 1.604-1.655 1.604-.766 0-1.287-.518-1.54-1.562-.16-.648-.239-1.445-.239-2.383 0-1.297.345-2.054 1.034-2.267.127-.036.26-.055.405-.055l-.002-.007h.528zm-5.88 0c.753 0 1.381.473 1.69 1.263.638 1.64.947 2.907 1.043 3.826.191-1.171.574-2.605 1.149-4.306.191-.575.605-.783 1.149-.783.67 0 1.073.32 1.073.991 0 .236-.037.446-.116.629a17.08 17.08 0 0 1-1.149 2.48c-.638 1.171-1.254 1.774-1.796 1.774-.526 0-1.001-.345-1.351-1.034-.085-.17-.16-.361-.223-.57-.446 1.064-.998 1.604-1.655 1.604-.766 0-1.287-.518-1.54-1.562-.16-.648-.239-1.445-.239-2.383 0-1.297.345-2.054 1.034-2.267.127-.036.26-.055.405-.055l-.002-.007h.528z"})}),cs=()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"w-6 h-6",fill:"currentColor",children:e.jsx("path",{d:"M.045 18.02c.072-.116.187-.124.348-.022 3.636 2.11 7.594 3.166 11.87 3.166 2.852 0 5.668-.533 8.447-1.595l.315-.14c.138-.06.234-.1.293-.13.226-.088.39-.046.493.126.112.188.03.393-.235.613-.363.307-1.076.776-2.14 1.408-1.165.687-2.43 1.217-3.79 1.59-1.472.404-2.97.607-4.493.607-1.89 0-3.716-.31-5.48-.927-1.762-.62-3.346-1.46-4.752-2.523-.182-.137-.273-.283-.273-.435 0-.102.034-.19.102-.267z"})}),ms=()=>e.jsxs("svg",{viewBox:"0 0 64 24",className:"w-10 h-6","aria-hidden":"true",children:[e.jsx("rect",{width:"64",height:"24",rx:"4",fill:"#ffea00"}),e.jsx("text",{x:"32",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"700",fill:"#333",children:"noon"})]}),xs=()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"w-6 h-6",fill:"currentColor",children:e.jsx("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1z"})}),ps=()=>e.jsx("svg",{viewBox:"0 0 24 24",className:"w-6 h-6",fill:"currentColor",children:e.jsx("path",{d:"M5.146 8.904c-.266.058-.465.285-.506.525l-.815 4.88c-.047.283.16.544.45.544h1.23c.266 0 .496-.183.55-.44l.56-2.598c.058-.27.312-.466.588-.466h.89c.276 0 .53.196.588.466l.56 2.598c.054.257.284.44.55.44h1.23c.29 0 .497-.261.45-.544l-.815-4.88a.557.557 0 0 0-.506-.525H5.146z"})}),hs=i=>{const c=(i||"").split("/").map(n=>n.trim()).filter(Boolean);return{selectedColor:c[0]||null,selectedSize:c.length>1?c.slice(1).join(" / "):null}},te={SHOPIFY:{icon:ns,gradient:"from-[#96bf48] to-[#5c8a1f]",bgColor:"bg-[#96bf48]/10",textColor:"text-[#5c8a1f]",name:"Shopify"},WOOCOMMERCE:{icon:os,gradient:"from-[#9b5c8f] to-[#7f54b3]",bgColor:"bg-[#9b5c8f]/10",textColor:"text-[#7f54b3]",name:"WooCommerce"},AMAZON:{icon:cs,gradient:"from-[#ff9900] to-[#e47911]",bgColor:"bg-[#ff9900]/10",textColor:"text-[#e47911]",name:"Amazon"},NOON:{icon:ms,gradient:"from-[#ffea00] to-[#f4c900]",bgColor:"bg-[#ffea00]/10",textColor:"text-[#4a4300]",name:"Noon"},TIKTOK:{icon:xs,gradient:"from-[#00f2ea] via-[#ff0050] to-[#000]",bgColor:"bg-slate-900/10",textColor:"text-slate-900",name:"TikTok Shop"},WIX:{icon:ps,gradient:"from-[#0c6efc] to-[#0040a0]",bgColor:"bg-[#0c6efc]/10",textColor:"text-[#0040a0]",name:"Wix"}},us=({scheduledSubmitAt:i})=>{const{locale:c}=le(),n=m.useCallback(f=>ie(f,c),[c]),[R,b]=m.useState(""),[a,z]=m.useState(!1);return m.useEffect(()=>{const f=()=>{const S=Date.now(),u=new Date(i).getTime()-S;if(u<=0){b(n("Processing...")),z(!1);return}const j=Math.floor(u/(1e3*60*60)),w=Math.floor(u%(1e3*60*60)/(1e3*60)),y=Math.floor(u%(1e3*60)/1e3);z(j===0&&w<30),j>0?b(`${j}h ${w}m ${y}s`):w>0?b(`${w}m ${y}s`):b(`${y}s`)};f();const I=setInterval(f,1e3);return()=>clearInterval(I)},[n,i]),e.jsxs("div",{className:`
2      inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium
3      ${a?"bg-gradient-to-r from-amber-500/20 to-orange-500/20 text-amber-700 border border-amber-300":"bg-gradient-to-r from-violet-500/10 to-purple-500/10 text-violet-700 border border-violet-200"}
4      transition-all duration-300
5    `,children:[e.jsx(ds,{className:`w-4 h-4 ${a?"animate-pulse":""}`}),e.jsx("span",{className:"tabular-nums",children:R})]})},js=()=>e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[e.jsx("div",{className:"bg-gradient-to-br from-slate-300 to-slate-400 animate-pulse",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx("div",{className:"w-5 h-5 bg-white/30 rounded"}),e.jsx("div",{className:"w-24 h-4 bg-white/30 rounded"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-28 h-8 bg-white/20 rounded-full"}),e.jsx("div",{className:"w-24 h-6 bg-white/20 rounded-full"})]}),e.jsx("div",{className:"w-64 h-10 bg-white/30 rounded-lg mb-2"}),e.jsx("div",{className:"w-40 h-4 bg-white/20 rounded"})]}),e.jsx("div",{className:"w-40 h-20 bg-white/10 rounded-2xl"})]})]})}),e.jsx("div",{className:"max-w-7xl mx-auto px-6 py-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden animate-pulse",children:[e.jsx("div",{className:"p-6 border-b border-slate-100",children:e.jsx("div",{className:"w-48 h-6 bg-slate-200 rounded"})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"w-24 h-4 bg-slate-200 rounded"}),[1,2].map(i=>e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-slate-50 rounded-xl",children:[e.jsx("div",{className:"w-20 h-20 bg-slate-200 rounded-lg shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"w-3/4 h-5 bg-slate-200 rounded"}),e.jsx("div",{className:"w-1/2 h-4 bg-slate-200 rounded"}),e.jsxs("div",{className:"flex justify-between items-center mt-2",children:[e.jsx("div",{className:"w-16 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"w-20 h-6 bg-slate-200 rounded"})]})]})]},`skeleton-${i}`)),e.jsxs("div",{className:"pt-4 border-t border-slate-100 space-y-3",children:[e.jsx("div",{className:"w-28 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"space-y-2",children:[1,2,3].map(i=>e.jsxs("div",{className:"flex justify-between",children:[e.jsx("div",{className:"w-20 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"w-16 h-4 bg-slate-200 rounded"})]},`skeleton-${i}`))}),e.jsxs("div",{className:"flex justify-between pt-3 border-t border-slate-200",children:[e.jsx("div",{className:"w-32 h-5 bg-slate-200 rounded"}),e.jsx("div",{className:"w-24 h-6 bg-slate-200 rounded"})]})]})]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-slate-100 to-slate-50 rounded-2xl border border-slate-200 overflow-hidden animate-pulse",children:[e.jsxs("div",{className:"p-6 border-b border-slate-100",children:[e.jsx("div",{className:"w-56 h-6 bg-slate-200 rounded"}),e.jsx("div",{className:"w-64 h-4 bg-slate-200 rounded mt-2"})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex gap-4",children:[1,2,3,4,5,6,7,8].map(i=>e.jsx("div",{className:"flex-1 h-4 bg-slate-200 rounded"},`skeleton-${i}`))}),[1,2].map(i=>e.jsx("div",{className:"flex gap-4",children:[1,2,3,4,5,6,7,8].map(c=>e.jsx("div",{className:"flex-1 h-5 bg-slate-200 rounded"},c))},`skeleton-${i}`)),e.jsxs("div",{className:"pt-4 border-t border-slate-200",children:[e.jsx("div",{className:"w-28 h-4 bg-slate-200 rounded mb-4"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[1,2,3,4].map(i=>e.jsxs("div",{className:"p-3 bg-white/50 rounded-xl",children:[e.jsx("div",{className:"w-20 h-3 bg-slate-200 rounded mb-2"}),e.jsx("div",{className:"w-16 h-6 bg-slate-200 rounded"})]},`skeleton-${i}`))}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[e.jsxs("div",{className:"p-4 bg-slate-100 rounded-xl",children:[e.jsx("div",{className:"w-24 h-4 bg-slate-200 rounded mb-2"}),e.jsx("div",{className:"w-28 h-8 bg-slate-200 rounded"})]}),e.jsxs("div",{className:"p-4 bg-slate-100 rounded-xl",children:[e.jsx("div",{className:"w-24 h-4 bg-slate-200 rounded mb-2"}),e.jsx("div",{className:"w-28 h-8 bg-slate-200 rounded"})]})]})]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden animate-pulse",children:[e.jsx("div",{className:"p-5 border-b border-slate-100",children:e.jsx("div",{className:"w-32 h-5 bg-slate-200 rounded"})}),e.jsx("div",{className:"p-5 space-y-4",children:[1,2,3].map(i=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-slate-200 rounded-xl shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"w-12 h-3 bg-slate-200 rounded mb-1"}),e.jsx("div",{className:"w-32 h-4 bg-slate-200 rounded"})]})]},`skeleton-${i}`))})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden animate-pulse",children:[e.jsx("div",{className:"p-5 border-b border-slate-100",children:e.jsx("div",{className:"w-36 h-5 bg-slate-200 rounded"})}),e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-slate-200 rounded-xl shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"w-32 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"w-48 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"w-40 h-4 bg-slate-200 rounded"}),e.jsx("div",{className:"w-24 h-4 bg-slate-200 rounded"})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 animate-pulse",children:[e.jsxs("div",{className:"p-4 bg-slate-100 rounded-xl",children:[e.jsx("div",{className:"w-16 h-3 bg-slate-200 rounded mb-2"}),e.jsx("div",{className:"w-14 h-4 bg-slate-200 rounded"})]}),e.jsxs("div",{className:"p-4 bg-slate-100 rounded-xl",children:[e.jsx("div",{className:"w-20 h-3 bg-slate-200 rounded mb-2"}),e.jsx("div",{className:"w-18 h-4 bg-slate-200 rounded"})]})]}),e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsx("div",{className:"w-full h-12 bg-slate-200 rounded-xl"}),e.jsx("div",{className:"w-full h-12 bg-slate-100 border border-slate-200 rounded-xl"}),e.jsx("div",{className:"w-full h-4 bg-slate-100 rounded mx-auto max-w-[200px]"})]})]})]})})]}),Ws=()=>{var H,K,Q,Y,J,X,Z,ee;const{storeOrderId:i}=we(),c=ye(),{toast:n}=qe(),{languageTag:R,locale:b}=le(),a=m.useCallback(s=>ie(s,b),[b]),[z,f]=m.useState(!1),[I,S]=m.useState(""),{materialize:M,loading:u}=_e(),{data:j,loading:w,error:y,refetch:U}=Ce(T,{fetchPolicy:"network-only"}),D=m.useMemo(()=>{var s,t;return((t=(s=j==null?void 0:j.pendingApprovalOrders)==null?void 0:s.edges)==null?void 0:t.map(l=>l.node))||[]},[j]),r=m.useMemo(()=>!D.length||!i?null:D.find(s=>{var h;const t=((h=s.externalOrderNumber)==null?void 0:h.replaceAll(/(?:^["#])|(?:"$)/g,"").trim())||"",l=i.replaceAll(/(?:^["#])|(?:"$)/g,"").trim(),o=(x=>{if(!x)return"";if(/^\d+$/.test(x))return x;const B=x.lastIndexOf("/");return B>0&&B<x.length-1?x.substring(B+1):x})(s.externalOrderId);return t===l||s.externalOrderNumber===i||s.externalOrderId===i||o===l}),[D,i]),g=m.useMemo(()=>r!=null&&r.id?`printarex:reviewed-personalization:${r.id}`:null,[r==null?void 0:r.id]),v=m.useCallback(s=>s.externalLineItemId||s.submissionId,[]),[A,P]=m.useState({});m.useEffect(()=>{var s;if(!g){P({});return}try{const t=(s=globalThis.sessionStorage)==null?void 0:s.getItem(g);P(t?JSON.parse(t):{})}catch{P({})}},[g]);const de=m.useCallback((s,t)=>{const l=v(s);P(p=>{var h;const o={...p,[l]:t};if(g)try{(h=globalThis.sessionStorage)==null||h.setItem(g,JSON.stringify(o))}catch{}return o}
5)},[v,g]),[ne,{loading:V}]=L(Me,{onCompleted:s=>{s.approveOrder.success?(n({title:a("Order Approved"),description:a("Order has been approved and sent for fulfillment.")}),c(`/dashboard/orders?newStoreOrder=${r==null?void 0:r.id}`)):n({title:a("Approval Failed"),description:s.approveOrder.message||a("Failed to approve order"),variant:"destructive"})},onError:s=>{n({title:a("Error"),description:s.message,variant:"destructive"})},refetchQueries:[{query:T}]}),[oe,{loading:_}]=L(Ue,{onCompleted:s=>{var t;if(s.approvePersonalizedOrder.success){if(n({title:a("Personalization Approved"),description:a("The reviewed design has been submitted for PrintaRex fulfillment.")}),g)try{(t=globalThis.sessionStorage)==null||t.removeItem(g)}catch{}P({}),c(`/dashboard/orders?newStoreOrder=${r==null?void 0:r.id}`)}else n({title:a("Approval Failed"),description:s.approvePersonalizedOrder.error||a("Failed to approve personalized order"),variant:"destructive"})},onError:s=>{n({title:a("Error"),description:s.message,variant:"destructive"})},refetchQueries:[{query:T}]}),[ce,{loading:O}]=L(Ve,{onCompleted:s=>{s.rejectOrder.success?(n({title:a("Order Rejected"),description:a("The order has been rejected and the store has been notified.")}),S(""),c("/dashboard/orders")):n({title:a("Rejection Failed"),description:s.rejectOrder.error||a("Failed to reject order"),variant:"destructive"})},onError:s=>{n({title:a("Error"),description:s.message,variant:"destructive"})},refetchQueries:[{query:T}]}),me=async s=>{var t;if(s.missing)return n({title:a("Personalization Missing"),description:a("This order line has an expired or missing buyer submission."),variant:"destructive"}),null;try{const l=v(s),p=!!(s.personalizedDesignId||A[l]),o=(t=s.status)==null?void 0:t.toUpperCase(),h=!p&&(!o||o==="SUBMITTED"||o==="CONSUMED"),x=await M({submissionId:s.submissionId,externalLineItemId:s.externalLineItemId,storeOrderId:r==null?void 0:r.id,orderSnapshot:s,forceRefresh:h});return await U(),x||s.personalizedDesignId||null}catch(l){if(s.personalizedDesignId)return n({title:a("Using previously reviewed design"),description:a("Could not refresh this personalization. Approval will use the saved reviewed design; reopen Review design if approval fails.")}),s.personalizedDesignId;throw l}},xe=s=>{const l=((r==null?void 0:r.lineItems)||[]).find(x=>s.externalVariantId&&x.externalVariantId===s.externalVariantId||s.externalProductId&&x.externalProductId===s.externalProductId||s.publishedProductId&&x.publishedProductId===s.publishedProductId)||null,p=(l==null?void 0:l.variantTitle)||null,{selectedColor:o,selectedSize:h}=hs(p);return{lineItem:l,selectedColor:o,selectedSize:h,variantTitle:p}},pe=async s=>{if(!r)return;const t=await me(s);if(!t)return;de(s,t);const l=xe(s);c(`/customization-for-your-stores/${t}/edit`,{state:{designId:t,editMode:!0,reviewMode:!0,storeOrderId:r.id,externalLineItemId:s.externalLineItemId,selectedColor:l.selectedColor||void 0,selectedSize:l.selectedSize||void 0,reviewVariantTitle:l.variantTitle||void 0,returnTo:globalThis.location.pathname}})},he=async()=>{if(r){if(r.hasPersonalization){const s=r.linePersonalizations||[];if(s.length===0){n({title:a("Personalization Required"),description:a("No personalization lines were found for this order."),variant:"destructive"});return}if(s.filter(o=>o.missing).length>0){n({title:a("Personalization Missing"),description:a("One or more buyer submissions are missing. Reject the order or ask the buyer to place it again."),variant:"destructive"});return}if(s.filter(o=>!(o.personalizedDesignId||A[v(o)])).length>0){n({title:a("Review design first"),description:a("Open each personalized line with Review design before approving this order.")});return}const p=s.map(o=>({externalLineItemId:o.externalLineItemId,submissionId:o.submissionId,personalizedDesignId:o.personalizedDesignId||A[v(o)]}));oe({variables:{input:{storeOrderId:r.id,lines:p}}});return}ne({variables:{storeOrderId:r.id}})}},ue=()=>{if(r){const s=I.trim();if(!s){n({title:a("Rejection Reason Required"),description:a("Add a short reason before rejecting this order."),variant:"destructive"});return}ce({variables:{input:{orderId:r.id,reason:s}}})}},je=s=>Ee(s,b,{weekday:"short",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),d=(s,t)=>Fe(s,t,{locale:R}),G=s=>s?a(s.replaceAll("_"," ").toLowerCase().replaceAll(/\b\w/g,t=>t.toUpperCase())):"—";if(w&&!j)return e.jsx(js,{});if(y)return e.jsx("div",{className:"p-6 max-w-7xl mx-auto",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(F,{className:"w-12 h-12 text-red-500 mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:a("Error Loading Order")}),e.jsx("p",{className:"text-slate-500 mb-4",children:y.message}),e.jsx(C,{onClick:()=>U(),children:a("Try Again")})]})});if(!r)return e.jsx("div",{className:"p-6 max-w-7xl mx-auto",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx($,{className:"w-12 h-12 text-slate-300 mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:a("Order Not Found")}),e.jsx("p",{className:"text-slate-500 mb-4",children:a(`The order #${i} could not be found or has already been processed.`)}),e.jsxs(C,{onClick:()=>c("/dashboard/orders"),children:[e.jsx(re,{className:"w-4 h-4 me-2"}),a("Back to Orders")]})]})});const be=((K=(H=r.storeConnection)==null?void 0:H.platform)==null?void 0:K.toUpperCase())||"SHOPIFY",k=te[be]||te.SHOPIFY,ge=k.icon,W=r.linePersonalizations||[],fe=W.filter(s=>s.missing).length,ve=W.filter(s=>{const t=s.personalizedDesignId||A[v(s)];return!s.missing&&!t}).length,q=r.hasPersonalization&&(fe>0||ve>0),Ne=()=>r.hasPersonalization?a(q?"Review every personalized line before approving":"Approving uses the reviewed design and prepares durable mockups on the server"):a("Approving will create a PrintaRex fulfillment order");return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[e.jsxs("div",{className:`relative bg-gradient-to-br ${k.gradient} overflow-hidden`,children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-white/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-black/10 rounded-full blur-2xl translate-y-1/2 -translate-x-1/2"}),e.jsxs("div",{className:"relative max-w-7xl mx-auto px-6 py-8",children:[e.jsxs("button",{type:"button",onClick:()=>c("/dashboard/orders"),className:"flex items-center gap-2 text-white/80 hover:text-white transition-colors mb-6",children:[e.jsx(re,{className:"w-5 h-5"}),e.jsx("span",{className:"font-medium",children:a("Back to Orders")})]}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-white/20 backdrop-blur-sm rounded-full",children:[e.jsx(ge,{}),e.jsx("span",{className:"text-white/90 text-sm font-medium",children:k.name})]}),e.jsx(N,{className:"bg-white/20 backdrop-blur-sm text-white border-0 hover:bg-white/30",children:a("Pending Review")})]}),e.jsxs("h1",{className:"text-white text-3xl md:text-4xl font-bold tracking-tight flex items-center gap-3",children:[a("Order")," #",(Q=r.externalOrderNumber)==null?void 0:Q.replace(/^#/,""),e.jsx(se,{className:"w-6 h-6 text-white/60"})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-white/80",children:[e.jsx(He,{className:"w-4 h-4"}),e.jsx("span",{children:((Y=r.storeConnection)==null?void 0:Y.shopName)||((J=r.storeConnection)==null?void 0:J.shopDomain)})]})]}),r.scheduledSubmitAt&&e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm rounded-2xl p-4",children:[e.jsx("p",{className:"text-white/70 text-sm mb-2",children:a("Auto-Submit In")}),e.jsx(us,{scheduledSubmitAt:r.scheduledSubmitAt})]})]})]})]}),e.jsx("div",{className:"max-w-7xl mx-auto px-6 py-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.hasPersonalization&&e.jsx("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-5 shadow-sm",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl bg-amber-100",children:e.jsx(F,{className:"h-5 w-5 text-amber-700"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-semibold text-amber-950",children:a("Review buyer personalization before fulfillment")}),e.jsx("p",{className:"text-sm leading-6 text-amber-800",children:a("Open each buyer-submitted design, confirm the materialized PrintaRex design is correct, then approve from PrintaRex. This keeps personalized artwork attached before the order is submitted for production.")})]})]})}),r.lineItems&&r.lineItems.length>0&&e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-slate-100",children:e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5 text-primary"}),a("Store Order Breakdown")]})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:a("Line Items")}),e.jsx("div",{className:"space-y-3",children:r.lineItems.map(s=>e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-slate-50 rounded-xl",children:[s.imageUrl?e.jsx("img",{src:s.imageUrl,alt:s.title,className:"w-20 h-20 object-cover rounded-lg border border-slate-200"}):e.jsx("div",{className:"w-20 h-20 bg-slate-200 rounded-lg flex items-center justify-center",children:e.jsx($,{className:"w-8 h-8 text-slate-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-base font-medium text-slate-900",children:s.title}),s.variantTitle&&e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:s.variantTitle}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-sm text-slate-500",children:[a("Qty:")," ",s.quantity]}),e.jsx("span",{className:"text-lg font-semibold text-slate-900",children:d(s.totalPrice,r.currency)})]}),s.isPrintarexProduct&&e.jsx(N,{variant:"secondary",className:"mt-2 bg-primary/10 text-primary border-0",children:a("PrintaRex Product")})]})]},`item-${s.title}-${s.sku}`))})]}),r.discounts&&r.discounts.length>0&&e.jsxs("div",{className:"pt-4 border-t border-slate-100 space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:a("Discounts Applied")}),r.discounts.map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-emerald-50 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[s.type==="GIFT_CARD"?e.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-100 flex items-center justify-center",children:e.jsx(Qe,{className:"w-5 h-5 text-emerald-600"})}):e.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-100 flex items-center justify-center",children:e.jsx(Ye,{className:"w-5 h-5 text-emerald-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-emerald-700",children:{GIFT_CARD:a("Gift Card"),COUPON:a("Coupon"),AUTOMATIC:a("Automatic Discount")}[s.type]??s.description??a("Discount")}
5),s.code&&e.jsx("p",{className:"text-sm text-emerald-600",children:s.code})]})]}),e.jsxs("span",{className:"text-lg font-semibold text-emerald-700",children:["-",s.isPercentage?`${s.amount}%`:d(s.amount,r.currency)]})]},`discount-${s.code||s.description||t}`))]}),e.jsxs("div",{className:"pt-4 border-t border-slate-100 space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:a("Cost Summary")}),e.jsxs("div",{className:"space-y-2",children:[r.subtotalPrice!=null&&e.jsxs("div",{className:"flex justify-between text-base",children:[e.jsx("span",{className:"text-slate-600",children:a("Subtotal")}),e.jsx("span",{className:"font-medium text-slate-900",children:d(r.subtotalPrice,r.currency)})]}),r.totalShipping!=null&&e.jsxs("div",{className:"flex justify-between text-base",children:[e.jsx("span",{className:"text-slate-600",children:a("Shipping")}),e.jsx("span",{className:"font-medium text-slate-900",children:r.totalShipping===0?a("Free"):d(r.totalShipping,r.currency)})]}),r.totalTax!=null&&r.totalTax>0&&e.jsxs("div",{className:"flex justify-between text-base",children:[e.jsx("span",{className:"text-slate-600",children:a("Tax")}),e.jsx("span",{className:"font-medium text-slate-900",children:d(r.totalTax,r.currency)})]}),r.totalDiscounts!=null&&r.totalDiscounts>0&&e.jsxs("div",{className:"flex justify-between text-base",children:[e.jsx("span",{className:"text-emerald-600",children:a("Discount")}),e.jsxs("span",{className:"font-medium text-emerald-600",children:["-",d(r.totalDiscounts,r.currency)]})]}),((X=r.discounts)==null?void 0:X.some(s=>s.type==="GIFT_CARD"))&&e.jsxs("div",{className:"flex justify-between text-base pt-2 border-t border-slate-100",children:[e.jsx("span",{className:"text-slate-600",children:a("Total price")}),e.jsx("span",{className:"font-medium text-slate-900",children:d(r.totalPrice,r.currency)})]}),(Z=r.discounts)==null?void 0:Z.filter(s=>s.type==="GIFT_CARD").map((s,t)=>e.jsxs("div",{className:"flex justify-between text-base",children:[e.jsx("span",{className:"text-emerald-600",children:a("Gift card")}),e.jsxs("span",{className:"font-medium text-emerald-600",children:["-",d(s.amount,r.currency)]})]},`gc-${t}`))]}),e.jsxs("div",{className:"flex justify-between text-lg pt-3 border-t border-slate-200",children:[e.jsx("span",{className:"font-semibold text-slate-900",children:a("Total Paid by Customer")}),e.jsx("span",{className:"font-bold text-xl bg-gradient-to-r from-primary to-emerald-500 bg-clip-text text-transparent",children:d(r.totalPrice-(((ee=r.discounts)==null?void 0:ee.filter(s=>s.type==="GIFT_CARD").reduce((s,t)=>s+(t.amount||0),0))||0),r.currency)})]})]})]})]}),r.hasPersonalization&&e.jsxs("div",{className:"bg-white rounded-2xl border border-[#15B67F]/35 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-[#15B67F]/20 bg-[#15B67F]/10",children:[e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(ae,{className:"w-5 h-5 text-primary"}),a("Personalization Review")]}),e.jsx("p",{className:"mt-1 text-sm text-slate-600",children:a("Review every buyer-submitted line before approving this order for production.")})]}),e.jsx("div",{className:"p-6 space-y-4",children:(r.linePersonalizations||[]).map(s=>{const t=s.personalizedDesignId||A[v(s)];return e.jsx("div",{className:"rounded-xl border border-slate-200 bg-slate-50 p-4",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(N,{className:"bg-[#15B67F]/10 text-[#0f8f65] border-0",children:a("Personalized")}),t?e.jsx(N,{variant:"secondary",className:"bg-emerald-100 text-emerald-700 border-0",children:a("Design ready")}):s.missing?e.jsx(N,{variant:"secondary",className:"bg-red-100 text-red-700 border-0",children:a("Submission missing")}):e.jsx(N,{variant:"secondary",className:"bg-amber-100 text-amber-700 border-0",children:a("Needs review")})]}),e.jsx("div",{className:"grid gap-2 text-sm",children:s.fields.map(l=>e.jsxs("div",{className:"flex items-start gap-2",children:[l.type==="IMAGE"?e.jsx(Je,{className:"mt-0.5 h-4 w-4 text-slate-500"}):e.jsx(se,{className:"mt-0.5 h-4 w-4 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-800",children:l.label||l.layerId}),e.jsx("p",{className:"text-slate-500 break-all",children:l.type==="IMAGE"?l.displayValue||l.imageStorageUrl||a("uploaded"):l.displayValue||l.textValue||"—"})]})]},`${s.submissionId}-${l.layerId}`))})]}),e.jsxs("div",{className:"flex flex-col gap-3 md:w-48",children:[s.previewStorageUrl&&e.jsx("img",{src:s.previewStorageUrl,alt:a("Personalized preview"),className:"aspect-square w-full rounded-xl border border-slate-200 object-cover"}),e.jsxs(C,{type:"button",disabled:u||s.missing,onClick:()=>void pe(s),className:"gap-2 rounded-xl bg-[#15B67F] text-white shadow-soft hover:bg-[#0f8f65] hover:text-white",children:[u?e.jsx(E,{className:"h-4 w-4 animate-spin"}):e.jsx(ae,{className:"h-4 w-4"}),a("Review design")]})]})]})},s.submissionId)})})]}),r.printarexSummary&&r.printarexSummary.lineItems.length>0&&e.jsxs("div",{className:"bg-gradient-to-br from-primary/5 to-emerald-500/5 rounded-2xl border border-primary/20 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-primary/10",children:[e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Xe,{className:"w-5 h-5 text-primary"}),a("PrintaRex Order Summary")]}),r.printarexSummary.providerName&&e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-sm text-slate-600",children:[e.jsx(Ze,{className:"w-4 h-4"}),e.jsxs("span",{children:[a("Provider:")," ",e.jsx("strong",{className:"text-slate-900",children:r.printarexSummary.providerName})]}),e.jsx("span",{className:"text-slate-400",children:"|"}),e.jsxs("span",{children:[a("Currency:")," ",e.jsx("strong",{className:"text-slate-900",children:r.printarexSummary.currency})]})]})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-slate-500 border-b border-slate-200",children:[e.jsx("th",{className:"text-start py-3 pr-4 font-medium",children:a("Variant")}),e.jsx("th",{className:"text-center py-3 px-2 font-medium",children:a("Qty")}),e.jsx("th",{className:"text-end py-3 px-2 font-medium",children:a("Retail Total")}),e.jsx("th",{className:"text-end py-3 px-2 font-medium",children:a("Provider Production Total")}),e.jsx("th",{className:"text-end py-3 px-2 font-medium",children:a("Shipping Total")}),e.jsx("th",{className:"text-end py-3 px-2 font-medium",children:a("Branding Total")}),e.jsx("th",{className:"text-end py-3 px-2 font-medium",children:a("PrintaRex Order Transaction Fee")}),e.jsx("th",{className:"text-end py-3 pl-2 font-medium",children:a("Your Profit")})]})}),e.jsx("tbody",{children:r.printarexSummary.lineItems.map(s=>{const t=Ge(s);return e.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[e.jsx("td",{className:"py-3 pr-4 text-slate-900 font-medium",children:s.variantDescription}),e.jsx("td",{className:"py-3 px-2 text-center text-slate-600",children:e.jsx("span",{className:"inline-flex items-center justify-center min-w-[24px] h-6 px-2 bg-slate-100 rounded-md font-medium",children:s.quantity})}),e.jsx("td",{className:"py-3 px-2 text-end text-slate-600",children:d(t.retailTotal,r.printarexSummary.currency)}),e.jsx("td",{className:"py-3 px-2 text-end text-slate-600",children:d(t.providerCostTotal,r.printarexSummary.currency)}),e.jsx("td",{className:"py-3 px-2 text-end text-slate-600",children:d(t.shippingTotal,r.printarexSummary.currency)}),e.jsx("td",{className:"py-3 px-2 text-end text-slate-600",children:d(t.brandingTotal,r.printarexSummary.currency)}),e.jsx("td",{className:"py-3 px-2 text-end text-slate-600",children:d(t.orderFee,r.printarexSummary.currency)}),e.jsxs("td",{className:"py-3 pl-2 text-end",children:[e.jsx("span",{className:"font-semibold text-primary",children:d(t.profit,r.printarexSummary.currency)}),e.jsxs("span",{className:"text-slate-400 ms-1",children:["(",t.profitMargin.toFixed(0),"%)"]})]})]},`${s.variantDescription}-${s.quantity}`)})})]})}),r.printarexSummary.brandingItems&&r.printarexSummary.brandingItems.length>0&&e.jsxs("div",{className:"pt-4 border-t border-slate-200 space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:a("Branding Items")}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:r.printarexSummary.brandingItems.map(s=>e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-violet-50 rounded-xl",children:[s.imageUrl?e.jsx("img",{src:s.imageUrl,alt:s.name,className:"w-16 h-16 object-cover rounded-lg border border-violet-200"}):e.jsx("div",{className:"w-16 h-16 bg-violet-100 rounded-lg flex items-center justify-center",children:e.jsx(We,{className:"w-6 h-6 text-violet-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-base font-medium text-slate-900",children:s.name}),s.providerCost!=null&&e.jsxs("p",{className:"text-sm text-slate-500 mt-0.5",children:[a("Cost:")," ",d(s.providerCost,r.printarexSummary.currency)]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(N,{variant:"secondary",className:"bg-violet-100 text-violet-700 border-0",children:a("Branding")}),s.designId&&s.productSlug&&e.jsxs(C,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-violet-600 hover:text-violet-700 border-violet-200",onClick:()=>globalThis.open(`/dashboard/branding/design/${s.productSlug}/${s.designId}`,"_blank","noopener,noreferrer"),children:[e.jsx(es,{className:"h-3 w-3"}),a("View Design")]})]})]})]},`branding-${s.name}`))})]}),e.jsxs("div",{className:"pt-4 border-t border-slate-200 space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-slate-500 uppercase tracking-wide",children:a("Order Totals")}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-3 bg-white/50 rounded-xl",children:[e.jsx("p",{className:"text-xs text-slate-500",children:a("Provider Production Cost")}),e.jsx("p",{className:"text-lg font-semibold text-slate-900",children:d(r.printarexSummary.totalProviderCost,r.printarexSummary.currency)})]}),e.jsxs("div",{className:"p-3 bg-white/50 rounded-xl",children:[e.jsx("p",{className:"text-xs text-slate-500",children:a("Order Shipping Total")}),e.jsx("p",{className:"text-lg font-semibold text-slate-900",children:d(r.printarexSummary.totalShippingCost,r.printarexSummary.currency)})]}),e.jsxs("div",{className:"p-3 bg-white/50 rounded-xl",children:[e.jsx("p",{className:"text-xs text-slate-500",children:a("Branding")}),e.jsx("p",{className:"text-lg font-semibold text-slate-900",children:d(r.printarexSummary.totalBrandingCost,r.printarexSummary.currency)})]}),e.jsxs("div",{className:"p-3 bg-white/50 rounded-xl",children:[e.jsx("p",{className:"text-xs text-slate-500",children:a("PrintaRex Order Transaction Fee")}),e.jsx("p",{className:"text-lg font-semibold text-slate-900",children:d(r.printarexSummary.totalOrderFee,r.printarexSummary.currency)})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 pt-3",children:[e.jsxs("div",{className:"p-4 bg-slate-100 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ss,{className:"w-5 h-5 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-slate-600",children:a("Total Cost to You")})]}),e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:d(r.printarexSummary.totalCost,r.printarexSummary.currency)})]}),e.jsxs("div",{className:"p-4 bg-gradient-to-r from-primary/10 to-emerald-500/10 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(rs,{className:"w-5 h-5 text-primary"}),e.jsx("span",{className:"text-sm font-medium text-primary",children:a("Expected Your Profit")})]}),e.jsx("p",{className:"text-2xl font-bold text-primary",children:d(r.printarexSummary.totalProfit,r.printarexSummary.currency)})]})]})]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"p-5 border-b border-slate-100",children:e.jsx("h3",{className:"font-semibold text-slate-900",children:a("Customer Details")})}),e.jsxs("div",{className:"p-5 space-y-4",children:[r.customerName&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(as,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400",children:a("Name")}
5),e.jsx("p",{className:"text-sm font-medium text-slate-900",children:r.customerName})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 flex items-center justify-center",children:e.jsx(Ie,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400",children:a("Email")}),e.jsx("p",{className:"text-sm font-medium text-slate-900 break-all",children:r.customerEmail})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 flex items-center justify-center",children:e.jsx(ts,{className:"w-5 h-5 text-amber-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400",children:a("Received")}),e.jsx("p",{className:"text-sm font-medium text-slate-900",children:je(r.receivedAt)})]})]})]})]}),r.shippingAddress&&e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"p-5 border-b border-slate-100",children:e.jsx("h3",{className:"font-semibold text-slate-900",children:a("Shipping Address")})}),e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 flex items-center justify-center shrink-0",children:e.jsx(Se,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{className:"text-sm text-slate-700 space-y-0.5",children:[(r.shippingAddress.name||r.shippingAddress.firstName||r.shippingAddress.lastName)&&e.jsx("p",{className:"font-medium text-slate-900",children:r.shippingAddress.name||[r.shippingAddress.firstName,r.shippingAddress.lastName].filter(Boolean).join(" ")}),r.shippingAddress.company&&e.jsx("p",{children:r.shippingAddress.company}),r.shippingAddress.address1&&e.jsx("p",{children:r.shippingAddress.address1}),r.shippingAddress.address2&&e.jsx("p",{children:r.shippingAddress.address2}),e.jsx("p",{children:[r.shippingAddress.city,r.shippingAddress.province,r.shippingAddress.zip].filter(Boolean).join(", ")}),r.shippingAddress.country&&e.jsx("p",{children:r.shippingAddress.country}),r.shippingAddress.phone&&e.jsx("p",{className:"text-slate-500",children:r.shippingAddress.phone}),r.shippingAddress.email&&e.jsx("p",{className:"text-slate-500",children:r.shippingAddress.email})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-emerald-50 rounded-xl border border-emerald-100",children:[e.jsx("p",{className:"text-xs text-emerald-600 mb-1",children:a("Payment")}),e.jsx("p",{className:"text-sm font-semibold text-emerald-700 capitalize",children:G(r.financialStatus)})]}),e.jsxs("div",{className:"p-4 bg-blue-50 rounded-xl border border-blue-100",children:[e.jsx("p",{className:"text-xs text-blue-600 mb-1",children:a("Fulfillment")}),e.jsx("p",{className:"text-sm font-semibold text-blue-700 capitalize",children:G(r.fulfillmentStatus)})]})]}),r.printarexOrderNumber&&r.printarexOrderId&&e.jsxs(Ae,{to:`/dashboard/orders/${r.printarexOrderNumber}`,className:"group flex items-center justify-between p-4 bg-gradient-to-r from-primary/5 to-emerald-500/5 rounded-xl border border-primary/20 hover:border-primary/40 transition-all duration-200",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx($,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400",children:a("PrintaRex Order")}),e.jsx("p",{className:"text-sm font-semibold text-primary",children:r.printarexOrderNumber})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-primary opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("span",{className:"text-sm font-medium",children:a("View")}),e.jsx(Pe,{className:"w-4 h-4"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(C,{onClick:he,disabled:V||_||u||q,className:"w-full h-12 gap-2 bg-[#15B67F] hover:bg-[#129968] text-white rounded-xl shadow-lg shadow-[#15B67F]/25 transition-all duration-200 hover:shadow-xl hover:shadow-[#15B67F]/30 hover:-translate-y-0.5",children:[V||_||u?e.jsx(E,{className:"w-5 h-5 animate-spin"}):e.jsx(ls,{className:"w-5 h-5"}),r.hasPersonalization?a("Approve personalization and submit order"):a("Approve Order")]}),e.jsxs(C,{variant:"outline",onClick:()=>f(!0),className:"w-full h-12 gap-2 text-red-600 border-red-200 hover:bg-red-50 hover:border-red-300 rounded-xl transition-all duration-200",children:[e.jsx(is,{className:"w-5 h-5"}),a("Reject Order")]}),e.jsx("p",{className:"text-center text-xs text-slate-400",children:Ne()})]})]})]})}),e.jsx(ze,{open:z,onOpenChange:s=>{f(s),s||S("")},children:e.jsxs(Oe,{children:[e.jsxs(Te,{children:[e.jsx(Re,{children:a("Reject this order?")}),e.jsx(De,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:a("This action cannot be undone. The store order will be marked as rejected and will not be fulfilled through PrintaRex.")}
5),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"rejection-reason",className:"text-sm font-medium text-slate-800",children:a("Rejection reason")}),e.jsx(Le,{id:"rejection-reason",value:I,onChange:s=>S(s.target.value),placeholder:a("Example: Buyer personalization is incomplete or cannot be produced."),rows:3,disabled:O})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-50 border border-amber-200 rounded-lg text-amber-800 text-sm",children:[e.jsx(F,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:[a("The order will be")," ",e.jsxs("strong",{children:[a("cancelled in")," ",(()=>{var l,p;const s={shopify:"Shopify",woocommerce:"WooCommerce"},t=((p=(l=r==null?void 0:r.storeConnection)==null?void 0:l.platform)==null?void 0:p.toLowerCase())??"";return s[t]??a("your store")})()]})," ",a("and the customer will be notified.")]}),e.jsx("p",{className:"text-amber-700",children:a("If a refund is needed, please process it directly through your store admin panel.")})]})]})]})})]}),e.jsxs(ke,{children:[e.jsx(Be,{disabled:O,children:a("Cancel")}),e.jsx($e,{onClick:ue,disabled:O||!I.trim(),className:"bg-red-600 hover:bg-red-700 text-white",children:O?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"me-2 h-4 w-4 animate-spin"}),a("Rejecting...")]}):a("Reject Order")})]})]})})]})};export{Ws as StorePendingApprovalOrderDetailPage,Ws 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.