<?php include 'class/coupon.class.php'; ?> <!DOCTYPE html> <html lang="en"> <head> <?php include 'header.php';?> <link href="../dist/css/build.css" rel="stylesheet"> </head> <body> <div id="wrapper"> <?php include 'menu.php'; ?> <?php $managerCou = new CouponManager($db); $listeDeal = $managerCou->getListDealEnCours(); // var_dump($listeDeal); ?> <!-- Page Content --> <div id="page-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Prix</h1> </div> <!-- /.col-lg-12 --> </div> <!-- /.row --> <?php $managerCou = new CouponManager($db); $listePrix = $managerCou->getListPrice(); ?> <script> function calc() { pt=document.getElementById('pt').value; t=0; tl=0; ch= "<table class='table-striped table-bordered table-hover' width='80%' style='margin: auto;'>"; ch= ch + "<thead><tr><th class='text-center'><a href='javascript:void(0);' onclick='removeall()'><i class='fas fa-times fa-2x' aria-hidden='true' style='color: red;'></i></a></th><th>Libelle</th><th class='text-center'>PU</th><th class='text-center'>QTE</th><th class='text-center'>PT</th></tr></thead><tbody>"; document.getElementById("resultat").innerHTML = ""; for (var i = 1; i <= pt; i++) { if (document.getElementById('cb'+i).checked) { document.getElementById('tr'+i).style.backgroundColor = "#fdbd32"; tl= document.getElementById('prix'+i).value * document.getElementById('qte'+i).value; t=t+ tl; ch= ch + "<tr><td class='text-center'><a href='javascript:void(0);' onclick='removetr("+i+")'><i class='fas fa-times' aria-hidden='true'></i></a></td><td>"+ document.getElementById('lib'+i).innerHTML +"</td><td class='text-center'>"+document.getElementById('prix'+i).value+"<sup>DT.</sup></td><td class='text-center'>"+ document.getElementById('qte'+i).value +"</td><td class='text-center'>"+tl+"<sup>DT.</sup></td></tr>"; } else {document.getElementById('tr'+i).style.backgroundColor = "";} } ch= ch + "</tbody><tr><th colspan='4' class='text-right'>Totale&nbsp;</th><th class='text-center'><span class='r_totale'>&nbsp;"+t+"</span><sup>DT.</sup></th></tr>"; document.getElementById("resultat").innerHTML = ch; } function selecttr(p) { if (document.getElementById('cb'+p).checked) {document.getElementById("cb"+p).checked=false;} else {document.getElementById("cb"+p).checked=true;} calc(); } function removetr(p) { pt=document.getElementById('pt').value; document.getElementById("cb"+p).checked=false; calc(); } function removeall() { pt=document.getElementById('pt').value; for (var i = 1; i <= pt; i++) {document.getElementById("cb"+i).checked=false;} calc(); } </script> <style> .resultatfixe { /*direction: rtl; overflow-y: auto; overflow-x: hidden; height : 150px;*/ min-height : 50px; position: fixed; bottom: 0; right: 0; background : #007CBB; border-bottom : 5px solid #FFF; border-top : 2px solid #FFF; width : 79%; padding: 2px; } #resultat{/*direction: ltr;*/} .r_item{font-weight: bold;font-size: larger;} .r_totale{font-weight: bold;font-size: x-large;color: #007cbb;} .clikable{cursor: pointer;} #resultat > .table-striped>tbody>tr:nth-child(odd)>td,#resultat > .table-striped>tbody>tr:nth-child(odd)>th {background-color: #f5f5f5;} #resultat > .table-striped>tbody>tr:nth-child(even)>td,#resultat > .table-striped>tbody>tr:nth-child(even)>th {background-color: #e5e3e3;} </style> <div class="row"> <div class="col-lg-12 col-xs-12 text-center"> <table class='table table-bordered table-condensed table-striped table-hover'> <thead> <tr> <th>Partenaire</th> <th>Libelle</th> <th>Prix</th> <th>QTE</th> <th></th> </tr> </thead> <tbody> <?php $p = 0;echo "<script>p=0;</script>"; $lastPartenaire = ""; foreach ($listePrix as $price) { $p++; echo "<form>"; echo "<tr id='tr".$p."'>"; if ($lastPartenaire != $price['partenaire']) {echo "<td class='clikable' onclick='selecttr(\"".$p."\")'>".$price['partenaire']."</td>";} else {echo "<td class='clikable' onclick='selecttr(\"".$p."\")'> <centre>---</centre> </td>";} $lastPartenaire = $price['partenaire']; echo "<td class='clikable' name='lib' id='lib".$p."' onclick='selecttr(\"".$p."\")'>".$price['libelle']."</td>"; echo "<th class='clikable' onclick='selecttr(\"".$p."\")'>".$price['prix']." <sup>Dt.</sup><input type='hidden' name='prix' id='prix".$p."' value='".$price['prix']."'></th>"; echo "<td ><input type='number' name='qte' id='qte".$p."' step='1' value='1' min='0' max='20' onclick='calc();'></td>"; echo "<td><div class='checkbox checkbox-primary' style='margin: 0;'><input type='checkbox' name='cb' id='cb".$p."' onclick='calc();' ><label for='etat'></label></div></td>"; echo "</tr>";echo "</form>"; } echo "<input type='hidden' name='pt' id='pt' value='".$p."'>"; ?> <tbody> </table> </div> </div><br><br><br><br><br><br><br><br><br><br><br> </div><br><br><br><br><br><br><br><br><br><br><br> </div> <!-- /.container-fluid --> </div> <!-- /#page-wrapper --> </div> <!-- /#wrapper --> <div class="resultatfixe row"> <span class="col-lg-12 col-xs-12 text-center" id='resultat'></span> </div> <!-- 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> </body> </html>