forked from CRM_Production/JTT_CrM
Merge branch 'master' of https://codefirst.iut.uca.fr/git/CRM_Production/JTT_CrM
commit
b750b1d6c1
@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
.vs
|
||||
|
@ -0,0 +1,6 @@
|
||||
projectKey=jtt_crm
|
||||
serverUrl=https://codefirst.iut.uca.fr/sonar
|
||||
serverVersion=9.6.1.59531
|
||||
dashboardUrl=https://codefirst.iut.uca.fr/sonar/dashboard?id=jtt_crm
|
||||
ceTaskId=AYSvDEjizKKB0GF_0uUi
|
||||
ceTaskUrl=https://codefirst.iut.uca.fr/sonar/api/ce/task?id=AYSvDEjizKKB0GF_0uUi
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "macos-clang-arm64",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "${default}",
|
||||
"cppStandard": "${default}",
|
||||
"intelliSenseMode": "macos-clang-arm64",
|
||||
"compilerArgs": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C/C++ Runner: Debug Session",
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"cwd": "/Users/malanone/JTT_Production/JTT_CrM",
|
||||
"program": "/Users/malanone/JTT_Production/JTT_CrM/build/Debug/outDebug"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"C_Cpp_Runner.cCompilerPath": "clang",
|
||||
"C_Cpp_Runner.cppCompilerPath": "clang++",
|
||||
"C_Cpp_Runner.debuggerPath": "lldb",
|
||||
"C_Cpp_Runner.cStandard": "",
|
||||
"C_Cpp_Runner.cppStandard": "",
|
||||
"C_Cpp_Runner.msvcBatchPath": "",
|
||||
"C_Cpp_Runner.useMsvc": false,
|
||||
"C_Cpp_Runner.warnings": [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wpedantic",
|
||||
"-Wshadow",
|
||||
"-Wformat=2",
|
||||
"-Wconversion",
|
||||
"-Wnull-dereference",
|
||||
"-Wsign-conversion"
|
||||
],
|
||||
"C_Cpp_Runner.enableWarnings": true,
|
||||
"C_Cpp_Runner.warningsAsError": false,
|
||||
"C_Cpp_Runner.compilerArgs": [],
|
||||
"C_Cpp_Runner.linkerArgs": [],
|
||||
"C_Cpp_Runner.includePaths": [],
|
||||
"C_Cpp_Runner.includeSearch": [
|
||||
"*",
|
||||
"**/*"
|
||||
],
|
||||
"C_Cpp_Runner.excludeSearch": [
|
||||
"**/build",
|
||||
"**/build/**",
|
||||
"**/.*",
|
||||
"**/.*/**",
|
||||
"**/.vscode",
|
||||
"**/.vscode/**"
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
@ -1,42 +1,97 @@
|
||||
import React, {useState} from 'react'
|
||||
import {useNavigate} from 'react-router-dom';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import axios from 'axios'
|
||||
import NavigationDashboard from '../NavigationDashboard.js';
|
||||
import CryptoJS from 'crypto-js';
|
||||
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Button } from '@mui/material';
|
||||
import Session from 'react-session-api';
|
||||
// HERE ABOVE useHistory IS REPLACED WITH useNavigate
|
||||
|
||||
function AddContact(props) {
|
||||
const api = axios.create({
|
||||
baseURL: 'http://localhost:8080'
|
||||
})
|
||||
|
||||
const navigate=useNavigate();
|
||||
const [User, setUser] = useState({name:"", email:""});
|
||||
function AddContact() {
|
||||
|
||||
let add = (e) => {
|
||||
e.preventDefault();
|
||||
if(User.name === "" || User.email === ""){
|
||||
alert("All fields are mandatory!!!");
|
||||
return
|
||||
const [loginError, setLoginError] = useState(false);
|
||||
const [entreprises, setEntreprises] = useState([]);
|
||||
const [selectedIdEntreprise, setSelectedIdEntreprise] = useState(1);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
api.get('/Entreprise/All').then((response) => {
|
||||
setEntreprises(response.data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
function handleChangeEntreprise(event) {
|
||||
setSelectedIdEntreprise(event.target.value);
|
||||
console.log("je suis dans handleChangeEntreprise");
|
||||
};
|
||||
|
||||
function checkAdd(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formData = new FormData(event.currentTarget);
|
||||
const values = Object.fromEntries(formData.entries());
|
||||
api.get('/Contact/Exist/' + values.phone).then((response) => {
|
||||
const login = response.data;
|
||||
if (login.length > 0) {
|
||||
setLoginError(true);
|
||||
}
|
||||
// THIS IS USED TO SHOW THE LIST DATA ON THE APP.JS FILE
|
||||
props.addContactHandler(User);
|
||||
// THIS IS USED FOR WHEN THE ADD BUTTON IS PRESSED THE INPUT FILED AGAIN GETS EMPTY
|
||||
setUser({name:"", email:""});
|
||||
//console.log(props);
|
||||
navigate('/');
|
||||
else {
|
||||
setLoginError(false);
|
||||
const newContact = { firstname: values.firstname, lastname: values.lastname, phone: values.phone, mail: values.mail, iduser: Session.get('idUser'), idcustomer: selectedIdEntreprise };
|
||||
api.post('/Contact/Add', newContact).then(function (response) {
|
||||
console.log(response.data);
|
||||
});
|
||||
navigate("/Repertoire");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className='ui main'>
|
||||
<h2>Add Contact</h2>
|
||||
<form className='ui form' onSubmit={add}>
|
||||
<div className='field'>
|
||||
<label>Name</label>
|
||||
<input type="text" name="Name" placeholder='Name' value={User.name} onChange={e => setUser({...User, name: e.target.value})}/>
|
||||
<div className='addContactPage'>
|
||||
<h2>Ajouter un nouveau contact</h2>
|
||||
<div className="Formulaire">
|
||||
<form className="form" onSubmit={checkAdd}>
|
||||
<table className="Formulaire_de_connexion">
|
||||
<tr>
|
||||
<div className="texte_côté">
|
||||
<p>Nom :</p>
|
||||
<p>Prénom :</p>
|
||||
<p>Téléphone :</p>
|
||||
<p>Email :</p>
|
||||
<p>Entreprise :</p>
|
||||
</div>
|
||||
<div className='field'>
|
||||
<label>Email</label>
|
||||
<input type="text" name="Email" placeholder='Email' value={User.email} onChange={e => setUser({...User, email: e.target.value})}/>
|
||||
</tr>
|
||||
<tr>
|
||||
<input id="nom" name='firstname' className="texte_zone" type="text" placeholder="Nom..." required />
|
||||
<input id="prenom" name='lastname' className="texte_zone" type="text" placeholder="Prénom..." required />
|
||||
<input id="phone" name='phone' className="texte_zone" type="tel"
|
||||
placeholder="Téléphone..." pattern="[0-9]{10}" required />
|
||||
<input id="email" name='mail' className="texte_zone" type="email" placeholder="Email..." required />
|
||||
<Select name='idcustomer' value={selectedIdEntreprise} onChange={handleChangeEntreprise}>
|
||||
{entreprises.map(entreprise => (<MenuItem value={entreprise.idcustomer}>{entreprise.name}</MenuItem>))}
|
||||
</Select>
|
||||
</tr>
|
||||
</table>
|
||||
<p>{loginError === true ? "Le contact existe déja" : ''}</p>
|
||||
<div className="bouton_submit">
|
||||
<button className="bouton_val" type="submit">Valider</button>
|
||||
<NavLink className="bouton_ann" to="/Repertoire">Retour</NavLink>
|
||||
</div>
|
||||
<button className='ui secondary button'>Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AddContact
|
||||
export default AddContact;
|
||||
|
@ -1,11 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
const Menu = () => {
|
||||
return (
|
||||
<div>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Menu;
|
@ -0,0 +1,97 @@
|
||||
import React, {useState} from 'react';
|
||||
import NavigationDashboard from '../components/NavigationDashboard';
|
||||
import axios from 'axios';
|
||||
import Session from 'react-session-api';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'http://localhost:8080'
|
||||
})
|
||||
|
||||
const MailPourAdmin = () => {
|
||||
const [mailError, setMailError] = useState(false);
|
||||
const [objetError, setObjetError] = useState(false);
|
||||
const [descriptionError, setDescriptionError] = useState(false);
|
||||
const [theme, setTheme] = useState("light");
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (localStorage.getItem('theme') && localStorage.getItem("theme") !== '' && localStorage.getItem("theme") !== theme) {
|
||||
setTheme(localStorage.getItem("theme"))
|
||||
}
|
||||
|
||||
function sendMail(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(e.currentTarget);
|
||||
const values = Object.fromEntries(formData.entries());
|
||||
|
||||
console.log(values);
|
||||
if (values.objet === '') {
|
||||
setObjetError(true)
|
||||
} else {
|
||||
setObjetError(false)
|
||||
}
|
||||
if (values.raison === '') {
|
||||
setDescriptionError(true)
|
||||
} else {
|
||||
setDescriptionError(false)
|
||||
}
|
||||
if (values.objet === '' || values.raison === '') {
|
||||
return
|
||||
}
|
||||
values.objet = values.objet + "[user id : " + Session.get("idUser") + "]"
|
||||
|
||||
|
||||
api.post('/Mail/Avertir',values).then (function(response) {
|
||||
if (response.data) {
|
||||
navigate('/dashboard')
|
||||
}
|
||||
else {
|
||||
setMailError(true)
|
||||
// e.reset();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<body className={theme}>
|
||||
|
||||
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css"></link>
|
||||
|
||||
<div className="page_mailAdmin">
|
||||
<div className="haut_de_page">
|
||||
<h2 className="titre">Signaler un problème</h2>
|
||||
<div className="rechLogo">
|
||||
<img className="logo" srcSet="./LogoApp.svg" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bas_de_page">
|
||||
<NavigationDashboard />
|
||||
<form className="form" onSubmit={sendMail}>
|
||||
<div className="Mail">
|
||||
<div className="object">
|
||||
<h3 className="name">Objet</h3>
|
||||
<input name="objet" type="text" placeholder="Objet de l'alerte" className="inputObjet"/>
|
||||
</div>
|
||||
<div className="value">
|
||||
<h3 className="name">Raison</h3>
|
||||
<textarea name="raison" placeholder="Raison de l'alerte" rows="10" cols="180" className="inputArea"/>
|
||||
|
||||
</div>
|
||||
<p>{mailError === true?"Le mail n'a pas pu être envoyé":''}</p>
|
||||
<p>{objetError === true?"L'objet est obligatoire":''}</p>
|
||||
<p>{descriptionError === true?"La description est obligatoire":''}</p>
|
||||
<div className="submit">
|
||||
<button className="button" type="submit">Envoyer</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
);
|
||||
};
|
||||
|
||||
export default MailPourAdmin;
|
@ -0,0 +1,256 @@
|
||||
|
||||
|
||||
body {
|
||||
|
||||
.page_mailAdmin {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
width: auto;
|
||||
height: 100vh;
|
||||
|
||||
.haut_de_page {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding: 50px;
|
||||
width: auto;
|
||||
height: 10%;
|
||||
align-items: center;
|
||||
margin: 10px 10px 5px 10px;
|
||||
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border: 1px solid #cbd0dd;
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.titre {
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.rechLogo {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bas_de_page {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
width: auto;
|
||||
height: 86%;
|
||||
|
||||
.nav_bar_verticale {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 5%;
|
||||
margin: 5px 5px 10px 10px;
|
||||
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border: 1px solid #cbd0dd;
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.parti_one {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 18%;
|
||||
}
|
||||
|
||||
.parti_two {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 35%;
|
||||
}
|
||||
|
||||
.parti_three {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
width: 100%;
|
||||
height: 18%;
|
||||
}
|
||||
|
||||
.parti_four {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 18%;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
object-fit: cover;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
.logo_nav_bar{
|
||||
display: flex;
|
||||
margin: 10px;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 94.3%;
|
||||
height: auto;
|
||||
margin: 5px 10px 10px 5px;
|
||||
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
}
|
||||
|
||||
|
||||
/*.Mail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
height: auto;
|
||||
margin: 5px 10px 10px 5px;
|
||||
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border: 1px solid #cbd0dd;
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.object {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
margin: 13px;
|
||||
width: auto;
|
||||
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.inputObjet{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: .375rem;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
border: 1px solid #cbd0dd;
|
||||
height: 30px;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
.value {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
margin-left: 13px;
|
||||
margin-right: 13px;
|
||||
width: auto;
|
||||
height: 40%;
|
||||
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.inputArea {
|
||||
resize: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: .375rem;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
border: 1px solid #cbd0dd;
|
||||
margin-top: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.submit {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
margin: 13px;
|
||||
width: auto;
|
||||
height: 15%;
|
||||
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 5px;
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
.button {
|
||||
cursor: pointer;
|
||||
color: #141824;
|
||||
background: #f5f7fa;
|
||||
border-radius: 0.375rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid #cbd0dd;
|
||||
|
||||
&:hover {
|
||||
color: #141824;
|
||||
background: #e3e6ed;
|
||||
border-color: #cbd0dd;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 0.2rem rgba(211, 214, 218, 0.5);
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: #000000;
|
||||
background: #f7f9fb;
|
||||
border-color: #f6f8fb;
|
||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
color: #000000;
|
||||
background: #f5f7fa;
|
||||
border-color: #f5f7fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
.addContactPage{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue