chore: add new address
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
getOrderETA,
|
||||
confirmReception,
|
||||
cancelCommand,
|
||||
respondToAddressProposal,
|
||||
formatOrderDate,
|
||||
formatPrice,
|
||||
calculateOrderTotal,
|
||||
@@ -267,6 +268,29 @@ export default function OrderTrackingScreen() {
|
||||
gap: spacing.s,
|
||||
marginTop: spacing.l,
|
||||
},
|
||||
proposalBox: {
|
||||
backgroundColor: colors.warning + "18",
|
||||
borderWidth: 1,
|
||||
borderColor: colors.warning,
|
||||
borderRadius: borderRadius.md,
|
||||
padding: spacing.m,
|
||||
marginTop: spacing.m,
|
||||
},
|
||||
proposalTitle: {
|
||||
color: colors.warning,
|
||||
fontSize: fontSize.sm,
|
||||
fontWeight: fontWeight.semibold,
|
||||
marginBottom: spacing.xs,
|
||||
},
|
||||
proposalAddress: {
|
||||
color: colors.textWhite,
|
||||
fontSize: fontSize.md,
|
||||
marginBottom: spacing.m,
|
||||
},
|
||||
proposalActions: {
|
||||
flexDirection: "row",
|
||||
gap: spacing.s,
|
||||
},
|
||||
modalBody: { gap: spacing.m },
|
||||
modalText: {
|
||||
color: colors.textPrimary,
|
||||
@@ -360,9 +384,7 @@ export default function OrderTrackingScreen() {
|
||||
const progress = STATUS_PROGRESS[order.status] || 0;
|
||||
const track = tracking[order.id];
|
||||
const eta = etas[order.id];
|
||||
const canConfirm = ["livre", "arrived"].includes(
|
||||
order.status,
|
||||
);
|
||||
const canConfirm = order.status === "livre";
|
||||
const canCancel = [
|
||||
"pending",
|
||||
"assigned",
|
||||
@@ -431,6 +453,46 @@ export default function OrderTrackingScreen() {
|
||||
color={colors.textMuted}
|
||||
/>
|
||||
</View>
|
||||
{order.address_proposal_status === "pending" && order.proposed_address && (
|
||||
<View style={styles.proposalBox}>
|
||||
<Text style={styles.proposalTitle}>
|
||||
📍 Nouvelle adresse proposée
|
||||
</Text>
|
||||
<Text style={styles.proposalAddress}>
|
||||
{order.proposed_address}
|
||||
</Text>
|
||||
<View style={styles.proposalActions}>
|
||||
<Button
|
||||
title="Accepter"
|
||||
variant="success"
|
||||
size="sm"
|
||||
onPress={async () => {
|
||||
const res = await respondToAddressProposal(order.id, true);
|
||||
if (res.success) {
|
||||
showToast("Adresse acceptée", "success");
|
||||
fetchOrders();
|
||||
} else {
|
||||
showToast(res.message, "error");
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
title="Refuser"
|
||||
variant="danger"
|
||||
size="sm"
|
||||
onPress={async () => {
|
||||
const res = await respondToAddressProposal(order.id, false);
|
||||
if (res.success) {
|
||||
showToast("Adresse refusée", "info");
|
||||
fetchOrders();
|
||||
} else {
|
||||
showToast(res.message, "error");
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
{expanded && (
|
||||
<View style={styles.expandedSection}>
|
||||
{track?.livreur_username && (
|
||||
|
||||
Reference in New Issue
Block a user