1import{ad as f,a as b,a4 as N,j as e,F as v,B as C,K as y}from"./index-BfLdn4Vu.js";import{C as l,b as m,c as x,a as p}from"./card-CW2Buz3p.js";import{B as o}from"./badge-Bqd04p_5.js";import{T as _,a as P,b as h,c as d,d as T,e as i}from"./table-BCUwSt2H.js";import{M}from"./MoedaCotacaoCard-CkdTsAQk.js";import{b as k}from"./useMoedas-CQhtX4EA.js";import{P as w}from"./PageHeader-CTtXZM-S.js";import{S as c}from"./SetBreadcrumbs-BZlpTm-B.js";import{P as B}from"./pencil-Cbx4Nl6T.js";import"./useCotacao-DoR7Yd3l.js";import"./radio-WQrQ549_.js";import"./trending-down-CWE2w0Nr.js";import"./minus-CR-40BGq.js";import"./formatDistanceToNow-BLIPnjV8.js";import"./en-US-BvK8AWMH.js";import"./endOfMonth-LmV9cV7M.js";import"./pt-BR-BrR0hY0V.js";import"./useMutation-D7MmsIig.js";function U(){const{codigo:t}=f(),j=b(),{data:s,isLoading:u}=k(t||""),{data:n=[]}=N({queryKey:["paises-by-moeda",t],queryFn:async()=>{const{data:a,error:r}=await y.from("pais_moeda_regras").select("*, paises:pais_id(nome, iso2, status)").eq("moeda_codigo",t||"");if(r)throw r;return a||[]},enabled:!!t});if(u)return e.jsxs(e.Fragment,{children:[e.jsx(c,{items:[{label:"Moedas",href:"/admin/moedas"},{label:"Detalhes"}]}),e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(v,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]});if(!s)return e.jsxs(e.Fragment,{children:[e.jsx(c,{items:[{label:"Moedas",href:"/admin/moedas"},{label:"Detalhes"}]}),e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Moeda não encontrada"})]});const g={permitido:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",restrito:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",proibido:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};return e.jsxs(e.Fragment,{children:[e.jsx(c,{items:[{label:"Moedas",href:"/admin/moedas"},{label:"Detalhes"}]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(w,{title:s.nome,description:`${s.codigo} ⢠${s.simbolo}`,actions:e.jsxs(C,{onClick:()=>j(`/admin/moedas/${s.codigo}/editar`),children:[e.jsx(B,{className:"h-4 w-4 mr-2"})," Editar"]})}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs(l,{children:[e.jsx(m,{children:e.jsx(x,{children:"Dados Cadastrais"})}),e.jsxs(p,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Código ISO:"})," ",e.jsx("span",{className:"font-mono font-semibold",children:s.codigo})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"SÃmbolo:"})," ",e.jsx("span",{className:"font-semibold",children:s.simbolo})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Par cotação:"})," ",e.jsx("span",{className:"font-mono",children:s.par_cotacao})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Casas decimais:"})," ",s.casa_decimal]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Ordem:"})," ",s.ordem_exibicao]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Status:"})," ",e.jsx(o,{variant:s.status==="ativo"?"default":"secondary",children:s.status})]})]}),e.jsx("div",{className:"flex gap-1.5 pt-2",children:s.tipo_operacao.map(a=>e.jsx(o,{variant:"outline",className:"capitalize",children:a},a))})]})]}),e.jsx(M,{parCotacao:s.par_cotacao,mostrarOHLC:!0,className:"h-fit"})]}),e.jsxs(l,{children:[e.jsx(m,{children:e.jsx(x,{children:"PaÃses com esta moeda configurada"})}),e.jsx(p,{children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"Nenhum paÃs vinculado a esta moeda"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(_,{children:[e.jsx(P,{children:e.jsxs(h,{children:[e.jsx(d,{children:"PaÃs"}),e.jsx(d,{children:"Tipo Operação"}),e.jsx(d,{children:"Status"}),e.jsx(d,{children:"Especificações"})]})}),e.jsx(T,{children:n.map(a=>{var r;return e.jsxs(h,{children:[e.jsx(i,{className:"font-medium",children:((r=a.paises)==null?void 0:r.nome)||"â"}),e.jsx(i,{className:"capitalize",children:a.tipo_operacao}),e.jsx(i,{children:e.jsx(o,{className:g[a.status_operacao]||"",children:a.status_operacao})}),e.jsx(i,{className:"text-sm text-muted-foreground max-w-xs truncate",children:a.especificacoes||"â"})]},a.id)})})]})})})]})]})]})}export{U 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.