@{
    ViewBag.Title = "wallpaper";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2 class="text-white mt-3 mb-3">Wallpaper</h2>
<p class="text-white-50">This image is used as the background on every public page.</p>
@if (TempData["ok"] != null)
{<div class="alert alert-success">@TempData["ok"]</div>}

<div class="mb-4">
    <label class="text-white d-block mb-2">Current wallpaper</label>
    <img src="@ViewBag.CurrentWallpaper" style="max-width:100%;max-height:300px;border-radius:8px;border:1px solid #444;" />
</div>

@using (Html.BeginForm("Wallpaper", "admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()

    <div class="mb-3">
        <label class="text-white">New wallpaper image</label>
        <img id="wallpaperPreview" style="display:none;max-width:100%;max-height:300px;border-radius:8px;" class="mb-2 d-block" />
        <input id="wallpaperFile" type="file" name="wallpaperFile" class="form-control bg-dark text-white" accept="image/*" />
        <button type="button" class="btn btn-outline-light btn-sm mt-2" onclick="PasteImageModal.open('#wallpaperFile', '#wallpaperPreview')">
            <i class="fa-solid fa-paste me-1"></i>Paste image
        </button>
        <small class="text-muted d-block mt-1">PNG, JPG, WEBP or GIF.</small>
    </div>

    <button class="btn btn-success">Upload New Wallpaper</button>
}

@using (Html.BeginForm("WallpaperReset", "admin", FormMethod.Post, new { onsubmit = "return confirm('Reset wallpaper to the default image?');" }))
{
    @Html.AntiForgeryToken()
    <button type="submit" class="btn btn-secondary mt-2">Reset to Default</button>
}
