chore: build
Backend - Build & Lint / build (push) Failing after 31m13s
Frontend Web - Build & Lint / build (push) Failing after 9m49s

This commit is contained in:
Xor290
2026-08-16 13:40:55 +02:00
parent 32a60b4476
commit b8fddc51c2
8 changed files with 348 additions and 2 deletions
@@ -14,6 +14,7 @@ import {
getOrderETA,
confirmReception,
cancelCommand,
updateOwnCommandAddress,
isUserAuthenticated,
getPublicSettings,
} from "../../api/api";
@@ -51,6 +52,7 @@ import {
faWind,
faChevronUp,
faChevronDown,
faPen,
} from "@fortawesome/free-solid-svg-icons";
interface OrderWithTracking extends OrderDetail {
@@ -282,6 +284,11 @@ function SuiviLivraison() {
const [showCancelDialog, setShowCancelDialog] = useState(false);
const [orderToCancel, setOrderToCancel] = useState<number | null>(null);
const [cancelReason, setCancelReason] = useState("");
const [editingAddressOrder, setEditingAddressOrder] = useState<
number | null
>(null);
const [newAddressValue, setNewAddressValue] = useState("");
const [savingAddress, setSavingAddress] = useState(false);
const [showPenaltyWarning, setShowPenaltyWarning] = useState(false);
const [penaltyWarningData, setPenaltyWarningData] =
useState<CancelCommandResponse | null>(null);
@@ -383,6 +390,28 @@ function SuiviLivraison() {
}
};
const handleUpdateAddress = async (orderId: number) => {
setSavingAddress(true);
try {
const res = await updateOwnCommandAddress(
orderId,
newAddressValue,
);
if (res.success) {
showToast(res.message || "Adresse mise à jour", "success");
setEditingAddressOrder(null);
setNewAddressValue("");
loadOrders();
} else {
showToast(res.message || "Erreur", "error");
}
} catch {
showToast("Erreur mise à jour adresse", "error");
} finally {
setSavingAddress(false);
}
};
const showToast = (
message: string,
type: "success" | "error" | "warning" | "info",
@@ -889,6 +918,88 @@ function SuiviLivraison() {
order,
)}
</p>
{(statusLow ===
"pending" ||
statusLow ===
"assigned") &&
(editingAddressOrder ===
order.id ? (
<div className="address-edit">
<input
type="text"
className="address-edit-input"
value={
newAddressValue
}
onChange={(
e,
) =>
setNewAddressValue(
e
.target
.value,
)
}
placeholder="Ex: 24 Rue Docteur Brindeau, 44000 Nantes"
/>
<div className="address-edit-actions">
<button
type="button"
className="btn-secondary"
onClick={() => {
setEditingAddressOrder(
null,
);
setNewAddressValue(
"",
);
}}
>
Annuler
</button>
<button
type="button"
className="btn-primary"
disabled={
savingAddress ||
!newAddressValue.trim()
}
onClick={() =>
handleUpdateAddress(
order.id,
)
}
>
{savingAddress
? "Enregistrement..."
: "Enregistrer"}
</button>
</div>
</div>
) : (
<button
type="button"
className="address-edit-toggle"
onClick={() => {
setNewAddressValue(
getDeliveryAddress(
order,
),
);
setEditingAddressOrder(
order.id,
);
}}
>
<FontAwesomeIcon
icon={
faPen
}
/>{" "}
Modifier
l'adresse
</button>
))}
{(() => {
const info =
getClientInfo(