@page
@model ConfigurationPannel.Pages.TestPrintModel
@{
    ViewData["Title"] = "Test Print";
}

<div class="container mt-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2>Test Print</h2>
        <a asp-page="/Logout" class="btn btn-outline-secondary">Logout</a>
    </div>

    <form method="post">
        <div class="card">
            <div class="card-header">
                <h4>Submit Test Print Job</h4>
            </div>
            <div class="card-body">
                @if (Model.WorkAreas == null || !Model.WorkAreas.Any())
                {
                    <div class="alert alert-warning">
                        No work areas found. Please check configuration.
                    </div>
                }
                else
                {
                    <div class="mb-3">
                        <label asp-for="SelectedWorkAreaId" class="form-label">Work Area</label>
                        <select asp-for="SelectedWorkAreaId" class="form-select" required>
                            <option value="">Select a work area...</option>
                            @foreach (var workArea in Model.WorkAreas)
                            {
                                <option value="@workArea.Id">@workArea.Name</option>
                            }
                        </select>
                    </div>

                    <div class="mb-3">
                        <label asp-for="PrintContent" class="form-label">Content to Print</label>
                        <textarea asp-for="PrintContent"
                                  class="form-control"
                                  rows="6"
                                  placeholder="Enter text to print..."
                                  required></textarea>
                        <small class="text-muted">Text will be printed on the assigned printer for the selected work area</small>
                    </div>

                    <button type="submit" class="btn btn-primary">Submit Print Job</button>
                }
            </div>
        </div>

        @if (!string.IsNullOrEmpty(Model.SuccessMessage))
        {
            <div class="alert alert-success mt-3">@Model.SuccessMessage</div>
        }
        @if (!string.IsNullOrEmpty(Model.ErrorMessage))
        {
            <div class="alert alert-danger mt-3">@Model.ErrorMessage</div>
        }
    </form>
</div>
