Fix checkout summary rendering
This commit is contained in:
parent
ed4349a938
commit
803d371b59
2 changed files with 9 additions and 9 deletions
|
|
@ -7,7 +7,7 @@ import { ordersService, CreateOrderRequest } from '../services/ordersService'
|
|||
import { shippingService } from '../services/shippingService'
|
||||
import { apiClient } from '../services/apiClient'
|
||||
import { formatCurrency } from '../utils/format'
|
||||
import { ArrowLeft, CheckCircle2, Truck, Store } from 'lucide-react'
|
||||
import { ArrowLeft, CheckCircle, Truck } from 'lucide-react'
|
||||
|
||||
export function CheckoutPage() {
|
||||
const navigate = useNavigate()
|
||||
|
|
@ -38,8 +38,7 @@ export function CheckoutPage() {
|
|||
async function fetchCompanyAddress() {
|
||||
try {
|
||||
// TODO: Use a proper service for this
|
||||
const res = await apiClient.get<any>('/v1/companies/me')
|
||||
const company = res.data
|
||||
const company = await apiClient.get<any>('/v1/companies/me')
|
||||
if (company) {
|
||||
setShipping(prev => ({
|
||||
...prev,
|
||||
|
|
@ -259,7 +258,7 @@ export function CheckoutPage() {
|
|||
{/* Payment Method Selection */}
|
||||
<div className="rounded-lg bg-white p-6 shadow-sm">
|
||||
<div className="mb-4 flex items-center gap-2">
|
||||
<CheckCircle2 className="h-5 w-5 text-medicalBlue" />
|
||||
<CheckCircle className="h-5 w-5 text-medicalBlue" />
|
||||
<h2 className="text-lg font-semibold text-gray-800">Forma de Pagamento</h2>
|
||||
</div>
|
||||
|
||||
|
|
@ -320,10 +319,11 @@ export function CheckoutPage() {
|
|||
{Object.entries(groups).map(([vendorId, group]) => (
|
||||
<div key={vendorId} className="border-b border-gray-100 pb-4 last:border-0 last:pb-0">
|
||||
<p className="mb-2 text-sm font-medium text-gray-600">{group.vendorName}</p>
|
||||
<div key={item.id} className="flex justify-between text-sm">
|
||||
<span className="text-gray-800">{item.quantity}x {item.name}</span>
|
||||
<span className="text-gray-600">R$ {formatCurrency(item.quantity * item.unitPrice)}</span>
|
||||
</div>
|
||||
{group.items.map(item => (
|
||||
<div key={item.id} className="flex justify-between text-sm">
|
||||
<span className="text-gray-800">{item.quantity}x {item.name}</span>
|
||||
<span className="text-gray-600">R$ {formatCurrency(item.quantity * item.unitPrice)}</span>
|
||||
</div>
|
||||
))}
|
||||
|
||||
{/* Shipping Options for this Vendor */}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export interface CalculateShippingResponse {
|
|||
}
|
||||
|
||||
export const shippingService = {
|
||||
getSettings: async (vendorId: string) => {
|
||||
getSettings: async (vendorId: string): Promise<ShippingSettings> => {
|
||||
const response = await apiClient.get<ShippingSettings>(`/v1/shipping/settings/${vendorId}`)
|
||||
return response
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue