Skip to content
Snippets Groups Projects
Commit 0bd467e8 authored by julien.debray's avatar julien.debray
Browse files

Reglage détails

parent 1eb411ab
No related branches found
No related tags found
No related merge requests found
import { useEffect, useState } from "react" import { useState } from "react"
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import emailjs from 'emailjs-com'; import emailjs from 'emailjs-com';
...@@ -129,7 +129,7 @@ const Inscription = () => { ...@@ -129,7 +129,7 @@ const Inscription = () => {
if (res.status === 200) { if (res.status === 200) {
emailjs.send("service_kwla1nj","template_mm87l15", data, "gkKZTWtimj8jnpE9G") emailjs.send("service_kwla1nj","template_mm87l15", data, "gkKZTWtimj8jnpE9G")
.then((result) => { .then((result) => {
console.log(result.text); console.log(result);
window.location.href = "/"; window.location.href = "/";
}, (error) => { }, (error) => {
console.log(error.text); console.log(error.text);
......
...@@ -2,8 +2,9 @@ function BoutiqueCard({ choisirCreneau, Heure, disponible, isSelected, setIsSele ...@@ -2,8 +2,9 @@ function BoutiqueCard({ choisirCreneau, Heure, disponible, isSelected, setIsSele
const handleSelect = (horaire) => { const handleSelect = (horaire) => {
if (disponible) { if (disponible) {
choisirCreneau(horaire) let value = horaire === isSelected ? null : horaire;
setIsSelected(horaire === isSelected ? null : horaire); choisirCreneau(value);
setIsSelected(value);
} }
} }
...@@ -17,7 +18,7 @@ function BoutiqueCard({ choisirCreneau, Heure, disponible, isSelected, setIsSele ...@@ -17,7 +18,7 @@ function BoutiqueCard({ choisirCreneau, Heure, disponible, isSelected, setIsSele
return ( return (
<div <div
className={`testclass h-100 max-w-sm rounded overflow-hidden shadow-lg ${!disponible ? 'opacity-50 cursor-not-allowed' : 'hover:bg-blue-200'} ${isSelected === Heure ? 'bg-green-300' : ''}`} className={`testclass h-100 max-w-sm rounded overflow-hidden shadow-lg ${disponible ? 'hover:bg-blue-200' : 'opacity-50 cursor-not-allowed'} ${isSelected === Heure ? 'bg-green-300 hover:bg-green-300' : ''}`}
onClick={() => handleSelect(Heure)} onClick={() => handleSelect(Heure)}
> >
<div className="px-3 py-4 pt-2"> <div className="px-3 py-4 pt-2">
......
...@@ -2,8 +2,6 @@ import React, { useState } from 'react'; ...@@ -2,8 +2,6 @@ import React, { useState } from 'react';
function RendezVous({ lieu, date, heure, id, descr, adv }) { function RendezVous({ lieu, date, heure, id, descr, adv }) {
const [state, setState] = useState("Cancel"); const [state, setState] = useState("Cancel");
const [description, setDescription] = useState("");
const [advice, setAdvice] = useState("");
function getContenuRdv() { function getContenuRdv() {
...@@ -73,45 +71,7 @@ function RendezVous({ lieu, date, heure, id, descr, adv }) { ...@@ -73,45 +71,7 @@ function RendezVous({ lieu, date, heure, id, descr, adv }) {
} }
} }
const updateComment = (id, value) => {
const data = {
idrdv: id,
description: value
};
const options = {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
mode: 'cors',
body: JSON.stringify(data),
};
fetch('http://127.0.0.1:3001/update-conseil', options)
.then(function (response) {
if (response.status !== 200) {
const options2 = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
mode: 'cors',
body: JSON.stringify(data),
};
fetch('http://127.0.0.1:3001/ajouter-conseil', options2)
.then(function (response) {
if (response.status !== 200) {
alert("Erreur lors de l'ajout de conseil");
}
})
}
});
}
const updateRdv = (description, advice) => { const updateRdv = (description, advice) => {
// console.log(advice)
const data = { const data = {
idrdv: id, idrdv: id,
description: description, description: description,
...@@ -136,13 +96,9 @@ function RendezVous({ lieu, date, heure, id, descr, adv }) { ...@@ -136,13 +96,9 @@ function RendezVous({ lieu, date, heure, id, descr, adv }) {
} }
function save() { function save() {
setDescription(document.getElementById("desc").value);
setAdvice(document.getElementById("advice").value);
updateRdv(document.getElementById("desc").value, document.getElementById("advice").value); updateRdv(document.getElementById("desc").value, document.getElementById("advice").value);
} }
// Change le button entre Annuler et Modifier
function getRightAction(stateAction) { function getRightAction(stateAction) {
const stateModif = ( const stateModif = (
<button type="button" className="btn btn-light" onClick={() => { <button type="button" className="btn btn-light" onClick={() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment