<?php
session_start();
if (isset($_SESSION['_session']['user']) &&  (time() - $_SESSION['_session']['LAST_ACTIVITY']  < $_SESSION['_session']['koha'])) {
  $_SESSION['_session']['LAST_ACTIVITY']  = time();

  if ($_SESSION['_session']['roli'] == 1 ||   $_SESSION['_session']['all_users'] == 1 || $_SESSION['_session']['my_users'] == 1) {
    require 'header.php';
?>
    <script src="js/sha256.js"></script>
    <style type="text/css">
      .hidden {
        display: none;
      }

      @media only screen and (max-width: 600px) {
        .control-label {
          display: none;
        }

        .edit {
          flex-wrap: nowrap;
          padding-bottom: 10px;
        }
      }
    </style>

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid" style="padding-top: 20px;">
          <div class="row">
            <div class="col-12">
              <div class="card">
                <?php if ($_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['roli'] == 2 || $_SESSION['_session']['roli'] == 3) { ?>
                  <div class="card-header clearfix">
                    <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#modal-register"> <i class="material-icons">person_add</i> Shto Përdorues</button>
                    <?php if ($_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['roli'] == 2) { ?>
                      <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#modal-klient"> <i class="material-icons">add</i> Edito/Shto Klient</button>
                    <?php } ?>
                    <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#modal-pozita"> <i class="material-icons">add</i> Shto Pozitë</button>

                    <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#modal-city"> <i class="material-icons">add_location</i> Shto Qytet</button>

                  </div>
                <?php } ?>
                <div id="tabel12"></div>
                <div id="getpc" class="card-body">
                  <?php
                  $opts = [
                    "http" => [
                      "method" => "GET",
                      "header" => "api_token:" . $token,
                    ]
                  ];
                  $context = stream_context_create($opts);
                  if ($_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['all_users'] == 1) {
                    if (isset($_GET['inst'])) {
                      $str_data = file_get_contents($urlapi . "/getmyusers/" . $_GET['inst'], false, $context);
                    } else {
                      $str_data = file_get_contents($urlapi . "/getallusers", false, $context);
                    }
                  } else {
                    $str_data = file_get_contents($urlapi . "/getmyusers/" . $instituti, false, $context);
                  }
                  $data = json_decode($str_data, true);
                  $length = count($data);

                  $str_inst = file_get_contents($urlapi . "/getallinstitut", false, $context);
                  $inst = json_decode($str_inst, true);
                  $instopt = '';
                  for ($i = 0; $i < count($inst["data"]); $i++) {
                    $instopt .= '<option value="' . $inst["data"][$i]['id'] . '">' . $inst["data"][$i]['emri_institutit'] . '</option>';
                  }

                  $temp = "<table id=\"example1\" class=\"table table-bordered table-hover\">";
                  $temp .= "<thead><tr ><th type=\"hidden\">ID</th>";
                  if ($_SESSION['_session']['roli'] == 1) {
                    $temp .= "<th>Instituti</th>";
                  }
                  $temp .= "<th>Emri</th>";
                  $temp .= "<th>Mbiemri</th>";
                  $temp .= "<th>Perdoruesi</th>";
                  $temp .= "<th>Qyteti</th>";
                  $temp .= "<th>Numri i telefonit</th>";
                  $temp .= "<th>Pozita</th>";
                  $temp .= "<th>Mundësia</th></tr></thead> <tbody>";

                  for ($i = 0; $i < $length; $i++) {
                    if ($data[$i]["statusi"] == 0) {
                      $color = 'style="color:red"';
                    } else {
                      $color = '';
                    }
                    $temp .= "<tr " . $color .  "><td type=\"hidden\"  >" . $data[$i]["id"] . "</td>";
                    if ($_SESSION['_session']['roli'] == 1) {
                      $temp .= "<td>" . $data[$i]["emri_institutit"] . "</td>";
                    }
                    $temp .= "<td>" . $data[$i]["emri"] . "</td>";
                    $temp .= "<td>" . $data[$i]["mbiemri"] . "</td>";
                    $temp .= "<td>" . $data[$i]["perdoruesi"] . "</td>";
                    $temp .= "<td>" . $data[$i]["emri_qytetit"] . "</td>";
                    $temp .= "<td>" . $data[$i]["nr_kontaktues"] . "</td>";
                    $temp .= "<td>" . $data[$i]["pozitat"] . "</td>";
                    // $temp .="<td><button id=\"btnpermissions". $data[$i]["id"] ."\" class=\"btn btn-primary btn-xs permissions\" style=\"padding: 6px\"></button></td>";

                    // $temp .= "</td>";
                    $temp .= "<td style=\"display: none;\">";
                    if ($_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['roli'] == 2 || $_SESSION['_session']['roli'] == 3) {
                      $temp .= "<button style=\"padding: 6px\" 
                class=\"btn btn-info btn-xs edit\" 
                onClick=\"selectuser_click(" . $data[$i]["id"] . ")\"
                data-toggle=\"modal\" 
                data-target=\"#modal-edit\">
                <i class=\"material-icons dp48\">edit</i></button>";
                    }
                    //  if($_SESSION['_session']['roli']==1 || $_SESSION['_session']['roli']==2 || $_SESSION['_session']['roli']==3)
                    // {
                    //   $temp .= "<button style=\"padding: 6px\" 
                    //   class=\"btn btn-danger btn-xs delete\"onClick=\"del_click(". $data[$i]["id"] . ")\">
                    //   <i class=\"material-icons dp48\">block</i>";
                    // } 
                    if ($_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['roli'] == 2 || $_SESSION['_session']['roli'] == 3) {
                      $temp .= "<button style=\"padding: 6px\" 
                class=\"btn btn-default btn-xs lock\" 
                onClick=\"updatelejet(" . $data[$i]["id"] . ")\">
                <i class=\"material-icons dp48\">lock</i></button>";
                    }
                    // if($_SESSION['_session']['user_profile']==1)
                    // {
                    $temp .= "<button target=\"_blank\" style=\"padding: 6px\" 
                class=\"btn btn-primary btn-xs lock\" 
               onclick=\" window.open('Profile.php?id=" . $data[$i]["id"] . "','_blank')\">
                <i class=\"material-icons dp48\">account_box</i></button>";
                    // }
                    $temp .= "</td>";
                    $temp .= "</tr>";
                  }
                  $temp .= "</tbody></table>";
                  echo $temp;

                  ?>

                </div>
                <!-- end TABLE EXMAPLE1 -->
              </div>
            </div>
          </div>
        </div>
        <!-- = = = = = = = =  MODALS START = =  MODALS START = =  MODALS START = =  MODALS START = =  MODALS START = = = = = = = = = = = = = = = -->

        <!-- start  OF MODAL FOR CITY CREATE UPDATE DELETE CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  -->
        <div class="modal fade" id="modal-city" style="display:none;">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button class="btn btn-success" id="shtoQytet" onclick="trigershtoQytet()" style="display: block;">
                  <i class="material-icons">add</i> Shto Qytet
                </button>
                <button class="btn btn-warning" id="editoQytet" onclick="trigereditoQytet()" style="display: none;">
                  <i class="material-icons">arrow_back</i> Edito Qytet
                </button>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>

              <div class="modal-body">
                <!-- kerkimi -->
                <div class="input-group mb-12" id="getQytethide">
                  <label class="col-sm-3 col-md-3 control-label">Kërko qytetin</label>
                  <div class="col-sm-8 col-md-8" id="getQytet">
                    <script>
                      function getQytet() {
                        $.ajax({
                          type: "GET",
                          url: url + "/getqytet",
                          headers: {
                            'api_token': token
                          },

                          success: function(data, status) {
                            y = "<select  id=\"select-qytet\" class=\"form-control selectized select2\" style=\"width:100%;\" autocomplete=\"off\" tabindex=\"-1\">";
                            y += "<option value=\"\" selected=\"selected\">-Zgjedh Qytetin-</option>";

                            for (i = 0; i < data.length; i++) {
                              y += '<option value="' + data[i].id + '">' + data[i].emri_qytetit + '</option> ';
                            }
                            y += '</select>';
                            document.getElementById("getQytet").innerHTML = y;

                            $('#select-qytet').select2({
                              dropdownParent: $('#modal-city')
                            });
                            $("#select-qytet").change(function() {
                              $.ajax({
                                url: url + "/qytetibyid",
                                headers: {
                                  'api_token': token
                                },
                                data: {


                                  id: this.value,
                                },
                                success: function(data, status) {
                                  if (data.code == 200)
                                    $('#EmriQytetit').val(data.data[0].emri_qytetit);


                                }
                              });
                            });
                          }
                        });

                      }
                      $(function() {
                        getQytet();
                      });


                      function trigershtoQytet() {
                        $('#getQytethide').hide();
                        $('#shtoQytet').hide();
                        $('#btnupdateqytet').hide();
                        $('#btninsertqytet').show();
                        $('#editoQytet').show();
                        $('#EmriQytetit').val('');

                      }

                      function trigereditoQytet() {
                        $('#getQytethide').show();
                        $('#shtoQytet').show();
                        $('#btnupdateqytet').show();
                        $('#editoQytet').hide();
                        $('#btninsertqytet').hide();
                        $('#EmriQytetit').val('');

                      }
                    </script>
                  </div>
                </div>
                <!-- end kerkimi -->
                <!-- start regjistrimi -->

                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Emri i qytetit</label>
                  <div class="col-sm-8 col-md-8">
                    <input class="form-control InputToUpper text-box single-line" data-val="true" data-val-required="Emri është i detyrueshëm *" id="EmriQytetit" placeholder="Emri Qytetit" type="text" value="">
                  </div>
                </div>

              </div>
              <div class="modal-footer justify-content-between">
                <button type="button" class="btn btn-default" data-dismiss="modal">Anulo</button>
                <button type="button" id="btninsertqytet" class="btn btn-success" style="display: none;">Shto</button>
                <button type="button" id="btnupdateqytet" class="btn btn-success">Ndrysho</button>
              </div>
              <!-- end -->
            </div>
          </div>
        </div>

        <!-- END OF MODAL FOR CITY CREATE UPDATE DELETE CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  CITY  -->
        <!-- Modal of deleting a User    DELETE USER  DELETE USER  DELETE USER  DELETE USER  DELETE USER  DELETE USER  DELETE USER  DELETE USER  -->

        <script type="text/javascript">
          $("#btninsertqytet").click(function() {
            var ajax = {
              emri_qyteti: $('#EmriQytetit').val(),
              veprimi: 'insert',
            }
            $.ajax({
              type: "POST",
              url: url + "/qyteti",
              data: ajax,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                toastr.success('Qyteti u shtua me sukses!');
                $('#modal-city').modal('hide');
                location.reload();
              },

              error: function(request, textStatus, errorThrown) {
                // $(".informasi").removeClass("hidden").addClass('alert-danger').html(request.responseJSON.message);
                // $(".informasi").effect( "shake", {  times: 2, distance: 7}, 800);

              }
            });
          });

          $('#btnupdateqytet').click(function(e) {
            e.preventDefault();
            $.ajax({
              type: "PUT",
              url: url + "/updqytet",
              data: {
                emri: $('#EmriQytetit').val(),
                id: $('#select-qytet').val()
              },
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                toastr.success('Qyteti u editua me sukses!');
                $('#modal-city').modal('hide');
              },

              error: function(request, textStatus, errorThrown) {
                // $(".informasi").removeClass("hidden").addClass('alert-danger').html(request.responseJSON.message);
                // $(".informasi").effect( "shake", {  times: 2, distance: 7}, 800);

              }
            });

          });

          function del_click(id) {
            $('#modal-del').modal('show');
            delid = id;
          }
        </script>

        <div class="modal fade" id="modal-del">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Pasivizo Përdoruesin</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <p>Deshironi ta pasivizoni Përdoruesin?</p>
              </div>
              <div class="modal-footer justify-content-between">
                <button type="button" class="btn btn-default" data-dismiss="modal">Jo</button>
                <button type="button" id="btndelete" onclick="" class="btn btn-success">Po</button>
              </div>
            </div>
          </div>
        </div>
        <script>
          $("#btndelete").click(function() {
            var ajax = {
              id: delid,
              veprimi: 'delete',
            }
            $.ajax({
              type: "POST",
              url: url + "/perdoruesi",
              data: ajax,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                location.reload();


              },
              error: function(request, textStatus, errorThrown) {

              }
            });
          });
        </script>
        <!-- END of modal for deleting User -->
        <!-- Modal of Adding Klient Client CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT -->
        <div class="modal fade" id="modal-klient">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <!--  <h4 class="modal-title">Shto Klient</h4> -->

                <button class="btn btn-success" id="shtoklient" onclick="trigershtoklient()" style="display: block;">
                  <i class="material-icons">add</i> Shto Klient
                </button>

                <button class="btn btn-warning" id="editoklient" onclick="trigereditoklient()" style="display: none;">
                  <i class="material-icons">arrow_back</i> Edito Klient
                </button>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>

              <div class="modal-body">
                <div class="input-group mb-12" id="getClienthide">
                  <label class="col-sm-3 col-md-3 control-label">Kërko institucionin</label>
                  <div class="col-sm-8 col-md-8" id="getClient">
                    <script>
                      function getClient() {
                        $.ajax({
                          url: url + "/klienti",
                          headers: {
                            'api_token': token
                          },
                          data: {
                            emriinstitutit: ' ',
                            nrbiznesit: ' ',
                            veprimi: 'select',
                            id: 0
                          },
                          success: function(data, status) {
                            y = "<select  id=\"select-klient\" class=\"form-control selectized select2\" autocomplete=\"off\" tabindex=\"-1\">";
                            y += "<option value=\"\" selected=\"selected\">-Zgjedh Institutin-</option>";

                            for (i = 0; i < data.length; i++) {
                              y += '<option value="' + data[i].id + '">' + data[i].emri_institutit + '</option> ';
                            }
                            document.getElementById("getClient").innerHTML = y;
                            //   $('#select-klient').select2({
                            //     width: '100%',
                            //     language: {
                            //     noResults: function (params) {
                            //       return "Nuk ka të dhëna me këtë emer";
                            //     }
                            //     }
                            // });
                            $("#select-klient").change(function() {
                              $.ajax({
                                url: url + "/klienti",
                                headers: {
                                  'api_token': token
                                },
                                data: {
                                  emriinstitutit: ' ',
                                  nrbiznesit: ' ',
                                  veprimi: 'select1',
                                  id: $('#select-klient').val(),
                                },
                                success: function(data, status) {

                                  $('#ClientName').val(data[0].emri_institutit);
                                  $('#nrBiznesit').val(data[0].numri_biznesit);
                                  $('#select-qytet-biznes').val(data[0].qyteti);
                                  $('#select-qytet-biznes').trigger('change');
                                  $('#adresa_biznesit').val(data[0].adressa);
                                  $('#emailklient').val(data[0].email);
                                  $('#nr_fiskal').val(data[0].nr_fiskal);

                                }
                              });
                            });
                          }
                        });

                      }

                      getClient();

                      function trigershtoklient() {
                        $('#getClienthide').hide();
                        $('#btninsert').show();
                        $('#btnupdate').hide();
                        $('#editoklient').show();
                        $('#shtoklient').hide();
                        $('#shtoklri').show();
                        $('#idekl').show();
                        $('#ClientName').val('');
                        $('#nrBiznesit').val('');
                        $('#select-qytet-biznes').val('');
                        $('#select-qytet-biznes').trigger('change');
                        $('#adresa_biznesit').val('');
                        $('#nr_fiskal').val('');

                      }

                      function trigereditoklient() {
                        $('#getClienthide').show();
                        $('#btninsert').hide();
                        $('#btnupdate').show();
                        $('#shtoklient').show();
                        $('#shtoklri').hide();
                        $('#idekl').hide();
                        $('#editoklient').hide();
                        $('#ClientName').val('');
                        $('#nrBiznesit').val('');
                        $('#select-qytet-biznes').val('');
                        $('#select-qytet-biznes').trigger('change');
                        $('#adresa_biznesit').val('');
                        $('#nr_fiskal').val('');

                      }
                    </script>
                  </div>
                </div>

                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Emri i Institucionit</label>
                  <div class="col-sm-8 col-md-8">
                    <input class="form-control InputToUpper text-box single-line" data-val="true" data-val-required="Emri është i detyrueshëm *" id="ClientName" name="ClientName" placeholder="Emri Klientit" type="text" value="">
                    <span class="field-validation-valid text-danger" data-valmsg-for="ClientName" data-valmsg-replace="true"></span>
                  </div>
                </div>
                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Numri Biznesit</label>
                  <div class="col-sm-8 col-md-8">
                    <input type="text" class="form-control" id="nrBiznesit" name="BussinesNumber" placeholder="Numri i biznesit">
                  </div>
                </div>
                <!-- i shtova -->
                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Numri fiskal</label>
                  <div class="col-sm-8 col-md-8">
                    <input type="text" class="form-control" id="nr_fiskal" name="nr_fiskal" placeholder="Numri fiskal">
                  </div>
                </div>
                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Adresa Biznesit</label>
                  <div class="col-sm-8 col-md-8">
                    <input type="text" class="form-control" id="adresa_biznesit" name="adresa_biznesit" placeholder="Adresa e biznesit">
                  </div>
                </div>
                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Email</label>
                  <div class="col-sm-8 col-md-8">
                    <input type="text" class="form-control" id="emailklient" name="emailklient" placeholder="Email biznesit">
                  </div>
                </div>
                <!-- enfd -->
                <div class="input-group mb-12">
                  <label class="col-sm-3 col-md-3 control-label">Qyteti Biznesit</label>
                  <div class="col-sm-8 col-md-8" id="qytetibiznisit">
                    <script>
                      $(document).ready(function() {


                        $.ajax({
                          type: "GET",
                          url: url + "/getqytet",
                          headers: {
                            'api_token': token
                          },
                          // start success
                          success: function(data, status) {
                            y = "<select  id=\"select-qytet-biznes\" class=\"form-control selectized \" style=\"width:100%;\" autocomplete=\"off\" tabindex=\"-1\">";
                            y += "<option value=\"\">-Zgjedh Qytetin-</option>";

                            for (i = 0; i < data.length; i++) {
                              y += '<option value="' + data[i].id + '">' + data[i].emri_qytetit + '</option>';
                            }
                            y += "</select>";
                            $('#qytetibiznisit').empty();
                            $('#qytetibiznisit').append(y);
                            // document.getElementById("").innerHTML = y;
                            $('#select-qytet-biznes').select2({
                              dropdownParent: $('#modal-klient')
                            });
                          } // success end
                        });
                      });
                    </script>
                  </div>
                </div>
                <!-- va  -->
                <div id="shtoklri" style="display: none;">
                  <!-- <div class="input-group mb-12 edit">
                            <label class="col-sm-3 col-md-3 control-label">Emri</label>
                            <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="bName" name="bName" placeholder="Emri" type="text" value="">
                            </div>
                        </div>
                        
                        <div class="input-group mb-12 edit">
                            <label class="col-sm-3 col-md-3 control-label">Mbiemri</label>
                            <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="bLastName" name="bLastname" placeholder="Mbiemri" type="text" value="">
                            </div>
                            
                        </div> -->
                  <div class="input-group mb-12 edit">
                    <label class="col-sm-3 col-md-3 control-label">Përdoruesi</label>
                    <div class="col-sm-9 col-md-9">
                      <input class="form-control InputToUpper text-box single-line" data-val="true" id="bperdoruesi" name="bperdoruesi" placeholder="Përdoruesi" type="text" value="">
                    </div>
                  </div>
            

                  <div class="input-group mb-12 edit">
                    <label class="col-sm-3 col-md-3 control-label">Fjalëkalimi</label>
                    <div class="col-sm-9 col-md-9">
                      <input class="form-control text-box single-line" data-val="true" id="bFjalekalimi" name="bFjalekalimi" type="password" value="" placeholder="Fjalëkalimi">
                    </div>
                  </div>

                  <div class="input-group mb-12 edit">
                    <label class="col-sm-3 col-md-3 control-label">Email</label>
                    <div class="col-sm-9 col-md-9">
                      <input class="form-control InputToUpper text-box single-line" data-val="true" id="bemail" name="bemail" placeholder="Email" type="text" value="">
                    </div>
                  </div>
                  <!-- <div class="input-group mb-12 edit">
                        <label class="col-sm-3 col-md-3 control-label">Gjinia</label>
                                <div id="gen" class="col-sm-4">
                                    <input type="radio" name="bGender" id="bGender1" value="Mashkull"> Mashkull<br>
                                </div>
                                <div class="col-sm-4">
                                    <input type="radio" name="bGender" id="bGender"  value="Femer">Femër<br />
                                </div>
                        </div>
                       
                        <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Data e Lindjes</label>
                              <div class="col-sm-9 col-md-9">
                                  <input type="date" class="form-control" id="bBirthDate" placeholder="Data lindjes"  value="" >
                              </div>
                        </div> -->
                  <div class="input-group mb-12 edit">
                    <label class="col-sm-3 col-md-3 control-label">Numri kontaktues</label>
                    <div class="col-sm-9 col-md-9">
                      <input class="form-control text-box single-line" data-val="true" id="bTel" name="bTel" placeholder="Numri kontaktues" type="text" value="">
                    </div>
                  </div>




                  <div class="input-group mb-12 edit" id="getCityhide">
                    <label class="col-sm-3 col-md-3 control-label">Pozita </label>
                    <div class="col-sm-9 col-md-9" id="bZgjedhpoziten">
                      <script>
                        function bZgjedhpoziten() {
                          $.ajax({
                            url: url + "/pozitat",
                            headers: {
                              'api_token': token
                            },
                            data: {
                              veprimi: 'select',
                              id_pozites: '<?php echo $_SESSION['_session']['roli']; ?>',

                            },
                            // start success
                            success: function(data, status) {
                              y = "<select  id=\"select-roli-klient\" class=\"form-control selectized \" autocomplete=\"off\" tabindex=\"-1\" disabled>";
                              y += "<option value=\"\" selected=\"selected\">-Zgjedh Pozitën-</option>";

                              for (i = 0; i < data.length; i++) {
                                y += '<option value="' + data[i].id + '">' + data[i].pozitat + '</option> ';
                              }
                              y += "</select>";
                              document.getElementById("bZgjedhpoziten").innerHTML = y;
                              $('#select-roli-klient').select2({
                                width: '100%',
                                language: {
                                  noResults: function(params) {
                                    return "Nuk ka të dhëna me këtë emer";
                                  }
                                },
                                dropdownParent: $("#modal-klient")
                              });

                              $('#select-roli-klient').val(3);
                              $('#select-roli-klient').trigger('change');
                            } // success end



                          });

                        }
                        $(function() {
                          bZgjedhpoziten();
                        });
                      </script>
                    </div>
                  </div>
                </div>
              </div>
              <div class="modal-footer">
                <div class="col-12">
                  <div class="row">
                    <div class="col-12 ">
                      <p id="errorishtoklient" class="hidden" style="color: red; font-weight: 500"></p>
                    </div>
                    <div class="col-12" style="text-align-last: justify;">
                      <button type="button" class="btn btn-default" data-dismiss="modal">Anulo</button>
                      <button type="button" id="btninsert" class="btn btn-success" style="display: none;">Shto</button>
                      <button type="button" id="btnupdate" class="btn btn-success">Ndrysho</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- END of modal for Adding Klient Client CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT  CREATE CLIENT -->

        <!-- Modal of Giving Roles for User POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA  POZITA-->
        <div class="modal fade" id="modal-pozita">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">

                <button class="btn btn-success" id="shtoPozite" onclick="trigershtoPozite()" style="display: block;">
                  <i class="material-icons">add</i> Shto Pozitë
                </button>

                <button class="btn btn-warning" id="editoPozite" onclick="trigereditoPozite()" style="display: none;">
                  <i class="material-icons">arrow_back</i> Edito Pozitë
                </button>
                <!-- <h4 class="modal-title">Cakto kufizime/lejime për përdorim të sistemit</h4> -->
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <div class="input-group mb-12 edit" id="getPozita">

                  <div class="col-sm-12 col-md-12" id="pozita_edit">
                    <script>
                      editpoz = 0;

                      function pozita_edit() {
                        $.ajax({
                          url: url + "/pozitat",
                          headers: {
                            'api_token': token
                          },
                          data: {
                            veprimi: 'select',
                            id_pozites: '<?php echo $_SESSION['_session']['roli']; ?>',

                          },
                          // start success
                          success: function(data, status) {
                            y = "<select  id=\"select-roli-edit\" class=\"form-control selectized select2\" autocomplete=\"off\" tabindex=\"-1\">";
                            y += "<option value=\"\" selected=\"selected\">-Zgjedh Pozitën-</option>";

                            for (i = 0; i < data.length; i++) {
                              y += '<option value="' + data[i].id + '">' + data[i].pozitat + '</option> ';
                            }
                            document.getElementById("pozita_edit").innerHTML = y;

                          } // success end



                        });

                      }
                      pozita_edit();

                      function trigershtoPozite() {
                        $('#getPozita').hide();
                        $('#btnnewrol').show();
                        $('#btn_edit').hide();
                        $('#editoPozite').show();
                        $('#shtoPozite').hide();
                        $('#emrrolit').show();
                        $('.editpoz').each(function(index, element) {
                          $(this).prop('checked', false);

                        });

                      }

                      function trigereditoPozite() {
                        $('#getPozita').show();
                        $('#btnnewrol').hide();
                        $('#btn_edit').show();
                        $('#shtoPozite').show();
                        $('#editoPozite').hide();
                        $('#emrrolit').hide();
                        $('#select-roli-edit').val('');
                        $('#select-roli-edit').trigger('change');

                      }
                    </script>
                  </div>
                </div>
                <div id="perminfo"></div>
                <!-- sTART -->
                <div class="col-sm-12 col-md-12">
                  <input class="form-control text-box single-line" placeholder="Emri i pozites" id="emrrolit" type="text" style="display: none" value="">

                </div>
                <div class="col">
                  <div class="row">
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Dashboard1">
                        <input type="checkbox" class="form-check-input editpoz" id="Dashboard1">
                        <label class="form-check-label" for="Dashboard1">Dashboard</label>
                      </div>
                      <div id="form-Profili_im1">
                        <input type="checkbox" class="form-check-input editpoz" id="Profili_im1">
                        <label class="form-check-label" for="Profili_im1">Profili im</label>
                      </div>
                      <div id="form-kerkesat_mine1">
                        <input type="checkbox" class="form-check-input editpoz" id="kerkesat_mine1">
                        <label class="form-check-label" for="kerkesat_mine1">Kerkesat e mia</label>
                      </div>
                      <div id="form-parashtro_kerkese_servisi1">
                        <input type="checkbox" class="form-check-input editpoz" id="parashtro_kerkese_servisi1">
                        <label class="form-check-label" for="parashtro_kerkese_servisi1">Parashtro Kerkes Servisi</label>
                      </div>
                      <div id="form-Harta1">
                        <input type="checkbox" class="form-check-input editpoz" id="Harta1">
                        <label class="form-check-label" for="Harta1">Harta</label>
                      </div>
                      <div id="form-GjithaKerkesatKlienteve1">
                        <input type="checkbox" class="form-check-input editpoz" id="GjithaKerkesatKlienteve1">
                        <label class="form-check-label" for="GjithaKerkesatKlienteve1">Gjitha Kerkesat Klienteve</label>
                      </div>
                      <div id="form-Kerkesat_Npritje1">
                        <input type="checkbox" class="form-check-input editpoz" id="Kerkesat_Npritje1">
                        <label class="form-check-label" for="Kerkesat_Npritje1">Kerkesat ne pritje</label>
                      </div>
                      <div id="form-Kerkesat_Nprocesim1">
                        <input type="checkbox" class="form-check-input editpoz" id="Kerkesat_Nprocesim1">
                        <label class="form-check-label" for="Kerkesat_Nprocesim1">Kerkesat ne procesim</label>
                      </div>
                      <div id="form-Kerkesat_Perfunduara1">
                        <input type="checkbox" class="form-check-input editpoz" id="Kerkesat_Perfunduara1">
                        <label class="form-check-label" for="Kerkesat_Perfunduara1">Kerkesat Perfunduara</label>
                      </div>
                      <div id="form-GjithPerdoruesit1">
                        <input type="checkbox" class="form-check-input editpoz" id="GjithPerdoruesit1">
                        <label class="form-check-label" for="GjithPerdoruesit1">Gjith Perdoruesit</label>
                      </div>
                      <div id="form-Personeli1">
                        <input type="checkbox" class="form-check-input editpoz" id="Personeli1">
                        <label class="form-check-label" for="Personeli1">Personeli im</label>
                      </div>
                      <!-- perfundpn divi -->
                    </div>
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Shto_perdorues1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shto_perdorues1">
                        <label class="form-check-label" for="Shto_perdorues1">Shto perdorues</label>
                      </div>
                      <div id="form-Shiko_perdorues1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shiko_perdorues1">
                        <label class="form-check-label" for="Shiko_perdorues1">Shiko perdorues</label>
                      </div>
                      <div id="form-edito_perdorues1">
                        <input type="checkbox" class="form-check-input editpoz" id="edito_perdorues1">
                        <label class="form-check-label" for="edito_perdorues1">Edito perdorues</label>
                      </div>
                      <div id="form-fshij_perdorues1">
                        <input type="checkbox" class="form-check-input editpoz" id="fshij_perdorues1">
                        <label class="form-check-label" for="fshij_perdorues1">Fshij Perdorues</label>
                      </div>
                      <div id="form-cakto_role1">
                        <input type="checkbox" class="form-check-input editpoz" id="cakto_role1">
                        <label class="form-check-label" for="cakto_role1">Cakto Role</label>
                      </div>
                      <div id="form-Klientet1">
                        <input type="checkbox" class="form-check-input editpoz" id="Klientet1">
                        <label class="form-check-label" for="Klientet1">Klientët</label>
                      </div>
                      <div id="form-Klientet_Npritje1">
                        <input type="checkbox" class="form-check-input editpoz" id="Klientet_Npritje1">
                        <label class="form-check-label" for="Klientet_Npritje1">Klientët pritje</label>
                      </div>
                      <div id="form-Kerkesat_Anuluara1">
                        <input type="checkbox" class="form-check-input editpoz" id="Kerkesat_Anuluara1">
                        <label class="form-check-label" for="Kerkesat_Anuluara1">Kërkesat e Anuluara </label>
                      </div>


                      <div id="form-kerkesat_my_institut1">
                        <input type="checkbox" class="form-check-input editpoz" id="kerkesat_my_institut1">
                        <label class="form-check-label" for="kerkesat_my_institut1">Kërkesat e Institutit tim</label>
                      </div>
                      <div id="form-Produktet_tona1">
                        <input type="checkbox" class="form-check-input editpoz" id="Produktet_tona1">
                        <label class="form-check-label" for="Produktet_tona1">Shfaq Brendet në Dashboard</label>
                      </div>
                      <div id="form-user_profile1">
                        <input type="checkbox" class="form-check-input editpoz" id="user_profile1">
                        <label class="form-check-label" for="user_profile1">Profili i përdoruesit</label>
                      </div>
                      <div id="form-Furnitoret1">
                        <input type="checkbox" class="form-check-input editpoz" id="Furnitoret1">
                        <label class="form-check-label" for="Furnitoret1">Firmat tona </label>
                      </div>
                      <!-- perfundon div -->
                    </div>
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Shiko_klient1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shiko_klient1">
                        <label class="form-check-label" for="Shiko_klient1">Shiko klient</label>
                      </div>
                      <div id="form-Edito_klient1">
                        <input type="checkbox" class="form-check-input editpoz" id="Edito_klient1">
                        <label class="form-check-label" for="Edito_klient1">Edito Klient</label>
                      </div>
                      <div id="form-Shto_klient1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shto_klient1">
                        <label class="form-check-label" for="Shto_klient1">Shto Klient</label>
                      </div>
                      <div id="form-Delete_klient1">
                        <input type="checkbox" class="form-check-input editpoz" id="Delete_klient1">
                        <label class="form-check-label" for="Delete_klient1">Fshij Klient</label>
                      </div>
                      <div id="form-Shiko_pozite1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shiko_pozite1">
                        <label class="form-check-label" for="Shiko_pozite1">Shiko pozitë</label>
                      </div>
                      <div id="form-Shto_pozite1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shto_pozite1">
                        <label class="form-check-label" for="Shto_pozite1">Shto pozitë</label>
                      </div>
                      <div id="form-Edito_pozite1">
                        <input type="checkbox" class="form-check-input editpoz" id="Edito_pozite1">
                        <label class="form-check-label" for="Edito_pozite1">Edito pozitë</label>
                      </div>
                      <div id="form-Delete_pozite1">
                        <input type="checkbox" class="form-check-input editpoz" id="Delete_pozite1">
                        <label class="form-check-label" for="Delete_pozite1">Fshij pozitë</label>
                      </div>
                      <div id="form-Shiko_qytet1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shiko_qytet1">
                        <label class="form-check-label" for="Shiko_qytet1">Shiko qytet</label>
                      </div>
                      <div id="form-Shto_qytet1">
                        <input type="checkbox" class="form-check-input editpoz" id="Shto_qytet1">
                        <label class="form-check-label" for="Shto_qytet1">Shto qytet</label>
                      </div>
                      <div id="form-Edito_qytet1">
                        <input type="checkbox" class="form-check-input editpoz" id="Edito_qytet1">
                        <label class="form-check-label" for="Edito_qytet1">Edito qytet</label>
                      </div>
                      <div id="form-Delete_qytet1">
                        <input type="checkbox" class="form-check-input editpoz" id="Delete_qytet1">
                        <label class="form-check-label" for="Delete_qytet1">Fshij qytet</label>
                      </div>
                      <!-- /EXTRA 1  -->
                      <div id="form-GjithaPorositeKlientve1">
                        <input type="checkbox" class="form-check-input editpoz" id="GjithaPorositeKlientve1">
                        <label class="form-check-label" for="GjithaPorositeKlientve1">Porositë (SuperAdmin)</label>
                      </div>
                      <div id="form-Porosite_Npritje1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_Npritje1">
                        <label class="form-check-label" for="Porosite_Npritje1">Porositë në pritje</label>
                      </div>
                      <!--   <div id="form-Porosite_Nprocesim1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_Nprocesim1">
                        <label class="form-check-label" for="Porosite_Nprocesim1">Porositë procesim</label>
                      </div> -->
                      <div id="form-Porosite_Anuluara1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_Anuluara1">
                        <label class="form-check-label" for="Porosite_Anuluara1">Porositë Anuluara</label>
                      </div>
                      <div id="form-Porosite_Perfunduara1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_Perfunduara1">
                        <label class="form-check-label" for="Porosite_Perfunduara1">Porositë përfunduara</label>
                      </div>
                      <div id="form-Porosite_my_institut1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_my_institut1">
                        <label class="form-check-label" for="Porosite_my_institut1">Porositë e institutit</label>
                      </div>
                      <div id="form-Porosite_mine1">
                        <input type="checkbox" class="form-check-input editpoz" id="Porosite_mine1">
                        <label class="form-check-label" for="Porosite_mine1">Porositë e mia</label>
                      </div>
                      <div id="form-parashtro_porosi1">
                        <input type="checkbox" class="form-check-input editpoz" id="parashtro_porosi1">
                        <label class="form-check-label" for="parashtro_porosi1">Parashtro Porosi</label>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="modal-footer">
                <button type="button" id="btnnewrol" style="float:right; display: none" class="btn btn-success"><i class=""></i> Ruaj</button>
                <button type="button" id="btn_edit" style="float:right; display: block" class="btn btn-success"><i class=""></i> Edito</button>
              </div>
            </div>
          </div>
        </div>
        <!-- Modali per pozita end end end end  -->
        <script>
          $('body').on('change', '#select-roli-edit', function() {
            editpoz = this.value;
            $.ajax({
              url: url + "/getpozitaid",
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              data: {

                id: this.value
              },
              success: function(response, status) {
                // console.log(data);
                if (response.code == 200) {
                  $.each(response.data[0], function(key, value) {
                    console.log(key);
                    console.log(value);
                    if (!isNaN(value)) {
                      if (value==1) {
                        $('#' + key + '1').prop('checked', true);
                      }else{
                        $('#' + key + '1').prop('checked', false);

                      }
                     
                    }
                  
                  });
                }
              },
            });

          });

          $('#btn_edit').click(function(e) {
            e.preventDefault();
            Dashboard1 = $('#Dashboard1').is(':checked') ? 1 : 0;
            Profili_im1 = $('#Profili_im1').is(':checked') ? 1 : 0;
            kerkesat_mine1 = $('#kerkesat_mine1').is(':checked') ? 1 : 0;
            parashtro_kerkese_servisi1 = $('#parashtro_kerkese_servisi1').is(':checked') ? 1 : 0;
            Harta1 = $('#Harta1').is(':checked') ? 1 : 0;
            GjithaKerkesatKlienteve1 = $('#GjithaKerkesatKlienteve1').is(':checked') ? 1 : 0;
            Kerkesat_Npritje1 = $('#Kerkesat_Npritje1').is(':checked') ? 1 : 0;
            Kerkesat_Nprocesim1 = $('#Kerkesat_Nprocesim1').is(':checked') ? 1 : 0;
            Kerkesat_Perfunduara1 = $('#Kerkesat_Perfunduara1').is(':checked') ? 1 : 0;
            GjithPerdoruesit1 = $('#GjithPerdoruesit1').is(':checked') ? 1 : 0;
            Personeli1 = $('#Personeli1').is(':checked') ? 1 : 0;
            Shto_perdorues1 = $('#Shto_perdorues1').is(':checked') ? 1 : 0;
            Shiko_perdorues1 = $('#Shiko_perdorues1').is(':checked') ? 1 : 0;
            edito_perdorues1 = $('#edito_perdorues1').is(':checked') ? 1 : 0;
            fshij_perdorues1 = $('#fshij_perdorues1').is(':checked') ? 1 : 0;
            cakto_role1 = $('#cakto_role1').is(':checked') ? 1 : 0;
            Klientet1 = $('#Klientet1').is(':checked') ? 1 : 0;
            Klientet_Npritje1 = $('#Klientet_Npritje1').is(':checked') ? 1 : 0;
            Kerkesat_Anuluara1 = $('#Kerkesat_Anuluara1').is(':checked') ? 1 : 0;
            kerkesat_my_institut1 = $('#kerkesat_my_institut1').is(':checked') ? 1 : 0;
            Produktet_tona1 = $('#Produktet_tona1').is(':checked') ? 1 : 0;
            user_profile1 = $('#user_profile1').is(':checked') ? 1 : 0;
            Furnitoret1 = $('#Furnitoret1').is(':checked') ? 1 : 0;
            Shiko_klient1 = $('#Shiko_klient1').is(':checked') ? 1 : 0;
            Edito_klient1 = $('#Edito_klient1').is(':checked') ? 1 : 0;
            Shto_klient1 = $('#Shto_klient1').is(':checked') ? 1 : 0;
            Delete_klient1 = $('#Delete_klient1').is(':checked') ? 1 : 0;
            Shiko_pozite1 = $('#Shiko_pozite1').is(':checked') ? 1 : 0;
            Shto_pozite1 = $('#Shto_pozite1').is(':checked') ? 1 : 0;
            Edito_pozite1 = $('#Edito_pozite1').is(':checked') ? 1 : 0;
            Delete_pozite1 = $('#Delete_pozite1').is(':checked') ? 1 : 0;
            Shiko_qytet1 = $('#Shiko_qytet1').is(':checked') ? 1 : 0;
            Shto_qytet1 = $('#Shto_qytet1').is(':checked') ? 1 : 0;
            Edito_qytet1 = $('#Edito_qytet1').is(':checked') ? 1 : 0;
            Delete_qytet1 = $('#Delete_qytet1').is(':checked') ? 1 : 0;
            // extra
            GjithaPorositeKlientve1 = $('#GjithaPorositeKlientve1').is(':checked') ? 1 : 0;
            Porosite_Npritje1 = $('#Porosite_Npritje1').is(':checked') ? 1 : 0;

            Porosite_Nprocesim1 = $('#Porosite_Nprocesim1').is(':checked') ? 1 : 0;

            Porosite_Anuluara1 = $('#Porosite_Anuluara1').is(':checked') ? 1 : 0;

            Porosite_Perfunduara1 = $('#Porosite_Perfunduara1').is(':checked') ? 1 : 0;

            Porosite_my_institut1 = $('#Porosite_my_institut1').is(':checked') ? 1 : 0;

            Porosite_mine1 = $('#Porosite_mine1').is(':checked') ? 1 : 0;

            parashtro_porosi1 = $('#parashtro_porosi1').is(':checked') ? 1 : 0;

            var ajaxlejet = {

              statusi: 1,
              Dashboard: Dashboard1,
              Profili_im: Profili_im1,
              Harta: Harta1,
              kerkesat_mine: kerkesat_mine1,
              parashtro_kerkese_servisi: parashtro_kerkese_servisi1,
              GjithaKerkesatKlienteve: GjithaKerkesatKlienteve1,
              Kerkesat_Npritje: Kerkesat_Npritje1,
              Kerkesat_Nprocesim: Kerkesat_Nprocesim1,
              Kerkesat_Perfunduara: Kerkesat_Perfunduara1,
              GjithPerdoruesit: GjithPerdoruesit1,
              Personeli: Personeli1,
              Shto_perdorues: Shto_perdorues1,
              Shiko_perdorues: Shiko_perdorues1,
              edito_perdorues: edito_perdorues1,
              fshij_perdorues: fshij_perdorues1,
              cakto_role: cakto_role1,
              Klientet: Klientet1,
              Klientet_Npritje: Klientet_Npritje1,
              Kerkesat_Anuluara: Kerkesat_Anuluara1,
              kerkesat_my_institut: kerkesat_my_institut1,
              Produktet_tona: Produktet_tona1,
              user_profile: user_profile1,
              Furnitoret: Furnitoret1,
              Shiko_klient: Shiko_klient1,
              Edito_klient: Edito_klient1,
              Shto_klient: Shto_klient1,
              Delete_klient: Delete_klient1,
              Shiko_pozite: Shiko_pozite1,
              Shto_pozite: Shto_pozite1,
              Edito_pozite: Edito_pozite1,
              Delete_pozite: Delete_pozite1,
              Edito_qytet: Edito_qytet1,
              Shiko_qytet: Shiko_qytet1,
              Delete_qytet: Delete_qytet1,
              Shto_qytet: Shto_qytet1,
              GjithaPorositeKlientve: GjithaPorositeKlientve1,
              Porosite_Npritje: Porosite_Npritje1,
              Porosite_Nprocesim: Porosite_Nprocesim1,
              Porosite_Anuluara: Porosite_Anuluara1,
              Porosite_Perfunduara: Porosite_Perfunduara1,
              Porosite_my_institut: Porosite_my_institut1,
              Porosite_mine: Porosite_mine1,
              parashtro_porosi: parashtro_porosi1,
              id: editpoz,
            }
            $.ajax({
              url: url + "/updatepozita",
              type: "PUT",
              data: ajaxlejet,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                toastr.success('Pozita u editua  me sukses');
                $('#modal-pozita').modal('hide');
                $('#select-roli-edit').val('');
                $('#select-roli-edit').trigger('change');
                $('.editpoz').each(function(index, element) {
                  $(this).prop('checked', false);

                });

              }
            });



          });
        </script>
        <!-- Modal of Giving Roles for User ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES-->
        <div class="modal fade" id="modal-roles">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Cakto kufizime/lejime për përdorim të sistemit</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <div id="perminfo"></div>
                <!-- sTART -->
                <div class="col">
                  <div class="row">
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Dashboard">
                        <input type="checkbox" class="form-check-input" id="Dashboard">
                        <label class="form-check-label" for="Dashboard">Dashboard</label>
                      </div>
                      <div id="form-Profili_im">
                        <input type="checkbox" class="form-check-input" id="Profili_im">
                        <label class="form-check-label" for="Profili_im">Profili im</label>
                      </div>
                      <div id="form-kerkesat_mine">
                        <input type="checkbox" class="form-check-input" id="kerkesat_mine">
                        <label class="form-check-label" for="kerkesat_mine">Kerkesat e mia</label>
                      </div>
                      <div id="form-parashtro_kerkese_servisi">
                        <input type="checkbox" class="form-check-input" id="parashtro_kerkese_servisi">
                        <label class="form-check-label" for="parashtro_kerkese_servisi">Parashtro Kerkes Servisi</label>
                      </div>
                      <div id="form-Harta">
                        <input type="checkbox" class="form-check-input" id="Harta">
                        <label class="form-check-label" for="Harta">Harta</label>
                      </div>
                      <div id="form-GjithaKerkesatKlienteve">
                        <input type="checkbox" class="form-check-input" id="GjithaKerkesatKlienteve">
                        <label class="form-check-label" for="GjithaKerkesatKlienteve">Gjitha Kerkesat (SuperAdmin)</label>
                      </div>
                      <div id="form-Kerkesat_Npritje">
                        <input type="checkbox" class="form-check-input" id="Kerkesat_Npritje">
                        <label class="form-check-label" for="Kerkesat_Npritje">Kerkesat në pritje</label>
                      </div>
                      <div id="form-Kerkesat_Nprocesim">
                        <input type="checkbox" class="form-check-input" id="Kerkesat_Nprocesim">
                        <label class="form-check-label" for="Kerkesat_Nprocesim">Kerkesat në procesim</label>
                      </div>
                      <div id="form-Kerkesat_Perfunduara">
                        <input type="checkbox" class="form-check-input" id="Kerkesat_Perfunduara">
                        <label class="form-check-label" for="Kerkesat_Perfunduara">Kerkesat Përfunduara</label>
                      </div>
                      <div id="form-GjithPerdoruesit">
                        <input type="checkbox" class="form-check-input" id="GjithPerdoruesit">
                        <label class="form-check-label" for="GjithPerdoruesit">Gjith Perdoruesit</label>
                      </div>
                      <div id="form-Personeli">
                        <input type="checkbox" class="form-check-input" id="Personeli">
                        <label class="form-check-label" for="Personeli">Personeli im</label>
                      </div>
                      <!-- perfundpn divi -->
                    </div>
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Shto_perdorues">
                        <input type="checkbox" class="form-check-input" id="Shto_perdorues">
                        <label class="form-check-label" for="Shto_perdorues">Shto perdorues</label>
                      </div>
                      <div id="form-Shiko_perdorues">
                        <input type="checkbox" class="form-check-input" id="Shiko_perdorues">
                        <label class="form-check-label" for="Shiko_perdorues">Shiko perdorues</label>
                      </div>
                      <div id="form-edito_perdorues">
                        <input type="checkbox" class="form-check-input" id="edito_perdorues">
                        <label class="form-check-label" for="edito_perdorues">Edito perdorues</label>
                      </div>
                      <div id="form-fshij_perdorues">
                        <input type="checkbox" class="form-check-input" id="fshij_perdorues">
                        <label class="form-check-label" for="fshij_perdorues">Fshij Perdorues</label>
                      </div>
                      <div id="form-cakto_role">
                        <input type="checkbox" class="form-check-input" id="cakto_role">
                        <label class="form-check-label" for="cakto_role">Cakto Role</label>
                      </div>
                      <div id="form-Klientet">
                        <input type="checkbox" class="form-check-input" id="Klientet">
                        <label class="form-check-label" for="Klientet">Klientët</label>
                      </div>
                      <div id="form-Klientet_Npritje">
                        <input type="checkbox" class="form-check-input" id="Klientet_Npritje">
                        <label class="form-check-label" for="Klientet_Npritje">Klientët pritje</label>
                      </div>
                      <div id="form-Kerkesat_Anuluara">
                        <input type="checkbox" class="form-check-input" id="Kerkesat_Anuluara">
                        <label class="form-check-label" for="Kerkesat_Anuluara">Kërkesat e Anuluara </label>
                      </div>


                      <div id="form-kerkesat_my_institut">
                        <input type="checkbox" class="form-check-input" id="kerkesat_my_institut">
                        <label class="form-check-label" for="kerkesat_my_institut">Kërkesat e Institutit tim</label>
                      </div>
                      <div id="form-Produktet_tona">
                        <input type="checkbox" class="form-check-input" id="Produktet_tona">
                        <label class="form-check-label" for="Produktet_tona">Shfaq Brendet në Dashboard</label>
                      </div>
                      <div id="form-user_profile">
                        <input type="checkbox" class="form-check-input" id="user_profile">
                        <label class="form-check-label" for="user_profile">Profili i përdoruesit</label>
                      </div>
                      <div id="form-Furnitoret">
                        <input type="checkbox" class="form-check-input" id="Furnitoret">
                        <label class="form-check-label" for="Furnitoret">Firmat tona </label>
                      </div>
                      <!-- perfundon div -->
                    </div>
                    <div class="col-lg-4 col-sm-12">
                      <div id="form-Shiko_klient">
                        <input type="checkbox" class="form-check-input" id="Shiko_klient">
                        <label class="form-check-label" for="Shiko_klient">Shiko klient</label>
                      </div>
                      <div id="form-Edito_klient">
                        <input type="checkbox" class="form-check-input" id="Edito_klient">
                        <label class="form-check-label" for="Edito_klient">Edito Klient</label>
                      </div>
                      <div id="form-Shto_klient">
                        <input type="checkbox" class="form-check-input" id="Shto_klient">
                        <label class="form-check-label" for="Shto_klient">Shto Klient</label>
                      </div>
                      <div id="form-Delete_klient">
                        <input type="checkbox" class="form-check-input" id="Delete_klient">
                        <label class="form-check-label" for="Delete_klient">Fshij Klient</label>
                      </div>
                      <div id="form-Shiko_pozite">
                        <input type="checkbox" class="form-check-input" id="Shiko_pozite">
                        <label class="form-check-label" for="Shiko_pozite">Shiko pozitë</label>
                      </div>
                      <div id="form-Shto_pozite">
                        <input type="checkbox" class="form-check-input" id="Shto_pozite">
                        <label class="form-check-label" for="Shto_pozite">Shto pozitë</label>
                      </div>
                      <div id="form-Edito_pozite">
                        <input type="checkbox" class="form-check-input" id="Edito_pozite">
                        <label class="form-check-label" for="Edito_pozite">Edito pozitë</label>
                      </div>
                      <div id="form-Delete_pozite">
                        <input type="checkbox" class="form-check-input" id="Delete_pozite">
                        <label class="form-check-label" for="Delete_pozite">Fshij pozitë</label>
                      </div>
                      <div id="form-Shiko_qytet">
                        <input type="checkbox" class="form-check-input" id="Shiko_qytet">
                        <label class="form-check-label" for="Shiko_qytet">Shiko qytet</label>
                      </div>
                      <div id="form-Shto_qytet">
                        <input type="checkbox" class="form-check-input" id="Shto_qytet">
                        <label class="form-check-label" for="Shto_qytet">Shto qytet</label>
                      </div>
                      <div id="form-Edito_qytet">
                        <input type="checkbox" class="form-check-input" id="Edito_qytet">
                        <label class="form-check-label" for="Edito_qytet">Edito qytet</label>
                      </div>
                      <div id="form-Delete_qytet">
                        <input type="checkbox" class="form-check-input" id="Delete_qytet">
                        <label class="form-check-label" for="Delete_qytet">Fshij qytet</label>
                      </div>

                      <!-- extra -->
                      <div id="form-GjithaPorositeKlientve">
                        <input type="checkbox" class="form-check-input" id="GjithaPorositeKlientve">
                        <label class="form-check-label" for="GjithaPorositeKlientve">Gjitha Porositë (SuperAdmin)</label>
                      </div>
                      <div id="form-Porosite_Npritje">
                        <input type="checkbox" class="form-check-input" id="Porosite_Npritje">
                        <label class="form-check-label" for="Porosite_Npritje">Porositë në pritje</label>
                      </div>
                      <!--  <div id="form-Porosite_Nprocesim">
                        <input type="checkbox" class="form-check-input" id="Porosite_Nprocesim">
                        <label class="form-check-label" for="Porosite_Nprocesim">Porositë në procesim</label>
                      </div> -->
                      <div id="form-Porosite_Anuluara">
                        <input type="checkbox" class="form-check-input" id="Porosite_Anuluara">
                        <label class="form-check-label" for="Porosite_Anuluara">Porositë qytet</label>
                      </div>
                      <div id="form-Porosite_Perfunduara">
                        <input type="checkbox" class="form-check-input" id="Porosite_Perfunduara">
                        <label class="form-check-label" for="Porosite_Perfunduara">Porositë e përfunduara</label>
                      </div>
                      <div id="form-Porosite_my_institut">
                        <input type="checkbox" class="form-check-input" id="Porosite_my_institut">
                        <label class="form-check-label" for="Porosite_my_institut">Porositë për institut</label>
                      </div>
                      <div id="form-Porosite_mine">
                        <input type="checkbox" class="form-check-input" id="Porosite_mine">
                        <label class="form-check-label" for="Porosite_mine">Porositë e mia</label>
                      </div>
                      <div id="form-parashtro_porosi">
                        <input type="checkbox" class="form-check-input" id="parashtro_porosi">
                        <label class="form-check-label" for="parashtro_porosi">Parashtro Porosi</label>
                      </div>

                    </div>
                  </div>
                </div>
              </div>
              <div class="modal-footer"><button type="button" id="btnUplejet" style="float:right;" class="btn btn-success"><i class=""></i> Ruaj</button></div>
            </div>
          </div>
        </div>
        <!-- End of modal of Giving Roles for User ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES  ROLES -->
        <script>
          function updatelejet(userid) {
            $.ajax({
              url: url + "/getlejet/" + userid,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, status) {
                if (data[0].Dashboard == 1) {
                  $("#Dashboard").prop("checked", true);
                } else {
                  $("#Dashboard").prop("checked", false);
                }
                if (data[0].Profili_im == 1) {
                  $("#Profili_im").prop("checked", true);
                } else {
                  $("#Profili_im").prop("checked", false);
                }
                if (data[0].Harta == 1) {
                  $("#Harta").prop("checked", true);
                } else {
                  $("#Harta").prop("checked", false);
                }
                if (data[0].kerkesat_mine == 1) {
                  $("#kerkesat_mine").prop("checked", true);
                } else {
                  $("#kerkesat_mine").prop("checked", false);
                }
                if (data[0].parashtro_kerkese_servisi == 1) {
                  $("#parashtro_kerkese_servisi").prop("checked", true);
                } else {
                  $("#parashtro_kerkese_servisi").prop("checked", false);
                }
                if (data[0].GjithaKerkesatKlienteve == 1) {
                  $("#GjithaKerkesatKlienteve").prop("checked", true);
                } else {
                  $("#GjithaKerkesatKlienteve").prop("checked", false);
                }
                if (data[0].Kerkesat_Npritje == 1) {
                  $("#Kerkesat_Npritje").prop("checked", true);
                } else {
                  $("#Kerkesat_Npritje").prop("checked", false);
                }
                if (data[0].Kerkesat_Nprocesim == 1) {
                  $("#Kerkesat_Nprocesim").prop("checked", true);
                } else {
                  $("#Kerkesat_Nprocesim").prop("checked", false);
                }
                if (data[0].Kerkesat_Perfunduara == 1) {
                  $("#Kerkesat_Perfunduara").prop("checked", true);
                } else {
                  $("#Kerkesat_Perfunduara").prop("checked", false);
                }

                if (data[0].GjithPerdoruesit == 1) {
                  $("#GjithPerdoruesit").prop("checked", true);
                } else {
                  $("#GjithPerdoruesit").prop("checked", false);
                }
                if (data[0].Personeli == 1) {
                  $("#Personeli").prop("checked", true);
                } else {
                  $("#Personeli").prop("checked", false);
                }
                if (data[0].Shto_perdorues == 1) {
                  $("#Shto_perdorues").prop("checked", true);
                } else {
                  $("#Shto_perdorues").prop("checked", false);
                }
                if (data[0].Shiko_perdorues == 1) {
                  $("#Shiko_perdorues").prop("checked", true);
                }
                if (data[0].edito_perdorues == 1) {
                  $("#edito_perdorues").prop("checked", true);
                } else {
                  $("#edito_perdorues").prop("checked", false);
                }
                if (data[0].fshij_perdorues == 1) {
                  $("#fshij_perdorues").prop("checked", true);
                } else {
                  $("#fshij_perdorues").prop("checked", false);
                }

                if (data[0].cakto_role == 1) {
                  $("#cakto_role").prop("checked", true);
                } else {
                  $("#cakto_role").prop("checked", false);
                }
                if (data[0].Klientet == 1) {
                  $("#Klientet").prop("checked", true);
                }
                if (data[0].Klientet_Npritje == 1) {
                  $("#Klientet_Npritje").prop("checked", true);
                } else {
                  $("#Klientet_Npritje").prop("checked", false);
                }
                if (data[0].Kerkesat_Anuluara == 1) {
                  $("#Kerkesat_Anuluara").prop("checked", true);
                } else {
                  $("#Kerkesat_Anuluara").prop("checked", false);
                }
                if (data[0].kerkesat_my_institut == 1) {
                  $("#kerkesat_my_institut").prop("checked", true);
                } else {
                  $("#kerkesat_my_institut").prop("checked", false);
                }
                if (data[0].Produktet_tona == 1) {
                  $("#Produktet_tona").prop("checked", true);
                }
                if (data[0].user_profile == 1) {
                  $("#user_profile").prop("checked", true);
                } else {
                  $("#user_profile").prop("checked", false);
                }
                if (data[0].Furnitoret == 1) {
                  $("#Furnitoret").prop("checked", true);
                } else {
                  $("#Furnitoret").prop("checked", false);
                }
                if (data[0].Shiko_klient == 1) {
                  $("#Shiko_klient").prop("checked", true);
                }
                if (data[0].Edito_klient == 1) {
                  $("#Edito_klient").prop("checked", true);
                }
                if (data[0].Shto_klient == 1) {
                  $("#Shto_klient").prop("checked", true);
                }
                if (data[0].Delete_klient == 1) {
                  $("#Delete_klient").prop("checked", true);
                }
                if (data[0].Shiko_pozite == 1) {
                  $("#Shiko_pozite").prop("checked", true);
                } else {
                  $("#Shiko_pozite").prop("checked", false);
                }
                if (data[0].Shto_pozite == 1) {
                  $("#Shto_pozite").prop("checked", true);
                } else {
                  $("#Shto_pozite").prop("checked", false);
                }
                if (data[0].Edito_pozite == 1) {
                  $("#Edito_pozite").prop("checked", true);
                } else {
                  $("#Edito_pozite").prop("checked", false);
                }
                if (data[0].Delete_pozite == 1) {
                  $("#Delete_pozite").prop("checked", true);
                } else {
                  $("#Delete_pozite").prop("checked", false);
                }
                if (data[0].Edito_qytet == 1) {
                  $("#Edito_qytet").prop("checked", true);
                } else {
                  $("#Edito_qytet").prop("checked", false);
                }

                if (data[0].Shiko_qytet == 1) {
                  $("#Shiko_qytet").prop("checked", true);
                } else {
                  $("#Shiko_qytet").prop("checked", false);
                }
                if (data[0].Delete_qytet == 1) {
                  $("#Delete_qytet").prop("checked", true);
                } else {
                  $("#Delete_qytet").prop("checked", false);
                }
                if (data[0].Shto_qytet == 1) {
                  $("#Shto_qytet").prop("checked", true);
                } else {
                  $("#Shto_qytet").prop("checked", false);
                }
                // extraa 
                if (data[0].GjithaPorositeKlientve == 1) {
                  $("#GjithaPorositeKlientve").prop("checked", true);
                } else {
                  $("#GjithaPorositeKlientve").prop("checked", false);
                }
                if (data[0].Porosite_Npritje == 1) {
                  $("#Porosite_Npritje").prop("checked", true);
                } else {
                  $("#Porosite_Npritje").prop("checked", false);
                }
                if (data[0].Porosite_Nprocesim == 1) {
                  $("#Porosite_Nprocesim").prop("checked", true);
                } else {
                  $("#Porosite_Nprocesim").prop("checked", false);
                }
                if (data[0].Porosite_Anuluara == 1) {
                  $("#Porosite_Anuluara").prop("checked", true);
                } else {
                  $("#Porosite_Anuluara").prop("checked", false);
                }
                if (data[0].Porosite_Perfunduara == 1) {
                  $("#Porosite_Perfunduara").prop("checked", true);
                } else {
                  $("#Porosite_Perfunduara").prop("checked", false);
                }
                if (data[0].Porosite_my_institut == 1) {
                  $("#Porosite_my_institut").prop("checked", true);
                } else {
                  $("#Porosite_my_institut").prop("checked", false);
                }
                if (data[0].Porosite_mine == 1) {
                  $("#Porosite_mine").prop("checked", true);
                } else {
                  $("#Porosite_mine").prop("checked", false);
                }
                if (data[0].parashtro_porosi == 1) {
                  $("#parashtro_porosi").prop("checked", true);
                } else {
                  $("#parashtro_porosi").prop("checked", false);
                }


                $('#modal-roles').modal('toggle');
              }
            });

            $("#btnUplejet").click(function() {
              if ($('#Dashboard').is(':checked')) {
                Dashboard = 1;
              } else {
                Dashboard = 0
              }
              if ($('#Profili_im').is(':checked')) {
                Profili_im = 1;
              } else {
                Profili_im = 0
              }
              if ($('#kerkesat_mine').is(':checked')) {
                kerkesat_mine = 1;
              } else {
                kerkesat_mine = 0
              }
              if ($('#parashtro_kerkese_servisi').is(':checked')) {
                parashtro_kerkese_servisi = 1;
              } else {
                parashtro_kerkese_servisi = 0
              }
              if ($('#Harta').is(':checked')) {
                Harta = 1;
              } else {
                Harta = 0
              }
              if ($('#GjithaKerkesatKlienteve').is(':checked')) {
                GjithaKerkesatKlienteve = 1;
              } else {
                GjithaKerkesatKlienteve = 0
              }
              if ($('#Kerkesat_Npritje').is(':checked')) {
                Kerkesat_Npritje = 1;
              } else {
                Kerkesat_Npritje = 0
              }
              if ($('#Kerkesat_Nprocesim').is(':checked')) {
                Kerkesat_Nprocesim = 1;
              } else {
                Kerkesat_Nprocesim = 0
              }
              if ($('#Kerkesat_Perfunduara').is(':checked')) {
                Kerkesat_Perfunduara = 1;
              } else {
                Kerkesat_Perfunduara = 0
              }
              if ($('#GjithPerdoruesit').is(':checked')) {
                GjithPerdoruesit = 1;
              } else {
                GjithPerdoruesit = 0
              }
              if ($('#Personeli').is(':checked')) {
                Personeli = 1;
              } else {
                Personeli = 0
              }
              if ($('#Shto_perdorues').is(':checked')) {
                Shto_perdorues = 1;
              } else {
                Shto_perdorues = 0
              }
              if ($('#Shiko_perdorues').is(':checked')) {
                Shiko_perdorues = 1;
              } else {
                Shiko_perdorues = 0
              }
              if ($('#edito_perdorues').is(':checked')) {
                edito_perdorues = 1;
              } else {
                edito_perdorues = 0
              }
              if ($('#fshij_perdorues').is(':checked')) {
                fshij_perdorues = 1;
              } else {
                fshij_perdorues = 0
              }
              if ($('#cakto_role').is(':checked')) {
                cakto_role = 1;
              } else {
                cakto_role = 0
              }
              if ($('#Klientet').is(':checked')) {
                Klientet = 1;
              } else {
                Klientet = 0
              }
              if ($('#Klientet_Npritje').is(':checked')) {
                Klientet_Npritje = 1;
              } else {
                Klientet_Npritje = 0
              }
              if ($('#Kerkesat_Anuluara').is(':checked')) {
                Kerkesat_Anuluara = 1;
              } else {
                Kerkesat_Anuluara = 0
              }
              if ($('#kerkesat_my_institut').is(':checked')) {
                kerkesat_my_institut = 1;
              } else {
                kerkesat_my_institut = 0
              }
              if ($('#Produktet_tona').is(':checked')) {
                Produktet_tona = 1;
              } else {
                Produktet_tona = 0
              }
              if ($('#user_profile').is(':checked')) {
                user_profile = 1;
              } else {
                user_profile = 0
              }
              if ($('#Furnitoret').is(':checked')) {
                Furnitoret = 1;
              } else {
                Furnitoret = 0
              }
              if ($('#Shiko_klient').is(':checked')) {
                Shiko_klient = 1;
              } else {
                Shiko_klient = 0
              }
              if ($('#Edito_klient').is(':checked')) {
                Edito_klient = 1;
              } else {
                Edito_klient = 0
              }
              if ($('#Shto_klient').is(':checked')) {
                Shto_klient = 1;
              } else {
                Shto_klient = 0
              }
              if ($('#Delete_klient').is(':checked')) {
                Delete_klient = 1;
              } else {
                Delete_klient = 0
              }
              if ($('#Shiko_pozite').is(':checked')) {
                Shiko_pozite = 1;
              } else {
                Shiko_pozite = 0
              }
              if ($('#Shto_pozite').is(':checked')) {
                Shto_pozite = 1;
              } else {
                Shto_pozite = 0
              }
              if ($('#Edito_pozite').is(':checked')) {
                Edito_pozite = 1;
              } else {
                Edito_pozite = 0
              }
              if ($('#Delete_pozite').is(':checked')) {
                Delete_pozite = 1;
              } else {
                Delete_pozite = 0
              }
              if ($('#Shiko_qytet').is(':checked')) {
                Shiko_qytet = 1;
              } else {
                Shiko_qytet = 0
              }
              if ($('#Shto_qytet').is(':checked')) {
                Shto_qytet = 1;
              } else {
                Shto_qytet = 0
              }
              if ($('#Edito_qytet').is(':checked')) {
                Edito_qytet = 1;
              } else {
                Edito_qytet = 0
              }
              if ($('#Delete_qytet').is(':checked')) {
                Delete_qytet = 1;
              } else {
                Delete_qytet = 0
              }
              // extra
              if ($('#GjithaPorositeKlientve').is(':checked')) {
                GjithaPorositeKlientve = 1;
              } else {
                GjithaPorositeKlientve = 0
              }
              if ($('#Porosite_Npritje').is(':checked')) {
                Porosite_Npritje = 1;
              } else {
                Porosite_Npritje = 0
              }

              if ($('#Porosite_Nprocesim').is(':checked')) {
                Porosite_Nprocesim = 1;
              } else {
                Porosite_Nprocesim = 0
              }

              if ($('#Porosite_Anuluara').is(':checked')) {
                Porosite_Anuluara = 1;
              } else {
                Porosite_Anuluara = 0
              }

              if ($('#Porosite_Perfunduara').is(':checked')) {
                Porosite_Perfunduara = 1;
              } else {
                Porosite_Perfunduara = 0
              }

              if ($('#Porosite_my_institut').is(':checked')) {
                Porosite_my_institut = 1;
              } else {
                Porosite_my_institut = 0
              }

              if ($('#Porosite_mine').is(':checked')) {
                Porosite_mine = 1;
              } else {
                Porosite_mine = 0
              }

              if ($('#parashtro_porosi').is(':checked')) {
                parashtro_porosi = 1;
              } else {
                parashtro_porosi = 0
              }


              var ajaxlejet = {
                Dashboard: Dashboard,
                Profili_im: Profili_im,
                Harta: Harta,
                kerkesat_mine: kerkesat_mine,
                parashtro_kerkese_servisi: parashtro_kerkese_servisi,
                GjithaKerkesatKlienteve: GjithaKerkesatKlienteve,
                Kerkesat_Npritje: Kerkesat_Npritje,
                Kerkesat_Nprocesim: Kerkesat_Nprocesim,
                Kerkesat_Perfunduara: Kerkesat_Perfunduara,
                GjithPerdoruesit: GjithPerdoruesit,
                Personeli: Personeli,
                Shto_perdorues: Shto_perdorues,
                Shiko_perdorues: Shiko_perdorues,
                edito_perdorues: edito_perdorues,
                fshij_perdorues: fshij_perdorues,
                cakto_role: cakto_role,
                Klientet: Klientet,
                Klientet_Npritje: Klientet_Npritje,
                Kerkesat_Anuluara: Kerkesat_Anuluara,
                kerkesat_my_institut: kerkesat_my_institut,
                Produktet_tona: Produktet_tona,
                user_profile: user_profile,
                Furnitoret: Furnitoret,
                Shiko_klient: Shiko_klient,
                Edito_klient: Edito_klient,
                Shto_klient: Shto_klient,
                Delete_klient: Delete_klient,
                Shiko_pozite: Shiko_pozite,
                Shto_pozite: Shto_pozite,
                Edito_pozite: Edito_pozite,
                Delete_pozite: Delete_pozite,
                Edito_qytet: Edito_qytet,
                Shiko_qytet: Shiko_qytet,
                Delete_qytet: Delete_qytet,
                Shto_qytet: Shto_qytet,
                GjithaPorositeKlientve: GjithaPorositeKlientve,
                Porosite_Npritje: Porosite_Npritje,
                Porosite_Nprocesim: Porosite_Nprocesim,
                Porosite_Anuluara: Porosite_Anuluara,
                Porosite_Perfunduara: Porosite_Perfunduara,
                Porosite_my_institut: Porosite_my_institut,
                Porosite_mine: Porosite_mine,
                parashtro_porosi: parashtro_porosi,

              }
              $.ajax({
                url: url + "/updlejet/" + userid,
                type: "PUT",
                data: ajaxlejet,
                headers: {
                  'api_token': '<?php echo $token ?>'
                },
                success: function(data, textStatus, jqXHR) {
                  toastr.success('Pozita u editua  me sukses');
                  $('#modal-roles').modal('hide');
            
                }
              });
            });
          }

          $("#btnnewrol").click(function() {
            if ($('#Dashboard1').is(':checked')) {
              Dashboard1 = 1;
            } else {
              Dashboard1 = 0
            }
            if ($('#Profili_im1').is(':checked')) {
              Profili_im1 = 1;
            } else {
              Profili_im1 = 0
            }
            if ($('#kerkesat_mine1').is(':checked')) {
              kerkesat_mine1 = 1;
            } else {
              kerkesat_mine1 = 0
            }
            if ($('#parashtro_kerkese_servisi1').is(':checked')) {
              parashtro_kerkese_servisi1 = 1;
            } else {
              parashtro_kerkese_servisi1 = 0
            }
            if ($('#Harta1').is(':checked')) {
              Harta1 = 1;
            } else {
              Harta1 = 0
            }
            if ($('#GjithaKerkesatKlienteve1').is(':checked')) {
              GjithaKerkesatKlienteve1 = 1;
            } else {
              GjithaKerkesatKlienteve1 = 0
            }
            if ($('#Kerkesat_Npritje1').is(':checked')) {
              Kerkesat_Npritje1 = 1;
            } else {
              Kerkesat_Npritje1 = 0
            }
            if ($('#Kerkesat_Nprocesim1').is(':checked')) {
              Kerkesat_Nprocesim1 = 1;
            } else {
              Kerkesat_Nprocesim1 = 0
            }
            if ($('#Kerkesat_Perfunduara1').is(':checked')) {
              Kerkesat_Perfunduara1 = 1;
            } else {
              Kerkesat_Perfunduara1 = 0
            }
            if ($('#GjithPerdoruesit1').is(':checked')) {
              GjithPerdoruesit1 = 1;
            } else {
              GjithPerdoruesit1 = 0
            }
            if ($('#Personeli1').is(':checked')) {
              Personeli1 = 1;
            } else {
              Personeli1 = 0
            }
            if ($('#Shto_perdorues1').is(':checked')) {
              Shto_perdorues1 = 1;
            } else {
              Shto_perdorues1 = 0
            }
            if ($('#Shiko_perdorues1').is(':checked')) {
              Shiko_perdorues1 = 1;
            } else {
              Shiko_perdorues1 = 0
            }
            if ($('#edito_perdorues1').is(':checked')) {
              edito_perdorues1 = 1;
            } else {
              edito_perdorues1 = 0
            }
            if ($('#fshij_perdorues1').is(':checked')) {
              fshij_perdorues1 = 1;
            } else {
              fshij_perdorues1 = 0
            }
            if ($('#cakto_role1').is(':checked')) {
              cakto_role1 = 1;
            } else {
              cakto_role1 = 0
            }
            if ($('#Klientet1').is(':checked')) {
              Klientet1 = 1;
            } else {
              Klientet1 = 0
            }
            if ($('#Klientet_Npritje1').is(':checked')) {
              Klientet_Npritje1 = 1;
            } else {
              Klientet_Npritje1 = 0
            }
            if ($('#Kerkesat_Anuluara1').is(':checked')) {
              Kerkesat_Anuluara1 = 1;
            } else {
              Kerkesat_Anuluara1 = 0
            }
            if ($('#kerkesat_my_institut1').is(':checked')) {
              kerkesat_my_institut1 = 1;
            } else {
              kerkesat_my_institut1 = 0
            }
            if ($('#Produktet_tona1').is(':checked')) {
              Produktet_tona1 = 1;
            } else {
              Produktet_tona1 = 0
            }
            if ($('#user_profile1').is(':checked')) {
              user_profile1 = 1;
            } else {
              user_profile1 = 0
            }
            if ($('#Furnitoret1').is(':checked')) {
              Furnitoret1 = 1;
            } else {
              Furnitoret1 = 0
            }
            if ($('#Shiko_klient1').is(':checked')) {
              Shiko_klient1 = 1;
            } else {
              Shiko_klient1 = 0
            }
            if ($('#Edito_klient1').is(':checked')) {
              Edito_klient1 = 1;
            } else {
              Edito_klient1 = 0
            }
            if ($('#Shto_klient1').is(':checked')) {
              Shto_klient1 = 1;
            } else {
              Shto_klient1 = 0
            }
            if ($('#Delete_klient1').is(':checked')) {
              Delete_klient1 = 1;
            } else {
              Delete_klient1 = 0
            }
            if ($('#Shiko_pozite1').is(':checked')) {
              Shiko_pozite1 = 1;
            } else {
              Shiko_pozite1 = 0
            }
            if ($('#Shto_pozite1').is(':checked')) {
              Shto_pozite1 = 1;
            } else {
              Shto_pozite1 = 0
            }
            if ($('#Edito_pozite1').is(':checked')) {
              Edito_pozite1 = 1;
            } else {
              Edito_pozite1 = 0
            }
            if ($('#Delete_pozite1').is(':checked')) {
              Delete_pozite1 = 1;
            } else {
              Delete_pozite1 = 0
            }
            if ($('#Shiko_qytet1').is(':checked')) {
              Shiko_qytet1 = 1;
            } else {
              Shiko_qytet1 = 0
            }
            if ($('#Shto_qytet1').is(':checked')) {
              Shto_qytet1 = 1;
            } else {
              Shto_qytet1 = 0
            }
            if ($('#Edito_qytet1').is(':checked')) {
              Edito_qytet1 = 1;
            } else {
              Edito_qytet1 = 0
            }
            if ($('#Delete_qytet1').is(':checked')) {
              Delete_qytet1 = 1;
            } else {
              Delete_qytet1 = 0
            }
            // extra
            if ($('#GjithaPorositeKlientve1').is(':checked')) {
              GjithaPorositeKlientve1 = 1;
            } else {
              GjithaPorositeKlientve1 = 0
            }
            if ($('#Porosite_Npritje1').is(':checked')) {
              Porosite_Npritje1 = 1;
            } else {
              Porosite_Npritje1 = 0
            }

            if ($('#Porosite_Nprocesim1').is(':checked')) {
              Porosite_Nprocesim1 = 1;
            } else {
              Porosite_Nprocesim1 = 0
            }

            if ($('#Porosite_Anuluara1').is(':checked')) {
              Porosite_Anuluara1 = 1;
            } else {
              Porosite_Anuluara1 = 0
            }

            if ($('#Porosite_Perfunduara1').is(':checked')) {
              Porosite_Perfunduara1 = 1;
            } else {
              Porosite_Perfunduara1 = 0
            }

            if ($('#Porosite_my_institut1').is(':checked')) {
              Porosite_my_institut1 = 1;
            } else {
              Porosite_my_institut1 = 0
            }

            if ($('#Porosite_mine1').is(':checked')) {
              Porosite_mine1 = 1;
            } else {
              Porosite_mine1 = 0
            }

            if ($('#parashtro_porosi1').is(':checked')) {
              parashtro_porosi1 = 1;
            } else {
              parashtro_porosi1 = 0
            }




            var ajaxlejet = {
              pozitat: $("#emrrolit").val(),
              statusi: 1,
              Dashboard: Dashboard1,
              Profili_im: Profili_im1,
              Harta: Harta1,
              kerkesat_mine: kerkesat_mine1,
              parashtro_kerkese_servisi: parashtro_kerkese_servisi1,
              GjithaKerkesatKlienteve: GjithaKerkesatKlienteve1,
              Kerkesat_Npritje: Kerkesat_Npritje1,
              Kerkesat_Nprocesim: Kerkesat_Nprocesim1,
              Kerkesat_Perfunduara: Kerkesat_Perfunduara1,
              GjithPerdoruesit: GjithPerdoruesit1,
              Personeli: Personeli1,
              Shto_perdorues: Shto_perdorues1,
              Shiko_perdorues: Shiko_perdorues1,
              edito_perdorues: edito_perdorues1,
              fshij_perdorues: fshij_perdorues1,
              cakto_role: cakto_role1,
              Klientet: Klientet1,
              Klientet_Npritje: Klientet_Npritje1,
              Kerkesat_Anuluara: Kerkesat_Anuluara1,
              kerkesat_my_institut: kerkesat_my_institut1,
              Produktet_tona: Produktet_tona1,
              user_profile: user_profile1,
              Furnitoret: Furnitoret1,
              Shiko_klient: Shiko_klient1,
              Edito_klient: Edito_klient1,
              Shto_klient: Shto_klient1,
              Delete_klient: Delete_klient1,
              Shiko_pozite: Shiko_pozite1,
              Shto_pozite: Shto_pozite1,
              Edito_pozite: Edito_pozite1,
              Delete_pozite: Delete_pozite1,
              Edito_qytet: Edito_qytet1,
              Shiko_qytet: Shiko_qytet1,
              Delete_qytet: Delete_qytet1,
              Shto_qytet: Shto_qytet1,
              GjithaPorositeKlientve: GjithaPorositeKlientve1,
              Porosite_Npritje: Porosite_Npritje1,
              Porosite_Nprocesim: Porosite_Nprocesim1,
              Porosite_Anuluara: Porosite_Anuluara1,
              Porosite_Perfunduara: Porosite_Perfunduara1,
              Porosite_my_institut: Porosite_my_institut1,
              Porosite_mine: Porosite_mine1,
              parashtro_porosi: parashtro_porosi1,
            }
            $.ajax({
              url: url + "/insertnewroli",
              type: "post",
              data: ajaxlejet,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                toastr.success('Pozita u shtua  me sukses');
                $('#modal-pozita').modal('hide');
                location.reload();

              }
            });


          });
        </script>
        <!-- scripta per editim t userit SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT  SCRIPT EDIT -->
        <script type="text/javascript">
          $("#btninsert").click(function() {
            var ajax = {
              emriinstitutit: $('#ClientName').val(),
              nrbiznesit: $('#nrBiznesit').val(),
            
              adressa: $("#adresa_biznesit").val(),
              nrfiskal: $("#nr_fiskal").val(),
              email: $("#bemail").val(),
          
              perdoruesi: $("#bperdoruesi").val(),
              fjalkalimi: sha256($("#bFjalekalimi").val()),
              nrkontakt: $("#bTel").val(),
              pozita: $("#select-roli-klient").val(),
              adresa: $("#select-qytet-biznes").val(),
            }
            $.ajax({
              type: "POST",
              url: url + "/shtoperdoruesi",

              data: ajax,
              headers: {
                'api_token': '<?php echo $token ?>'
              },
              success: function(data, textStatus, jqXHR) {
                location.reload();
                $('#modal-register').modal('toggle');
                toastr.success('Përdoruesi u shtua me suskes');

              },
              error: function(request, textStatus, errorThrown) {
                console.log(request.responseJSON.message);
                $("#errorishtoklient").removeClass("hidden").html(request.responseJSON.message);
              }
            });

          });
          $("#btnupdate").click(function() {
            $.ajax({
              type:"PUT",
              url: url + "/updklienti",
              headers: {
                'api_token': token
              },
              data: {
                emriinstitutit: $('#ClientName').val(),
                nrbiznesit: $('#nrBiznesit').val(),
                id: $('#select-klient').val(),
                qyteti: $('#select-qytet-biznes').val(),
                nrfiskal: $('#nr_fiskal').val(),
                adresa: $('#adresa_biznesit').val(),
                email: $('#emailklient').val(),
              },
              success: function(data, status) {

                toastr.success('Klienti u perditsua me sukses.');
                EgetClients();
                getClients();
                $('#modal-klient').modal('hide');
              }
            });
          });
          $(document).ready(function() {
            $('.select2').select2({
              width: '100%',
              language: {
                noResults: function(params) {
                  return "Nuk ka të dhëna me këtë emer";
                }
              }
            });
          });

          function selectuser_click(id) {
            userid = id;
            $.ajax({
              type: "POST",
              url: url + "/perdoruesi",
              headers: {
                'api_token': token
              },
              data: {
                veprimi: 'select1',
                id: id,


              },
              // $(ky emer esht id e di -selector).val(eshte kolona e databazes)s
              success: function(data, status) {
                $('#EName').val(data[0].emri);
                $('#EEmail').val(data[0].email);
                $('#ELastName').val(data[0].mbiemri);
                $('#Eperdoruesi').val(data[0].perdoruesi);
                $('#EBirthDate').val(data[0].data_e_lindjes);
                $('#ETel').val(data[0].nr_kontaktues);
                $('#EnrBiznesit').val(data[0].nrbiznesit);
                $('#select-qytet-edit').val(data[0].adresa);
                $('#select-qytet-edit').trigger('change');
                $('#select-roli').val(data[0].pozitat);
                $('#select-roli').trigger('change');
                $('#select-institut').val(data[0].institucioni);
                $('#select-institut').trigger('change');
                if (data[0].gjinia != "") {
                  $("input[name='EGender'][value=" + data[0].gjinia + "]").prop('checked', true);
                }
                $("input[name='EStatusi'][value=" + data[0].statusi + "]").prop('checked', true);
                // select 2 eshte per div select na undson opcionet me search bar me i gjet

                // deri ktu
              }
            });
          }
        </script>
        <!-- Start of modal for editing users edit EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT -->
        <div class="modal fade" id="modal-edit">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Edito
                </h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <div class="card-body">
                  <form method="POST" class="form-horizontal prevent-multiple" novalidate="novalidate">
                    <div class="box-body">
                      <div class="row">
                        <div class="col-sm-12 col-md-12">
                          <div id="page-content-wrapper">

                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Emri</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="EName" name="EName" placeholder="Emri" type="text" value="">
                              </div>
                            </div>

                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Mbiemri</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="ELastName" name="ELastname" placeholder="Mbiemri" type="text" value="">
                              </div>

                            </div>
                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Përdoruesi</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="Eperdoruesi" name="Eperdoruesi" placeholder="Përdoruesi" type="text" value="" disabled="">
                              </div>
                            </div>
                      
                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Fjalëkalimi</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control text-box single-line" data-val="true" id="EFjalekalimi" name="EFjalekalimi" type="EFjalekalimi" value="" placeholder="Fjalëkalimi">
                              </div>
                            </div>
                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Email</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" id="EEmail" name="EEmail" placeholder="Email" type="text" value="" >
                              </div>
                            </div>

                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Gjinia</label>
                              <div id="gen" class="col-sm-4">
                                <input type="radio" name="EGender" id="EGender" value="Mashkull"> Mashkull<br>
                              </div>
                              <div class="col-sm-4">
                                <input type="radio" name="EGender" id="EGender" value="Femer">Femër<br />
                              </div>
                            </div>

                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Data e Lindjes</label>
                              <div class="col-sm-9 col-md-9">
                                <input type="date" class="form-control" id="EBirthDate" placeholder="Data lindjes" value="">
                              </div>
                            </div>
                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Numri kontaktues</label>
                              <div class="col-sm-9 col-md-9">
                                <input class="form-control text-box single-line" data-val="true" id="ETel" name="ETel" placeholder="Numri kontaktues" type="text" value="">
                              </div>
                            </div>


                            <div class="input-group mb-12 edit" id="getCityhide">
                              <label class="col-sm-3 col-md-3 control-label">Qyteti </label>
                              <div class="col-sm-9 col-md-9" id="EZgjedhqytetin">
                                <script>
                                  $.ajax({
                                    type: "GET",
                                    url: url + "/getqytet",
                                    headers: {
                                      'api_token': token
                                    },

                                    // start success
                                    success: function(data, status) {
                                      y = "<select  id=\"select-qytet-edit\" class=\"form-control selectized select2\" autocomplete=\"off\" tabindex=\"-1\">";
                                      y += "<option value=\"\" selected=\"selected\">-Zgjedh Qytetin-</option>";

                                      for (i = 0; i < data.length; i++) {
                                        y += '<option value="' + data[i].id + '">' + data[i].emri_qytetit + '</option> ';
                                      }
                                      document.getElementById("EZgjedhqytetin").innerHTML = y;
                                      $('#select-qytet-edit').select2({
                                        width: '100%',
                                        language: {
                                          noResults: function(params) {
                                            return "Nuk ka të dhëna me këtë emer";
                                          }
                                        },
                                        dropdownParent: $("#modal-edit")
                                      });
                                    } // success end

                                  });
                                </script>
                              </div>
                            </div>


                            <div class="input-group mb-12 edit" id="getCityhide">
                              <label class="col-sm-3 col-md-3 control-label">Pozita </label>
                              <div class="col-sm-9 col-md-9" id="EZgjedhpoziten">
                                <script>
                                  function EZgjedhpoziten() {
                                    $.ajax({
                                      url: url + "/pozitat",
                                      headers: {
                                        'api_token': token
                                      },
                                      data: {
                                        veprimi: 'select',
                                        id_pozites: '<?php echo $_SESSION['_session']['roli']; ?>',


                                      },
                                      // start success
                                      success: function(data, status) {
                                        y = "<select  id=\"select-roli\" class=\"form-control selectized select2\" autocomplete=\"off\" tabindex=\"-1\">";
                                        y += "<option value=\"\" selected=\"selected\">-Zgjedh Pozitën-</option>";

                                        for (i = 0; i < data.length; i++) {
                                          y += '<option value="' + data[i].id + '">' + data[i].pozitat + '</option> ';
                                        }

                                        document.getElementById("EZgjedhpoziten").innerHTML = y;
                                        $('#select-roli').select2({
                                          width: '100%',
                                          language: {
                                            noResults: function(params) {
                                              return "Nuk ka të dhëna me këtë emer";
                                            }
                                          },
                                          dropdownParent: $("#modal-edit")
                                        });
                                      } // success end



                                    });

                                  }
                                  $(function() {
                                    EZgjedhpoziten();
                                  });
                                </script>
                              </div>
                            </div>


                            <div class="input-group mb-12 edit" id="egetClientshide">
                              <label class="col-sm-3 col-md-3 control-label">I punësuar: </label>
                              <div class="col-sm-9 col-md-9" id="EgetClients">
                                <script>
                                  function EgetClients() {
                                    $.ajax({
                                      url: url + "/klienti",
                                      headers: {
                                        'api_token': token
                                      },
                                      data: {
                                        emriinstitutit: ' ',
                                        veprimi: 'select',
                                        id: 0,
                                        qyteti: 0
                                      },
                                      // start success
                                      success: function(data, status) {
                                        y = "<select  id=\"select-institut\" class=\"form-control selectized select2\" autocomplete=\"off\" tabindex=\"-1\">";

                                        for (i = 0; i < data.length; i++) {
                                          y += '<option value="' + data[i].id + '">' + data[i].emri_institutit + '</option> ';
                                        }

                                        document.getElementById("EgetClients").innerHTML = y;

                                      } // success end

                                    });

                                  }
                                  EgetClients();
                                </script>
                              </div>
                            </div>
                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Numri i biznesit</label>
                              <div id="nrbz" class="col-sm-4">
                                <input type="text" class="form-control" name="EnrBiznesit" id="EnrBiznesit" value="0"> Pasiv<br>
                              </div>
                            </div>

                            <div class="input-group mb-12 edit">
                              <label class="col-sm-3 col-md-3 control-label">Statusi</label>
                              <div id="statusii" class="col-sm-4">
                                <input type="radio" name="EStatusi" id="EStatusi" value="0"> Pasiv<br>
                              </div>
                              <div class="col-sm-4">
                                <input type="radio" name="EStatusi" id="EStatusi" value="1">Aktiv<br />
                              </div>
                            </div>
                          </div>


                          <div class="input-group mb-12 edit">
                            <label class="col-sm-3 col-md-3 control-label"></label>
                            <div class="col-sm-9 col-md-9">
                              <button type="button" id="btnUpdateEditmodal" class="btn btn-success" style="float: right;"><i class=""></i> Ruaj</button>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                </div>
                </form>
              </div>
            </div>
          </div>
        </div>
        <!-- end of modal for editing users  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT  EDIT -->

        <!-- Start of modal for register users CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS -->
        <div class="modal fade" id="modal-register">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Regjistro Përdorues</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <div class="card-body">
                  <form method="POST" class="form-horizontal prevent-multiple" novalidate="novalidate">
                    <div class="box-body">
                      <div class="row">
                        <div class="col-sm-12 col-md-12">
                          <div id="page-content-wrapper">

                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Emri</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" data-val-required="Emri është i detyrueshëm *" id="Name" name="Name" placeholder="Emri" type="text" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Name" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>
                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Mbiemri</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control InputToUpper text-box single-line" data-val="true" data-val-required="Mbiemri është i detyrueshëm *" id="LastName" name="Lastname" placeholder="Mbiemri" type="text" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Lastname" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>
                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Përdoruesi</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control text-box single-line" data-val="true" data-val-email="Invalid Email Address" id="perdoruesi" name="perdoruesi" placeholder="Perdoruesi" type="text" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>
                          

                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Fjalëkalimi</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control text-box single-line" data-val="true" data-val-email="Fjalëkalimi është i detyrueshëm" id="Password" name="Password" type="password" value="" placeholder="Fjalëkalimi">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Passwprd" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>
                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Email</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control text-box single-line" data-val="true" data-val-email="Invalid Email Address" id="Email" name="Email" placeholder="Email" type="email" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>

                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Gjinia</label>
                              <div id="gen" class="col-sm-4">
                                <label> <input type="radio" name="Gender" id="Gender" value="Mashkull"> Mashkull<br></label>
                              </div>
                              <div class="col-sm-4">
                                <label> <input type="radio" name="Gender" id="Gender" value="Femer">Femër<br /></label>
                                <span class="field-validation-valid text-danger" data-valmsg-for="Gender" data-valmsg-replace="true"></span>
                              </div>

                            </div>


                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Data e Lindjes</label>
                              <div class="col-sm-8 col-md-8">
                                <input type="date" class="form-control" id="BirthDate" placeholder="Data E lindjes" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="BirthDate" data-valmsg-replace="true"></span>
                              </div>

                            </div>
                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label">Numri kontaktues</label>
                              <div class="col-sm-8 col-md-8">
                                <input class="form-control text-box single-line" data-val="true" data-val-required="Numri i telefonit është i detyrueshëm *" id="Tel" name="Tel" placeholder="Numri telefonit" type="text" value="">
                                <span class="field-validation-valid text-danger" data-valmsg-for="Tel" data-valmsg-replace="true"></span>
                              </div>
                              <div class="col-md-1" style="margin-top: 7px;">
                                <span>*</span>
                              </div>
                            </div>



                            <div class="input-group mb-12 edit" id="getCityhide">
                              <label class="col-sm-3 col-md-3 control-label">Qyteti </label>
                              <div class="col-sm-8 col-md-8" id="Zgjedhqytetin">
                                <script>
                                  $(document).ready(function() {


                                    $.ajax({
                                      type: "GET",
                                      url: url + "/getqytet",
                                      headers: {
                                        'api_token': token
                                      },

                                      // start success
                                      success: function(data, status) {
                                        y = "<select  id=\"select-qyteti-reg\" class=\"form-control selectized select2\" style=\"width:100%;\" autocomplete=\"off\" tabindex=\"-1\">";
                                        y += "<option value=\"\" selected=\"selected\">-Zgjedh Qytetin-</option>";

                                        for (i = 0; i < data.length; i++) {
                                          y += '<option value="' + data[i].id + '">' + data[i].emri_qytetit + '</option> ';
                                        }

                                        document.getElementById("Zgjedhqytetin").innerHTML = y;
                                        $('#select-qyteti-reg').select2({
                                          dropdownParent: $('#modal-register')
                                        });
                                      } // success end

                                    });
                                  });
                                </script>

                              </div>
                              <div class="col-md-1">
                                <a class="btn btn-default" onclick="$('#modal-city').appendTo('body').modal('show');" style="cursor:pointer; padding:inherit; padding-top: 4px; padding-right: 9px;padding-left: 9px;">+</a>
                              </div>
                            </div>


                            <div class="input-group mb-12 edit" id="getCityhide">
                              <label class="col-sm-3 col-md-3 control-label">Pozita </label>
                              <div class="col-sm-8 col-md-8" id="Zgjedhpoziten">
                                <script>
                                  function Zgjedhpoziten() {
                                    $.ajax({
                                      url: url + "/pozitat",
                                      headers: {
                                        'api_token': token
                                      },
                                      data: {
                                        veprimi: 'select',
                                        id_pozites: '<?php echo $_SESSION['_session']['roli']; ?>',


                                      },
                                      // start success
                                      success: function(data, status) {
                                        y = "<select  id=\"select-roli-reg\" class=\"form-control selectized select2\" style=\"width:100%;\" autocomplete=\"off\" tabindex=\"-1\">";
                                        y += "<option value=\"\" selected=\"selected\">-Zgjedh Pozitën-</option>";

                                        for (i = 0; i < data.length; i++) {
                                          y += '<option value="' + data[i].id + '">' + data[i].pozitat + '</option> ';
                                        }
                                        document.getElementById("Zgjedhpoziten").innerHTML = y;
                                        $('#select-roli-reg').select2({
                                          dropdownParent: $('#modal-register')
                                        });
                                      } // success end


                                    });

                                  }
                                  $(document).ready(function() {
                                    Zgjedhpoziten();
                                  });
                                </script>
                              </div>
                            </div>

                            <?php if ($_SESSION['_session']['roli'] == 1) { ?>
                              <div class="input-group mb-12 edit" id="getClientshide">
                                <label class="col-sm-3 col-md-3 control-label">I punësuar: </label>
                                <div class="col-sm-8 col-md-8" id="getClients">
                                  <script>
                                    function getClients() {
                                      $.ajax({
                                        url: url + "/klienti",
                                        headers: {
                                          'api_token': token
                                        },
                                        data: {
                                          emriinstitutit: '',
                                          veprimi: 'select',
                                          id: 0,
                                          qyteti: 0
                                        },
                                        // start success
                                        success: function(data, status) {
                                          y = "<select  id=\"select-institut-reg\" class=\"form-control selectized select2\" style=\"width:100%;\" autocomplete=\"off\" tabindex=\"-1\">";
                                          y += "<option value=\"\" selected=\"selected\">-Zgjedh Institutin-</option>";

                                          for (i = 0; i < data.length; i++) {
                                            y += '<option value="' + data[i].id + '">' + data[i].emri_institutit + '</option> ';
                                          }

                                          document.getElementById("getClients").innerHTML = y;
                                          $("#select-institut-reg").select2({
                                            dropdownParent: $('#modal-register')
                                          });
                                        } // success end

                                      });

                                    }
                                    getClients();
                                  </script>
                                </div>
                              </div>

                            <?php } ?>
                            <div class="input-group mb-12">
                              <label class="col-sm-3 col-md-3 control-label"></label>
                              <div class="col-sm-8 col-md-8">
                                <button type="button" id="btnreg" class="btn btn-success" style="float: right;"><i class=""></i> Ruaj</button>
                              </div>
                            </div>

                          </div>
                        </div>
                      </div>
                    </div>
                    <div><span style="font-size: 14px;">*</span> <span style="font-size:12px"> paraqet fushat të cilat në mënyre obligative duhet të plotësohen</span></div>
                    <div class="alert hidden reg" role="alert" style="margin-top: 12px; padding: 0.75rem 1.25rem;"></div>

                  </form>
                </div>
              </div>
            </div>
          </div>
          <script>
            $("#btnreg").click(function() {
              var ajax = {
                emri: $("#Name").val(),
                mbiemri: $("#LastName").val(),
                perdoruesi: $("#perdoruesi").val(),
                email: $("#Email").val(),
                fjalkalimi: sha256($("#Password").val()),
                gjinia: $('input[name="Gender"]:checked').val(),
                datalindjes: $("#BirthDate").val(),

                nrkontakt: $("#Tel").val(),
                pozita: $("#select-roli-reg").val(),

                adresa: $("#select-qyteti-reg").val(),
                institucioni: <?php if ($_SESSION['_session']['roli'] == 1) {
                                echo '$("#select-institut-reg").val()';
                              } else {
                                echo $instituti;
                              } ?>,
                statusi: 1
              }
              $.ajax({
                url: url + "/register",
                type: "POST",
                data: ajax,
                headers: {
                  'api_token': '<?php echo $token ?>'
                },
                success: function(data, textStatus, jqXHR) {
                  location.reload();
                  $('#modal-register').modal('toggle');
                  toastr.success('Përdoruesi u shtua me suskes');

                },
                error: function(request, textStatus, errorThrown) {
                  $(".reg").removeClass("hidden").addClass('alert-danger').html(request.responseJSON.message);
                }
              });
            });
          </script>

          <!-- end of modal for register user CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS  CREATE USERS -->
          <!-- - - - - - -  - - MODALS END -- MODALS END -- MODALS END -- MODALS END -- MODALS END -- MODALS END -- MODALS END -- MODALS END -- MODALS END - - - - - - - - -  - - - - -->
        </div>
      </div>
      <!-- inside footer inside footer inside footer inside footer inside footer inside footer inside footer  -->

      <script src="plugins/datatables/jquery.dataTables.min.js"></script>
      <script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
      <script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
      <script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
      <script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
      <script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
      <script src="plugins/jszip/jszip.min.js"></script>
      <script src="plugins/pdfmake/pdfmake.min.js"></script>
      <script src="plugins/pdfmake/vfs_fonts.js"></script>
      <script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
      <script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
      <script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
      <script src="plugins/moment/moment.min.js"></script>

      <script>
        // ONLICK btn - FUNCTION FOR EDITIN a user. EDIT USER FUNCTION  EDIT USER FUNCTION  EDIT USER FUNCTION  EDIT USER FUNCTION 
        $("#btnUpdateEditmodal").click(function() {
          if ($('#EFjalekalimi').val() == null || $('#EFjalekalimi').val() == "") {
            fjlklm = "";
          } else {
            fjlklm = sha256($('#EFjalekalimi').val());
          }
          console.log($('input[name="EGender"]:checked').val() );
          var ajax = {
            id: userid,
            veprimi: 'update',
            emri: $("#EName").val(),
            mbiemri: $("#ELastName").val(),
            email: $("#EEmail").val(),
            fjalkalimi: fjlklm,
            gjinia: $('input[name="EGender"]:checked').val()==undefined?null: $('input[name="EGender"]:checked').val(),
            datalindjes: $("#EBirthDate").val(),
            nrkontakt: $("#ETel").val(),
            pozita: $("#select-roli").val(),
            adresa: $("#select-qytet-edit").val(),
            institucioni: $("#select-institut").val(),
            statusi: $('input[name="EStatusi"]:checked').val()
          }
          $.ajax({
            type: "PUT",
            url: url + "/updperdoruesi",
            data: ajax,
            headers: {
              'api_token': '<?php echo $token ?>'
            },
            success: function(data, textStatus, jqXHR) {
              location.reload();
              $('#modal-edit').modal('toggle');
              toastr.success('Përdoruesi u editua me suskes');
            },
            error: function(request, textStatus, errorThrown) {
              $(".informasi").removeClass("hidden").addClass('alert-danger').html(request.responseJSON.message);

            }
          });
        });
        // END END END EDIT USER FUNCTION  EDIT USER FUNCTION  EDIT USER FUNCTION  EDIT USER FUNCTION 
        $.ajax({
          url: url + "/getlejet/" + <?php echo $_SESSION['_session']['id'] ?>,
          headers: {
            'api_token': '<?php echo $token ?>'
          },
          success: function(data, status) {


            if (data[0].Dashboard == 0) {
              $("#form-Dashboard").hide();
              $("#form-Dashboard1").hide();
            } else {}
            if (data[0].Profili_im == 0) {
              $("#form-Profili_im").hide();
              $("#form-Profili_im1").hide();
            }
            if (data[0].Harta == 0) {
              $("#form-Harta").hide();
              $("#form-Harta1").hide();
            }
            if (data[0].kerkesat_mine == 0) {
              $("#form-kerkesat_mine").hide();
              $("#form-kerkesat_mine1").hide();
            } else {}
            if (data[0].parashtro_kerkese_servisi == 0) {
              $("#form-parashtro_kerkese_servisi").hide();
              $("#form-parashtro_kerkese_servisi1").hide();
            }
            if (data[0].GjithaKerkesatKlienteve == 0) {
              $("#form-GjithaKerkesatKlienteve").hide();
              $("#form-GjithaKerkesatKlienteve1").hide();
            }
            if (data[0].Kerkesat_Npritje == 0) {
              $("#form-Kerkesat_Npritje").hide();
              $("#form-Kerkesat_Npritje1").hide();
            }
            if (data[0].Kerkesat_Nprocesim == 0) {
              $("#form-Kerkesat_Nprocesim").hide();
              $("#form-Kerkesat_Nprocesim1").hide();
            }
            if (data[0].Kerkesat_Perfunduara == 0) {
              $("#form-Kerkesat_Perfunduara").hide();
              $("#form-Kerkesat_Perfunduara1").hide();
            }

            if (data[0].GjithPerdoruesit == 0) {
              $("#form-GjithPerdoruesit").hide();
              $("#form-GjithPerdoruesit1").hide();
            }
            if (data[0].Personeli == 0) {
              $("#form-Personeli").hide();
              $("#form-Personeli1").hide();
            }
            if (data[0].Shto_perdorues == 0) {
              $("#form-Shto_perdorues").hide();
              $("#form-Shto_perdorues1").hide();
            }
            if (data[0].Shiko_perdorues == 0) {
              $("#form-Shiko_perdorues").hide();
              $("#form-Shiko_perdorues1").hide();
            }
            if (data[0].edito_perdorues == 0) {
              $("#form-edito_perdorues").hide();
              $("#form-edito_perdorues1").hide();
            }
            if (data[0].fshij_perdorues == 0) {
              $("#form-fshij_perdorues").hide();
              $("#form-fshij_perdorues1").hide();
            }

            if (data[0].cakto_role == 0) {
              $("#form-cakto_role").hide();
              $("#form-cakto_role1").hide();
            }
            if (data[0].Klientet == 0) {
              $("#form-Klientet").hide();
              $("#form-Klientet1").hide();
            }
            if (data[0].Klientet_Npritje == 0) {
              $("#form-Klientet_Npritje").hide();
              $("#form-Klientet_Npritje1").hide();
            }
            if (data[0].Kerkesat_Anuluara == 0) {
              $("#form-Kerkesat_Anuluara").hide();
              $("#form-Kerkesat_Anuluara1").hide();
            }
            if (data[0].kerkesat_my_institut == 0) {
              $("#form-kerkesat_my_institut").hide();
              $("#form-kerkesat_my_institut1").hide();
            }
            if (data[0].Produktet_tona == 0) {
              $("#form-Produktet_tona").hide();
              $("#form-Produktet_tona1").hide();
            }
            if (data[0].user_profile == 0) {
              $("#form-user_profile").hide();
              $("#form-user_profile1").hide();
            }
            if (data[0].Furnitoret == 0) {
              $("#form-Furnitoret").hide();
              $("#form-Furnitoret1").hide();
            }
            if (data[0].Shiko_klient == 0) {
              $("#form-Shiko_klient").hide();
              $("#form-Shiko_klient1").hide();
            }
            if (data[0].Edito_klient == 0) {
              $("#form-Edito_klient").hide();
              $("#form-Edito_klient1").hide();
            }
            if (data[0].Shto_klient == 0) {
              $("#form-Shto_klient").hide();
              $("#form-Shto_klient1").hide();
            }
            if (data[0].Delete_klient == 0) {
              $("#form-Delete_klient").hide();
              $("#form-Delete_klient1").hide();
            }
            if (data[0].Shiko_pozite == 0) {
              $("#form-Shiko_pozite").hide();
              $("#form-Shiko_pozite1").hide();
            }
            if (data[0].Shto_pozite == 0) {
              $("#form-Shto_pozite").hide();
              $("#form-Shto_pozite1").hide();
            }
            if (data[0].Edito_pozite == 0) {
              $("#form-Edito_pozite").hide();
              $("#form-Edito_pozite1").hide();
            }
            if (data[0].Delete_pozite == 0) {
              $("#form-Delete_pozite").hide();
              $("#form-Delete_pozite1").hide();
            }
            if (data[0].Edito_qytet == 0) {
              $("#form-Edito_qytet").hide();
              $("#form-Edito_qytet1").hide();
            }

            if (data[0].Shiko_qytet == 0) {
              $("#form-Shiko_qytet").hide();
              $("#form-Shiko_qytet1").hide();
            }
            if (data[0].Delete_qytet == 0) {
              $("#form-Delete_qytet").hide();
              $("#form-Delete_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            // EXTRA MBETI BOSH
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            if (data[0].Shto_qytet == 0) {
              $("#form-Shto_qytet").hide();
              $("#form-Shto_qytet1").hide();
            }
            // extra
            if (data[0].GjithaPorositeKlientve == 0) {
              $("#form-GjithaPorositeKlientve").hide();
              $("#form-GjithaPorositeKlientve1").hide();
            }
            if (data[0].Porosite_Npritje == 0) {
              $("#form-Porosite_Npritje").hide();
              $("#form-Porosite_Npritje1").hide();
            }
            if (data[0].Porosite_Nprocesim == 0) {
              $("#form-Porosite_Nprocesim").hide();
              $("#form-Porosite_Nprocesim1").hide();
            }
            if (data[0].Porosite_Anuluara == 0) {
              $("#form-Porosite_Anuluara").hide();
              $("#form-Porosite_Anuluara1").hide();
            }
            if (data[0].Porosite_Perfunduara == 0) {
              $("#form-Porosite_Perfunduara").hide();
              $("#form-Porosite_Perfunduara1").hide();
            }
            if (data[0].Porosite_my_institut == 0) {
              $("#form-Porosite_my_institut").hide();
              $("#form-Porosite_my_institut1").hide();
            }
            if (data[0].Porosite_mine == 0) {
              $("#form-Porosite_mine").hide();
              $("#form-Porosite_mine1").hide();
            }
            if (data[0].parashtro_porosi == 0) {
              $("#form-parashtro_porosi").hide();
              $("#form-parashtro_porosi1").hide();
            }



          }
        });
        // start of oTable NDRYSHIME NE TABELE  NDRYSHIME NE TABELE  NDRYSHIME NE TABELE  NDRYSHIME NE TABELE  

        $(function() {
          oTable = $("#example1").DataTable({

            "responsive": true,
            "lengthChange": false,
            "autoWidth": false,
            "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"],
            "order": [
              [0, "desc"]
            ],
            "language": {
              "search": "",
              "searchPlaceholder": "Kërko",
              "lengthMenu": "Shfaq _MENU_ të dhëna për faqe",
              "zeroRecords": "Nuk u gjet asgjë",
              "info": "Shfaqur faqja _PAGE_ prej _PAGES_",
              "infoEmpty": "Nuk ka të dhëna",
              "infoFiltered": "(Filtruar _MAX_ të gjithave)",

              "loadingRecords": "Loading...",
              "processing": "Duke procesuar...",
              //"search":         "Kërko:",
              "paginate": {
                "first": "E para",
                "last": "E fundit",
                "next": "Tjetra",
                "previous": "Para"
              },
            },
            "pageLength": 10,
            "columnDefs": [{
              "targets": [0],
              "visible": false,

            }]
          });
          $('#example1_wrapper .col-md-6:eq(0)').append('<div class="row"' +
            '<div class="input-group col-3">' +
            '<div class="col"><input class=form-control date" type="date" id="min" /></div>' +
            '<div class="col"><input class=form-control date" type="date" id="max" /></div>' +
            '<div class="col"><i class="material-icons dp48" id="searchbydate">search</i></div>' +
            '</div></div>').ready(function() {
            $('#min').val(new Date().toISOString().split('T')[0]);
            $('#max').val(new Date().toISOString().split('T')[0]);
          });

          if (<?php echo $_SESSION['_session']['roli'] == 1 || $_SESSION['_session']['all_users'] == 1 ? 'true' : 'false' ?> == true) {
            $('#example1_wrapper .col-md-6:eq(1)').addClass('row');
            $('#example1_wrapper .col-md-6:eq(1)').append('<div class="col-sm-6"    style="display: -webkit-inline-box;">' +
              '<select id="installad" class="form-control" style="width:80%"><option value="">Zgjedh Institutin</option><?php echo $instopt ?></select><button ' +
              ' onclick="opennewtab()"' +
              ' class="btn btn-sm"><i class="material-icons dp48" id="searchbydate">search</i></button></div>')
            $('#example1_wrapper .col-md-6:eq(1)').children().first().addClass('col-sm-6');

          }
          if (<?php echo isset($_GET['inst']) ? 'true' : 'false'; ?>) {
            $("#installad").val(<?php echo $_GET['inst'] ?>);
          }
          $('#searchbydate').on('click', function() {
            $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
              var min = $('#min').val();
              var max = $('#max').val();
              var date = new Date(data[3]);
              date = JSON.stringify(date);
              date = date.slice(1, 11);
              if ((min === '' && max === '') || (min === '' && date <= max) || (min <= date && max === '') || (min <= date && date <= max)) {
                return true;
              }
              return false;
            });

            oTable.draw();
          });
        }); // end of oTable
        // end of oTable NDRYSHIME NE TABELE  NDRYSHIME NE TABELE  NDRYSHIME NE TABELE  NDRYSHIME NE TABELE                          
        function opennewtab() {
          if ($('#installad').val() == "") {
            window.open("perdoruesit.php", "_self")
          } else {
            window.open("perdoruesit.php?inst=" + $('#installad').val(), "_self")
          }

        }
      </script>

  <?php require 'footer.php';
  } else {
    header("location:./dashboard.php");
  }
} else {
  header("location:../logout.php");
}
  ?>