Fix and UI imporvements 3
This commit is contained in:
@@ -114,6 +114,7 @@ const ListFieldRenderer: React.FC<ListFieldRendererProps> = ({ field, value, onC
|
||||
};
|
||||
|
||||
const isDisabled = listConfig.disabled ?? false;
|
||||
const disableRemove = listConfig.disableRemove ?? false;
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
@@ -148,13 +149,15 @@ const ListFieldRenderer: React.FC<ListFieldRendererProps> = ({ field, value, onC
|
||||
<div key={item.id || itemIndex} className="p-4 border border-[var(--border-secondary)] rounded-lg bg-[var(--bg-secondary)]/50 space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm font-medium text-[var(--text-primary)]">Elemento #{itemIndex + 1}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeItem(itemIndex)}
|
||||
className="p-1 text-red-500 hover:text-red-700 transition-colors"
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</button>
|
||||
{!disableRemove && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeItem(itemIndex)}
|
||||
className="p-1 text-red-500 hover:text-red-700 transition-colors"
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||
@@ -223,6 +226,7 @@ export interface AddModalField {
|
||||
showSubtotals?: boolean; // For calculating item totals
|
||||
subtotalFields?: { quantity: string; price: string }; // Field names for calculation
|
||||
disabled?: boolean; // Disable adding new items
|
||||
disableRemove?: boolean; // Disable removing existing items
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user