Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alba María Álvarez
/
front_recipes
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7ed48579
authored
Aug 31, 2025
by
Alba María Álvarez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(UserManagement): añadido buscador y funcionalidad para buscar usuarios
parent
2ef4e016
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
src/views/UserManagement.vue
src/views/UserManagement.vue
View file @
7ed48579
...
...
@@ -23,6 +23,9 @@
entradas
</label>
</div>
<div
class=
"d-flex"
style=
"width: 330px;"
>
<input
class=
"form-control me-2"
type=
"search"
placeholder=
"Buscar por nombre o email..."
aria-label=
"Search"
v-model=
"searchQuery"
@
input=
"handleSearch"
/>
</div>
</div>
<div
v-if=
"errorMsg"
class=
"alert alert-danger"
role=
"alert"
>
...
...
@@ -134,10 +137,12 @@ const errorMsg = ref(null);
const
userToChangeId
=
ref
(
null
);
const
modalMessage
=
ref
(
''
);
let
modalInstance
=
null
;
const
actionType
=
ref
(
''
);
const
roleToChangeTo
=
ref
(
''
);
// Variable para la búsqueda
const
searchQuery
=
ref
(
''
);
onMounted
(
async
()
=>
{
errorMsg
.
value
=
null
;
try
{
...
...
@@ -150,7 +155,11 @@ onMounted(async () => {
// Cambip de página
const
goToPage
=
(
page
)
=>
{
userStore
.
readAll
(
page
,
userStore
.
pageSize
,
userStore
.
sortBy
,
userStore
.
sortDirection
);
if
(
searchQuery
.
value
)
{
userStore
.
search
(
searchQuery
.
value
,
page
,
userStore
.
pageSize
);
}
else
{
userStore
.
readAll
(
page
,
userStore
.
pageSize
,
userStore
.
sortBy
,
userStore
.
sortDirection
);
}
};
// Cambio de ordenación
...
...
@@ -247,6 +256,19 @@ const handleConfirmation = async () => {
}
}
};
// Función para la búsqueda
let
searchTimeout
=
null
;
const
handleSearch
=
()
=>
{
clearTimeout
(
searchTimeout
);
searchTimeout
=
setTimeout
(()
=>
{
if
(
searchQuery
.
value
===
''
)
{
userStore
.
readAll
(
0
,
userStore
.
pageSize
,
userStore
.
sortBy
,
userStore
.
sortDirection
);
}
else
{
userStore
.
search
(
searchQuery
.
value
,
0
,
userStore
.
pageSize
);
}
},
500
);
// Pequeño retraso para evitar peticiones constantes
};
</
script
>
<
style
scoped
>
...
...
@@ -301,4 +323,9 @@ const handleConfirmation = async () => {
.pagination-custom
.page-item.disabled
.page-link
{
color
:
#bbb
;
}
.form-control
:focus
{
border-color
:
#793E6C
;
box-shadow
:
0
0
0
0.25rem
rgba
(
121
,
62
,
108
,
0.25
);
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment