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.

3.0 KB
Raw Blame
@model SlideModel
@inject IEnumTranslationService EnumTranslation
<script>
        $(document).ready(function () {
            $("#@Html.IdFor(model => model.SliderTypeId)").change(toggleSliderType);
            toggleSliderType();
        });
        function toggleSliderType() {
            var sliderTypeId = $("#@Html.IdFor(model => model.SliderTypeId)").val();
            if (sliderTypeId == @(((int)SliderType.HomePage).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').hide();
                $('#pnlBrand').hide();
            } else if (sliderTypeId == @(((int)SliderType.Category).ToString())) {
                $('#pnlCategory').show();
                $('#pnlCollection').hide();
                $('#pnlBrand').hide();
            }else if (sliderTypeId == @(((int)SliderType.Collection).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').show();
                $('#pnlBrand').hide();
            }
            else if (sliderTypeId == @(((int)SliderType.Brand).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').hide();
                $('#pnlBrand').show();
            }
        }
</script>
@{
    Func<int, HelperResult> template = @<div class="grand-fields">
        <admin-field asp-for="@Model.Locales[item].Name"/>
        <admin-field asp-for="@Model.Locales[item].Description" asp-template="Editor"/>
        <input type="hidden" asp-for="@Model.Locales[item].LanguageId"/>
    </div>;
}
@* what the slide says, then the picture and where it shows; the slider type reveals the category,
   collection or brand picker right under it - pnlCategory, pnlCollection and pnlBrand are the ids
   the script above toggles *@
<admin-card>
    <localized-editor localized-template="@template" name="slide-info-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">
        <div class="grand-fields">
            <admin-field asp-for="Name"/>
            <admin-field asp-for="Description" asp-template="Editor"/>
        </div>
    </localized-editor>
</admin-card>
<admin-card>
    <div class="grand-fields grand-fields--2col">
        <admin-field asp-for="PictureId"/>
        <admin-field asp-for="Link"/>
        <admin-field asp-for="Published"/>
        <admin-field asp-for="FullWidth"/>
        <admin-field asp-for="Stores"/>
        <admin-field asp-for="DisplayOrder" size="sm"/>
        <div class="grand-reveal">
            <admin-field asp-for="SliderTypeId" size="md" asp-items="@EnumTranslation.ToSelectList((SliderType)Model.SliderTypeId)"/>
            <div class="grand-reveal__body grand-fields grand-fields--2col">
                <admin-field asp-for="CategoryId" id="pnlCategory"/>
                <admin-field asp-for="CollectionId" id="pnlCollection"/>
                <admin-field asp-for="BrandId" id="pnlBrand"/>
            </div>
        </div>
        <div class="grand-range">
            <admin-field asp-for="StartDateUtc"/>
            <admin-field asp-for="EndDateUtc"/>
        </div>
    </div>
</admin-card>