<!DOCTYPE html>
<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>OpenKDS &raquo; Edit <%= station.name %></title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    
    <style>
        
        body {
            background-color: #f8f9fa;
        }
        
        
        
        
    </style>
    
</head>
<body>
    
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand" href="#">OpenKDS</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" href="/web/dashboard">Dashboard</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="/web/stations">Stations</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/stationtypes">Station Types</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/orders">Orders</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/items">Menu Items</a>
                </li>
            </ul>
        </div>
    </nav>
    
    <div class="container">
        <div class="row">
            <div class="col-12">
                <a href="/web/stations" class="btn btn-primary">Back to Stations</a>
            </div>
        </div>
        <div class="row">
            <div class="col-12">
                <h1>Edit <%=stationtype.name %>/<%= station.name %> (ID: <%= station.id %>)</h1>
                <p>Manage <%= station.name %>. You can edit the station name & check average times, find items assigned to this station and get the current order count.</p>
            </div>
        </div>
    </div>
    
    <hr />
    
    <div class="container">
        <h2>
            Station Details
        </h2>
        <p>Manage the station details.</p>
        <div class="name">
            <label for="stationName">Station Name</label>
            <input type="text" name="name" id="stationName" placeholder="Station Name" value="<%= station.name %>">
        </div>
        <div class="stationType">
            <label for="stationType">Station Type</label>
            <select name="stationType" id="stationType">
                <% stationtypes.forEach(stationtype => { %>
                    <option value="<%= stationtype.id %>" <% if (stationtype.id == station.stationTypeId) { %> selected <% } %>><%= stationtype.name %></option>
                <% }); %>
            </select>
        </div>

        <div class="save">
            <button class="btn btn-primary">Save Changes</button>
        </div>


        <h2>Items</h2>
        <p>Items assigned to this station type.</p>
        <div class="row">
            <div class="col-12">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th scope="col">ID</th>
                            <th scope="col">Name</th>
                            <th scope="col">Description</th>
                            <th scope="col">Price</th>
                            <th scope="col">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <% items.forEach(item => { %>
                            <tr>
                                <th scope="row"><%= item.id %></th>
                                <td><%= item.name %></td>
                                <td><%= item.description %></td>
                                <td><%= item.price %></td>
                                <td>
                                    <a href="/web/items/<%= item.id %>/edit" class="btn btn-primary">Edit</a>
                                    <a href="/web/items/<%= item.id %>/delete" class="btn btn-danger">Delete</a>
                                </td>
                            </tr>
                        <% }); %>
                    </tbody>
                </table>
            </div>
        </div>

        <h2>Destructive Actions</h2>
        <p>These actions are destructive and cannot be undone.</p>
        <div class="row">
            <div class="col-12">
                <a href="/web/stations/<%= station.id %>/delete" class="btn btn-danger">Delete Station</a>
            </div>
        </div>  



        
        
    </div>
    
    
</body>
</html>