alpha_full/admin/options/moyensL/grilleTarifaire/gt.pays2Zone.modale.php
2026-04-06 22:58:51 +02:00

130 lines
5.6 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// -----------------------------------------------------
// Etre admin
// -----------------------------------------------------
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']=='O' ) {
// -----------------------------------------------------
// Init
// -----------------------------------------------------
$refresh="Oui";
$idMl=1;
$tabIdZoneMl=array();
// -----------------------------------------------------
// Post
// -----------------------------------------------------
if (!empty($_GET['idMl'])) {$idMl=$_GET['idMl']; }
else
{if (isset($_POST['idMl'])) {$idMl=$_POST['idMl']; }}
if (isset($_GET['theIdZone'])) {$theIdZone=$_GET['theIdZone']; }
else
{if (isset($_POST['theIdZone'])) {$theIdZone=$_POST['theIdZone']; }}
if (isset($_POST['codeOpe'])) {$codeOpe=$_POST['codeOpe']; }
if (isset($_POST['theIdPays'])) {$theIdPays=$_POST['theIdPays']; }
// -----------------------------------------------------
// Update
// -----------------------------------------------------
if ($codeOpe==='upPays2Zone') {
// recupere tableau existant
include ("gt.reqSelectPaysZone.php");
// ajoute au tableau existant
include ("gt.reqUpdatePays2Zone.php");
}
if ($codeOpe==='downPays2Zone') {
include ("gt.reqSelectPaysZone.php");
include ("gt.reqRemovePays2Zone.php");
include ("gt.reqSelectPaysZone.php");
}
// -----------------------------------------------------
// Select
// -----------------------------------------------------
include ("gt.reqSelectPaysZone.php");
// -----------------------------------------------------
// Debug
// -----------------------------------------------------
if (isset($debug[1]) && $debug[1] == '1') {include ("gt.debug.php"); }
echo '<div id="zoneFormModales" style="display:grid; grid-template-columns:40% 20% 40%;" >';
// -----------------------------------------------------
// Zone gauche
// -----------------------------------------------------
echo '<div style="border:1px solid lightgrey; grid-column:1; grid-row:2; line-height:5px; border-radius:5px; " >';
echo '<span>';
if (!empty($tabPaysZone)) {
if (isset($debug[1]) && $debug[1] == '1' ) print_r($tabPaysZone[0]);
$test= explode(';',$tabPaysZone[0]);
for ($i=0; $i<count($test); $i++) {
echo '<input class="inputWebmaster" id="idp' .$i. '" wrap="hard" value="' .$test[$i]. '" onClick="deSelectPays(\'' .$test[$i]. '\');" >';
echo '<i class="fad fa-trash-alt" style="color:red;fill:red;" onClick="desAffecterPays();"></i>&#160;';
echo '<br>';
}
}
echo '</span>';
echo '<br><br><span class="boutonsWebmaster" onClick="document.location.href=\'./frmModale.php?affModale=6-7&idMl=' .$idMl. '&theIdZone=' .$theIdZone. '\';"><i class="fad fa-plus"></i>&#160;Ajouter une ville ';
echo '</span>';
echo '</div>';
// -----------------------------------------------------
// Boutons fleches
// -----------------------------------------------------
echo '<div style="grid-column:2; text-align:center; grid-row:2;" >';
echo '<span onClick="affecterPays(); " style="border:1px solid transparent; margin:1px; "><i class="fad fa-arrow-alt-square-left" style="font-size:32px; " ></i>Affecter le pays</span>';
echo '<br>';
echo '<span onClick="desAffecterPays();" style="border:1px solid transparent; margin:1px; "><i class="fad fa-arrow-alt-square-right" style="font-size:32px; "></i>Enlever le pays</span>';
echo '</div>';
// -----------------------------------------------------
// Zone droite
// -----------------------------------------------------
$refresh="Oui"; include ($includePath. "/req/30-initPaysList.php");
echo '<div style="border:1px solid lightgrey; grid-column:3; grid-row:2; overflow:auto; max-height:450px; line-height:5px; border-radius:5px; " >';
for ($i=0; $i<count($tabLibPays); $i++) {
$trouve=false;
if (!empty($tabPaysZone)) {
for ($j=0; $j<count($test); $j++) {
if ($test[$j]== $tabLibPays[$i]) {$trouve=true; }
}
}
if ($trouve==false) echo '<p><span id="id' .$i. '" onClick="selectPays(\'' .$tabLibPays[$i]. '\'); changeBackColor(\'id' .$i. '\'); " style="cursor:pointer;font-size:12px; ">' .$tabLibPays[$i]. '</span></p>';
}
echo '</div>';
// -----------------------------------------------------
// Formulaire
// -----------------------------------------------------
echo '<form name="pays2Zone" id="pays2Zone" method="POST" >';
// -----------------------------------------------------
// Champs cachés
// -----------------------------------------------------
echo '<input type="hidden" name="codeOpe" id="codeOpe" value="' .$codeOpe. '" />';
echo '<input type="hidden" name="theIdZone" id="theIdZone" value="' .$theIdZone. '" />';
echo '<input type="hidden" name="idMl" id="idMl" value="' .$idMl. '" />';
echo '<input type="hidden" name="theIdPays" id="theIdPays" value="' .$theIdPays. '" />';
// -----------------------------------------------------
// Retour
// -----------------------------------------------------
echo '<span class="boutonsWebmaster" style="max-width:40%;" onClick=location.href="./frmModale.php?affModale=6-2&idMl=' .$idMl. '&theIdZone=' .$theIdZone. '"><i class="fad fa-chevron-circle-left"></i>&#160;Retour';
echo '</span>';
echo '</form>';
echo '</div>';
}
else {
$confPath="../_conf";
include ("./adminInclude/redirectionAdmin.php");
}
?>