Skip to content
Snippets Groups Projects
Commit 0f164599 authored by BLOT Tristan's avatar BLOT Tristan
Browse files

script fonctionnel creation de "product" et insertion de 3 lignes

parent 12555172
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ volumes: ...@@ -7,7 +7,7 @@ volumes:
services: services:
slim: slim:
build: ./ build: ./
image: php:7-alpine image: php:8-alpine
working_dir: /var/www working_dir: /var/www
command: php -S 0.0.0.0:8080 -t public command: php -S 0.0.0.0:8080 -t public
environment: environment:
...@@ -25,12 +25,14 @@ services: ...@@ -25,12 +25,14 @@ services:
MYSQL_DATABASE: lehangarlocal MYSQL_DATABASE: lehangarlocal
MYSQL_USER: user MYSQL_USER: user
MYSQL_PASSWORD: user MYSQL_PASSWORD: user
volumes:
- ./script.sql:/docker-entrypoint-initdb.d/script.sql
phpmyadmin: phpmyadmin:
image: phpmyadmin image: phpmyadmin
restart: always restart: always
ports: ports:
- 8000:8000 - 8100:80
environment: environment:
- PMA_ARBITRARY=1 - PMA_ARBITRARY=1
composer: composer:
......
FROM php:7.4-alpine FROM php:8-alpine
RUN docker-php-ext-install pdo pdo_mysql RUN docker-php-ext-install pdo pdo_mysql
...@@ -19,20 +19,21 @@ var createNewTaskElement=function(taskString){ ...@@ -19,20 +19,21 @@ var createNewTaskElement=function(taskString){
//button.edit //button.edit
var editButton=document.createElement("button");//edit button var editButton=document.createElement("button");//edit button
var div= document.createElement("div");
//button.delete //button.delete
var deleteButton=document.createElement("button");//delete button var deleteButton=document.createElement("button");//delete button
label.innerText=taskString; label.innerText=taskString;
label.className="nomcommande"; label.className="nomcommande";
livre.innerText="Livrée"; livre.innerText="Livré";
livre.className = "livre"; livre.className = "livre";
//Each elements, needs appending //Each elements, needs appending
checkBox.type="checkbox"; checkBox.type="checkbox";
editInput.type="text"; editInput.type="text";
editButton.innerText="Edit";//innerText encodes special characters, HTML does not. editButton.innerText="Voir";//innerText encodes special characters, HTML does not.
editButton.className="edit"; editButton.className="voir";
deleteButton.innerText="Delete"; deleteButton.innerText="Delete";
deleteButton.className="delete"; deleteButton.className="delete";
...@@ -40,6 +41,7 @@ var createNewTaskElement=function(taskString){ ...@@ -40,6 +41,7 @@ var createNewTaskElement=function(taskString){
//and appending. //and appending.
listItem.appendChild(div);
listItem.appendChild(label); listItem.appendChild(label);
listItem.appendChild(livre); listItem.appendChild(livre);
...@@ -65,33 +67,6 @@ var addTask=function(){ ...@@ -65,33 +67,6 @@ var addTask=function(){
} }
//Edit an existing task.
var editTask=function(){
console.log("Edit Task...");
console.log("Change 'edit' to 'save'");
var listItem=this.parentNode;
var editInput=listItem.querySelector('input[type=text]');
var label=listItem.querySelector("label");
var containsClass=listItem.classList.contains("editMode");
//If class of the parent is .editmode
if(containsClass){
//switch to .editmode
//label becomes the inputs value.
label.innerText=editInput.value;
}else{
editInput.value=label.innerText;
}
//toggle .editmode on the parent.
listItem.classList.toggle("editMode");
}
//Delete task. //Delete task.
...@@ -151,7 +126,7 @@ var bindTaskEvents=function(taskListItem,checkBoxEventHandler){ ...@@ -151,7 +126,7 @@ var bindTaskEvents=function(taskListItem,checkBoxEventHandler){
//Bind editTask to edit button. //Bind editTask to edit button.
editButton.onclick=editTask; //editButton.onclick=editTask;
//Bind deleteTask to delete button. //Bind deleteTask to delete button.
deleteButton.onclick=deleteTask; deleteButton.onclick=deleteTask;
//Bind taskCompleted to checkBoxEventHandler. //Bind taskCompleted to checkBoxEventHandler.
......
...@@ -32,20 +32,11 @@ CREATE TABLE `product` ( ...@@ -32,20 +32,11 @@ CREATE TABLE `product` (
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`price` decimal(11) NOT NULL, `price` decimal(11) NOT NULL,
`amount_unit` decimal(11) NOT NULL, `amount_unit` decimal(11) NOT NULL,
`unit` decimal(11) NOT NULL, `unit` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `product` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`price` decimal(11) NOT NULL,
`amount_unit` decimal(11) NOT NULL,
`unit` decimal(11) NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `product` (`id`, `name`, `price`, `amount_unit`, `unit`, `description`) VALUES INSERT INTO `product` (`id`, `name`, `price`, `amount_unit`, `unit`, `description`) VALUES
(1, 'Lait BIO', '0.80', '0.80', '1L', 'Lait BIO produit dans une ferme par des chèvre unijambiste'), (1, 'Lait BIO', '0.80', '0.80', '1L', 'Lait BIO produit dans une ferme par des chèvre unijambiste'),
......
...@@ -15,10 +15,54 @@ ...@@ -15,10 +15,54 @@
margin: 100px auto 0; margin: 100px auto 0;
} }
/*Label avec le nom de la commande*/
.nomcommande{ .nomcommande{
margin-right: 2em; margin-right: 2em;
} }
/* Bouton voir*/
.voir {
background-color: #0095ff;
border: 1px solid transparent;
border-radius: 3px;
box-shadow: rgba(255, 255, 255, .4) 0 1px 0 0 inset;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-block;
font-family: -apple-system,system-ui,"Segoe UI","Liberation Sans",sans-serif;
font-size: 13px;
font-weight: 400;
line-height: 1.15385;
margin: 0;
outline: none;
padding: 8px .8em;
position: relative;
text-align: center;
text-decoration: none;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
vertical-align: baseline;
white-space: nowrap;
}
.voir:hover,
.voir:focus {
background-color: #07c;
}
.voir:focus {
box-shadow: 0 0 0 4px rgba(0, 149, 255, .15);
}
.voir:active {
background-color: #0064bd;
box-shadow: none;
}
/* Completed */ /* Completed */
#completed-tasks label { #completed-tasks label {
text-decoration: line-through; text-decoration: line-through;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment