<% include _header %>

<h1>Edit Profile</h1>

<form action="/edit-profile" method="POST" enctype="multipart/form-data">

    <input name="given" type="text" class="form-control"
        placeholder="given name" 
        value="<%= currentUser.name.given || "" %>">

    <input name="middle" type="text" class="form-control"
        placeholder="middle name" 
        value="<%= currentUser.name.middle || "" %>">

    <input name="family" type="text" class="form-control"
        placeholder="family name" 
        value="<%= currentUser.name.family || "" %>">

    <input name="dob" type="date" class="form-control"
        placeholder="dob" 
        value="<%= currentUser.dob || "" %>">

    <input name="street" class="form-control"
        placeholder="street"
        value="<%= currentUser.address.street || "" %>">
        
    <input name="city" class="form-control"
        placeholder="city"
        value="<%= currentUser.address.city || "" %>">
    
    <select name="state">
        <% if (currentUser.address.state === "") { %> 
            <option value="">Choose...</option>
        <% } else { %> 
            <option value="<%= currentUser.address.state %>"><%= currentUser.address.state %></option>
        <% } %> 
        <option value="NSW">NSW</option>
        <option value="VIC">VIC</option>
        <option value="QLD">QLD</option>
        <option value="ACT">ACT</option>
        <option value="SA">SA</option>
        <option value="NT">NT</option>
        <option value="WA">WA</option>
        <option value="TAS">TAS</option>
    </select>
        
    <input name="postcode" class="form-control"
        placeholder="postcode"
        value="<%= currentUser.address.postcode || "" %>">
        
    <input name="mobile" class="form-control"
        placeholder="mobile"
        value="<%= currentUser.mobile || "" %>">
        
    <input name="email" class="form-control"
        placeholder="email"
        value="<%= currentUser.email || "" %>">

    <input type="file" name="profile-image">
    
    <input type="submit" value="Update" class="btn btn-primary btn-block">
</form>

<% include _footer %>