alpha_full/pages/panier/panier.affLignes.php
2026-04-06 22:58:51 +02:00

192 lines
10 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
$imagesMail='';
$libellesArt='<ul>';
$_SESSION['libellesArt']='';
if (!isset($_SESSION['sOpt'])) $_SESSION['sOpt']="1";
echo '<input type="hidden" name="idLgCde" id="idLgCde" value="" >';
for($j=0; $j<count($idPrdTab); $j++) {
echo '<input type="hidden" name="idLgCde' .$j. '" id="idLgCde' .$j. '" value="' .$idLgCdeTab[$j]. '" />';
$idPrd=$idPrdTab[$j];
include ("_reqPanier/panier.reqSelectPrd.php");
// ---------------------------------------------------
// 0 - FORMATTAGE apres CALCUL
// ---------------------------------------------------
include ("panier.formattageLignesCde.php");
echo '<div style="display:flex; grid-column:1 / span 4; width:100%; " class="flexToColumn" >';
// ---------------------------------------------------
// Affichage image
// ---------------------------------------------------
echo '<div style="display:flex; grid-column:1; width:20%; " >';
echo '<div class="champsPanierCell" style="width:100%" >';
if (isset($nomPrd)) {
echo '<a href="produits-details-'.($idPrd). '" target="_top" data-tooltip="' .$nomPrd. '" >';
if (isset($imagePrd)) echo '<img src="' .$imagePrd. '" style="max-height:80%; max-width:80%;" data-tooltip="' .$nomPrd. '" alt="' .$nomPrd. '" />';
echo '</a>';
}
// Icône options
if (isset($imagePrd)) {
if ($imagePrd=='' || $imagePrd=='-')
echo '<i data-tooltip="Options" class="fad fa-check-circle icones" style=" cursor:pointer; " onClick="window.location=\'panier-ligne-' .$qteTab[$j]. '-' .$idPrd. '-' .$idLgCdeTab[$j]. '\'; " ></i>';
}
echo '</div>';
echo '</div>';
// ---------------------------------------------------
// Affichage du nom prd
// ---------------------------------------------------
echo '<div style="display:flex; flex-direction:column; grid-column:2/ span 4; width:100%; " >'; //pour mettre les options en colonnes
if (isset($nomPrd)) {
echo '<div style="display:flex; grid-column:1/ span 4; " class="flexToColumn" >';
// ---------------------------------------------------
// Affichage image + nom
// ---------------------------------------------------
// Trop compliqué avec fonction générique, de plus il faut aller sur idPrd avec clic droit
if ( $affMContext === true ) echo '<div class="champsPanierCell" onClick="document.location.href=\'produits-details-' .($idPrd). '\';" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, ' .$idPrd. ', event);" >';
else echo '<div class="champsPanierCell" onClick="document.location.href=\'produits-details-' .($idPrd). '\';">';
if ( $affMContext === true ) echo '<span class="champsPanier" style="cursor:context-menu" ' .$mouseOverMenuContext. ' onContextMenu="return mContextuel(this, \'champsPanierCell\', \'cde\', ' .$idPrd. ', event);" >' .$nomPrd. '</span>';
else echo '<span class="champsPanier" >' .$nomPrd. '</span>';
echo '</div>';
// ---------------------------------------------------
// Affichage de la remise ou promo
// ---------------------------------------------------
if (isset($typeReducLigneTab[$j]) && trim($typeReducLigneTab[$j])!='-' && $typeReducLigneTab[$j]!='') {
echo '<div class="champsPanierCell" >';
echo '<span class="champsPanier" >';
echo $typeReducLigneTab[$j]. '&#160;&#160;';
if ($typeReducLigneTab[$j]==$cdeMsg[33]) { echo abs($remiseCli). '&#160; %&#160'; }
if ($typeReducLigneTab[$j]==$cdeMsg[89]) { echo abs(intval($promo)). '&#160;€'; }
echo '</span>';
}
else {
echo '<div class="champsPanierCell notInResponsive" >';
echo '<span class="champsPanier"> - </span>';
}
echo '</div>';
// ---------------------------------------------------
// Prix HT remisé--> pas de place pour responsive
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 32, event);" >';
else echo '<div class="champsPanierCell" >';
if ( $affMContext === true ) echo '<span class="champsPanier"' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanier\', 7, \'cde\', 4, 32, event);" >';
else echo '<span class="champsPanier" >';
if (!empty($prixUnitRemiseHtTab[$j])) echo $prixUnitRemiseHtTab[$j]. '&#160; &#128; &#160; ';
echo '</span>';
echo '</div>';
// ---------------------------------------------------
// Quantité <--> creation d'un id unique sur chaque item pour post javascript
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 26, event);" >';
else echo '<div class="champsPanierCell" >';
$affListe=$catalogAfficher[30];
if (isset($_SESSION['geststockOui'])) $gererStock=$_SESSION['geststockOui']; else $gererStock=1;
if ($gererStock==1 ) {
// flag edt : 60 en dur
if ($stock>60) $maxQte=60; else $maxQte=$stock;
if ($stock >=1) $affListe==1; else $affListe==0;
}
else {
$maxQte=$_SESSION['qDefaut'];
}
if ($affListe==0) {echo '' .$qteTab[$j] ; echo '<span style="display:none;" >'; }
else {
echo '<span >';
// ---------------------------------------------------
// si option quantité à 1
// ---------------------------------------------------
$reqSelectP="SELECT * from prdOptions WHERE idCde =" .$idCde. " and idLgCde=" .$idLgCdeTab[$j]. ";";
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['codeOpe' => $codeOpe], 'panier.affLignes.php'); }
$resConnX='';
$resConnX=$idPdo->query($reqSelectP);
if ($resConnX) {
$o=0;
$test=-1;
while($tabResult=$resConnX->fetch(PDO::FETCH_ASSOC)) {
$test=$tabResult['numListe'];
}
if (isset($debug[2]) && $debug[2] == '1' ) { $debugMsg .= monDebug (2, ['test' => $test], ''); }
}
if($test>-1) {
$qte=1;
echo '<span class="champsPanier">1</span>';
}
else {
// ---------------------------------------------------
// Liste deroulante
// ---------------------------------------------------
if ( $affMContext === true ) echo '<select class="listeDeroulantePanier" name="select' .$j. '" id="select' .$j. '" onChange="changeQte(' .$j. ',' .$idPrd. ');" onCick="changeQte(' .$j. ',' .$idPrd. ');" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'listeDeroulantePanier\', 11, \'cde\', 4, 26, event);" >';
else echo '<select class="listeDeroulantePanier" name="select' .$j. '" id="select' .$j. '" onChange="changeQte(' .$j. ',' .$idPrd. ');" onCick="changeQte(' .$j. ',' .$idPrd. ');" >';
for ($ijk=1; $ijk<= $maxQte; $ijk++) {
if ($ijk==$qteTab[$j])
{echo '<option value="' .$ijk. '" selected>' .$ijk. '</option>'; }
else
{echo '<option value="' .$ijk. '" >' .$ijk. '</option>'; }
}
echo '</select>';
}
echo '<input type="hidden" name="qte" id="qte" value="' .$qte. '" >';
echo '</span >';
}
if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug (1, ['$_SESSION[qDefaut]' => $_SESSION['qDefaut'], 'qte' => $qte, 'maxQte' => $maxQte, 'affListe' => $affListe], ''); }
// ---------------------------------------------------
// Bouton supprimer: hoh hoho la class est en dur...flag edt
// ---------------------------------------------------
echo '&#160;<i class="fad fa-trash-alt" style="color:red; fill:red; cursor:pointer; font-size:1.2rem; " onClick="deleteLine(\'' .$idLgCdeTab[$j]. '\'); " ></i>';
echo '</div>';
// ---------------------------------------------------
// TTC de la ligne
// ---------------------------------------------------
if ( $affMContext === true ) echo '<div class="champsPanierCell" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanierCell\', 6, \'cde\', 4, 33, event);" >';
else echo '<div class="champsPanierCell" >';
if ( $affMContext === true ) echo '<span class="champsPanier" style="cursor:context-menu" ' .$mouseOverMenuContextContainer. ' onContextMenu="return mConStyle(this, \'Panier\', \'champsPanier\', 7, \'cde\', 4, 33, event);">' .$totTtcLigneTab[$j]. '&#160; &#128; &#160; </span>';
else echo '<span class="champsPanier">' .$totTtcLigneTab[$j]. '&#160; &#128; &#160; </span>';
echo '</div>';
// ---------------------------------------------------
// Recup articles pour le mail commande
// ---------------------------------------------------
if (isset($imagePrd)) $imagesMail = str_replace("./",$_SESSION['prodServer']. '/',$imagePrd);
if (isset($imagePrd)) $imagesMail = str_replace("../",$_SESSION['prodServer']. '/',$imagesMail);
$libellesArt .='<li>' .$nomPrd. ' ( ' .$qteTab[$j]. ' ) '. $totTtcLigneTab[$j] . ' &#128; <img src="' .$imagesMail. '" width="100" style="max-width:150px; " data-tooltip="' .$nomPrd. '" alt="' .$nomPrd. '" /></li>';
if (isset($debug[1]) && $debug[1] == '1') {include ("panier.debugLignes.php"); }
echo '</div>';
}
// ---------------------------------------------------
// Options
// ---------------------------------------------------
echo '<div style="display:flex; width:100%; flex-direction:column; " >';
include ("options.lignes.php");
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="panierLignes" ></div>';
}//for
$libellesArt .='</ul>';
$_SESSION['libellesArt']=$libellesArt;
?>