@model ProductAttributeCombinationModel

@{
    Layout = "_AdminPopupLayout";

    //page title
    ViewBag.PageTitle = T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateSeveralTitle").Text;
}

@if (ViewBag.RefreshPage == true)
{
<script>
        try {window.opener.document.forms['@(Context.Request.Query["formId"])'].@(Context.Request.Query["btnId"]).click();}
        catch (e){}
        window.close();
</script>
}

@if (Model.Warnings.Count > 0)
{
    <div class="callout callout-danger">
        <ul>
            @foreach (var warning in Model.Warnings)
            {
                <li>@warning</li>
            }
        </ul>
    </div>
}

<form asp-controller="Product" asp-action="ProductAttributeCombinationGeneratePopup"
      asp-route-productId="@Context.Request.Query["productId"]"
      asp-route-btnId="@Context.Request.Query["btnId"]"
      asp-route-formId="@Context.Request.Query["formId"]">
    <div class="content-header clearfix">
        <h1 class="float-left">
            @T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateSeveralTitle")
        </h1>
        <div class="float-right">
            <button type="submit" name="save" class="btn btn-primary">
                <i class="far fa-floppy-disk"></i>
                @T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Generate")
            </button>
            @await Component.InvokeAsync(typeof(AdminWidgetViewComponent), new { widgetZone = AdminWidgetZones.ProductAttributeCombinationDetailsButtons, additionalData = Model })
        </div>
    </div>
    <section class="content">
        <div class="container-fluid">
            <div class="form-horizontal">
                <h4>@T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.RequiredAttribute")</h4>
                <div class="form-horizontal">
                    @foreach (var attribute in Model.ProductAttributes)
                    {
                        <div class="cards-group">
                            <div class="card card-default">
                                <div class="card-header">
                                    @(attribute.Name)
                                    @if (attribute.IsRequired)
                                    {
                                        <span>*</span>
                                    }
                                </div>
                                <div class="card-body">
                                    @foreach (var attributeValue in attribute.Values)
                                    {
                                        <div>
                                            <input id="attribute_value_@(attributeValue.Id)" type="checkbox" value="@(attributeValue.Id)" name="attribute_value_@(attributeValue.Id)" @(attributeValue.Checked)/>
                                            <label for="attribute_value_@(attributeValue.Id)">@(attributeValue.Name)</label>
                                        </div>
                                    }
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </section>
</form>