gestion entreprise debut stat
This commit is contained in:
parent
41a07df168
commit
c04d15d456
@ -1,9 +1,11 @@
|
||||
var ID_company=0;
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#li_gestion_entreprises").delay(2000).addClass("hover");
|
||||
|
||||
|
||||
$(".logo_add").click(function() {
|
||||
$(".modal").show();
|
||||
$("#modal_add_edit").show();
|
||||
$(".title_modal").html("Ajout d'une entreprise");
|
||||
$("input[type='hidden']").attr("value","add");
|
||||
$("input[name='name']").attr("value","");
|
||||
@ -14,24 +16,28 @@ $(document).ready(function(){
|
||||
$(".info_message").css("display", "none");
|
||||
});
|
||||
|
||||
$(".close:eq(0)").click(function() {
|
||||
$(".modal").hide();
|
||||
$("#close_add_edit").click(function() {
|
||||
$("#modal_add_edit").hide();
|
||||
});
|
||||
|
||||
window.onclick = function(event) {
|
||||
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_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;
|
||||
}));
|
||||
|
||||
|
||||
$(".logo_edit").click(function() {
|
||||
$(".modal").show();
|
||||
$("#modal_add_edit").show();
|
||||
window.ID_company = $(this).attr("ID_company");
|
||||
$(".title_modal").html("Modification d'une entreprise");
|
||||
$("input[type='hidden']").attr("value","edit");
|
||||
$("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
|
||||
|
||||
if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
|
||||
require "ConnexionBDD.php";
|
||||
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;');
|
||||
@ -18,7 +19,8 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
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 (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 {
|
||||
$query_add_company = $bdd->prepare('INSERT INTO companies VALUES (NULL, :name, :activity_sector, :nb_intern_CESI, :visibility, :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;
|
||||
$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 = $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 = $bdd->prepare('INSERT INTO evaluate VALUES (:ID_company, (SELECT ID_user FROM users WHERE username = :user), :note);');
|
||||
$query_add_company->execute(['ID_company' => $ID_add_company, 'user' => $_COOKIE['username'], 'note' => $_POST['note']]);
|
||||
echo "<script>location.href='/gestion_entreprises.php';</script>";
|
||||
} catch (Exception $e) {
|
||||
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>
|
||||
<div id="modal_add_edit" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<span class="close" id="close_add_edit">×</span>
|
||||
<div class="title_modal"></div>
|
||||
<form class="form_add_edit" method="POST" action="/controller/Manage_companies.php">
|
||||
<input type="hidden" name="action" value="add">
|
||||
@ -90,6 +90,13 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
</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">
|
||||
<?php require "controller/Nav_bar.php" ?>
|
||||
<div class="main">
|
||||
|
||||
@ -42,22 +42,31 @@ self.addEventListener('activate', evt => {
|
||||
);
|
||||
});
|
||||
|
||||
/*self.addEventListener('fetch', evt => {
|
||||
self.addEventListener('fetch', evt => {
|
||||
evt.respondWith(
|
||||
caches.match(evt.request).then(cacheRes => {
|
||||
console.log(evt.request);
|
||||
return cacheRes || fetch(evt.request).then(fetchRes => {
|
||||
return caches.open(dynamicCacheName).then(cache => {
|
||||
if (evt.request.url.indexOf('favoris') > -1){
|
||||
if(evt.request.url.indexOf("favoris") > -1){
|
||||
return fetch(evt.request).then(fetchRes => {
|
||||
return caches.open(dynamicCacheName).then(cache => {
|
||||
cache.put(evt.request.url, fetchRes.clone());
|
||||
}
|
||||
return fetchRes;
|
||||
})
|
||||
});
|
||||
return cacheRes;
|
||||
})
|
||||
}).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(() => {
|
||||
console.log("Erreur d'accès à :", evt.request.url)
|
||||
return caches.match('/fallback.php');
|
||||
})
|
||||
);
|
||||
});
|
||||
*/
|
||||
Loading…
x
Reference in New Issue
Block a user