fix: display monetary value

master
adriano 2025-06-16 16:26:37 -03:00
parent 8222eb4b50
commit 69a93b1041
1 changed files with 13 additions and 9 deletions

View File

@ -12,7 +12,7 @@ import { Download, Search, Loader2, DollarSign, TrendingUp, Calculator } from "l
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:5000/api/v1"
function formatDateBr(dateStr:string) {
function formatDateBr(dateStr: string) {
const [year, month, day] = dateStr.split("-");
return `${day}/${month}/${year}`;
}
@ -319,7 +319,7 @@ export default function TranscriptionTable() {
{formatCurrency(costInfo.total_client_cost, "BRL")}
</div>
<p className="text-xs text-muted-foreground">
{formatDateBr(costInfo.start_date)} até {formatDateBr(costInfo.end_date)}
{formatDateBr(costInfo.start_date)} até {formatDateBr(costInfo.end_date)}
</p>
</CardContent>
</Card>
@ -495,22 +495,24 @@ export default function TranscriptionTable() {
<TableCell>{(item as HitTranscriptionData).src || "-"}</TableCell>
<TableCell>{(item as HitTranscriptionData).dst || "-"}</TableCell>
<TableCell>{(item as HitTranscriptionData).total_billsec || "-"}</TableCell>
<TableCell>{(item as HitTranscriptionData).total_min || "-"}</TableCell>
<TableCell>{(item as HitTranscriptionData).total_min || "-"}</TableCell>
<TableCell>
{(item as HitTranscriptionData).client_total_cost
? `R$ ${(item as HitTranscriptionData).client_total_cost.slice(0, 4)}`
{(item as HitTranscriptionData)?.client_total_cost
? `R$ ${Number((item as HitTranscriptionData).client_total_cost).toFixed(2)}`
: "-"}
</TableCell>
<TableCell>
{(item as HitTranscriptionData).client_price
? `R$ ${(item as HitTranscriptionData).client_price}`
: "-"}
</TableCell>
<TableCell>
{(item as HitTranscriptionData).custo_hit
? `$ ${(item as HitTranscriptionData).custo_hit.slice(0, 4)}`
{(item as HitTranscriptionData)?.custo_hit
? `$ ${Number((item as HitTranscriptionData).custo_hit).toFixed(2)}`
: "-"}
</TableCell>
<TableCell>{formatDateTime((item as HitTranscriptionData).start_call || "-")}</TableCell>
<TableCell>{formatDateTime((item as HitTranscriptionData).end_call || "-")}</TableCell>
<TableCell>{(item as HitTranscriptionData).qtd_token_input || "-"}</TableCell>
@ -525,10 +527,12 @@ export default function TranscriptionTable() {
<TableCell>{(item as ClientTranscriptionData).total_billsec || "-"}</TableCell>
<TableCell>{(item as ClientTranscriptionData).total_min || "-"}</TableCell>
<TableCell>
{(item as ClientTranscriptionData).client_total_cost
? `R$ ${(item as ClientTranscriptionData).client_total_cost.slice(0, 4)}`
{(item as ClientTranscriptionData)?.client_total_cost
? `R$ ${Number((item as ClientTranscriptionData).client_total_cost).toFixed(2)}`
: "-"}
</TableCell>
</>
)}
</TableRow>