From 0de3a8faf4d725ea1b5f1f2068d7230f84184881 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Tue, 3 Jun 2025 19:40:48 +0000
Subject: [PATCH 1/2] Refactor: Centralize UI card component with
NucleoDataCard
This commit introduces a new `NucleoDataCard.vue` component to centralize the common structure and styling of various card elements used throughout the UI.
The following existing card components have been refactored to use `NucleoDataCard.vue`:
- `ui/src/components/asistencias/cardAsistencia.vue`
- `ui/src/components/empleados/cardEmpleado.vue`
- `ui/src/components/planillas/cardPlanilla.vue`
- `ui/src/components/tareas/cardTarea.vue`
Key changes:
- Created `NucleoDataCard.vue` in `ui/src/components/ui/` with flexible props (title, status, fields, accentColor, backgroundColor, avatarUrl, observation, showEditButton, showDeleteButton) and slots (header, body, footer, actions) to accommodate different card designs.
- Updated `NucleoDataCard.vue` to directly use hex color values for `accentColor` and `backgroundColor` props for easier integration with the UI store.
- Refactored the listed existing card components to utilize `NucleoDataCard.vue`, passing data through props and customizing specific sections (like avatars or field icons) via slots.
- Ensured that all functionalities, including edit/delete actions and dynamic styling based on the UI store, are preserved in the refactored components.
This centralization reduces code duplication, improves maintainability, and provides a consistent foundation for future card-based UI elements.
---
.../components/asistencias/cardAsistencia.vue | 101 +++++++--------
ui/src/components/empleados/cardEmpleado.vue | 118 ++++++++----------
ui/src/components/planillas/cardPlanilla.vue | 93 +++++++-------
ui/src/components/tareas/cardTarea.vue | 107 ++++++++--------
ui/src/components/ui/NucleoDataCard.vue | 89 +++++++++++++
5 files changed, 277 insertions(+), 231 deletions(-)
create mode 100644 ui/src/components/ui/NucleoDataCard.vue
diff --git a/ui/src/components/asistencias/cardAsistencia.vue b/ui/src/components/asistencias/cardAsistencia.vue
index f5a14b7..c09c91b 100644
--- a/ui/src/components/asistencias/cardAsistencia.vue
+++ b/ui/src/components/asistencias/cardAsistencia.vue
@@ -1,41 +1,30 @@
-
+
+
+
+
+
From 38339466c1ae659345145d93ce499ab7cd1ee564 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Tue, 3 Jun 2025 19:48:57 +0000
Subject: [PATCH 2/2] Refactor: Centralize UI card component and add
documentation
This commit introduces a new `NucleoDataCard.vue` component to centralize the common structure and styling of various card elements used throughout the UI. It also includes documentation for this new component.
The following existing card components have been refactored to use `NucleoDataCard.vue`:
- `ui/src/components/asistencias/cardAsistencia.vue`
- `ui/src/components/empleados/cardEmpleado.vue`
- `ui/src/components/planillas/cardPlanilla.vue`
- `ui/src/components/tareas/cardTarea.vue`
Key changes:
- Created `NucleoDataCard.vue` in `ui/src/components/ui/` with flexible props (title, status, fields, accentColor, backgroundColor, avatarUrl, observation, showEditButton, showDeleteButton) and slots (header, body, footer, actions) to accommodate different card designs.
- Updated `NucleoDataCard.vue` to directly use hex color values for `accentColor` and `backgroundColor` props for easier integration with your UI store.
- Refactored the listed existing card components to utilize `NucleoDataCard.vue`, passing data through props and customizing specific sections (like avatars or field icons) via slots.
- Ensured that all functionalities, including edit/delete actions and dynamic styling based on your UI store, are preserved in the refactored components.
- Added `ui/src/components/ui/README.md` with detailed documentation for `NucleoDataCard.vue`, covering its purpose, props, slots, events, and a usage example.
This centralization reduces code duplication, improves maintainability, and provides a consistent foundation for future card-based UI elements. The added documentation will help developers understand and use the new component effectively.
---
ui/src/components/ui/README.md | 96 ++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 ui/src/components/ui/README.md
diff --git a/ui/src/components/ui/README.md b/ui/src/components/ui/README.md
new file mode 100644
index 0000000..64c2603
--- /dev/null
+++ b/ui/src/components/ui/README.md
@@ -0,0 +1,96 @@
+# UI Components
+
+This directory contains general-purpose UI components used throughout the application.
+
+## NucleoDataCard.vue
+
+A flexible and centralized card component for displaying data entities.
+
+### Purpose
+
+The `NucleoDataCard` component provides a standardized way to display information in a card format. It's designed to be adaptable to various data types and styling requirements through props and slots. It supports a header (with optional avatar, title, and status), a body for displaying data fields and an optional observation section, and a footer with action buttons.
+
+### Props
+
+| Prop | Type | Default | Description |
+|---------------------|---------|-------------|-----------------------------------------------------------------------------|
+| `title` | String | _Required_ | The main title of the card, typically displayed in the header. |
+| `status` | String | `''` | A status string to be displayed as a badge in the header. |
+| `fields` | Array | `[]` | An array of objects (`{ label: String, value: String }`) for data rows. Each object represents a piece of data to be displayed with a label and its value. |
+| `accentColor` | String | `'#808080'` | Hex color code for the card's top border. |
+| `backgroundColor` | String | `'#FFFFFF'` | Hex color code for the card's background. |
+| `avatarUrl` | String | `''` | URL for an avatar image to be displayed in the header. |
+| `observation` | String | `''` | A text string for an observation section displayed below the fields. |
+| `showEditButton` | Boolean | `true` | Whether to display the default Edit button in the footer. |
+| `showDeleteButton` | Boolean | `true` | Whether to display the default Delete button in the footer. |
+
+*Note: `accentColor` and `backgroundColor` are applied using inline styles. The default status badge styling in the header slot might not work as expected with hex `accentColor` values for its default Tailwind classes; use the `header` slot for custom status styling if needed.*
+
+### Slots
+
+- **`header`**: Allows custom content or layout for the card header. If used, it overrides the default header structure which includes the avatar, title, and status badge.
+- **`body`**: Allows complete customization of the main card content area. If used, you are responsible for rendering the content that would normally go here, such as iterating through the `fields` prop and displaying the `observation` prop. The default content of this slot handles the rendering of `fields` and `observation`.
+- **`footer`**: Allows custom content to be injected at the beginning of the card footer, before the `actions` slot and default Edit/Delete buttons.
+- **`actions`**: Allows adding custom buttons or other interactive elements to the footer. These are rendered before the default Edit and Delete buttons if they are visible.
+
+### Events
+
+- **`edit`**: Emitted with no payload when the default Edit button (if shown) is clicked.
+- **`delete`**: Emitted with no payload when the default Delete button (if shown) is clicked.
+
+### Example Usage
+
+```vue
+
+
+
+
+
+
+
+
+
+
+
+```