chore: fix reset point
This commit is contained in:
@@ -20,7 +20,6 @@ import {
|
|||||||
notifyClientToDescendCabine,
|
notifyClientToDescendCabine,
|
||||||
getCabineLivreursList,
|
getCabineLivreursList,
|
||||||
assignDeliveryPersonByCabine,
|
assignDeliveryPersonByCabine,
|
||||||
resetClientPoints,
|
|
||||||
proposeAddressChangeCabine,
|
proposeAddressChangeCabine,
|
||||||
} from "../../api/api_cabine";
|
} from "../../api/api_cabine";
|
||||||
import type { CommandResponse } from "../../api/types";
|
import type { CommandResponse } from "../../api/types";
|
||||||
@@ -166,23 +165,6 @@ export default function OrdersScreen() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResetPoints = (clientUsername: string) => {
|
|
||||||
setOpenMenuId(null);
|
|
||||||
showConfirm(
|
|
||||||
"Reset points zipette",
|
|
||||||
`Réinitialiser les points zipette du client ${clientUsername} ?`,
|
|
||||||
async () => {
|
|
||||||
try {
|
|
||||||
await resetClientPoints(clientUsername, true);
|
|
||||||
showSuccess("Points réinitialisés", `Les points de ${clientUsername} ont été remis à zéro`);
|
|
||||||
} catch (e: any) {
|
|
||||||
showError("Erreur", e.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Réinitialiser",
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = (commandId: number) => {
|
const handleDelete = (commandId: number) => {
|
||||||
setOpenMenuId(null);
|
setOpenMenuId(null);
|
||||||
showConfirm(
|
showConfirm(
|
||||||
@@ -457,11 +439,6 @@ export default function OrdersScreen() {
|
|||||||
onPress: () => handleConfirmReception(item.id),
|
onPress: () => handleConfirmReception(item.id),
|
||||||
condition: item.status === "livre",
|
condition: item.status === "livre",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Reset points zipette",
|
|
||||||
icon: "star-outline" as keyof typeof Ionicons.glyphMap,
|
|
||||||
onPress: () => handleResetPoints(item.username),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Supprimer",
|
label: "Supprimer",
|
||||||
icon: "trash-outline" as keyof typeof Ionicons.glyphMap,
|
icon: "trash-outline" as keyof typeof Ionicons.glyphMap,
|
||||||
|
|||||||
@@ -73,6 +73,22 @@ export default function UsersScreen() {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleResetZipette = (username: string) => {
|
||||||
|
showConfirm(
|
||||||
|
"Reset points zipette",
|
||||||
|
`Réinitialiser les points zipette de ${username} ?`,
|
||||||
|
async () => {
|
||||||
|
try {
|
||||||
|
await resetClientPoints(username, true);
|
||||||
|
await loadData();
|
||||||
|
} catch (e: any) {
|
||||||
|
showError("Erreur", e.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Reset",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const styles = useMemo(
|
const styles = useMemo(
|
||||||
() =>
|
() =>
|
||||||
StyleSheet.create({
|
StyleSheet.create({
|
||||||
@@ -154,6 +170,12 @@ export default function UsersScreen() {
|
|||||||
size="sm"
|
size="sm"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
title="Reset zipette"
|
||||||
|
onPress={() => handleResetZipette(item.username)}
|
||||||
|
size="sm"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user