gestion entreprise debut stat
This commit is contained in:
parent
41a07df168
commit
c04d15d456
@ -1,9 +1,11 @@
|
|||||||
|
var ID_company=0;
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#li_gestion_entreprises").delay(2000).addClass("hover");
|
$("#li_gestion_entreprises").delay(2000).addClass("hover");
|
||||||
|
|
||||||
|
|
||||||
$(".logo_add").click(function() {
|
$(".logo_add").click(function() {
|
||||||
$(".modal").show();
|
$("#modal_add_edit").show();
|
||||||
$(".title_modal").html("Ajout d'une entreprise");
|
$(".title_modal").html("Ajout d'une entreprise");
|
||||||
$("input[type='hidden']").attr("value","add");
|
$("input[type='hidden']").attr("value","add");
|
||||||
$("input[name='name']").attr("value","");
|
$("input[name='name']").attr("value","");
|
||||||
@ -14,24 +16,28 @@ $(document).ready(function(){
|
|||||||
$(".info_message").css("display", "none");
|
$(".info_message").css("display", "none");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".close:eq(0)").click(function() {
|
$("#close_add_edit").click(function() {
|
||||||
$(".modal").hide();
|
$("#modal_add_edit").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onclick = function(event) {
|
window.onclick = function(event) {
|
||||||
if (event.target == document.getElementById("modal_add_edit")) {
|
if (event.target == document.getElementById("modal_add_edit")) {
|
||||||
$(".modal").hide();
|
$("#modal_add_edit").hide();
|
||||||
|
}
|
||||||
|
if (event.target == document.getElementById("modal_stat")) {
|
||||||
|
$("#modal_stat").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.form_add_edit').on('submit',(function(){
|
$('.form_add_edit').on('submit',(function(){
|
||||||
$(".form_postuler").append('<input type="hidden" name="ID_internship" value="'+ window.ID_internship +'">');
|
$(".form_add_edit").append('<input type="hidden" name="ID_company" value="'+ window.ID_company +'">');
|
||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
$(".logo_edit").click(function() {
|
$(".logo_edit").click(function() {
|
||||||
$(".modal").show();
|
$("#modal_add_edit").show();
|
||||||
|
window.ID_company = $(this).attr("ID_company");
|
||||||
$(".title_modal").html("Modification d'une entreprise");
|
$(".title_modal").html("Modification d'une entreprise");
|
||||||
$("input[type='hidden']").attr("value","edit");
|
$("input[type='hidden']").attr("value","edit");
|
||||||
$("input[name='name']").attr("value",$(this).attr("name"));
|
$("input[name='name']").attr("value",$(this).attr("name"));
|
||||||
@ -64,6 +70,14 @@ $(document).ready(function(){
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".logo_stat").click(function() {
|
||||||
|
console.log($(this).attr("ID_company"));
|
||||||
|
$("#modal_stat").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#close_stat").click(function() {
|
||||||
|
$("#modal_stat").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||||
|
|
||||||
require "ConnexionBDD.php";
|
require "ConnexionBDD.php";
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$query_check_cookie = $bdd->prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
|
$query_check_cookie = $bdd->prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
|
||||||
@ -18,8 +19,9 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
|||||||
echo "false";
|
echo "false";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isset($_POST["action"]) && isset($_POST["name"]) && isset($_POST["activity_sector"]) && isset($_POST["nb_intern_cesi"]) && isset($_POST["email"]) && isset($_POST["note"]) && isset($_POST["localisation"]) && isset($_POST["visibility"])) {
|
}
|
||||||
if ($_POST["action"] == "add"){
|
if (isset($_POST["action"]) && isset($_POST["name"]) && isset($_POST["activity_sector"]) && isset($_POST["nb_intern_cesi"]) && isset($_POST["email"]) && isset($_POST["note"]) && isset($_POST["localisation"]) && isset($_POST["visibility"])) {
|
||||||
|
if ($_POST["action"] == "add"){
|
||||||
try {
|
try {
|
||||||
$query_add_company = $bdd->prepare('INSERT INTO companies VALUES (NULL, :name, :activity_sector, :nb_intern_CESI, :visibility, :email);');
|
$query_add_company = $bdd->prepare('INSERT INTO companies VALUES (NULL, :name, :activity_sector, :nb_intern_CESI, :visibility, :email);');
|
||||||
$query_add_company->execute(['name' => $_POST["name"], 'activity_sector' => $_POST["activity_sector"], 'nb_intern_CESI' => $_POST["nb_intern_cesi"], 'visibility' => $_POST["visibility"], 'email' => $_POST["email"]]);
|
$query_add_company->execute(['name' => $_POST["name"], 'activity_sector' => $_POST["activity_sector"], 'nb_intern_CESI' => $_POST["nb_intern_cesi"], 'visibility' => $_POST["visibility"], 'email' => $_POST["email"]]);
|
||||||
@ -28,14 +30,35 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
|||||||
$ID_add_company = $query_add_company->fetchALL(PDO::FETCH_OBJ)[0]->ID_company;
|
$ID_add_company = $query_add_company->fetchALL(PDO::FETCH_OBJ)[0]->ID_company;
|
||||||
$query_add_company = $bdd->prepare('INSERT INTO companies_located VALUES (:ID_localisation, :ID_company);');
|
$query_add_company = $bdd->prepare('INSERT INTO companies_located VALUES (:ID_localisation, :ID_company);');
|
||||||
$query_add_company->execute(['ID_localisation' => $_POST["localisation"], 'ID_company' => $ID_add_company]);
|
$query_add_company->execute(['ID_localisation' => $_POST["localisation"], 'ID_company' => $ID_add_company]);
|
||||||
$query_add_company = $bdd->prepare('INSERT INTO companies_located VALUES (:ID_localisation, :ID_company);');
|
$query_add_company = $bdd->prepare('INSERT INTO evaluate VALUES (:ID_company, (SELECT ID_user FROM users WHERE username = :user), :note);');
|
||||||
$query_add_company->execute(['ID_localisation' => $_POST["localisation"], 'ID_company' => $ID_add_company]);
|
$query_add_company->execute(['ID_company' => $ID_add_company, 'user' => $_COOKIE['username'], 'note' => $_POST['note']]);
|
||||||
echo "<script>location.href='/gestion_entreprises.php';</script>";
|
echo "<script>location.href='/gestion_entreprises.php';</script>";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "false";
|
echo "false";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_POST["action"]) && isset($_POST["name"]) && isset($_POST["activity_sector"]) && isset($_POST["nb_intern_cesi"]) && isset($_POST["email"]) && isset($_POST["note"]) && isset($_POST["localisation"]) && isset($_POST["visibility"]) && isset($_POST["ID_company"])){
|
||||||
|
if ($_POST["action"] == "edit"){
|
||||||
|
try {
|
||||||
|
$ID_company = $_POST["ID_company"];
|
||||||
|
$query_edit_company = $bdd->prepare('UPDATE evaluate SET note = :note WHERE ID_company = :ID_company;');
|
||||||
|
$query_edit_company->execute(['note' => $_POST['note'], 'ID_company' => $ID_company]);
|
||||||
|
|
||||||
|
$query_edit_company = $bdd->prepare('UPDATE companies_located SET ID_localisation = :localisation WHERE ID_company = :ID_company;');
|
||||||
|
$query_edit_company->execute(['localisation' => $_POST['localisation'], 'ID_company' => $ID_company]);
|
||||||
|
|
||||||
|
$query_edit_company = $bdd->prepare('UPDATE companies SET name_company = :name, activity_sector_company = :sector, nb_intern_cesi_company = :nb_intern, visibility_company = :visibility, email_company = :email WHERE ID_company=:ID_company;');
|
||||||
|
$query_edit_company->execute(['name'=> $_POST['name'], 'sector' => $_POST['activity_sector'], 'nb_intern' => $_POST['nb_intern_cesi'], 'visibility' => $_POST['visibility'], 'email' => $_POST['email'], 'ID_company' => $ID_company]);
|
||||||
|
|
||||||
|
echo "<script>location.href='/gestion_entreprises.php';</script>";
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
|||||||
<body>
|
<body>
|
||||||
<div id="modal_add_edit" class="modal">
|
<div id="modal_add_edit" class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<span class="close">×</span>
|
<span class="close" id="close_add_edit">×</span>
|
||||||
<div class="title_modal"></div>
|
<div class="title_modal"></div>
|
||||||
<form class="form_add_edit" method="POST" action="/controller/Manage_companies.php">
|
<form class="form_add_edit" method="POST" action="/controller/Manage_companies.php">
|
||||||
<input type="hidden" name="action" value="add">
|
<input type="hidden" name="action" value="add">
|
||||||
@ -90,6 +90,13 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="modal_stat" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close" id="close_stat">×</span>
|
||||||
|
<div class="title_modal">oui</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php require "controller/Nav_bar.php" ?>
|
<?php require "controller/Nav_bar.php" ?>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|||||||
@ -42,22 +42,31 @@ self.addEventListener('activate', evt => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*self.addEventListener('fetch', evt => {
|
self.addEventListener('fetch', evt => {
|
||||||
evt.respondWith(
|
evt.respondWith(
|
||||||
caches.match(evt.request).then(cacheRes => {
|
caches.match(evt.request).then(cacheRes => {
|
||||||
console.log(evt.request);
|
console.log(evt.request);
|
||||||
return cacheRes || fetch(evt.request).then(fetchRes => {
|
if(evt.request.url.indexOf("favoris") > -1){
|
||||||
return caches.open(dynamicCacheName).then(cache => {
|
return fetch(evt.request).then(fetchRes => {
|
||||||
if (evt.request.url.indexOf('favoris') > -1){
|
return caches.open(dynamicCacheName).then(cache => {
|
||||||
cache.put(evt.request.url, fetchRes.clone());
|
cache.put(evt.request.url, fetchRes.clone());
|
||||||
}
|
return cacheRes;
|
||||||
return fetchRes;
|
})
|
||||||
})
|
}).catch(() => {
|
||||||
});
|
console.log("BLAAAAA", evt.request.url)
|
||||||
|
return cacheRes;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return cacheRes || fetch(evt.request).then(fetchRes => {
|
||||||
|
return caches.open(dynamicCacheName).then(cache => {
|
||||||
|
return fetchRes;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
console.log("Erreur d'accès à :", evt.request.url)
|
console.log("Erreur d'accès à :", evt.request.url)
|
||||||
return caches.match('/fallback.php');
|
return caches.match('/fallback.php');
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
Loading…
x
Reference in New Issue
Block a user