{if !isset($type)}
    {assign var="type" value="radio"}
{/if}
{$isFirst = $isFirst|default:false}
{$configItemDescriptionLimit=$configItemDescriptionLimit|default:0}
{block name='productdetails-config-container-group-item-type'}
    <div data-id="{$oItem->getKonfigitem()}" id="cfg-item-{$oItem->getKonfigitem()}" class="row config-item {if $oItem->getEmpfohlen()} bg-info{/if}{if empty($bSelectable)} disabled{/if}{if $checkboxActive} active{/if}">
        {* Config Item Image *}
        {block name='productdetails-config-container-group-item-type-image'}
            <div class="col-2">
                <label for="item{$oItem->getKonfigitem()}" class="config-item-image-label">
                    {include file='snippets/image.tpl' item=$oItem->getArtikel() srcSize='sm' alt=$oItem->getName() square=false}
                </label>
            </div>
        {/block}

        {* Config Item Title & Description, Also show alerts here *}
        {block name='productdetails-config-container-group-item-type-content'}
            <div class="col-7 config-item-content">
                {* Input + Label *}
                {if $type == 'radio' || $type == 'checkbox'}
                    {block name='productdetails-config-container-group-item-type-input'}
                        <div class="custom-control custom-{$type} custom-control-inline">
                            <input
                                class="custom-control-input"
                                type="{$type}"
                                id="item{$oItem->getKonfigitem()}"
                                name="item[{$kKonfiggruppe}][]"
                                data-selected="{if isset($nKonfigitem_arr) && in_array($oItem->getKonfigitem(), $nKonfigitem_arr)}true{/if}"
                                value="{$oItem->getKonfigitem()}"
                                {if empty($bSelectable)}disabled{/if}
                                {if $type == 'radio' && $isFirst && $configGroup->getMin() > 0}required{/if}
                                {if $checkboxActive}checked{/if}
                            >

                            <label for="item{$oItem->getKonfigitem()}" class="custom-control-label">
                                {$oItem->getName()}{if empty($bSelectable)} - {lang section="productDetails" key="productOutOfStock"}{/if}
                            </label>
                        </div>
                    {/block}
                {* Label for Dropdown Selection *}
                {elseif $type == 'dropdown'}
                    <div class="dropdown-label">{$oItem->getName()}{if empty($bSelectable)} - {lang section="productDetails" key="productOutOfStock"}{/if}</div>
                {/if}

                {* Errors *}
                {if isset($aKonfigitemerror_arr[$kKonfigitem]) && $aKonfigitemerror_arr[$kKonfigitem]}
                    {block name='productdetails-config-container-group-item-type-error'}
                        <p class="box_error alert alert-danger">{$aKonfigitemerror_arr[$kKonfigitem]}</p>
                    {/block}
                {/if}

                {* Description *}
                {if !empty($cBeschreibung)}
                    {if empty($configItemDescriptionLimit) || mb_strlen($cBeschreibung) > $configItemDescriptionLimit}
                        {block name='productdetails-config-container-group-item-type-description-collapsible-control'}
                            <a class="config-item-description-collapsible-control et-collapse" data-toggle="collapse" href="#config-item-description-collapsible_{$oItem->getKonfigitem()}" aria-expanded="false" aria-controls="config-item-description-collapsible_{$oItem->getKonfigitem()}">
                                {lang key="showDescription"}

                                <i class='{et_getIcon key="collapseOpen"} et-collapse-open'></i>
                                <i class='{et_getIcon key="collapseClosed"} et-collapse-closed'></i>
                            </a>
                        {/block}
                    {/if}

                    {block name='productdetails-config-container-group-item-type-description'}
                        {if empty($configItemDescriptionLimit) || mb_strlen($cBeschreibung) > $configItemDescriptionLimit}<div id="config-item-description-collapsible_{$oItem->getKonfigitem()}" class="collapse">{/if}
                            <div class="config-item-description">
                                {$cBeschreibung}
                            </div>
                        {if empty($configItemDescriptionLimit) || mb_strlen($cBeschreibung) > $configItemDescriptionLimit}</div>{/if}
                    {/block}
                {/if}
            </div>
        {/block}

        {* Prices and Quantity *}
        {block name='productdetails-config-container-group-item-type-price-quantity'}
            <div class="col-3">
                {if $smarty.session.Kundengruppe->mayViewPrices()}
                    {block name='productdetails-config-container-group-item-type-price'}
                        <span class="config-item-price">
                        {$oItem->getPreisLocalized()}
                        {if $oItem->hasRabatt() && $oItem->showRabatt()}
                            <span class="discount">{$oItem->getRabattLocalized()} {lang key='discount'}</span>
                        {elseif $oItem->hasZuschlag() && $oItem->showZuschlag()}
                            <span class="additional">{$oItem->getZuschlagLocalized()} {lang key='additionalCharge'}</span>
                        {/if}
                        </span>
                    {/block}
                {/if}

                {block name='productdetails-config-container-group-item-type-quantity'}
                    {if $oItem->getMin() == $oItem->getMax()}
                        <span class="config-item-quantity">
                            {lang key='quantity'}: {$oItem->getInitial()}
                        </span>
                    {else}
                        <div class="config-item-quantity et-validation-error-wrapper">
                            {if !empty($nKonfigitemAnzahl_arr[$oItem->getKonfigitem()])}
                                {$itemQuantityVal = $nKonfigitemAnzahl_arr[$oItem->getKonfigitem()]}
                            {else}
                                {if $oItem->getArtikel()->fAbnahmeintervall > 0}
                                    {if $oItem->getArtikel()->fMindestbestellmenge > $oItem->getArtikel()->fAbnahmeintervall}
                                        {$itemQuantityVal = $oItem->getArtikel()->fMindestbestellmenge}
                                    {else}
                                        {$itemQuantityVal = $oItem->getArtikel()->fAbnahmeintervall}
                                    {/if}
                                {else}
                                    {if ($oItem->getInitial() > 0)}
                                        {$itemQuantityVal = $oItem->getInitial()}
                                    {else}
                                        {$itemQuantityVal = $oItem->getMin()}
                                    {/if}
                                {/if}
                            {/if}
                            <label for="quantity{$oItem->getKonfigitem()}">{lang key='quantity'}</label>
                            <input
                                type="number"
                                min="{$oItem->getMin()}"
                                max="{$oItem->getMax()}"
                                step="{if $oItem->getArtikel()->cTeilbar === 'Y' && $oItem->getArtikel()->fAbnahmeintervall == 0}any{elseif $oItem->getArtikel()->fAbnahmeintervall > 0}{$oItem->getArtikel()->fAbnahmeintervall}{else}1{/if}"
                                id="quantity{$oItem->getKonfigitem()}"
                                class="form-control quantity"
                                name="item_quantity[{$oItem->getKonfigitem()}]"
                                autocomplete="off"
                                value="{$itemQuantityVal}"
                            />
                        </div>
                    {/if}
                {/block}
            </div>
        {/block}
    </div>
{/block}