chore: add new features cabine & admin
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
getCommandItems,
|
||||
deleteCommand,
|
||||
confirmReceptionCabine,
|
||||
notifyClientToDescendCabine,
|
||||
getCabineLivreursList,
|
||||
assignDeliveryPersonByCabine,
|
||||
} from "../../api/api_cabine";
|
||||
@@ -51,7 +52,7 @@ export default function OrdersScreen() {
|
||||
const [commands, setCommands] = useState<CommandResponse[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const { alert, showError, showConfirm, hideAlert } = useAlert();
|
||||
const { alert, showError, showSuccess, showConfirm, hideAlert } = useAlert();
|
||||
const [itemsModal, setItemsModal] = useState<{
|
||||
visible: boolean;
|
||||
commandId: number | null;
|
||||
@@ -135,6 +136,15 @@ export default function OrdersScreen() {
|
||||
);
|
||||
};
|
||||
|
||||
const handleNotifyClient = async (commandId: number) => {
|
||||
try {
|
||||
await notifyClientToDescendCabine(commandId);
|
||||
showSuccess("Notification envoyée", "Le client a été prévenu de descendre");
|
||||
} catch (e: any) {
|
||||
showError("Erreur", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = (commandId: number) => {
|
||||
showConfirm(
|
||||
"Supprimer",
|
||||
@@ -356,6 +366,12 @@ export default function OrdersScreen() {
|
||||
size="sm"
|
||||
variant="primary"
|
||||
/>
|
||||
<Button
|
||||
title="Le client est là"
|
||||
onPress={() => handleNotifyClient(item.id)}
|
||||
size="sm"
|
||||
variant="warning"
|
||||
/>
|
||||
<Button
|
||||
title="Assigner"
|
||||
onPress={() => openAssignModal(item.id)}
|
||||
|
||||
Reference in New Issue
Block a user