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.

8.3 KB
Raw Blame
<div v-if="vmorder.cart.CheckoutAttributes[0]" class="checkout-attributes p-0">
    <div v-for="attribute in vmorder.cart.CheckoutAttributes" :id="'checkout_attribute_label_' + attribute.Id" class="col-12 px-0 mb-2">
        <span class="col-form-label text-prompt">
            <template v-if="attribute.TextPrompt !== null">
                {{attribute.TextPrompt}}
            </template>
            <template v-else>
                {{attribute.Name}}
            </template>
        </span>
        <span v-if="attribute.IsRequired" class="required">*</span>
        <template v-if="attribute.AttributeControlType == 4">
            <label :for="'checkout_attribute_' + attribute.Id" class="visually-hidden">checkout_attribute_{{attribute.Id}}</label>
            <input :name="'attributes['+attribute.Id+']'" type="text" class="form-control textbox" :id="'checkout_attribute_' + attribute.Id" v-model="attribute.DefaultValue" :value="attribute.DefaultValue" onchange="checkoutAttributeChange();"/>
        </template>
        <template v-if="attribute.AttributeControlType == 1">
            <label :for="'checkout_attribute_' + attribute.Id" class="visually-hidden">checkout_attribute_{{attribute.Id}}</label>
            <select :id="'checkout_attribute_' + attribute.Id" class="form-control form-select" onchange="checkoutAttributeChange()" :name="'attributes['+attribute.Id+']'">
                <template v-if="attribute.IsRequired == false">
                    <option value="">---</option>
                </template>
                <option v-for="attributeValue in attribute.Values" :selected="attributeValue.IsPreSelected" :value="attributeValue.Id">
                    <template v-if="attributeValue.PriceAdjustment == null">
                        {{attributeValue.Name}}
                    </template>
                    <template v-else>
                        {{attributeValue.Name}} [{{attributeValue.PriceAdjustment}}]
                    </template>
                </option>
            </select>
        </template>
        <template v-if="attribute.AttributeControlType == 2">
            <ul class="option-list px-0 mb-0">
                <li v-for="attributeValue in attribute.Values">
                    <fieldset>
                        <legend class="visually-hidden">
                            checkout_attribute_{{attribute.Id}}
                        </legend>
                        <label class="form-check">
                            <input class="form-check-input" :id="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'attributes['+attribute.Id+']'" :value="attributeValue.Id" :checked="attributeValue.IsPreSelected" onclick="checkoutAttributeChange()"/>
                            <span class="form-check-label"></span>
                            <span class="custom-control-description" :for="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id">
                                <template v-if="attributeValue.PriceAdjustment == null">
                                    {{attributeValue.Name}}
                                </template>
                                <template v-else>
                                    {{attributeValue.Name}} [{{attributeValue.PriceAdjustment}}]
                                </template>
                            </span>
                        </label>

                    </fieldset>
                </li>
            </ul>
        </template>
        <template v-if="attribute.AttributeControlType == 3 || attribute.AttributeControlType == 50">
            <fieldset>
                <legend></legend>
                <ul class="option-list px-0 mb-0">
                    <li v-for="attributeValue in attribute.Values">
                        <label class="form-check">
                            <input v-if="attribute.AttributeControlType == 50" class="form-check-input" :id="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id" type="checkbox" :name="'attributes['+attribute.Id+']'" :value="attributeValue.Id" onclick="checkoutAttributeChange()" :checked="attributeValue.IsPreSelected" disabled="disabled"/>
                            <input v-else class="form-check-input" :id="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id" type="checkbox" :name="'attributes['+attribute.Id+']'" :value="attributeValue.Id" onclick="checkoutAttributeChange()" :checked="attributeValue.IsPreSelected"/>
                            <span class="form-check-label"></span>
                            <span class="custom-control-description" :for="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id">
                                <template v-if="attributeValue.PriceAdjustment == null">
                                    {{attributeValue.Name}}
                                </template>
                                <template v-else>
                                    {{attributeValue.Name}} [{{attributeValue.PriceAdjustment}}]
                                </template>
                            </span>
                        </label>
                    </li>
                </ul>
            </fieldset>
        </template>
        <template v-if="attribute.AttributeControlType == 10">
            <textarea class="form-control" :id="'checkout_attribute_' + attribute.Id" :name="'attributes['+attribute.Id+']'" v-model="attribute.DefaultValue" :value="attribute.DefaultValue" onchange="checkoutAttributeChange()">{{attribute.DefaultValue}}</textarea>
        </template>
        <template v-if="attribute.AttributeControlType == 20">
            <input :id="'checkout_attribute_' + attribute.Id" :name="'attributes['+attribute.Id+']'" class="form-control" :value="attribute.DefaultValue" v-model="attribute.DefaultValue" onchange="checkoutAttributeChange();" type="date"/>
        </template>
        <template v-if="attribute.AttributeControlType == 30">
            <div :id="'checkout_attribute_' + attribute.Id + 'uploader'">
                <input class="form-control" type="file" :accept="attribute.AllowedFileExtensions" id="qqfile" name="qqfile" :data-url="'/uploadfilecheckoutattribute/' + attribute.Id" :attribute="attribute.Id" onchange="uploadFile(this)">
            </div>
            <input class="hidden-upload-input" type="hidden" onchange="checkoutAttributeChange()" :id="'checkout_attribute_' + attribute.Id" :name="'attributes['+attribute.Id+']'" v-model="attribute.DefaultValue" :value="attribute.DefaultValue"/>
            <div id="download-message" class="alert my-2" style="display:none;"></div>
            <a :id="'checkout_attribute_' + attribute.Id + 'downloadurl'" class="download-file btn btn-outline-info" style="display:none;">
                Download
            </a>
            <script type="application/json" data-grand-vm="checkoutAttributes">@Json.Serialize(new {
            routes = new { change = Url.Action("checkoutattributechange", "shoppingcart") }
        })</script>
        </template>
        <template v-if="attribute.AttributeControlType == 40">
            <ul class="option-list color-squares w-100 d-inline-flex flex-wrap px-0 mb-0" :id="'color-squares-' + attribute.Id">
                <li v-for="attributeValue in attribute.Values" class="me-1 p-0">
                    <label :for="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id" class="mb-0">
                        <input :id="'checkout_attribute_' + attribute.Id + '_' + attributeValue.Id" type="radio" :name="'attributes['+attribute.Id+']'" :value="attributeValue.Id" onchange="checkoutAttributeChange()" :checked="attributeValue.IsPreSelected"/>
                        <template v-if="attributeValue.PriceAdjustment == null">
                            <span class="color-container" :title="attributeValue.Name">
                                <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span>
                            </span>
                        </template>
                        <template v-else>
                            <span class="color-container" :title="attributeValue.Name + ' [' + attributeValue.PriceAdjustment + ']'">
                                <span class="color" :style="'background-color:' + attributeValue.ColorSquaresRgb"></span>
                            </span>
                        </template>
                    </label>
                </li>
            </ul>
        </template>

    </div>
</div>