{block name='productdetails-availability-notification-form'}
    {et_isShopVersionAtLeast value="5.3.0-rc.3" assign='shopIsAtLeast53'}
    {et_isShopVersionAtLeast value="5.5.0-rc.1" assign='shopIsAtLeast55'}
    {if isset($position) && $position === 'popup'}
        {if isset($Artikelhinweise) && count($Artikelhinweise) > 0}
            {block name='productdetails-availability-notification-form-alert'}
                <div role="alert" class="alert alert-danger alert-dismissable">
                    <button type="button" aria-label="{if $shopIsAtLeast55}{lang key="close" section="aria"}{else}Close{/if}" class="close" data-dismiss="alert">
                        <i class="{et_getIcon key="close"}"></i>
                    </button>
                    <div class="sr-only">x</div>

                    {foreach $Artikelhinweise as $Artikelhinweis}
                        {$Artikelhinweis}
                    {/foreach}
                </div>
            {/block}
        {/if}
    {/if}
    {block name='productdetails-availability-notification-form-form'}
        <form action="{if !empty($Artikel->cURLFull)}{$Artikel->cURLFull}{else}{$ShopURL}/{/if}"
            method="post" id="article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}"
            class="jtl-validate label-slide availability-notification-form"
        >
            {csrf_token}
            {if $shopIsAtLeast53}{honeypot}{/if}
            {block name='productdetails-availability-notification-form-fieldset-contact'}
                <fieldset>
                    {block name='productdetails-availability-notification-form-legend-contact'}
                        <legend>{lang key='contact'}</legend>
                    {/block}
                    {if $Einstellungen.$tplscope.benachrichtigung_abfragen_vorname !== 'N' || $Einstellungen.$tplscope.benachrichtigung_abfragen_nachname !== 'N'}
                        {block name='productdetails-availability-notification-form-name'}
                            <div class="row">
                                {if $Einstellungen.$tplscope.benachrichtigung_abfragen_vorname !== 'N'}
                                <div class="col col-md-6">
                                    {include file='snippets/form_group_simple.tpl'
                                        options=[
                                            "text", "article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}_firstName", "vorname",
                                            {$Benachrichtigung->cVorname|default:null}, {lang key='firstName' section='account data'},
                                            $Einstellungen.$tplscope.benachrichtigung_abfragen_vorname|default:null, null, "given-name"
                                        ]
                                    }
                                </div>
                                {/if}

                                {if $Einstellungen.$tplscope.benachrichtigung_abfragen_nachname !== 'N'}
                                <div class="col col-md-6">
                                    {include file='snippets/form_group_simple.tpl'
                                        options=[
                                            "text", "article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}_lastName", "nachname",
                                            {$Benachrichtigung->cNachname|default:null}, {lang key='lastName' section='account data'},
                                            $Einstellungen.$tplscope.benachrichtigung_abfragen_nachname|default:null, null, "family-name"
                                        ]
                                    }
                                </div>
                                {/if}
                            </div>
                        {/block}
                    {/if}
                    {block name='productdetails-availability-notification-form-email'}
                        <div class="row">
                            <div class="col col-md-6">
                                {include file='snippets/form_group_simple.tpl'
                                    options=[
                                        "email", "article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}_email", "email",
                                        {$Benachrichtigung->cMail|default:null}, {lang key='email' section='account data'},
                                        true, $fehlendeAngaben_benachrichtigung.email|default:null, "email"
                                    ]
                                }
                            </div>
                        </div>
                    {/block}
                    {block name='productdetails-availability-notification-form-include-checkbox'}
                        {if isset($fehlendeAngaben_benachrichtigung)}
                            {include file='snippets/checkbox.tpl' nAnzeigeOrt=$smarty.const.CHECKBOX_ORT_FRAGE_VERFUEGBARKEIT cPlausi_arr=$fehlendeAngaben_benachrichtigung cPost_arr=null cIDPrefix="article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}"}
                        {else}
                            {include file='snippets/checkbox.tpl' nAnzeigeOrt=$smarty.const.CHECKBOX_ORT_FRAGE_VERFUEGBARKEIT cPlausi_arr=null cPost_arr=null cIDPrefix="article_availability{if isset($position) && $position === 'popup'}_popup{/if}{$Artikel->kArtikel}"}
                        {/if}
                    {/block}
                </fieldset>
            {/block}
            {if (!isset($smarty.session.bAnti_spam_already_checked) || $smarty.session.bAnti_spam_already_checked !== true) &&
                isset($Einstellungen.$tplscope.benachrichtigung_abfragen_captcha) && $Einstellungen.$tplscope.benachrichtigung_abfragen_captcha !== 'N' && empty($smarty.session.Kunde->kKunde)}
                {block name='productdetails-availability-notification-form-captcha'}
                    <hr>
                    <div class="row">
                        <div class="col {if !empty($fehlendeAngaben_benachrichtigung.captcha)}has-error{/if}">
                            {captchaMarkup getBody=true}
                            <hr>
                        </div>
                    </div>
                {/block}
            {/if}
            {block name='productdetails-availability-notification-form-submit'}
                <input type="hidden" name="a" value="{if $Artikel->kVariKindArtikel}{$Artikel->kVariKindArtikel}{else}{$Artikel->kArtikel}{/if}"/>
                <input type="hidden" name="show" value="1" />
                <input type="hidden" name="benachrichtigung_verfuegbarkeit" value="1" />
                <div class="row">
                    <div class="col col-12 col-md-auto">
                        {include file="widgets/base/button.tpl" type="submit" value="1" variant="primary" classes="btn-block" label="{lang key='requestNotification'}"}
                    </div>
                    {if isset($oSpezialseiten_arr[$smarty.const.LINKTYP_DATENSCHUTZ])}
                        <div class="col-12">
                            <p class="info small availability-notification-consent mt-1">
                                {sprintf("{et_language key='et360_availability_notification_consent'}", $oSpezialseiten_arr[$smarty.const.LINKTYP_DATENSCHUTZ]->getURL())}
                            </p>
                        </div>
                    {/if}
                </div>
            {/block}
        </form>
    {/block}
{/block}
