@model EditBlog

<div id="preview">
    
</div>

@if (Model.Id is null)
{
    <h2>New Blog</h2>
}
else
{
    <h2>Edit "@Model.Title"</h2>
}

<form action="~/blogs/edit/" method="post">
    <input type="hidden" id="id" name="id" value="@Model.Id"/>
    <div>
        <label for="title">Title:</label>
        <input type="text" id="title" name="title" value="@Model.Title" required>
    </div>
    <div>
        <label for="sourceLocation">Source Location:</label>
        <input type="text" id="sourceLocation" name="sourceLocation" value="@Model.SourceLocation" required>
    </div>
    <div>
        <label for="slug">Slug:</label>
        <input type="text" id="slug" name="slug" value="@Model.Slug">
    </div>
    <div>
        <input type="checkbox" id="showDetails" name="showDetailsStr" @(Model.ShowDetails ? "checked" : "")>
        <label for="showDetails">Show Details</label>
    </div>
    <div>
        <label for="imageUrl">Image URL:</label>
        <input type="text" id="imageUrl" name="imageUrl" value="@Model.ImageUrl">
    </div>
    <div>
        <label for="createdAt">Created At:</label>
        <input type="datetime-local" id="createdAt" name="createdAt" value="@Model.CreatedAt.ToString("yyyy-MM-ddTHH:mm")" required>
    </div>
    <div>
        <label for="modifiedAt">Modified At:</label>
        <input type="datetime-local" id="modifiedAt" name="modifiedAt" value="@Model.ModifiedAt.ToString("yyyy-MM-ddTHH:mm")" required>
    </div>
    <div>
        <label for="signature">Signature:</label>
        <input type="text" id="signature" name="signature" value="@Model.Signature">
    </div>
    <div>
        <input type="checkbox" id="fullWidth" name="fullWidthStr" @(Model.FullWidth ? "checked" : "")>
        <label for="visible">FullWidth</label>
    </div>
    <div>
        <input type="checkbox" id="visible" name="visibleStr" @(Model.Visible ? "checked" : "")>
        <label for="visible">Visible</label>
    </div>
    <br/>
    <div>
        <label for="text">Text:</label>
        <textarea style="field-sizing: content" id="text" name="text" required>@Model.Text</textarea>
    </div>
    <div>
        <button type="submit" class="create-btn">
            @if (Model.Id is null)
            {
                <span>Create</span>
            }
            else
            {
                <span>Update</span>
            }
        </button>
    </div>
    <div>
        <button class="preview-btn secondary" hx-post="/blog/preview" hx-target="#preview" hx-swap="OuterHTML">Preview</button>
    </div>
</form>



