Your IP : 18.191.208.253


Current Path : /data/web/virtuals/51568/virtual/www/www/ucebnice/
Upload File :
Current File : /data/web/virtuals/51568/virtual/www/www/ucebnice/ucebnice.php

<script src="www/ucebnice/ucebnice.js"> </script>
<div id="modalTisk"></div>
<div class="row">    
    <div class="col-12 col-lg-6">        
        <div class="d-flex flex-row mb-2">           
            <button id="btnFiltr" class="btn btn-outline-warning rounded-0" style="color: black;"  data-toggle="collapse" data-target="#ucFiltr">Zobraz filtr
            </button>           
            <button id="btnTisk" class="btn btn-outline-success rounded-0 ml-2" onclick="ucebniceTiskDialog()">Tisk <i class="fas fa-print"></i>
            </button>   
            <div class="ml-auto">    
                <button id="btnRefresh" class="btn btn-outline-info ml-2 rounded-0" onclick="ucebniceRefresh()">Znovunačti seznam
                </button>              
                <button id="btnUcebniceNova" class="btn btn-outline-info rounded-0" onclick="novaUcebnice()">Nová učebnice <i class="far fa-file"></i>
                </button>            
            </div>        
        </div>        
        <div id="ucFiltr" class="collapse">                   
            <div class="card rounded-0 mb-3 border border-primary">            
                <div class="card-body pb-0 pt-2">              
                    <div class="form-group row ">                  
                        <div class="col-8">                      
                            <label>Předmět
                            </label>                        
                            <select class="custom-select rounded-0"  name="predFiltr" id="predFiltr" onchange="stavFiltru()" >                                                                        
                            </select>                                                         
                        </div>                                                                                                                     
                        <div class="col-4">                      
                            <label>Ročník
                            </label>                      
                            <select class="custom-select rounded-0" name="rocFiltr" id="rocFiltr"  onchange="stavFiltru()">                          
                                <option id="rocFiltr0" value="0">... zvol ročník ...
                                </option>                          
                                <?php for ($i = 1;$i <= 9; $i++){ ?>                          
                                <option id="rocFiltr<?=$i?>" value="<?=$i?>">
                                <?=$i;?>                          
                                </option>                          
                                <?php }  ?>                      
                            </select>                         
                        </div>                                
                    </div>  
                    
                    <div class="form-group d-flex mt-2">                                                  
                        <label class="col-form-label mr-3"><strong>Má vypůjčeno:</strong>                                               
                        </label>                                                    
                        <div class="mr-4 pt-2">                                                            
                            <div class="custom-control custom-radio custom-control-inline" required>                                                                      
                                <input name="filtrKdo" id="filtrKdo0" type="radio" class="custom-control-input" value="u" onclick="zapujckaKdo('u', 'selectKdoFiltr', 'true')">                                                                        
                                <label for="filtrKdo0" class="custom-control-label">učitel                                                              
                                </label>                                                            
                            </div>                                                            
                            <div class="custom-control custom-radio custom-control-inline">                                                                      
                                <input name="filtrKdo" id="filtrKdo1" type="radio" class="custom-control-input" value="t" onclick="zapujckaKdo('t', 'selectKdoFiltr', 'true')">                                                                        
                                <label for="filtrKdo1" class="custom-control-label">třída                                                              
                                </label>                                                            
                            </div>                                                  
                        </div>                                                
                        <div id="filtr" style="max-width: 150px;">                                                     
                            <div class="" id="idComboselectKdoFiltr">                                                             
                                                                                    
                            </div>                                             
                        </div>                                                                              
                    </div>                      
                    
                                
                </div>            
                <div class="card-footer d-flex py-1" style="min-height: 47px;">              
                    <button class="btn btn-warning d-none rounded-0" id="btnZrusFiltrUcebnice" onclick="zrusFiltrUcebnice()">Zruš filtr
                    </button>              
                    <div class="ml-auto">                                
                        <button id="btnFiltrujUcebnice" class="btn btn-success rounded-0 d-none" onclick="filtrujUcebnice()">Filtruj
                        </button>              
                    </div>              
                </div>          
            </div>                                
        </div>        
        <div id="ucebniceSeznam" style="height: 100%;">        
            <?php include "ucebnice-seznam.php";?>        
        </div>    
    </div>    
    <div class="col-12 col-lg-6">
        <div id="btnBar"  class="d-none">         
            <div class="d-flex flex-row mb-2">                   
                <!--button id="btnZaklUdaje" class="btn btn-outline-info mr-2 rounded-0 invisible" onclick="editujUcebnici()">Základní údaje                  
                </button-->          
                <button id="btnUcebniceKopie" class="btn btn-outline-info  rounded-0 d-none" onclick="kopieUcebnice()">Kopie zobrazené
                </button>                     
                <div class="ml-auto">                                
                    <button id="btnSkladPohyb" class="btn btn-outline-info mr-2 rounded-0" onclick="skladPohyb()">Nový pohyb skladu                          
                    </button>                                                   
                </div>                           
                <div class="">                                  
                    <button id="btnUcebniceZapujcka" class="btn btn-outline-info rounded-0" onclick="ucebniceZapujcka()">Nová zápůjčka                          
                    </button>                      
                </div>         
            </div>
        </div>             
        <div id="ucebniceDetail">        
        </div>    
    </div>     
</div>
<script>
$("#ucFiltr").on('show.bs.collapse', function(){
  $("#btnFiltr").html("Skryj filtr");
  let predFiltr = $("#predFiltr").val();
  $.ajax({
    url: "www/ucebnice/filtr-predmety-napln.php",
    type: 'POST',
    dataType: 'HTML',
    data: {
      'predmet' : predFiltr,
    },
    success: function (result) {
         $("#predFiltr").html(result);
       }
  });   
});
$("#ucFiltr").on('hide.bs.collapse', function(){
  $("#btnFiltr").html("Zobraz filtr");    
});

function ucebniceForma(){
    $.ajax({
      url: "www/ucebnice/ucebnice-detail.php",
      type: 'POST',
      dataType: 'HTML',
      data: {
        'rocnik': ucUcebnice.rokstudia,
      },
      success: function (result) {
        $("#ucebniceDetail").html(result);
        $.ajax({
          url: "www/ucebnice/ucebnice-predmety-napln.php",
          type: 'POST',
          dataType: 'HTML',
          data: {
            'predmet' : ucUcebnice.idpredmet,
          },
          success: function (result) {
              $("#predmetSeznam").html(result);
              $.ajax({
                url: "www/ucebnice/ucebnice-naklad-napln.php",
                type: 'POST',
                dataType: 'HTML',
                data: {
                  'naklad' : ucUcebnice.idnaklad,
                },
                success: function (result) {
                     $("#nakladSeznam").html(result);
                     nastavBtnBar();
                   }
             });             
             }
       });
     }
   })
}
function ucebniceNastav(btnText){
  $("#detailUcebniceForma").attr("id-ucebnice", ucUcebnice.id);
  nastavBtnBar();
  $("#ucebniceTitulek").html('Nová učebnice')
  $("#nazevuc").val(ucUcebnice.titul);
  $("#rokVydani").val(ucUcebnice.rokvydani);
  $("#nakladSeznam").val(ucUcebnice.idnaklad);
  $("#predmetSeznam").val(ucUcebnice.idpredmet);
  $("#rocnik").val(ucUcebnice.rokstudia);
  $("#btnUlozit").html(btnText);
  $("#btnUcebniceKopie").removeClass("d-none");
  
}
function novaUcebnice(){
  $("#pohybSpodek").addClass("d-none");
  $('[id^="radekUc"]').css("background-color", "transparent");
  $("#btnUcebniceKopie").addClass("d-none");
  $("#msgKopirujes").addClass("d-none");
  let f = document.getElementById('detailUcebniceForma');
  ucUcebnice.setUcebnice (0, 0, "", 0, "", 0, "1");
  if ((f === undefined) || (f === null)) {
    ucebniceForma();
    $.ajax({
        success: function () {
          ucebniceNastav("Založit");
          $("#detailUcebniceBody").addClass("show");
          nastavBtnBar();        
        }
    })     
  } else {
    ucebniceNastav("Založit");
    $("#detailUcebniceBody").addClass("show");
    nastavBtnBar();        
  }  
}
            
function editujUcebnici(id){
  $("#pohybSpodek").removeClass("d-none");
  $('[id^="radekUc"]').css("background-color", "transparent");
  $("#radekUc"+id).css("background-color", "#dee2e6");
  $("#msgKopirujes").addClass("d-none");
  $.ajax({
    url: "www/ucebnice/ucebnice-nacti.php",
    type: 'POST',
    dataType: 'HTML',
    data: {
      'id' : id,
    },
    success: function (result) {
        let ucebniceDB = JSON.parse(result),
            f = document.getElementById('detailUcebniceForma');      
        ucUcebnice.setUcebnice (id, ucebniceDB.idnaklad, ucebniceDB.titul, ucebniceDB.idpredmet, ucebniceDB.rokvydani, ucebniceDB.rokstudia, "1");
        if ((f === undefined) || (f === null)) {
          $.ajax({
              success: function () {
                  ucebniceForma();
                  $.ajax({
                      success: function () {
                          ucebniceNastav("Uložit");                          
                         $("#ucebniceTitulek").html(ucebniceDB.titul);
                         ucebniceSklad(id);
                         ucebniceZapujcky(id);
                      }
                  })
              }
          })               
        } else {
          ucebniceNastav("Uložit"); 
          $("#ucebniceTitulek").html(ucebniceDB.titul);
          ucebniceSklad(id);
          ucebniceZapujcky(id);
        }              
       }
  });
  
}

function ucebniceSklad(idkniha){
  $.ajax({
    url: "www/ucebnice/ucebnice-sklad-pohyby.php",
    type: 'POST',
    dataType: 'HTML',
    data: {
      'idkniha' : idkniha,
    },
    success: function (result) {
         $("#pohybSklad").html(result);
       }
 });
}

function ucebniceZapujcky(idkniha){
  $.ajax({
      url: "www/ucebnice/zapujcka-seznam.php",
      type: 'POST',
      dataType: 'HTML',
      data: {
        'idkniha': idkniha,
      },
      success: function (result) {
          $("#pohybZapujcky").html(result);
      }
  }); 
}
  
 
</script>