<?php include 'config/_globle.php'; ?>
<?php include 'api/config/database.php'; ?>
<?php include 'api/AUTh/check_user_session.php'; ?>

<?php include_once 'api/objects/createrole.php'; ?>
<?php include 'api/AUTh/get_role_permission.php'; ?>

<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <link rel="shortcut icon" type="image/x-icon" href="<?=$app_url;?>img/logo_sm.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>Car Rental</title>
    <!-- CSS files -->

    <link href="<?=$app_url;?>dist/css/tabler.min.css?1692870487" rel="stylesheet"/>
    <link href="<?=$app_url;?>dist/css/tabler-flags.min.css?1692870487" rel="stylesheet"/>
    <link href="<?=$app_url;?>dist/css/tabler-payments.min.css?1692870487" rel="stylesheet"/>
    <link href="<?=$app_url;?>dist/css/tabler-vendors.min.css?1692870487" rel="stylesheet"/>
    <link href="<?=$app_url;?>dist/css/demo.min.css?1692870487" rel="stylesheet"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css"> -->
    <!--<link rel="stylesheet" href="<?=$app_url;?>custom_dist/css/datatables.min.css" />-->

    <!-- SweetAlert2 CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
    <!-- SweetAlert2 JS -->

    <!-- datatable -->
    <link rel="stylesheet" href="<?=$app_url;?>custom_dist/css/datatables.min.css" />
    <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.dataTables.min.css">


    <style>
      @import url('https://rsms.me/inter/inter.css');
      :root {
      	--tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
        --car-rental-primary: #1f4e79;
        --car-rental-primary-dark: #153957;
        --car-rental-accent: #f59f00;
        --car-rental-bg: #f4f7fb;
        --car-rental-panel: #f1f6fb;
        --car-rental-panel-warm: #fff8eb;
        --car-rental-border: #d7e3ee;
      }
      body {
      	font-feature-settings: "cv03", "cv04", "cv11";
        background: var(--car-rental-bg);
      }
      .page-header {
        background: linear-gradient(90deg, rgba(31, 78, 121, 0.08), rgba(245, 159, 0, 0.08));
        border-bottom: 1px solid var(--car-rental-border);
        padding: 1rem 0;
      }
      .page-title {
        color: #102a43;
        font-weight: 750;
      }
      .card {
        border-color: var(--car-rental-border);
        box-shadow: 0 8px 22px rgba(31, 78, 121, 0.06);
      }
      .card > .card-header,
      .modal-header {
        background: var(--car-rental-panel);
        border-bottom-color: var(--car-rental-border);
      }
      .form-label {
        color: var(--car-rental-primary-dark);
        font-weight: 650;
      }
      .form-control,
      .form-select,
      .input-group-text {
        border-color: #d8e1ea;
      }
      .form-control:focus,
      .form-select:focus {
        border-color: var(--car-rental-primary);
        box-shadow: 0 0 0 0.18rem rgba(31, 78, 121, 0.16);
      }
      .input-group .btn {
        border-color: #c9d8e5;
      }
      .table thead th {
        color: #fff;
        background: var(--car-rental-primary);
        border-color: var(--car-rental-primary);
      }
      .table tbody tr:hover {
        background: #eef5fb;
      }
      .dataTables_wrapper .dataTables_length select,
      .dataTables_wrapper .dataTables_filter input,
      .select2-container--default .select2-selection--single,
      .select2-container--default .select2-selection--multiple {
        border-color: #d8e1ea;
        background-color: #fbfdff;
      }
      .select2-container--default.select2-container--focus .select2-selection--single,
      .select2-container--default.select2-container--focus .select2-selection--multiple,
      .select2-container--default .select2-selection--single:focus,
      .select2-container--default .select2-selection--multiple:focus {
        border-color: var(--car-rental-primary);
        box-shadow: 0 0 0 0.18rem rgba(31, 78, 121, 0.16);
      }
      .select2-container--default .select2-results__option--highlighted[aria-selected] {
        background-color: var(--car-rental-primary);
      }
      .dataTables_wrapper .dataTables_paginate .paginate_button.current,
      .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
        color: #fff !important;
        border-color: var(--car-rental-primary) !important;
        background: var(--car-rental-primary) !important;
      }
      .dropdown-item:hover {
        background-color: #eef5fb;
        color: var(--car-rental-primary-dark);
      }
      .btn-primary {
        --tblr-btn-bg: var(--car-rental-primary);
        --tblr-btn-border-color: var(--car-rental-primary);
        --tblr-btn-hover-bg: var(--car-rental-primary-dark);
        --tblr-btn-hover-border-color: var(--car-rental-primary-dark);
        --tblr-btn-active-bg: var(--car-rental-primary-dark);
        --tblr-btn-active-border-color: var(--car-rental-primary-dark);
      }
      .btn-outline-success {
        --tblr-btn-color: var(--car-rental-primary);
        --tblr-btn-border-color: var(--car-rental-primary);
        --tblr-btn-hover-bg: var(--car-rental-primary);
        --tblr-btn-hover-border-color: var(--car-rental-primary);
        --tblr-btn-active-bg: var(--car-rental-primary-dark);
        --tblr-btn-active-border-color: var(--car-rental-primary-dark);
      }
      .btn-success {
        --tblr-btn-bg: var(--car-rental-accent);
        --tblr-btn-border-color: var(--car-rental-accent);
        --tblr-btn-color: #1f2937;
        --tblr-btn-hover-bg: #d98900;
        --tblr-btn-hover-border-color: #d98900;
        --tblr-btn-hover-color: #111827;
      }

    </style>
<script>

function showAlert(message, type = 'success', number) {
    const alertContainer = document.getElementById(`alertContainer${number}`); // Correct interpolation
    const alertHtml = `
        <div class="alert alert-important alert-${type} alert-dismissible fade show mt-5" role="alert">
            ${message}
        </div>
    `;
    
    alertContainer.innerHTML += alertHtml; // Append the alert to the container

    setTimeout(() => {
        $(`#alertContainer${number} .alert`).alert('close'); // Close the alert with correct selector
    }, 2000);
}



</script>
<!-- Delete Confirmation Modal -->
<div class="modal modal-blur fade" id="modal-delete" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="modal-title">Delete this record?</div>
                <div>This action cannot be undone.</div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-link link-secondary me-auto" data-bs-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-danger" id="confirm-delete">Yes</button>
            </div>
        </div>
    </div>
</div>



  </head>
  <body class="layout-fluid">
    <script src="<?=$app_url;?>dist/js/demo-theme.min.js?1692870487"></script>
    <div class="page">
      <!-- Navbar -->
    <div class="">
      <header class="navbar navbar-expand-md  d-print-none " style="background-color: #1f4e79;" >
        <div class="container-xl">
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
            <a href="<?=$app_url;?>" style="color: white;">
              <!-- <img src="<?=$app_url;?>img/logo_sm.png" width="110" height="32" alt="Tabler" class="navbar-brand-image"> -->
              Car Rental
            </a>
          </h1>
          <!-- <div class="navbar-nav flex-row order-md-last "> -->
            <!-- <div class="nav-item d-none d-md-flex me-3">
              <div class="btn-list">
                <a href="https://github.com/sponsors/codecalm" class="btn" target="_blank" rel="noreferrer">
                  <svg xmlns="http://www.w3.org/2000/svg" class="icon text-pink" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" /></svg>
                  
                </a>
              </div>
            </div> -->
     <!--       <div class="d-none d-md-flex">-->
     <!--         <a href="?theme=dark" class="nav-link px-0 hide-theme-dark" title="Enable dark mode" data-bs-toggle="tooltip"-->
		   <!--data-bs-placement="bottom">-->
                <!-- Download SVG icon from http://tabler-icons.io/i/moon -->
     <!--           <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /></svg>-->
     <!--         </a>-->
     <!--         <a href="?theme=light" class="nav-link px-0 hide-theme-light" title="Enable light mode" data-bs-toggle="tooltip"-->
		   <!--data-bs-placement="bottom">-->
                <!-- Download SVG icon from http://tabler-icons.io/i/sun -->
     <!--           <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /><path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7" /></svg>-->
     <!--         </a>-->
              <!--<div class="nav-item dropdown d-none d-md-flex me-3">-->
              <!--  <a href="#" class="nav-link px-0" data-bs-toggle="dropdown" tabindex="-1" aria-label="Show notifications">-->
                  <!-- Download SVG icon from http://tabler-icons.io/i/bell -->
              <!--    <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" /><path d="M9 17v1a3 3 0 0 0 6 0v-1" /></svg>-->
              <!--    <span class="badge bg-red"></span>-->
              <!--  </a>-->
              <!--  <div class="dropdown-menu dropdown-menu-arrow dropdown-menu-end dropdown-menu-card">-->
              <!--    <div class="card">-->
              <!--      <div class="card-header">-->
              <!--        <h3 class="card-title">Last updates</h3>-->
              <!--      </div>-->
              <!--      <div class="list-group list-group-flush list-group-hoverable">-->
              <!--        <div class="list-group-item">-->
              <!--          <div class="row align-items-center">-->
              <!--            <div class="col-auto"><span class="status-dot status-dot-animated bg-red d-block"></span></div>-->
              <!--            <div class="col text-truncate">-->
              <!--              <a href="#" class="text-body d-block">Example 1</a>-->
              <!--              <div class="d-block text-secondary text-truncate mt-n1">-->
              <!--                Change deprecated html tags to text decoration classes (#29604)-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-auto">-->
              <!--              <a href="#" class="list-group-item-actions">-->
                              <!-- Download SVG icon from http://tabler-icons.io/i/star -->
              <!--                <svg xmlns="http://www.w3.org/2000/svg" class="icon text-muted" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z" /></svg>-->
              <!--              </a>-->
              <!--            </div>-->
              <!--          </div>-->
              <!--        </div>-->
              <!--        <div class="list-group-item">-->
              <!--          <div class="row align-items-center">-->
              <!--            <div class="col-auto"><span class="status-dot d-block"></span></div>-->
              <!--            <div class="col text-truncate">-->
              <!--              <a href="#" class="text-body d-block">Example 2</a>-->
              <!--              <div class="d-block text-secondary text-truncate mt-n1">-->
              <!--                justify-content:between ⇒ justify-content:space-between (#29734)-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-auto">-->
              <!--              <a href="#" class="list-group-item-actions show">-->
                              <!-- Download SVG icon from http://tabler-icons.io/i/star -->
              <!--                <svg xmlns="http://www.w3.org/2000/svg" class="icon text-yellow" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z" /></svg>-->
              <!--              </a>-->
              <!--            </div>-->
              <!--          </div>-->
              <!--        </div>-->
              <!--        <div class="list-group-item">-->
              <!--          <div class="row align-items-center">-->
              <!--            <div class="col-auto"><span class="status-dot d-block"></span></div>-->
              <!--            <div class="col text-truncate">-->
              <!--              <a href="#" class="text-body d-block">Example 3</a>-->
              <!--              <div class="d-block text-secondary text-truncate mt-n1">-->
              <!--                Update change-version.js (#29736)-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-auto">-->
              <!--              <a href="#" class="list-group-item-actions">-->
                              <!-- Download SVG icon from http://tabler-icons.io/i/star -->
              <!--                <svg xmlns="http://www.w3.org/2000/svg" class="icon text-muted" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z" /></svg>-->
              <!--              </a>-->
              <!--            </div>-->
              <!--          </div>-->
              <!--        </div>-->
              <!--        <div class="list-group-item">-->
              <!--          <div class="row align-items-center">-->
              <!--            <div class="col-auto"><span class="status-dot status-dot-animated bg-green d-block"></span></div>-->
              <!--            <div class="col text-truncate">-->
              <!--              <a href="#" class="text-body d-block">Example 4</a>-->
              <!--              <div class="d-block text-secondary text-truncate mt-n1">-->
              <!--                Regenerate package-lock.json (#29730)-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-auto">-->
              <!--              <a href="#" class="list-group-item-actions">-->
                              <!-- Download SVG icon from http://tabler-icons.io/i/star -->
              <!--                <svg xmlns="http://www.w3.org/2000/svg" class="icon text-muted" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z" /></svg>-->
              <!--              </a>-->
              <!--            </div>-->
              <!--          </div>-->
              <!--        </div>-->
              <!--      </div>-->
              <!--    </div>-->
              <!--  </div>-->
              <!--</div>-->
            <!-- </div> -->
            <div class="nav-item dropdown">
              <a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-bs-toggle="dropdown" aria-label="Open user menu">
              <span class="avatar avatar-sm" style="background-image: url(<?=$app_url;?>api/createaccount/<?=$_SESSION['profilepicture'];?>)"></span>

                <div class="d-none d-xl-block ps-2" style="color: white;">
                  <div><?= isset($_SESSION['user']) ? $_SESSION['user'] : ''; ?></div>
                  <!-- <div class="mt-1 small text-secondary">UI Designer</div> -->
                </div>
              </a>
              <div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
                <!--<a href="<?=$app_url;?>profile.html" class="dropdown-item">Profile</a>-->
                <!--<a href="<?=$app_url;?>admin/userrolelist.php" class="dropdown-item">Role</a>-->
                <!--<a href="<?=$app_url;?>admin/userlist.php" class="dropdown-item">Account</a>-->
                <!--<div class="dropdown-divider"></div>-->
                <!--<a href="<?=$app_url;?>settings.html" class="dropdown-item">Settings</a>-->
                <a href="<?=$app_url;?>logout.php" class="dropdown-item">Logout</a>
              </div>
            </div>
          </div>
        </div>
      </header>
      <script>
        var APP_URL = '<?=$app_url;?>';
        
      </script>

