diff --git a/frontend/documentation/components/DataTable.md b/frontend/documentation/components/DataTable.md index c4596a1..3033f60 100644 --- a/frontend/documentation/components/DataTable.md +++ b/frontend/documentation/components/DataTable.md @@ -768,102 +768,107 @@ const customFilters = { ```vue diff --git a/frontend/src/components/common/DataTable.vue b/frontend/src/components/common/DataTable.vue index b63cc55..b9c1e12 100644 --- a/frontend/src/components/common/DataTable.vue +++ b/frontend/src/components/common/DataTable.vue @@ -1,10 +1,6 @@ - + @@ -85,14 +81,14 @@ - + - + - + - + - {{ selectedRows.length }} row{{ selectedRows.length !== 1 ? "s" : "" }} selected + {{ selectedRows.length }} row{{ + selectedRows.length !== 1 ? "s" : "" + }} + selected @@ -145,7 +152,10 @@ - + - + - + Select a row to enable single-selection actions - Select only one row to enable single-selection actions + Select only one row to enable single-selection actions Single-selection actions enabled @@ -277,7 +295,10 @@ - + - + - + { const topActionsGrouped = computed(() => { const actions = [...globalActions.value, ...singleSelectionActions.value]; const groups = { - left: actions.filter(action => action.layout?.position === 'left' || !action.layout?.position), - center: actions.filter(action => action.layout?.position === 'center'), - right: actions.filter(action => action.layout?.position === 'right'), + left: actions.filter( + (action) => action.layout?.position === "left" || !action.layout?.position, + ), + center: actions.filter((action) => action.layout?.position === "center"), + right: actions.filter((action) => action.layout?.position === "right"), }; return groups; }); const bulkActionsGrouped = computed(() => { const groups = { - left: bulkActions.value.filter(action => action.layout?.position === 'left' || !action.layout?.position), - center: bulkActions.value.filter(action => action.layout?.position === 'center'), - right: bulkActions.value.filter(action => action.layout?.position === 'right'), + left: bulkActions.value.filter( + (action) => action.layout?.position === "left" || !action.layout?.position, + ), + center: bulkActions.value.filter((action) => action.layout?.position === "center"), + right: bulkActions.value.filter((action) => action.layout?.position === "right"), }; return groups; }); const rowActionsGrouped = computed(() => { const groups = { - primary: rowActions.value.filter(action => action.layout?.priority === 'primary' || !action.layout?.priority), - secondary: rowActions.value.filter(action => action.layout?.priority === 'secondary'), - dropdown: rowActions.value.filter(action => action.layout?.priority === 'dropdown'), + primary: rowActions.value.filter( + (action) => action.layout?.priority === "primary" || !action.layout?.priority, + ), + secondary: rowActions.value.filter((action) => action.layout?.priority === "secondary"), + dropdown: rowActions.value.filter((action) => action.layout?.priority === "dropdown"), }; return groups; }); @@ -928,9 +968,9 @@ const handleTopAction = (action) => { // Helper methods for action styling and behavior const getActionSeverity = (action) => { if (action.requiresSelection) { - return action.style || 'info'; + return action.style || "info"; } - return action.style || 'primary'; + return action.style || "primary"; }; const getActionDisabled = (action) => { @@ -942,14 +982,14 @@ const getActionDisabled = (action) => { }; const getActionClasses = (action) => { - const classes = ['dt-action-btn']; + const classes = ["dt-action-btn"]; if (action.requiresSelection) { - classes.push('dt-action-btn-selection'); + classes.push("dt-action-btn-selection"); if (!hasExactlyOneRowSelected.value) { - classes.push('dt-action-btn-disabled'); + classes.push("dt-action-btn-disabled"); } } else { - classes.push('dt-action-btn-global'); + classes.push("dt-action-btn-global"); } if (action.layout?.variant) { classes.push(`dt-action-btn-${action.layout.variant}`); @@ -960,7 +1000,7 @@ const getActionClasses = (action) => { const toggleRowDropdown = (event, rowData) => { // Placeholder for dropdown menu functionality // Could be implemented with PrimeVue OverlayPanel or Menu component - console.log('Toggle dropdown for row:', rowData); + console.log("Toggle dropdown for row:", rowData); }; const handleBulkAction = (action, selectedRows) => { @@ -1126,7 +1166,9 @@ defineExpose({ border-radius: 8px; padding: 0.625rem; font-size: 0.875rem; - transition: border-color 0.2s ease, box-shadow 0.2s ease; + transition: + border-color 0.2s ease, + box-shadow 0.2s ease; } .dt-filter-input:focus { @@ -1141,7 +1183,8 @@ defineExpose({ flex-wrap: wrap; } -.dt-btn-primary, .dt-btn-secondary { +.dt-btn-primary, +.dt-btn-secondary { border-radius: 8px; font-weight: 500; transition: all 0.2s ease; @@ -1433,22 +1476,22 @@ defineExpose({ .dt-filter-grid { grid-template-columns: 1fr; } - + .dt-pagination-content { flex-direction: column; align-items: stretch; text-align: center; } - + .dt-global-actions-content { flex-direction: column; align-items: stretch; } - + .dt-action-group { justify-content: center; } - + .dt-bulk-actions-groups { flex-direction: column; align-items: stretch; @@ -1464,20 +1507,20 @@ defineExpose({ border-color: #374151; color: #f9fafb; } - + .dt-filter-title, .dt-filter-label, .dt-pagination-label { color: #f9fafb; } - + .dt-filter-input, .dt-pagination-select { background: #374151; border-color: #4b5563; color: #f9fafb; } - + .dt-filter-status, .dt-global-actions-status { background: #374151; diff --git a/frontend/src/components/pages/Clients.vue b/frontend/src/components/pages/Clients.vue index cbc3bda..f17b8b3 100644 --- a/frontend/src/components/pages/Clients.vue +++ b/frontend/src/components/pages/Clients.vue @@ -158,8 +158,8 @@ const tableActions = [ icon: "pi pi-plus", layout: { position: "left", - variant: "filled" - } + variant: "filled", + }, // Global action - always available }, { @@ -173,8 +173,8 @@ const tableActions = [ requiresSelection: true, // Single selection action - appears above table, enabled when exactly one row selected layout: { position: "center", - variant: "outlined" - } + variant: "outlined", + }, }, { label: "Export Selected", @@ -188,8 +188,8 @@ const tableActions = [ requiresMultipleSelection: true, // Bulk action - operates on selected rows layout: { position: "right", - variant: "filled" - } + variant: "filled", + }, }, { label: "Edit", @@ -203,8 +203,8 @@ const tableActions = [ rowAction: true, // Row action - appears in each row's actions column layout: { priority: "primary", - variant: "outlined" - } + variant: "outlined", + }, }, { label: "Quick View", @@ -218,8 +218,8 @@ const tableActions = [ rowAction: true, // Row action - appears in each row's actions column layout: { priority: "secondary", - variant: "compact" - } + variant: "compact", + }, }, ]; // Handle lazy loading events from DataTable