. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 213.186.33.4 / Your IP :
216.73.216.146 [
Web Server : Apache System : Linux webm002.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : dealkatnwc ( 662330) PHP Version : 7.0.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/dealkatnwc/www/GDEAL/pages/ |
Upload File : |
<?php
include 'class/coupon.class.php';
include_once 'class/utilisateur.class.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'header.php';?>
</head>
<body>
<div id="wrapper">
<?php include 'menu.php'; ?>
<?php if (!(he_can('CPEDIT'))) {echo "<script>location.href = '403.php';</script>";}?>
<?php
$managerCou = new CouponManager($db);
$utman = new UtilisateurManager($db);
$message ='';
$class_msg='';
/*if (isset($_GET['msg']))
{
if (($_GET['msg']== 1)&&(isset($_GET['c'])))
{
$coupon = $managerCou->get((int) $_GET['c']);
$class_msg="alert alert-success";
$message = "<b>Coupon ajouter. <br> Le numéro de commande est ".$coupon->code_cmd().". </b>";
$message .="<a type='button' href='".$coupon_dir."coupon-pdf.php?id_coup=".$_GET['c']."'' target='_blanc' class='btn btn-info'><i class='fas fa-print'></i> Imprimer</a>";
}
if (($_GET['msg']== 2)&&(isset($_GET['c'])))
{
$coupon = $managerCou->get((int) $_GET['c']);
$class_msg="alert alert-info";
$message = "<b>Reservation enregistrer. <br> Le numéro de commande est ".$coupon->code_cmd().". </b>";
// $message .="<a type='button' href='".$coupon_dir."coupon-pdf.php?id_coup=".$_GET['c']."'' target='_blanc' class='btn btn-info'><i class='fas fa-print'></i> Imprimer</a>";
}
}
*/
////////////////// traitement des action sur les coupons
if (isset($_POST['action']))
{
if ($_POST['action'] == 'Modification')
{
// echo "t : <br>";
// echo $_POST['mailing']."<br>";
// echo strtotime($_POST['mailing'])."<br>";
// echo var_dump($_POST);
$maj = array();
$maj['id']=(int) $_POST['id'];
$maj['code_cmd']=(int) $_POST['code_cmd'];
$maj['deal_id']=(int) $_POST['id_post'];
$maj['id_vendeur']=(int) $_POST['id_vendeur'];
$maj['quantite']=(int) $_POST['quantite'];
$maj['addr']= $_POST['addr'];
$maj['etat']=(int) $_POST['etat'];
$maj['dealer_nom']= $_POST['dealer_nom'];
$maj['dealer_prenom']= $_POST['dealer_prenom'];
$maj['dealer_tel']= $_POST['dealer_tel'];
$maj['dealer_email']= $_POST['dealer_email'];
$maj['dealer_sex']= $_POST['dealer_sex'];
$maj['dealer_gouv']= $_POST['dealer_gouv'];
$maj['pv']= (int) $_POST['pv'];
$maj['av']= (int) $_POST['av'];
$maj['rst']= (int) $_POST['rst'];
$maj['date_coupon']= strtotime($_POST['date_coupon']);
$maj['mailing']= strtotime($_POST['mailing']);
$maj['recu']= strtotime($_POST['recu']);
$managerCou->update($maj);
$managerCou->maj_nb_achteurs((int) $_POST['id_post'],$_POST['inc_nb_ach']);
$class_msg="alert alert-warning";
$message = "<b>Coupon enregistrer. <br> Le numéro de commande est ".$maj['code_cmd'].". </b>";
$message .="<br><div class='btn-group'>";
if ((he_can('CPPRINT'))&&(in_array($_POST['etat'], $etat_cp_canprint)))
{$message .="<a type='button' href='".$coupon_dir."coupon-pdf.php?id_coup=".$_POST['id']."'' target='_blanc' class='btn btn-primary btn-sm' title='Imprimer le coupon' data-toggle='tooltip' data-placement='top'><i class='fas fa-print'></i> Imprimer le coupon</a> ";
$message .="<a type='button' href='".$coupon_dir."coupon-pdf.php?id_coup=".$_POST['id']."'' target='_blanc' class='btn btn-info btn-sm' title='Imprimer la bon de commande' data-toggle='tooltip' data-placement='top'><i class='fas fa-print'></i> Imprimer la bon de commande</a> ";}
$message .= "<a type='button' href='couponsrapide.php?query=".$maj['code_cmd']."' class='btn btn-warning btn-sm' title='Voir' data-toggle='tooltip' data-placement='top'><i class='fas fa-eye'></i> Voir</a>";
$message .= "<a type='button' href='couponsrapide.php' class='btn btn-success btn-sm' title='Tous les coupons' data-toggle='tooltip' data-placement='top'><i class='fas fa-shopping-cart'></i> Tous les coupons</a>";
$message .= "</div>";
}
}
if( $managerCou->existe((int) $_GET['id_coup']) != 'oui') {echo "<script>location.href = '403.php';</script>";}
$coupon = $managerCou->get((int) $_GET['id_coup']);
$listeDeal = $managerCou->getListDeal();
$listeusr = $utman->getList();
// var_dump($listeDeal);
$abdelete = 'disabled';
if (he_can('CPDELETE')) {$abdelete = '';}
?>
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Modifier Un Coupon</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3>INFO DEAL</h3>
</div>
<div class="panel-body">
<?php
if ($message !='')
{echo '<div class="'.$class_msg.' animated flash" role="alert"><i class="fas fa-exclamation-circle"></i> '.$message.'</div>';}
?>
<table class="table table-striped table-condensed">
<form name='frm' id='frm' action='' method='post'>
<input type='hidden' name='action' value='Modification'>
<input type='hidden' name='id' value='<?php echo $coupon->id(); ?>'>
<?php
?>
<tbody>
<tr>
<th width='25%'>Id/CMD <span class="asteriskField">*</span></th>
<td ><div class='col-xs-2'><?php echo "<input type='number' class='form-control' value='".$coupon->id()."' required disabled>";?></div><div class='col-xs-8'><?php echo "<input type='number' class='form-control' name='code_cmd' placeholder='Code commande' title='Le code commande doit être un nombre' value='".$coupon->code_cmd()."' required>";?></div></td>
</tr>
<tr>
<th width='25%'>DEAL <span class="asteriskField">*</span></th>
<td >
<?php
echo "
<select style='width: 90%;' name='id_post' id='id_post'
onchange=\"document.getElementById('infod').innerHTML = document.getElementById('infodeal'+this.options[this.selectedIndex].value).innerHTML;
document.getElementById('pu').innerHTML = document.getElementById('pp'+this.options[this.selectedIndex].value).value;
document.getElementById('pp').value = document.getElementById('pp'+this.options[this.selectedIndex].value).value;
document.getElementById('pt').innerHTML = document.getElementById('pp'+this.options[this.selectedIndex].value).value * document.getElementById('q').value ;
\"
required><option value='' selected>Veuillez choisir un deal</option>";
foreach ($listeDeal as $deal)
{echo "<option value='".$deal['id']."' > ".$deal['id'].' - '.substr($deal['titre'],0,80)."...</option>";}
echo "</select>";
foreach ($listeDeal as $deal)
{echo "<div id='infodeal".$deal['id']."' class='well well-sm' style='width: 90%;display:none;'>".$deal['id'].' - '.$deal['titre']."<br>
Partenaire : <b>".$deal['p_nom']."</b><br>
Prix : <b>".$deal['prix_promo']."</b><sup>Dt.</sup> au lieu de <b><s>".$deal['prix_reel']."</s></b><sup>Dt.</sup> (<b>".$deal['nba']."</b> Ventes)<br>
D. Fin : <b>".date('d-m-Y \à h:i ',$deal['df']) ."</b><br>
<a class='btn btn-info btn-xs' href='".$home."/?p=".$deal['id']."' target='_blanc'><i class='fas fa-eye' style='color:#fff;' ></i> <b>VOIR LE DEAL</b></a>
</div>
<input id='pp".$deal['id']."' type='hidden' value='".$deal['prix_promo']."'>
";}
echo "<div style='width: 90%;' id='infod' class='well well-sm'> <font color='red'>Veuillez choisir un deal</font></div>
<input id='pp' type='hidden' value='0'>
";
?>
</td>
</tr>
<tr>
<th>Quantite <span class="asteriskField">*</span> </th>
<td>
<div class='row'>
<div class='col-xs-6'>
<input type="number" class="form-control" name="quantite" id="q" pattern="^[0-9-]{1,70}$" value="<?php echo $coupon->quantite(); ?>" min="1"
onclick="
document.getElementById('pt').innerHTML = document.getElementById('q').value * document.getElementById('pp').value;
document.getElementById('quantite').value = document.getElementById('q').value;"
required>
</div>
<div class='col-xs-6' style="font-size: 24px;">
<span> x <span id='pu'>0</span><sup>Dt.</sup></span>
<span> = <b><span id='pt'>0</span><sup>Dt.</sup></b></span>
</div>
</div>
</td>
</tr>
<script>document.getElementById("id_post").value = "<?php echo $coupon->deal_id(); ?>";
document.getElementById('infod').innerHTML = document.getElementById('infodeal'+"<?php echo $coupon->deal_id(); ?>").innerHTML;
document.getElementById('pu').innerHTML = document.getElementById('pp'+"<?php echo $coupon->deal_id(); ?>").value;
document.getElementById('pp').value = document.getElementById('pp'+"<?php echo $coupon->deal_id(); ?>").value;
document.getElementById('pt').innerHTML = document.getElementById('pp'+"<?php echo $coupon->deal_id(); ?>").value * document.getElementById('q').value
</script>
<tr>
<th>Vendeur <span class="asteriskField">*</span> </th>
<td><?php
echo "<select name='id_vendeur' id='id_vendeur'>";
echo "<option value=0>virtuel</option>";
foreach ($listeusr as $usr)
{echo "<option value=".$usr->id().">".$usr->nom()."</option>";}
echo "</select>";
?>
<script>document.getElementById("id_vendeur").value = "<?php echo $coupon->id_vendeur(); ?>";</script></td>
</tr>
<tr>
<!-- th>Addresse du dealer </th>
<td>
<div class='row'>
<div class='col-xs-12'>
<input type="text" class="form-control" name="addr" id="q" value="<?php //echo $coupon->addr(); ?>">
</div>
</div>
</td>
</tr -->
<tr>
<th>Etat <span class="asteriskField">*</span> </th>
<td><?php
echo "<select name='etat' id='etat' onchange='ch_addr()'>";
foreach ($coupon_code as $key => $value)
{echo "<option value=".$key.">".$value."</option>";}
echo "</select>";
?>
<script>document.getElementById("etat").value = "<?php echo $coupon->etat(); ?>";</script>
</td>
</tr>
<tr>
<th>Prénom <span class="asteriskField">*</span> </th>
<td><?php echo "<div class='form-group input-group'><span class='input-group-addon'> M/Mme/Mlle</span><input value='".$coupon->dealer_prenom()."' type='text' class='form-control' name='dealer_prenom' pattern='^[a-zA-Z0-9àâçéèêëîïôûùüÿñæœ _+-.,!@#$%^&*();\/|<>]{3,70}$' placeholder='Le prénom' title='Le prénom doit être composer des lettres de taille varie entre 4 et 70 carractére' required></div>";?></td>
</tr>
<tr>
<th>Nom <span class="asteriskField">*</span> </th>
<td><?php echo "<input value='".$coupon->dealer_nom()."' type='text' class='form-control' name='dealer_nom' pattern='^[a-zA-Z0-9àâçéèêëîïôûùüÿñæœ _+-.,!@#$%^&*();\/|<>]{3,70}$' placeholder='Le nom' title='Le nom doit être composer des lettres de taille varie entre 4 et 70 carractére' required>";?></td>
</tr>
<tr>
<th>Téléphone <span class="asteriskField">*</span> </th>
<td><?php echo "<div class='form-group input-group'><span class='input-group-addon'> 00 ".$indicatif_tel."</span><input value='".$coupon->dealer_tel()."' type='text' class='form-control' name='dealer_tel' pattern='^[0-9 +]{8,20}$' placeholder='Le numéro de téléphone' title='Le numéro de télépohne doit être composer entre 8 et 20 chiffres' required></div>";?></td>
</tr>
<tr>
<th>Email </th>
<td><?php echo "<input value='".$coupon->dealer_email()."' type='email' class='form-control' name='dealer_email' placeholder='L`adresse mail'>";?></td>
</tr>
<tr>
<th>Sex </th>
<td><?php
$h_cheked = $F_cheked = '';
if ($coupon->dealer_sex() == 'homme') $h_cheked = 'checked';
if ($coupon->dealer_sex() == 'Femme') $F_cheked = 'checked';
echo "
<div class='radio radio-info radio-inline'><input type='radio' name='dealer_sex' value='homme' id='homme' ".$h_cheked." required><label for='homme'><i class='fas fa-male' aria-hidden='true' style='color:#2859C9'> homme</i></label></div>
<div class='radio radio-danger radio-inline'><input type='radio' name='dealer_sex' value='Femme' id='Femme' ".$F_cheked."><label for='Femme'><i class='fas fa-female' aria-hidden='true' style='color:#B92F77'> Femme</i></label></div>";?></td>
</tr>
<script>
function ch_addr()
{
var e = document.getElementById("etat");
var key = e.options[e.selectedIndex].value;
/*if(key == 7)
{document.getElementById("champs_address_livraison").style.visibility = "";
document.getElementById("champs_address_livraison").style.display = "";}
else
{document.getElementById("champs_address_livraison").style.visibility = "hidden";
document.getElementById("champs_address_livraison").style.display = "none";}*/
}
</script>
<!-- tr class="warning" id="champs_address_livraison" style='<?php if ($coupon->etat() !=7) echo "display:none;";?>' -->
<tr class="warning" id="champs_address_livraison" >
<th>Adresse de livraison de coupon </th>
<td><?php echo "<input type='text' class='form-control' name='addr' pattern='^[a-zA-Z0-9àâçéèêëîïôûùüÿñæœ _+-.,!@#$%^&*();\/|<>]{1,100}$' placeholder='Adresse de livraison de coupon' value='".$coupon->addr()."' title='L'adresse doit être composer des lettres de taille varie entre 1 et 100 carractére'>";?></td>
</tr>
<tr>
<th>Gouvernorat <span class="asteriskField">*</span></th>
<td><?php echo "
<select id='dealer_gouv' name='dealer_gouv' aria-label='Gouvernorat' class='form-control' required>
<option value='Ariana'>Ariana</option>
<option value='Beja'>Beja</option>
<option value='Ben Arous' selected>Ben Arous</option>
<option value='Bizerte'>Bizerte</option>
<option value='Gabes'>Gabes</option>
<option value='Gafsa'>Gafsa</option>
<option value='Jendouba'>Jendouba</option>
<option value='Kairouan'>Kairouan</option>
<option value='Kasserine'>Kasserine</option>
<option value='Kebili'>Kebili</option>
<option value='Kef'>Kef</option>
<option value='Mahdia'>Mahdia</option>
<option value='Manouba (La)'>Manouba (La)</option>
<option value='Medenine'>Medenine</option>
<option value='Monastir'>Monastir</option>
<option value='Nabeul'>Nabeul</option>
<option value='Sfax'>Sfax</option>
<option value='Sidi Bouzid'>Sidi Bouzid</option>
<option value='Silana'>Silana</option>
<option value='Sousse'>Sousse</option>
<option value='Tataouine'>Tataouine</option>
<option value='Tozeur'>Tozeur</option>
<option value='Tunis' >Tunis</option>
<option value='Zaghouan'>Zaghouan</option>
</select>
";?></td>
</tr>
<script>document.getElementById("dealer_gouv").value = "<?php echo $coupon->dealer_gouv(); ?>";</script>
<tr>
<th>Date Coupon </th>
<td>
<div class="input-group date form_datetime_date_coupon col-md-5" data-date="1979-09-16T05:25:07Z" data-date-format="dd-mm-yyyy hh:ii" data-link-field="date_coupon">
<input class="form-control" id="date_coupon" name="date_coupon"size="16" type="text" value="<?php echo date("d-m-Y H:i", $coupon->date_coupon());?>" readonly>
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
</td>
</tr>
<tr>
<th>Date Mailing </th>
<td>
<div class="input-group date form_datetime_date_coupon col-md-5" data-date="1979-09-16T05:25:07Z" data-date-format="dd-mm-yyyy hh:ii" data-link-field="mailing">
<input class="form-control" id="mailing" name="mailing"size="16" type="text" value="<?php if($coupon->mailing() > 0) echo date("d-m-Y H:i", $coupon->mailing());?>" readonly>
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
</td>
</tr>
<tr>
<th>Date Réception </th>
<td>
<div class="input-group date form_datetime_date_coupon col-md-5" data-date="1979-09-16T05:25:07Z" data-date-format="dd-mm-yyyy hh:ii" data-link-field="recu">
<input class="form-control" id="recu" name="recu"size="16" type="text" value="<?php if ($coupon->recu() > 0) echo date("d-m-Y H:i", $coupon->recu());?>" readonly>
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
</td>
</tr>
<tr>
<th>Payement </th>
<td>
<div class="row">
<div class="col-md-4 col-xs-12"><?php echo "<div class='form-group input-group'><span class='input-group-addon'><b>Totale:</b></span><input type='number' class='form-control' value='".$coupon->pv()."' name='pv' id='pv' placeholder='Totale'><span class='input-group-addon'> <b>DT</b></span></div>";?></div>
<div class="col-md-4 col-xs-12"><?php echo "<div class='form-group input-group'><span class='input-group-addon'><b>Avance :</b></span><input type='number' class='form-control' value='".$coupon->av()."' name='av' id='av' onchange='document.getElementById(\"rst\").value = document.getElementById(\"pv\").value - document.getElementById(\"av\").value;' placeholder='Avance'><span class='input-group-addon'> <b>DT</b></span></div>";?></div>
<div class="col-md-4 col-xs-12"><?php echo "<div class='form-group input-group'><span class='input-group-addon'><b>Reste :</b></span><input type='number' class='form-control' value='".$coupon->rst()."' name='rst' id='rst' placeholder='Reste'><span class='input-group-addon'> <b>DT</b></span></div>";?></div>
</div>
</td>
</tr>
<tr>
<th>Incrémente Nb Acheteurs </th>
<td >
<div class='input-group col-md-5'>
<input type='number' class='form-control' name='inc_nb_ach' value='0'>
</div>
</td>
</tr>
<tr>
<th colspan='2'>
<div class='btn-group btn-group-lg btn-block'>
<a class="btn btn-md btn-info col-lg-3" href="couponsrapide.php"><i class="fas fa-chevron-circle-left"></i> Annuler</a>
<a class="btn btn-md btn-danger<?php echo $abdelete;?> col-lg-3" onclick="if (confirm('Voulez vous vraiment supprimer ce coupon ( ID = <?php echo $coupon->id();?>)?')) {document.forms['frmdel<?php echo $coupon->id();?>'].submit(); return false;}"><i class="fas fa-trash"></i> Supprimer</a>
<button type="submit" class="btn btn-md btn-success col-lg-6"><i class="fas fa-save"></i> Mise à Jour</button>
</div>
</th>
</tr>
</tbody>
</form>
<form name='frmdel<?php echo $coupon->id();?>' id='frmdel<?php echo $coupon->id();?>' action='couponsrapide.php' method='get'>
<?php
echo "<input type='hidden' name='id' value = '".$coupon->id()."'>";
echo "<input type='hidden' name='op' value = 'delete'>";
?>
</form>
</table>
</div>
<!-- /.table-responsive -->
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="../bower_components/metisMenu/dist/metisMenu.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="../dist/js/sb-admin-2.js"></script>
<link href="../bower_components/datetimepicker/bootstrap-datetimepicker.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="../bower_components/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="../bower_components/datetimepicker/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip({html: true});
$('[data-toggle="popover"]').popover({html: true});
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {$(this).popover('hide');}
});
});
});
$('.form_datetime_date_coupon').datetimepicker({
format: 'dd-mm-yyyy hh:ii',
language: 'fr',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: false,
pickerPosition: "bottom-left",
startDate: "2016-08-01 00:00",
minuteStep: 10
});
</script>
</body>
</html>