Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

2.1 KB
Raw Blame
@using Microsoft.AspNetCore.Mvc.Razor
@model SpecificationAttributeOptionModel

<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden"/>
<input asp-for="SpecificationAttributeId" type="hidden"/>
@{
    if (string.IsNullOrEmpty(Model.ColorSquaresRgb))
    {
        Model.ColorSquaresRgb = "#FFFFFF";
    }
}

<script>

    $("#@Html.IdFor(model => model.EnableColorSquaresRgb)").click(toggleEnableColorSquaresRgb);
    toggleEnableColorSquaresRgb();


function toggleEnableColorSquaresRgb() {
    if ($('#@Html.IdFor(model => model.EnableColorSquaresRgb)').is(':checked')) {
        $('#pnlColorSquaresRgb').show();
    } else {
        $('#pnlColorSquaresRgb').hide();
    }
}
</script>
<partial name="Partials/WidgetZone.Option.Top"/>

@{
    Func<int, HelperResult>
        template = @<div class="grand-fields">
            <admin-field asp-for="@Model.Locales[item].Name"/>
            <input asp-for="@Model.Locales[item].LanguageId" type="hidden"/>
        </div>;
}
<localized-editor localized-template="@template" name="specificationattribute-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">
    <div class="grand-fields">
        <admin-field asp-for="Name"/>
    </div>
</localized-editor>
@* pnlColorSquaresRgb is what toggleEnableColorSquaresRgb() above shows and hides *@
<div class="grand-fields grand-fields--2col">
    <admin-field asp-for="SeName"/>
    <admin-field asp-for="DisplayOrder" size="sm"/>
    <admin-field asp-for="EnableColorSquaresRgb"/>
    <admin-field asp-for="ColorSquaresRgb" id="pnlColorSquaresRgb">
        <admin-input asp-for="ColorSquaresRgb"/>
        <div id="color-picker"></div>
        <script>
            $('#color-picker').farbtastic('#@Html.IdFor(model => model.ColorSquaresRgb)');
        </script>
    </admin-field>
</div>
<partial name="Partials/WidgetZone.Option.Bottom" model="Model"/>
<div class="grand-popup__actions">
    <partial name="Partials/WidgetZone.OptionButtons"/>
    <button class="btn btn-primary" type="submit" name="save">
        <i class="bi bi-check-lg"></i> @Loc["Admin.Common.Save"]
    </button>
</div>