| @@ -65,8 +65,10 @@ | ||
| 65 | 65 | ? parseInt(urlParams.get("trip_id")!) |
| 66 | 66 | : null; |
| 67 | 67 | |
| 68 | 68 | // Filters and search |
| 69 | + const [bulkDeleteConfirm, setBulkDeleteConfirm] = useState(false); | |
| 70 | + | |
| 69 | 71 | const [searchTerm, setSearchTerm] = useState(""); |
| 70 | 72 | const [statusFilter, setStatusFilter] = useState("all"); |
| 71 | 73 | const [page, setPage] = useState(1); |
| 72 | 74 | |
| @@ -198,18 +200,11 @@ | ||
| 198 | 200 | if (!bulkAction || selectedIds.length === 0) return; |
| 199 | 201 | |
| 200 | 202 | switch (bulkAction) { |
| 201 | 203 | case "delete": |
| 202 | - if ( | |
| 203 | - confirm( | |
| 204 | - __( | |
| 205 | - "Are you sure you want to delete {count} rule(s)?", | |
| 206 | - "yatra", | |
| 207 | - ).replace("{count}", selectedIds.length.toString()), | |
| 208 | - ) | |
| 209 | - ) { | |
| 210 | - bulkDeleteMutation.mutate(selectedIds); | |
| 211 | - } | |
| 204 | + // Confirmed through the shared dialog, matching the single-rule delete | |
| 205 | + // already used on this page. | |
| 206 | + setBulkDeleteConfirm(true); | |
| 212 | 207 | break; |
| 213 | 208 | } |
| 214 | 209 | |
| 215 | 210 | setBulkAction(""); |
| @@ -643,8 +638,26 @@ | ||
| 643 | 638 | </CardContent> |
| 644 | 639 | </Card> |
| 645 | 640 | </> |
| 646 | 641 | )} |
| 642 | + | |
| 643 | + <ConfirmationDialog | |
| 644 | + isOpen={bulkDeleteConfirm} | |
| 645 | + onClose={() => setBulkDeleteConfirm(false)} | |
| 646 | + onConfirm={() => { | |
| 647 | + bulkDeleteMutation.mutate(selectedIds); | |
| 648 | + setBulkDeleteConfirm(false); | |
| 649 | + }} | |
| 650 | + title={__("Delete Rules", "yatra")} | |
| 651 | + message={__( | |
| 652 | + "Are you sure you want to delete {count} rule(s)? This action cannot be undone.", | |
| 653 | + "yatra", | |
| 654 | + ).replace("{count}", selectedIds.length.toString())} | |
| 655 | + confirmText={__("Delete", "yatra")} | |
| 656 | + cancelText={__("Cancel", "yatra")} | |
| 657 | + variant="danger" | |
| 658 | + isLoading={bulkDeleteMutation.isPending} | |
| 659 | + /> | |
| 647 | 660 | </div> |
| 648 | 661 | ); |
| 649 | 662 | }; |
| 650 | 663 | |