<!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>Hospital Bed Finder - Account</title>
    <link rel="icon" type="image/x-icon" href="/images/logo.png">
    <link rel="stylesheet" href="/css/account.css">
</head>
<body>
    <div id="wrapper">
        <header>
            <div class="feedHeader">
                <div class="buttonWrapper whiteText">
                    <button id="homeButton">
                        <img src="/images/left_arrow_white.png" alt="Left arrow"><span>Back to home</span>
                    </button>
                </div>
                <div class="logo">
                    <div>
                        <img src="/images/logo.png" alt="HBF_LOGO">
                    </div>
                    <h1 class="logoName">
                        <a class="whiteText" href="https://hospitalbedfinder.com">H<span class="nameLower">ospital</span> B<span class="nameLower">ed</span> F<span class="nameLower">inder</span></a>
                    </h1>    
                </div>
                <div class="buttonWrapper whiteText">
                    <button id="logoutButton">
                        <span>Logout</span>
                        <img src="/images/logout_white.png" alt="Logout">
                    </button>
                </div>
            </div>
            <div class="spacer"></div>
        </header>
        <main>
            <div class="accountWrapper">
                <div class="imageWrapper">
                    <img src="<%= image %>" alt="Hospital image">
                    <div class="imageInputWrapper">
                        <div class="imageInput">
                            <form id="imageForm" method="post">
                                <label for="imageInput" class="inputLabel">
                                    <input type="file" accept="image/*" name="image" id="imageInput"> 
                                    <span>Change picture...</span>
                                </label>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="detailsWrapper">
                    <% if (!validated) { %>
                        <div class="notice">
                            <p>
                                This hospital will not be displayed on the homepage because it is not validated.
                                To validate this account, please email us through hospitalbedfinder@gmail.com with
                                attachments to prove the legitimacy of this hospital and your association with such.
                            </p>
                        </div>
                    <% } %>
                    <form id="editForm" method="post">
                        <ul class="detailsList">
                            <li class="detail">
                                <p class="detailLabel">Name</p>
                                <p id="hospitalName" class="detailInfo"><%= name %></p>
                                <div class="detailInputWrapper">
                                    <input type="text" name="name" id="inputName" class="detailInput" placeholder="Enter name here">
                                    <p id="nameError" class="error"></p>
                                </div>
                            </li>
                            <li class="detail">
                                <p class="detailLabel">Address</p>
                                <p id="hospitalLocation" class="detailInfo"><%= location %></p>
                                <div class="detailInputWrapper">
                                    <input type="text" name="location" id="inputLocation" class="detailInput" placeholder="Enter address here">
                                </div>
                            </li>
                            <li class="detail">
                                <p class="detailLabel">Contact number</p>
                                <p id="hospitalContact" class="detailInfo"><%= contactNum %></p>
                                <div class="detailInputWrapper">
                                    <input type="text" name="contactNum" id="inputContactNum" class="detailInput" placeholder="Enter contact number here">
                                </div>
                            </li>
                            <li class="detail">
                                <p class="detailLabel">Maximum bed count</p>
                                <p id="hospitalMaxBeds" class="detailInfo"><%= maxBeds %></p>
                                <div class="detailInputWrapper">
                                    <input type="text" name="maxBeds" id="inputMaxBeds" class="detailInput" maxlength="6" placeholder="Enter maximum beds here">
                                </div>
                            </li>
                        </ul>
                    </form>
                    <div class="editWrapper">
                        <button id="editButton" class="editButton">Edit</button>
                        <div id="toggledButtonsWrapper" class="toggledButtonsWrapper">
                            <button id="saveButton" class="saveButton">Save</button>
                            <button id="cancelButton" class="cancelButton">Cancel</button>
                        </div>
                        <p id="requestError" class="error"></p>
                    </div>
                    <div class="bedCountWrapper">
                        <p class="detailLabel">Available bed count</p>
                        <div class="upperSection">
                            <span id="availableBedCount"><%= availableBeds %></span>
                            <button id="minusOneChangeBedBtn" class="negativeButton">-1</button>
                            <button id="plusOneChangeBedBtn" class="positiveButton">+1</button>
                        </div>
                        <div class="middleSection">
                            <p>Custom:</p>
                            <input type="text" name="customBedCount" id="customBedCount" maxlength="6" placeholder="Enter custom amount here">
                        </div>
                        <div class="lowerSection">
                            <button id="minusChangeBedBtn" class="negativeButton">-</button>
                            <button id="plusChangeBedBtn" class="positiveButton">+</button>
                        </div>
                        <p id="customBedCountError" class="error"></p>
                    </div>
                </div>
            </div>
        </main>
    </div>
</body>
<script>
    let baseUrl = window.location.origin;
</script>
<script src="/js/accountRedirect.js"></script>
<script src="/js/editAccount.js"></script>
<script src="/js/editImage.js"></script>
<script src="/js/availableBedsUpdate.js"></script>
</html>