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

107 lines
5.4 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, [
'c1' => isset($c1)?$c1:'empty',
'ETOU' => isset($ETOU)?$ETOU:'empty'
],'21-itemCheck.php');}
// ---------------------------------------------------
// Formulaire
// ---------------------------------------------------
if (isset ($c1) && strtoupper($c1)=='AUCUN') {
echo '<div style="text-align:left; color:black; font-weight:normal; background:lightgrey;" >';
}
else {
echo '<div style="text-align:left; color:black; font-weight:normal;" >';
}
// ---------------------------------------------------
// Champs caché qui stock le bouton radio cliqué - unique par type de CA
// ---------------------------------------------------
if ($z==2) echo '<input type="hidden" id="selected' .$x. '" value="' .$u. '" style="width:30px;" >';
// ---------------------------------------------------
// Icône
// ---------------------------------------------------
if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['u' => isset($u)?$u:'empty', 'src' => isset($src)?$src:'empty', 'item N°' => isset($tabItemNumber[$u])?$tabItemNumber[$u]:'empty', 'tabTagLib' => isset($tabTagLib[$z])?$tabTagLib[$z]:'empty', 'tabQuantite' => isset($tabQuantite[$u])? $tabQuantite[$u]:'empty', 'itemNumberPost' => isset($itemNumberPost[$u])?$itemNumberPost[$u]:'empty' ],'');
}
echo ' ' .$src. ' &#160;&#160;';
// ---------------------------------------------------
// OU
// ---------------------------------------------------
if ($ETOU=='OU') {
if ($tabItemNumber[$u]==$itemNumberPost && isset($tabQuantite[$u]) && $tabQuantite[$u]>0) {$checked="checked";}
else $checked="";
echo '<input id="radio' .$u. '" name="choix' .$x. '" type="radio" '.$checked.' value="1" onClick="activBouton(\'1\', \'' .$x. '\'); radioChange(\'' .$u. '\', \'' .$x. '\'); upQte(document.getElementById (\'kant' .$u. '\').value, \'' .$tabItemNumber[$u]. '\', \'' .$c1. '\');" >';
}
// ---------------------------------------------------
// ET
// ---------------------------------------------------
else {
if (isset($tabQuantite[$u]) && $tabQuantite[$u]>0) {
// si liste includée avec defaut remplis, la quantité ne compte pas mais on peut l'enlever elle passe à moins 1
// donc code3= SANS c'est que on veut une quantité à 0 mais coché, ou à -1 decochée
// si zero elle doit aparaitre dans le panier
if (strtoupper($isAucun)=='AUCUN') {
echo '<script type="text/javascript">document.getElementById (\'kant' .$u. '\').value=0;</script>';
}
if (strtoupper($c3)=='SANS') {
echo '<script type="text/javascript">document.getElementById (\'kant' .$u. '\').value=-1;</script>';
echo '<input style="color:black;" id="check' .$u. '" type="checkbox" value="' .$tabTagLib[$z]. '" onClick="activBouton(\'1\', \'' .$x. '\'); upQte(\'-1\', \'' .$tabItemNumber[$u]. '\', \'' .$c1. '\');" checked>';
}
else {
echo '<input style="color:black;" id="check' .$u. '" type="checkbox" value="' .$tabTagLib[$z]. '" onClick="activBouton(\'1\', \'' .$x. '\'); checkChange(\'' .$u. '\'); upQte(document.getElementById (\'kant' .$u. '\').value, \'' .$tabItemNumber[$u]. '\', \'' .$c1. '\');" checked>';
if ($sOpt==$x) {$_SESSION['quantiteParListe']=($_SESSION['quantiteParListe']) + ($tabQuantite[$u]);}
}
echo '<script type="text/javascript">activBtn(\'1\', \'' .$sOpt. '\');</script>';
$activBtn=1;
}
else {
if (isset ($c1) ) {
// si isAucun on force le check alors que q = 0
if (strtoupper($isAucun=='AUCUN') && strtoupper($c1)=="AUCUN")
echo '<input style="color:black;" id="check' .$u. '" type="checkbox" value="' .$tabTagLib[$z]. '" onClick="activBouton(\'1\', \'' .$x. '\'); checkChange(\'' .$u. '\'); upQte(document.getElementById(\'kant' .$u. '\').value, \'' .$tabItemNumber[$u]. '\', \'' .$c1. '\');" checked>';
else
echo '<input style="color:black;" id="check' .$u. '" type="checkbox" value="' .$tabTagLib[$z]. '" onClick="activBouton(\'1\', \'' .$x. '\'); checkChange(\'' .$u. '\'); upQte(document.getElementById(\'kant' .$u. '\').value, \'' .$tabItemNumber[$u]. '\', \'' .$c1. '\');" >';
}
}
}
if (isset($max) && $max!='' && $_SESSION['quantiteParListe'] > $max) {
// echo '<script type="text/javascript">alert("Vous avez dépassé la quantité maximum ");</script>';
// echo '<span style="color:red">Quantité dépassée, veuillez enlever un choix</span>';
$isQDepasse=true;
}
// ---------------------------------------------------
// le code C1 donne la quantité min
// ---------------------------------------------------
if (!empty($c1) && $c1!='-') {
$test=substr($c1, 0, 3);
if (strtolower($test)==strtolower('min')) {
$min = substr($c1, -2);
// max inlut le zero
$min = trim( intval($min) ) ;
$min = $min++ ;
}
}
// Affichage du libellé
echo '<span style="white-space:break-spaces;"> ' .$tabTagLib[$z]. '</span>';
if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, [
'c1' => isset($c1)?$c1:'empty',
'z' => $z,
'tabIdType' => $tabIdType[$z], 'u' => $u,
'tabItemN' => isset($tabItemNumber[$u])? $tabItemNumber[$u]:'empty',
'quant' => isset($quant)?$quant:'empty',
'lineItemQ[nLigne]' => isset($lineItemQuantite[$nLigne])?$lineItemQuantite[$nLigne]:'empty',
'SESSION[quantiteParListe]' => $_SESSION['quantiteParListe'] ],'');
}
$nombreItem[$x]++;
echo '</div>';
?>