Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mod4-wp-2023-2024-pokemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ruginosu, M.I. (Ioana, Student B-BIT)
mod4-wp-2023-2024-pokemon
Commits
fbe3e245
Commit
fbe3e245
authored
10 months ago
by
Ruginosu, M.I. (Ioana, Student B-BIT)
Browse files
Options
Downloads
Patches
Plain Diff
issue#7 solved
parent
1539eb29
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/webapp/js/requests.js
+18
-0
18 additions, 0 deletions
src/main/webapp/js/requests.js
src/main/webapp/pokemonTypes.html
+18
-1
18 additions, 1 deletion
src/main/webapp/pokemonTypes.html
with
36 additions
and
1 deletion
src/main/webapp/js/requests.js
+
18
−
0
View file @
fbe3e245
...
...
@@ -127,4 +127,22 @@ function createPokemonType() {
}).
then
(
response
=>
updatePokemonTypesTable
())
}
function
deletePokemonType
()
{
let
idPokemon
=
document
.
getElementById
(
"
pokemonId
"
).
value
;
fetch
(
`/pokemon/api/pokemonTypes/
${
idPokemon
}
`
,
{
method
:
'
DELETE
'
})
.
then
(
response
=>
{
if
(
response
.
ok
)
{
// Trainer deleted successfully, update UI
updatePokemonTypesTable
();
// Reload trainer table
updateDetails
(
''
);
// Clear details panel
}
else
{
console
.
error
(
'
Failed to delete Pokemon type:
'
,
response
.
status
);
}
})
.
catch
(
error
=>
{
console
.
error
(
'
Error deleting Pokemon type:
'
,
error
);
});
}
This diff is collapsed.
Click to expand it.
src/main/webapp/pokemonTypes.html
+
18
−
1
View file @
fbe3e245
...
...
@@ -33,6 +33,10 @@
<h1>
Pokemon Types
</h1>
<br>
<h4>
Create a Pokemon type
</h4>
<form
id=
"createPokemonTypeForm"
onsubmit=
"createPokemonType()"
>
<div
class =
"form-group"
>
<label
for =
"pokemonName"
>
Name
</label>
...
...
@@ -106,7 +110,7 @@
<!-- <label for = "generation">Generation</label>-->
<!-- <input type = "text" class = "form-control" id = "generation" required>-->
<!-- </div>-->
<!-- <div class = "form-group">-->
x
<!-- <div class = "form-group">-->
<!-- <label for = "isLegendary">Is Legendary?</label>-->
<!-- <input type = "text" class = "form-control" id = "isLegendary" required>-->
<!-- </div>-->
...
...
@@ -116,6 +120,19 @@
<br>
<br>
<h4>
Delete a Pokemon type
</h4>
<form
id =
"deletePokemonTypeForm"
onsubmit =
"deletePokemonType()"
>
<div
class =
"form-group"
>
<label
for =
"pokemonId"
>
Pokemon ID
</label>
<input
type =
"text"
class =
"form-control"
id =
"pokemonId"
>
</div>
<button
type =
"submit"
class =
"btn btn-primary"
>
Delete Pokemon type
</button>
</form>
<br>
<br>
<div
class=
"container"
>
<div
class=
"row"
>
<div
id=
"tableDiv"
class=
"col-8"
>
No data
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment