<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        Admin || <%= config.name %>
    </title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.css">
    <%- include("./../components/head.ejs")%>
</head>

<body class="w-100 bg-light-light h-auto">
    <%- include("./../components/nav.ejs")%>
        <div class="w-100 content bg-light-light px-3 px-md-5 py-3" id="content">
            <h2 class="d-inline-block">Airline</h2>
            <button type="button" class="btn btn-<%= config.other.navColor[2] %> float-end" data-bs-toggle="modal"
                data-bs-target="#exampleModal">
                Add Airline
            </button>
            <div class="table-responsive">
                <table data-toggle="table" data-search="true" data-show-columns="true" id="mainTable">
                    <thead>
                        <tr class="tr-class-2">
                            <th data-field="title">Name</th>
                            <th data-field="url">Code</th>
                            <th data-field="data">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <% operators.forEach(op=>{%>
                            <tr id="tr-id-<%=op.id%>" class="tr-class-<%=op.id%>" data-title="<%=op.id%>" title="<%=op.id%>"
                                data-object='{"key": "value"}'>
                                <td id="td-id-<%=op.id%>" class="td-class-<%=op.id%>" data-title="<%=op.name%>">
                                    <strong>
                                        <%=op.name%>
                                    </strong>
                                </td>
                                <td data-text="<%= op.code%>">
                                    <%= op.code %>
                                </td>
                                <td data-text="Delete">
                                    <button <% if(op.self==0){%>class="btn btn-danger" onclick="remCode('<%=op.id%>')"<%}else{%>class="btn btn-secondary"
                                                style="cursor: not-allowed !important;" disabled<%}%>><i class="bi bi-x-circle"></i></button>
                                </td>
                            </tr>
                            <%})%>
                    </tbody>
                </table>
            </div>
            <br>
            <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel"
                aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">Add Operator</h5>
                        </div>
                        <div class="modal-body">
                            <form method="POST" action="/admin/codeshare/new" class="needs-validation" novalidate>
                                <div>
                                    <label class="form-label">Operator Name:
                                    <input class="form-control mt-1" id="newAirAirName" placeholder="VACenter Virtual" required type="text" name="airName">
                                    <div class="valid-feedback">
                                        Looks good!
                                    </div>
                                    <div class="invalid-feedback">
                                        Needs to be valid text.
                                    </div>
                                </div>
                                <div>
                                    <label class="form-label">Operator Code:
                                        <input class="form-control mt-1" id="newAirAirName" placeholder="VACV" minlength="3" maxlength="4" required type="text" name="airCode">
                                        <div class="valid-feedback">
                                            Looks good!
                                        </div>
                                        <div class="invalid-feedback">
                                            Needs to be valid text, 3 to 4 characters long.
                                        </div>
                                </div>
                                <button type="submit" class="btn btn-<%= config.other.navColor[2] %>">Submit</button>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <%- include('./../components/footer.ejs') %>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
            crossorigin="anonymous"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.js"></script>
</body>

</html>