<?php
// =======================================
// demo2/inc/footer.php
// Footer + Modales + JS base (AdminLTE)
// =======================================
?>

    <!-- ================== MODALES GLOBALES ================== -->

    <div class="modal fade" id="confirm_modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-md modal-dialog-centered">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">Confirmación</h5>
          </div>
          <div class="modal-body" id="delete_content"></div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary btn-flat" id="confirm">Continuar</button>
            <button type="button" class="btn btn-secondary btn-flat" data-dismiss="modal">Cancelar</button>
          </div>
        </div>
      </div>
    </div>

    <div class="modal fade" id="uni_modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-md modal-dialog-centered">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title"></h5>
          </div>
          <div class="modal-body"></div>
          <div class="modal-footer">
            <button type="button"
                    class="btn btn-primary btn-flat"
                    onclick="$('#uni_modal form').submit()">Guardar</button>
            <button type="button"
                    class="btn btn-secondary btn-flat"
                    data-dismiss="modal">Cerrar</button>
          </div>
        </div>
      </div>
    </div>

    <div class="modal fade" id="viewer_modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-md modal-dialog-centered">
        <div class="modal-content text-center">
          <img src="" class="img-fluid">
        </div>
      </div>
    </div>

    <!-- ================== FOOTER ================== -->
    <footer class="main-footer text-sm">
      <strong>© <?= date('Y') ?> SGPPBN</strong>
      <div class="float-right d-none d-sm-inline-block">
        PMO – Planeamiento
      </div>
    </footer>

  </div> <!-- /.wrapper -->

  <!-- ================== JS BASE (ORDEN CRÍTICO) ================== -->

  <script src="<?= base_url ?>plugins/jquery/jquery.min.js"></script>
  <script src="<?= base_url ?>plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="<?= base_url ?>plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="<?= base_url ?>plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
  <script src="<?= base_url ?>dist/js/adminlte.min.js"></script>

  <script>
  $(function(){

    window.uni_modal = function(title = '', url = ''){
      start_loader();
      $.get(url, function(resp){
        $('#uni_modal .modal-title').html(title);
        $('#uni_modal .modal-body').html(resp);
        $('#uni_modal').modal({
          backdrop: 'static',
          keyboard: false
        });
        end_loader();
      });
    }

    window._conf = function(msg = '', func = '', params = []){
      $('#confirm')
        .attr('onclick', func + "(" + params.join(',') + ")");
      $('#delete_content').html(msg);
      $('#confirm_modal').modal('show');
    }

    window.viewer_modal = function(src = ''){
      $('#viewer_modal img').attr('src', src);
      $('#viewer_modal').modal('show');
    }

  });
  </script>

</body>
</html>

