Your IP : 3.21.93.81


Current Path : /data/web/virtuals/51568/virtual/www/www/plany.bak/
Upload File :
Current File : /data/web/virtuals/51568/virtual/www/www/plany.bak/planyPlany.php.orig

<?php
  require_once('DbConnect.php');
  if (!IsSet($idRok)){
      if (IsSet($_POST["idRok"])){$idRok = $_POST["idRok"];}
  }
?> 

  <div class="row my-2">
    <div class="col">
      <button class="btn btn-info" id="plNovyBtn">Nový   
      </button>
    </div>
    <div class="col text-right">
      <button class="btn btn-success" id="plTiskBtn">Tisk 
      </button>   
    </div>    
  </div>

                     
<div id="plany" class="table-scroll-container-40 mb-3 table-scroll" style="min-width: 220px; max-width: 220px;">
  <div id="containerNovyPlan"></div>  
<?php

  $sql = "SELECT pp.id, MIN(pt.zacatek) as zacatek from pl_plany pp join pl_tydny pt on pt.idplan = pp.id "
       ."where pp.idrok = $idRok GROUP by pp.id order by zacatek desc";        
  $result = mysqli_query($conn, $sql);
  $row =  mysqli_fetch_object($result);
  $pocet = 0;
  if ($row->id > 0) { ?>                         
  <table class="table table-striped table-bordered table-sm ">                                  
    <thead>                                          
      <tr> <td>začátek</td>                                          
      </tr>                                  
    </thead>                          
<?php   do {
          $pocet++;
          $checked = false;
          if($pocet == 1) {$checked = true;  $idPlan = $row->id;}  
          $checkedS = ($checked) ? "checked" : "";         
                    ?>                                    
    <tr <?php echo ($checked) ?  "id='aktualni'" : ""; ?>>        <td>                                                  
        <div class="custom-control custom-radio ml-1 pr-0">                                                          
          <input type="radio" class="custom-control-input" id="rgPlanZobr<?php echo $row->id; ?>" name="rgPlanZobr" <?php echo $checkedS; ?>>                                                           
          <label class="custom-control-label" for="rgPlanZobr<?php echo $row->id; ?>">                                                                   
            <?php echo date('d.m.Y', strtotime($row->zacatek));?>                                                             
          </label>                                                  
        </div>                                   </td>                                                             
    </tr>                                  
    <?php  } while ($row =  mysqli_fetch_object($result)); ?>                            
  </table>       
  <?php ;}?>                   
</div>


<script src="funkce.js"></script>
<script>
    $(document).ready(function () {
      $("#plNovyBtn").on('click', function(){
      //  $(this).addClass("d-none");
        $.ajax({
            url: "planyPlanyNovy.php",
            type: 'POST',
            data: {
                'idRok': '<?php echo $idRok; ?>'
            },
            success: function (result) {
                $("#containerNovyPlan").html(result);
            }
        })
      })
     $('[id^="rgPlanZobr"]').on('click', function(){
         var idPlan = rgKod("rgPlanZobr");
                 $.ajax({
            url: "planyNahled.php",
            type: 'POST',
            data: {
                'idPlan': idPlan
            },
            success: function (result) {
                $("#main").html(result);
            }
        })
         
     }) 
     
    $('#plTiskBtn').on('click', function(event){
      var idPlan = rgKod("rgPlanZobr");
      event.preventDefault();
      event.stopPropagation();
      var targetAttr = 'tisk';
      var linkHref = 'planyTisk.php?idPlan='+idPlan;     
      window.open(linkHref, targetAttr);  
    });     
     
     
    })
</script>