This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
formatOrderDate,
|
||||
formatPrice,
|
||||
calculateOrderTotal,
|
||||
getPublicSettings,
|
||||
} from "../../api/api";
|
||||
import type {
|
||||
OrderDetail,
|
||||
@@ -72,6 +73,7 @@ export default function OrderTrackingScreen() {
|
||||
const [penaltyWarning, setPenaltyWarning] =
|
||||
useState<CancelCommandResponse | null>(null);
|
||||
const [penaltyOrderId, setPenaltyOrderId] = useState<number | null>(null);
|
||||
const [penaltiesEnabled, setPenaltiesEnabled] = useState(false);
|
||||
const [toastMsg, setToastMsg] = useState("");
|
||||
const [toastType, setToastType] = useState<
|
||||
"success" | "error" | "warning" | "info"
|
||||
@@ -98,6 +100,10 @@ export default function OrderTrackingScreen() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
getPublicSettings().then((s) => setPenaltiesEnabled(s.penalties_enabled)).catch(() => {});
|
||||
}, []);
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
setLoading(true);
|
||||
@@ -677,6 +683,24 @@ export default function OrderTrackingScreen() {
|
||||
iconColor={colors.danger}
|
||||
>
|
||||
<View style={styles.modalBody}>
|
||||
{penaltiesEnabled && (
|
||||
<View style={{
|
||||
flexDirection: "row",
|
||||
alignItems: "flex-start",
|
||||
gap: 8,
|
||||
backgroundColor: colors.danger + "18",
|
||||
borderWidth: 1,
|
||||
borderColor: colors.danger + "55",
|
||||
borderRadius: 8,
|
||||
padding: 12,
|
||||
marginBottom: 12,
|
||||
}}>
|
||||
<Ionicons name="warning-outline" size={18} color={colors.danger} style={{ marginTop: 1 }} />
|
||||
<Text style={{ flex: 1, color: colors.danger, fontSize: 13, lineHeight: 18 }}>
|
||||
Attention : en cas d'annulations répétées, une amende sera appliquée à votre compte.
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
<Text style={styles.modalText}>
|
||||
Raison de l'annulation :
|
||||
</Text>
|
||||
@@ -739,12 +763,10 @@ export default function OrderTrackingScreen() {
|
||||
<Ionicons
|
||||
name="remove-circle-outline"
|
||||
size={16}
|
||||
color={colors.warning}
|
||||
color={colors.danger}
|
||||
/>
|
||||
<Text style={styles.penaltyDetail}>
|
||||
Penalite:{" "}
|
||||
{penaltyWarning.penalty_warning.penalty_amount}{" "}
|
||||
points
|
||||
<Text style={[styles.penaltyDetail, { color: colors.danger, fontWeight: "700" }]}>
|
||||
Amende : {penaltyWarning.penalty_warning.penalty_amount} €
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user