123 lines
4.9 KiB
PHP
Executable File
123 lines
4.9 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
// -----------------------------------------------------
|
|
// Etre admin
|
|
// -----------------------------------------------------
|
|
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']=='O' ) {
|
|
$supprPrd='';
|
|
$nomPrd ='';
|
|
$lienImgPrdPt ='';
|
|
$statusPrd ='';
|
|
$supprPrd='';
|
|
|
|
// -----------------------------------------------------
|
|
// Post
|
|
// -----------------------------------------------------
|
|
if (isset($_POST['supprPrd'])) {$supprPrd=$_POST['supprPrd'];}
|
|
// if (isset($_POST['idPrd'])) {$idPrd=$_POST['idPrd'];}
|
|
|
|
// -----------------------------------------------------
|
|
// Debug
|
|
// -----------------------------------------------------
|
|
if (isset($debug[1]) && $debug[1] == '1' ) {
|
|
$debugMsg .= monDebug (1, ['supprPrd '=> $supprPrd, 'idPrd' => $idPrd, 'submit' => $_POST["submit"] ], 'art.deleteProduit.modale.php');
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Req delete
|
|
// -----------------------------------------------------
|
|
if (!empty($_POST["submit"])) {
|
|
switch ($supprPrd) {
|
|
case '1':
|
|
// faire un test si aucune commande existe avec ce produit
|
|
// si aucune --> delete
|
|
// s'il y en a --> forcer un désactiver
|
|
include ("./catalog/req/reqDeleteProduit.php");
|
|
$idPrd=1; //par defaut apres delete - pas mieux ?---> faire select first
|
|
break;
|
|
|
|
case '2':
|
|
include ("./catalog/req/reqDesactivProduit.php");
|
|
break;
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Req select
|
|
// -----------------------------------------------------
|
|
include ("./catalog/req/reqSelectPrd.php");
|
|
|
|
echo '<div id="zoneFormModales" >';
|
|
|
|
// -----------------------------------------------------
|
|
// Form
|
|
// -----------------------------------------------------
|
|
echo '<form name="deleteProduitF" method="POST" >';
|
|
|
|
// -----------------------------------------------------
|
|
// Champs cachés
|
|
// -----------------------------------------------------
|
|
echo '<input type="hidden" value="' .$idPrd. '" name="idPrd" >';
|
|
|
|
// -----------------------------------------------------
|
|
// Champs du formulaire
|
|
// -----------------------------------------------------
|
|
echo '<div >';
|
|
echo '<span class="libChampsWebmaster">N° : ';
|
|
echo '<span class="inputWebmaster" type="text" >' .$idPrd. '</span>';
|
|
echo '</span>';
|
|
|
|
echo '<br><span class="libChampsWebmaster">Nom : ';
|
|
echo '<span class="inputWebmaster" type="text" >' .$nomPrd. '</span>';
|
|
echo '</span>';
|
|
|
|
echo '<br><span class="libChampsWebmaster">Image : ';
|
|
echo '<img src=".' .$lienImgPrdPt. '" class="imgCatalogue" />';
|
|
echo '</span>';
|
|
|
|
echo '<br><span class="libChampsWebmaster">Statut : ';
|
|
switch ($statusPrd)
|
|
{ case 0:
|
|
$libStatusPrd ="Désactivé";
|
|
break;
|
|
|
|
case 1:
|
|
$libStatusPrd ="Activé";
|
|
break;
|
|
}
|
|
echo '<span class="inputWebmaster" type="text" >' .$libStatusPrd. '</span>';
|
|
echo '</span>';
|
|
echo '</div>';
|
|
|
|
// -----------------------------------------------------
|
|
// Bouton submit
|
|
// -----------------------------------------------------
|
|
echo '<div id="zoneValidateModales" >';
|
|
if (!isset($_POST["submit"])) {
|
|
if ($supprPrd=='1') {
|
|
echo '<input class="inputWebmaster" type="radio" name="supprPrd" id="supprPrd" value="1" checked="true" onClick="uncheckN()">Supression définitive';
|
|
echo '<input class="inputWebmaster" type="radio" name="supprPrd" id="supprPrd" value="2" onClick="uncheckO()">Désactivation';
|
|
}
|
|
else {
|
|
echo '<input class="inputWebmaster" type="radio" name="supprPrd" id="supprPrd" value="1" onClick="uncheckN()">Supression définitive';
|
|
echo '<input class="inputWebmaster" type="radio" name="supprPrd" id="supprPrd" value="2" checked="true" onClick="uncheckO()">Désactivation';
|
|
}
|
|
echo '<br><label for="submit" ><span class="boutonsWebmaster tooltip-top" data-tooltip="Cliquez sur ce bouton pour passer à l\'étape suivante" >';
|
|
echo '<i class="fad fa-check-circle"></i> ';
|
|
echo 'Valider</span></label>';
|
|
echo '<input class="boutonsWebmaster" style="display:none;" value="Valider" name="submit" id="submit" type="submit" ><br>';
|
|
}
|
|
else {
|
|
echo '<span type="button" class="boutonsWebmaster tooltip-top" onClick="window.self.location=\'./frmAdmin.php?affAdmin=8&ongletCatalog=4&idPrd=' .$idPrd. '\';" data-tooltip="Retour aux articles">';
|
|
echo '<i class="fad fa-chevron-circle-left"></i> ';
|
|
echo 'Retour';
|
|
echo '</span>';
|
|
}
|
|
// besoin car title fous la merde
|
|
echo '<br><br><br><br>';
|
|
echo '</div>'; //zone validate
|
|
echo '</form>';
|
|
echo '</div>'; // zoneFormModales
|
|
}
|
|
else {include ("./adminInclude/redirectionAdmin.php"); }
|
|
?>
|