Fix
This commit is contained in:
@@ -19,7 +19,7 @@ struct OrderDetailsView: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, 20)
|
.padding(.horizontal, 20)
|
||||||
.padding(.top, 14)
|
.padding(.top, 14)
|
||||||
.padding(.bottom, UIDevice.bottomNotch + 110)
|
.padding(.bottom, UIDevice.bottomNotch)
|
||||||
}
|
}
|
||||||
.background(AppColors.backgroundLight)
|
.background(AppColors.backgroundLight)
|
||||||
.navigationTitle("Detalhes do Pedido")
|
.navigationTitle("Detalhes do Pedido")
|
||||||
@@ -29,7 +29,7 @@ struct OrderDetailsView: View {
|
|||||||
reorderButton
|
reorderButton
|
||||||
.padding(.horizontal, 20)
|
.padding(.horizontal, 20)
|
||||||
.padding(.top, 10)
|
.padding(.top, 10)
|
||||||
.padding(.bottom, max(10, UIDevice.bottomNotch))
|
.padding(.bottom, UIDevice.bottomNotch + 60)
|
||||||
}
|
}
|
||||||
.background(AppColors.backgroundLight.opacity(0.94))
|
.background(AppColors.backgroundLight.opacity(0.94))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,18 +53,27 @@ struct OrdersView: View {
|
|||||||
orderId: context.orderId,
|
orderId: context.orderId,
|
||||||
initialShortId: context.shortId,
|
initialShortId: context.shortId,
|
||||||
fallbackPaymentMethod: context.paymentMethod,
|
fallbackPaymentMethod: context.paymentMethod,
|
||||||
fallbackTotal: context.total
|
fallbackTotal: context.total,
|
||||||
|
routeIntent: context.intent
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func orderCard(_ order: AppOrderSummary) -> some View {
|
private func orderCard(_ order: AppOrderSummary) -> some View {
|
||||||
let status = orderVisualStatus(for: order)
|
let status = orderVisualStatus(for: order)
|
||||||
let route = OrderRouteContext(
|
let detailsRoute = OrderRouteContext(
|
||||||
orderId: trackingOrderId(for: order),
|
orderId: trackingOrderId(for: order),
|
||||||
shortId: order.shortId,
|
shortId: order.shortId,
|
||||||
paymentMethod: order.paymentMethod,
|
paymentMethod: order.paymentMethod,
|
||||||
total: order.total
|
total: order.total,
|
||||||
|
intent: .details
|
||||||
|
)
|
||||||
|
let trackingRoute = OrderRouteContext(
|
||||||
|
orderId: trackingOrderId(for: order),
|
||||||
|
shortId: order.shortId,
|
||||||
|
paymentMethod: order.paymentMethod,
|
||||||
|
total: order.total,
|
||||||
|
intent: .tracking
|
||||||
)
|
)
|
||||||
|
|
||||||
return VStack(alignment: .leading, spacing: 14) {
|
return VStack(alignment: .leading, spacing: 14) {
|
||||||
@@ -121,7 +130,7 @@ struct OrdersView: View {
|
|||||||
|
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
Button(status.isCanceled ? "Ajuda" : "Ver Detalhes") {
|
Button(status.isCanceled ? "Ajuda" : "Ver Detalhes") {
|
||||||
selectedOrderRoute = route
|
selectedOrderRoute = detailsRoute
|
||||||
}
|
}
|
||||||
.font(AppTypography.heading3)
|
.font(AppTypography.heading3)
|
||||||
.foregroundStyle(AppColors.textMuted)
|
.foregroundStyle(AppColors.textMuted)
|
||||||
@@ -134,7 +143,7 @@ struct OrdersView: View {
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
if status.isInProgress {
|
if status.isInProgress {
|
||||||
selectedOrderRoute = route
|
selectedOrderRoute = trackingRoute
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
SnackbarCenter.shared.show(
|
SnackbarCenter.shared.show(
|
||||||
@@ -464,11 +473,18 @@ struct OrdersView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct OrderRouteContext: Identifiable, Hashable {
|
struct OrderRouteContext: Identifiable, Hashable {
|
||||||
var id: String { orderId }
|
var id: String { "\(orderId)|\(intent.rawValue)" }
|
||||||
let orderId: String
|
let orderId: String
|
||||||
let shortId: String?
|
let shortId: String?
|
||||||
let paymentMethod: String?
|
let paymentMethod: String?
|
||||||
let total: Double?
|
let total: Double?
|
||||||
|
let intent: OrderRouteIntent
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OrderRouteIntent: String, Hashable {
|
||||||
|
case details
|
||||||
|
case tracking
|
||||||
|
case auto
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum OrderRowStatusStyle {
|
private enum OrderRowStatusStyle {
|
||||||
@@ -584,6 +600,7 @@ struct OrderEntryDestinationView: View {
|
|||||||
let initialShortId: String?
|
let initialShortId: String?
|
||||||
let fallbackPaymentMethod: String?
|
let fallbackPaymentMethod: String?
|
||||||
let fallbackTotal: Double?
|
let fallbackTotal: Double?
|
||||||
|
let routeIntent: OrderRouteIntent
|
||||||
|
|
||||||
@State var isResolvingRoute = true
|
@State var isResolvingRoute = true
|
||||||
@State var didResolve = false
|
@State var didResolve = false
|
||||||
@@ -643,8 +660,16 @@ struct OrderEntryDestinationView: View {
|
|||||||
func resolveRoute() async {
|
func resolveRoute() async {
|
||||||
defer { isResolvingRoute = false }
|
defer { isResolvingRoute = false }
|
||||||
|
|
||||||
|
if routeIntent == .tracking {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let order = await fetchOrderForRouting()
|
let order = await fetchOrderForRouting()
|
||||||
guard let order else { return }
|
guard let order else { return }
|
||||||
|
if routeIntent == .details {
|
||||||
|
orderDetails = order
|
||||||
|
return
|
||||||
|
}
|
||||||
if shouldOpenOrderDetails(for: order) {
|
if shouldOpenOrderDetails(for: order) {
|
||||||
orderDetails = order
|
orderDetails = order
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user