| @@ -40,8 +40,9 @@ | ||
| 40 | 40 | description: string; |
| 41 | 41 | type_id: number; |
| 42 | 42 | type_name?: string; |
| 43 | 43 | type_icon?: string; |
| 44 | + type_icon_provider?: "yatra" | "fa-solid" | "fa-regular"; | |
| 44 | 45 | status: "draft" | "publish" | "trash"; |
| 45 | 46 | usage_count?: number; |
| 46 | 47 | created_at: string; |
| 47 | 48 | updated_at: string; |
| @@ -419,16 +420,22 @@ | ||
| 419 | 420 | ]; |
| 420 | 421 | }, [statusFilter]); |
| 421 | 422 | |
| 422 | 423 | const handleBulkApply = async () => { |
| 423 | - if (!bulkAction || selectedIds.length === 0) { | |
| 424 | - showToast( | |
| 425 | - __("Please select items and a bulk action first.", "yatra"), | |
| 426 | - "error", | |
| 427 | - ); | |
| 424 | + // Report the input that is actually missing. The Apply button is disabled | |
| 425 | + // whenever nothing is selected, so this can only be reached with a non-empty | |
| 426 | + // selection — the combined message blamed the selection and left operators | |
| 427 | + // re-selecting rows that were already ticked. | |
| 428 | + if (selectedIds.length === 0) { | |
| 429 | + showToast(__("Please select at least one item.", "yatra"), "error"); | |
| 428 | 430 | return; |
| 429 | 431 | } |
| 430 | 432 | |
| 433 | + if (!bulkAction) { | |
| 434 | + showToast(__("Please choose a bulk action to apply.", "yatra"), "error"); | |
| 435 | + return; | |
| 436 | + } | |
| 437 | + | |
| 431 | 438 | try { |
| 432 | 439 | setBulkMutationPending(true); |
| 433 | 440 | |
| 434 | 441 | const selectedItems = items.filter((item: Item) => |
| @@ -515,8 +522,9 @@ | ||
| 515 | 522 | {item.type_icon && ( |
| 516 | 523 | <div className="w-8 h-8 rounded-md bg-gray-100 dark:bg-gray-800 flex items-center justify-center"> |
| 517 | 524 | <IconSelector |
| 518 | 525 | iconName={item.type_icon as any} |
| 526 | + provider={item.type_icon_provider ?? "yatra"} | |
| 519 | 527 | className="w-4 h-4 text-gray-700 dark:text-gray-300" |
| 520 | 528 | /> |
| 521 | 529 | </div> |
| 522 | 530 | )} |
| @@ -658,8 +666,9 @@ | ||
| 658 | 666 | }); |
| 659 | 667 | } |
| 660 | 668 | |
| 661 | 669 | return actions; |
| 670 | + // eslint-disable-next-line react-hooks/exhaustive-deps | |
| 662 | 671 | }, [can, queryClient, showToast]); |
| 663 | 672 | |
| 664 | 673 | return ( |
| 665 | 674 | <div className="space-y-3"> |