<!DOCTYPE html>
<html lang="en">


<?php $this->load->view("kepaladinas/header"); ?>

<body>

  <?php $this->load->view("kepaladinas/side_topbar"); ?>

  <div id="wrapper">
    <div class="main-content">
      <div class="row small-spacing">
        <div class="col-xs-12">
          <div class="box-content card">
            <h4 class="box-title">List Hari Jam Kerja</h4>
            <!-- /.dropdown js__dropdown -->
            <div class="card-content">
              <div style="overflow-x: auto">
                <table id="table_list_hari" class="table table-striped table-bordered display" style="width:100%">
                  <thead>
                    <tr>
                      <th>Hari</th>
                      <th>Jam Masuk</th>
                      <th>Jam Istirehat</th>
                      <th>Jam Masuk Kembali</th>
                      <th>Jam Pulang</th>
                    </tr>
                  </thead>
                  <tbody style="text-align: center;">
                    <tr id="senin">
                      <td class="harinya">Senin</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                     
                    </tr>
                    <tr id="selasa">
                      <td class="harinya">Selasa</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                      
                    </tr>
                    <tr id="rabu">
                      <td class="harinya">Rabu</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                      
                    </tr>
                    <tr id="kamis">
                      <td class="harinya">Kamis</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                     
                    </tr>
                    <tr id="jumat">
                      <td class="harinya">Jumat</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                      
                    </tr>
                    <tr id="sabtu">
                      <td class="harinya">Sabtu</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                      
                    </tr>
                    <tr id="ahad">
                      <td class="harinya">Ahad</td>
                      <td class="jam_masuk">-</td>
                      <td class="jam_istirehat">-</td>
                      <td class="jam_masuk_kembali">-</td>
                      <td class="jam_pulang">-</td>
                      
                    </tr>
                  </tbody>
                </table>
              </div>
              <br>
            </div>

            <!-- /#flot-chart-1.flot-chart -->
          </div>
          <!-- /.box-content -->
        </div>
        <!-- /.col-xs-12 -->



      </div>
      <!-- /.row -->

      <?php $this->load->view('kepaladinas/footer') ?>

    </div>
    <!-- /.main-content -->
  </div>

 

  <?php $this->load->view('kepaladinas/scripts') ?>

  <!-- <script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
  <script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script> -->

  <script>
    var id_dinas = <?= $id_dinas ?>;
    var all_data = [];

    async function get_all_data() {
      let data;
      try {
        data = await $.ajax({
          url: server_url_api + "jam_kerja?id_dinas=" + id_dinas,
          type: 'get',
          async: false,
          beforeSend: function(res) {
            block_ui("Mengambil Data Jam Kerja");
          },
        });
        data = data.data
        all_data = data
        data.forEach((item, index) => {
          $("#table_list_hari #" + item['hari'] + " .jam_masuk").html(tConvert(item['jam_masuk']))
          $("#table_list_hari #" + item['hari'] + " .jam_istirehat").html(tConvert(item['jam_istirehat']))
          $("#table_list_hari #" + item['hari'] + " .jam_masuk_kembali").html(tConvert(item['jam_masuk_kembali']))
          $("#table_list_hari #" + item['hari'] + " .jam_pulang").html(tConvert(item['jam_pulang']))
        })
        // data_karyawan = data;
        await $.unblockUI();
      } catch (error) {
        await $.unblockUI();
        const statusCode = error.status;
        console.log(error)
        console.log(statusCode)
        if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");

        const message = error.responseJSON.message
        toastr.error(message);


      }
    }
    get_all_data();

    
  </script>

</body>

<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->

</html>