feat: Refactor order flow initiation logic and enhance UI button styles for better user experience

This commit is contained in:
2026-01-08 09:08:25 -03:00
parent e97bcfbd6a
commit 5a6d9069c9
5 changed files with 95 additions and 59 deletions

View File

@@ -0,0 +1,23 @@
import { query } from './_generated/server';
import { v } from 'convex/values';
export const inspectOrder = query({
args: { pedidoId: v.id('pedidos') },
handler: async (ctx, args) => {
const pedido = await ctx.db.get(args.pedidoId);
const historicoEtapas = await ctx.db
.query('pedidoEtapasHistorico')
.withIndex('by_pedidoId', (q) => q.eq('pedidoId', args.pedidoId))
.collect();
const etapas = await ctx.db.query('pedidoFluxoEtapa').collect();
const transicoes = await ctx.db.query('pedidoFluxoTransicao').collect();
return {
pedido,
historicoEtapas,
etapasConfiguradas: etapas,
transicoesConfiguradas: transicoes
};
}
});