Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Projet_idaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liang Wu
Projet_idaw
Commits
609efa9a
Commit
609efa9a
authored
Mar 30, 2020
by
Raulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formulaire aliment
parent
b4341613
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
444 additions
and
302 deletions
+444
-302
aliments.php
aliments.php
+387
-301
freelancer.css
bootstrap/css/freelancer.css
+2
-0
crud.js
crud.js
+54
-0
index.php
index.php
+1
-1
No files found.
aliments.php
View file @
609efa9a
This diff is collapsed.
Click to expand it.
bootstrap/css/freelancer.css
View file @
609efa9a
...
...
@@ -9852,3 +9852,5 @@ form .row:first-child .floating-label-form-group {
background-color
:
#1a252f
;
}
crud.js
0 → 100644
View file @
609efa9a
var
selectedRow
=
null
function
onFormSubmit
()
{
var
formData
=
readFormData
();
if
(
selectedRow
==
null
)
insertNewRecord
(
formData
);
else
updateRecord
(
formData
);
resetForm
();
}
function
readFormData
()
{
var
formData
=
{};
formData
[
"aliment"
]
=
document
.
getElementById
(
"aliment"
).
value
;
formData
[
"type"
]
=
document
.
getElementById
(
"type"
).
value
;
return
formData
;
}
function
insertNewRecord
(
data
)
{
var
table
=
document
.
getElementById
(
"table_aliments"
).
getElementsByTagName
(
'tbody'
)[
0
];
var
newRow
=
table
.
insertRow
(
table
.
length
);
cell1
=
newRow
.
insertCell
(
0
);
cell1
.
innerHTML
=
data
.
aliment
;
cell2
=
newRow
.
insertCell
(
1
);
cell2
.
innerHTML
=
data
.
type
;
cell3
=
newRow
.
insertCell
(
2
);
cell3
.
innerHTML
=
`<a onClick="onEdit(this)">Edit</a>
<a onClick="onDelete(this)">Delete</a>`
;
}
function
resetForm
()
{
document
.
getElementById
(
"aliment"
).
value
=
""
;
document
.
getElementById
(
"type"
).
value
=
""
;
selectedRow
=
null
;
}
function
onEdit
(
td
)
{
selectedRow
=
td
.
parentElement
.
parentElement
;
document
.
getElementById
(
"aliment"
).
value
=
selectedRow
.
cells
[
0
].
innerHTML
;
document
.
getElementById
(
"type"
).
value
=
selectedRow
.
cells
[
1
].
innerHTML
;
}
function
updateRecord
(
formData
)
{
selectedRow
.
cells
[
0
].
innerHTML
=
formData
.
aliment
;
selectedRow
.
cells
[
1
].
innerHTML
=
formData
.
type
;
}
function
onDelete
(
td
)
{
if
(
confirm
(
"Supprimer l'élément ?"
))
{
row
=
td
.
parentElement
.
parentElement
;
document
.
getElementById
(
"table_aliments"
).
deleteRow
(
row
.
rowIndex
);
resetForm
();
}
}
\ No newline at end of file
index.php
View file @
609efa9a
...
...
@@ -16,7 +16,7 @@ if(isset($_GET['page'])){
<div
class=
"container d-flex align-items-center flex-column"
>
<!-- Masthead Heading -->
<
h2
class=
"masthead-heading text-uppercase mb-0"
>
<?php
echo
$mymenu
[
$currentPageId
][
0
]
?>
</h2
>
<
!-- <h2 class="masthead-heading text-uppercase mb-0">
<?php
echo
$mymenu
[
$currentPageId
][
0
]
?>
</h2> --
>
<!-- Masthead Subheading -->
...
...
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