{* Main *}
<div style="text-align: left;">

    {if $showNews}
        <h2>{$indexNews->GetTitle()}</h2><p>{$indexNews->GetDescription()}</p>
        <a href="{url label=$objNewsElement->GetUrlLabel()}" >{$objNewsElement->GetName()}</a>
    {else}
        <h2>{$indexNews->GetName()}</h2><p>{$indexNews->GetDescription()}</p>
    {/if}
    <div class="formBox">
        <div class="trescAdd">
            <div class="cb"></div>
            <div class="formContainer">
                <div id="info_container">
                    {if isset($info)}
                        <div class="{if $error && $error!='info'}error{else}info{/if}">{$info}</div>
                    {/if}
                </div>

                <form method="post" action="{url label=current}" id="sendContactForm" class="contactForm">
                    <input name="send" type="hidden" value="true" />
                    <div class="entry">
                         <div><h5 align="center">{translate word='Dane uczestnika (służbowe)'}:</h5></div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Imię'}:</div>
                        <div class="value">{formField  name="name" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Nazwisko'}:</div>
                        <div class="value">{formField  name="surname" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Tytuł/stop. naukowy'}:</div>
                        <div class="value">{formField  name="degree" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Stanowisko'}:</div>
                        <div class="value">{formField  name="position" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Telefon'}:</div>
                        <div class="value">{formField  name="phone" type="text" errorClass="warning"}</div>
                    </div>                                        
                    <div class="entry">
                        <div class="label">{translate word='Fax'}:</div>
                        <div class="value">{formField  name="fax" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='email'}:</div>
                        <div class="value">{formField  name="email" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="cb"></div>
                    <div class="entry">
                        <div><h5 align="center">{translate word='registration_invoice_data'}:</h5></div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Instytucja'}:</div>
                        <div class="value">{formField  name="institution" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Ulica i numer'}:</div>
                        <div class="value">{formField  name="address" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Kod pocztowy'}:</div>
                        <div class="value">{formField  name="post_code" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Miejscowość'}:</div>
                        <div class="value">{formField  name="city" type="text" errorClass="warning"}</div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='NIP Instytucji'}:</div>
                        <div class="value">
                            {formField  name="nip" type="text" errorClass="warning"}
                        </div>
                    </div>
                    <div class="entry">
                        <div class="label">Dodatkowe informacje:</div>
                        <div class="value">
                            <div style="font-size: 11px; line-height: 1.3; margin-bottom: 4px;">{translate word='Do wypełnienia w przypadku posiadania identyfikatora wewnętrznego w KSEF i prośba o podanie KSeF ID wew.'}</div>
                            <textarea name="additional_info" rows="3" style="width:100%; box-sizing:border-box;">{if isset($smarty.post.additional_info)}{$smarty.post.additional_info|escape}{/if}</textarea>
                        </div>
                    </div>
                    <div class="cb"></div>
                    <div class="entry">
                        <div class="label">{translate word='registration_submit_talk'}</div>
                        <div class="value" title="s">

                            <label class="control control--radio">{translate word='registration_yes'}
                              <input type="radio" name="referat" class="referat" value="1" />
                                <div class="control__indicator"></div>
                            </label>
                            <label class="control control--radio">{translate word='registration_no'}
                                <input type="radio" name="referat" class="referat" value="2" />
                                <div class="control__indicator"></div>
                            </label>
                        </div>
                    </div>	
                    <div class="cb"></div>
                    <div class="entry">
                        <div class="label">{translate word='registration_submit_poster'}</div>
                        <div class="value" title="s">

                            <label class="control control--radio">{translate word='registration_yes'}
                                <input type="radio" name="poster" value="1" />
                                <div class="control__indicator"></div>
                            </label>
                            <label class="control control--radio">{translate word='registration_no'}
                                <input type="radio" name="poster" value="2" />
                                <div class="control__indicator"></div>
                            </label>

                        </div>
                    </div>			           

                    <div class="cb"></div>
                    <div class="entry">
                        <div class="label">{translate word='Tytuł referatu/posteru'}:</div>
                        <div class="value">{formField  name="message" type="text" errorClass="warning"}</div>
                    </div>  
                    <div class="cb"></div>
                    <div class="entry">
                        <div class="label">{translate word='Autor referatu/posteru'}:</div>
                        <div class="value">{formField  name="autor" type="text" errorClass="warning"}</div>
                    </div>  
                    <div class="cb">&nbsp;</div>
                    <div class="entry">
                        <label class="control control--checkbox" title="{translate word='agree_title'}">
                            <input type="checkbox" name="agree1" id="agree1" data-theme="d" >{translate word='agree1'}
                            <div class="control__indicator"></div>
                        </label> 
                        <label class="control control--checkbox" title="{translate word='agree_title'}">
                            <input type="checkbox" name="agree2" id="agree2" data-theme="d" >{translate word='agree2'}
                            <div class="control__indicator"></div>
                        </label> 		            
                        <div class="cb"></div>
                    </div>
                    <div class="entry">
                        <div><h5 align="center">{translate word='Udział w konrefencji'}:</h5></div>
                        
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='Opłata'}: </div>
                        <div class="value">
                          <div class="confOption"> 
                            <label class="control control--radio">{translate word='registration_fee_discount_2026'}
                              <input type="radio" name="conference_fee_disc" id="conference_fee_disc" checked="true" class="conference_fee_disc" value="1" onclick="calculatePrice();"/>
                                <div class="control__indicator"></div>
                            </label>
                            <label class="control control--radio">{translate word='registration_fee_normal_2026'}
                                <input type="radio" name="conference_fee_disc" id="conference_fee_norm" class="conference_fee_disc" value="2" onclick="calculatePrice();"/>
                                <div class="control__indicator"></div>
                            </label>
                          </div>
                        </div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='registration_full_conference_label'}: </div>
                        <div class="value">
                            <input type="hidden" name="participation_option" id="participation_option" value="full" />
                            <input type="hidden" name="one_day_lodging" id="one_day_lodging" value="0" />
                            <div class="configContainer">
                                <div class="confOption">
                                    <div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px;">
                                        <label class="control control--radio">&nbsp;
                                            <input type="radio" name="conference_fee" checked="true" id="conference_fee" class="conference_fee" value="1" onclick="$('#conference_1').show();
                                                    $('#conference_2').hide(); calculatePrice();" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        <span>{translate word='registration_participation_full_cta'}</span>
                                    </div>
                                    <div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px; margin-bottom:30px;">
                                        <label class="control control--radio">&nbsp;
                                            <input type="radio" name="conference_fee" id="conference_fee_1_lodging" class="conference_fee" value="5" onclick="calculatePrice()" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        <span>{translate word='registration_participation_one_day_lodging_cta'}</span>
                                    </div>
                                    <div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px; margin-bottom:30px;">
                                        <label class="control control--radio">&nbsp;
                                            <input type="radio" name="conference_fee" id="conference_fee_1" class="conference_fee" value="5" onclick="calculatePrice()" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        <span>{translate word='registration_participation_one_day_no_lodging_cta'}</span>
                                    </div>
                                    <div class="show--day-select" id="one-day-lodging-days" style="display:none; width:100%; margin-bottom:30px; flex-direction:column; gap:10px;">
                                        <span>{translate word='registration_select_day'}:</span>
                                        {foreach from=$registrationSettings.days_lodging item=day}
                                        <label class="control control--radio">{$day}
                                            <input type="radio" name="participation_days" value="{$day}" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        {/foreach}
                                    </div>
                                    <div class="show--day-select" id="one-day-no-lodging-days" style="display:none; width:100%; margin-bottom:30px; flex-direction:column; gap:10px;">
                                        <span>{translate word='registration_select_day'}:</span>
                                        {foreach from=$registrationSettings.days_no_lodging item=day}
                                        <label class="control control--radio">{$day}
                                            <input type="radio" name="participation_days" value="{$day}" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        {/foreach}
                                    </div>
                                    <script>
                                        {literal}
                                          var registrationPrices = {/literal}{$registrationPricesJson}{literal};
                                          var registrationVatMultiplier = parseFloat('{/literal}{$registrationVatMultiplier}{literal}');

                                          $(function () {  
                                            $('#conference_1').show();
                                            calculatePrice();
                                          });
                                          $('.conference_fee').on('change', showSelectDate);
                                          
                                        function showSelectDate() {
                                            const selectedId = $('.conference_fee:checked').attr('id');
                                            $('#one_day_lodging').val('0');
                                            $('#participation_option').val('full');
                                            $('#one-day-lodging-days').hide();
                                            $('#one-day-no-lodging-days').hide();

                                            if (selectedId === 'conference_fee_1_lodging') {
                                                $('#participation_option').val('one_day_lodging');
                                                $('#one_day_lodging').val('1');
                                                $('#one-day-lodging-days').css('display', 'flex');
                                            }
                                            if (selectedId === 'conference_fee_1') {
                                                $('#participation_option').val('one_day_no_lodging');
                                                $('#one-day-no-lodging-days').css('display', 'flex');
                                            }
                                        }

                                          function calculatePrice() {
                                             if ($("#conference_fee_disc").is(':checked')) {
                                                 //alert('disc');
                                                var price = {/literal}{$arrayPricePromJson}{literal};
                                                var priceVat = {/literal}{$arrayPricePromVatJson}{literal};
                                              } 
                                              if ($("#conference_fee_norm").is(':checked')) {
                                                //alert('normal');
                                                var price = {/literal}{$arrayPriceJson}{literal};
                                                var priceVat = {/literal}{$arrayPriceVatJson}{literal};
                                              }  
                                              
                                              
                                                    var sumPrice = 0;
                                                    var sumPriceVat = 0;
                                                    var price_info = '';

                                                    let promo = $("#conference_fee_norm").is(':checked')

                                                    if ($("#conference_fee").is(':checked')) {
                                                        sumPrice = price[1];
                                                        sumPriceVat = priceVat[1];
                                                        price_info += 'cała conf ';
                                                    }                                          

                                                    if ($('#conference_fee_1').is(':checked')) {
                                                        sumPrice = !promo ? parseFloat(registrationPrices.one_day.price_prom) : parseFloat(registrationPrices.one_day.price_normal);
                                                        sumPriceVat = sumPrice * registrationVatMultiplier;
                                                        price_info += '1-dniowa';
                                                    }
                                                    if ($('#conference_fee_1_lodging').is(':checked')) {
                                                        sumPrice = !promo ? parseFloat(registrationPrices.one_day.price_prom) : parseFloat(registrationPrices.one_day.price_normal);
                                                        sumPriceVat = sumPrice * registrationVatMultiplier;
                                                        price_info += '1-dniowa z noclegiem';
                                                    }
                                                      
                                                    if ($("#price_plus_room").is(':checked')) {
                                                       sumPrice = sumPrice + price[2];
                                                       sumPriceVat = sumPriceVat + priceVat[2];
                                                       price_info += 'pokój jedynka ';
                                                    }
                                                    if ($("#price_plus_person").is(':checked')) {
                                                       sumPrice = sumPrice + price[3];
                                                       sumPriceVat = sumPriceVat + priceVat[3];
                                                       price_info += 'osoba dodatkoawa ';
                                                    }
                                                    if ($("#price_plus_ang").is(':checked')) {
                                                        sumPrice = sumPrice + price[4];
                                                        sumPriceVat = sumPriceVat + priceVat[4];
                                                        price_info += 'ang ';
                                                    }
                                                    if ($("#conference_fee_one").is(':checked')) {
                                                       sumPrice = price[5];
                                                       sumPriceVat = priceVat[5];
                                                       price_info = 'jeden dzień ';
                                                     }
                                                    $("p.price_full_fee").html(sumPrice.toFixed(2) + ' PLN netto ' + '(' + sumPriceVat.toFixed(2) + ' PLN brutto)');
                                                    //alert(sumPrice);
                                                    $("p.price_info").html(price_info);
                                                    window.sumPrice = sumPrice;
                                                    window.sumPriceVat = sumPriceVat;
                                            
                                          }
                                            $(function () {  
                                                $(".conference_fee").on('change', function () { 
                                                  if ($("#conference_fee_one").is(':checked')) {                                                        
                                                        $("#price_plus_room").prop("checked", false);
                                                        $("#price_plus_ang").prop("checked", false);
                                                        $("#price_plus_person").prop("checked", false);                                                        
                                                    }                                                    
                                                });
                                            });
                                        {/literal}
                                    </script>
                                    <div class="confOptionContainer" id="conference_1">
                                        <label class="control control--checkbox" > {translate word='registration_single_room_surcharge'}
                                          <input type="checkbox" name="fee_room1" class="price_plus_room" id="price_plus_room" data-theme="d" value="2" onchange="calculatePrice();" >
                                            <div class="control__indicator"></div>
                                        </label>
                                        <label class="control control--checkbox" > {translate word='registration_accompanying_driver_fee'}
                                            <input type="checkbox" name="fee_room_add_person" id="price_plus_person" data-theme="d" onclick="$('#price_plus_room').prop
                                                    ("checked", true);" value="3" onchange="calculatePrice();" >
                                            <div class="control__indicator"></div>
                                        </label>
                                      <label class="control control--checkbox" style="display: none;" > Udział w kongresie Ang. 
                                            <input type="checkbox" name="fee_ang_conference" id="price_plus_ang" data-theme="d" value="4" onchange="calculatePrice();" >
                                            <div class="control__indicator"></div>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>  
                    <div class="entry" style="display:none;">
                        <div class="label">{translate word='Jeden dzień (bez noclegu)'}:</div>
                        <div class="value">
                            <div class="configContainer">
                                <div class="confOption"> 
                                    <label class="control control--radio">&nbsp;
                                        <input type="radio" name="conference_fee" id="conference_fee_one" class="conference_fee" value="5"  onclick="$('#conference_1').hide();
                                                $('#conference_2').show(); calculatePrice();" />
                                        <div class="control__indicator"></div>
                                    </label>
                                    <div class="confOptionContainer" id="conference_2">
                                        Wybierz dzień kongresu:
                                        <label class="control control--radio">03.11
                                            <input type="radio" name="day_conference" value="3.11" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        <label class="control control--radio">04.11
                                            <input type="radio" name="day_conference" value="4.11" />
                                            <div class="control__indicator"></div>
                                        </label>
                                        <label class="control control--radio">5.11
                                            <input type="radio" name="day_conference" value="5.11" />
                                            <div class="control__indicator"></div>
                                        </label>
										<label class="control control--radio">6.11
                                            <input type="radio" name="day_conference" value="6.11" />
                                            <div class="control__indicator"></div>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>  
                    <div class="entry">
                        <div class="label">{translate word='registration_diet_preferences'}:</div>
                        <div class="value">
                            <label class="control control--radio">{translate word='registration_diet_standard'}
                                <input type="radio" name="diet" value="1" checked="checked" onclick="$('#diet_special_container').hide(); $('#diet_special').val('');" />
                                <div class="control__indicator"></div>
                            </label>
                            <label class="control control--radio">{translate word='registration_diet_special'}
                                <input type="radio" name="diet" value="2" onclick="$('#diet_special_container').show();" />
                                <div class="control__indicator"></div>
                            </label>
                            <div id="diet_special_container" style="display:none; margin-top:10px;">
                                <label for="diet_special">{translate word='registration_diet_which'}</label>
                                <input type="text" name="diet_special" id="diet_special" />
                            </div>
                        </div>
                    </div>
                    <div class="entry">
                        <div class="label">{translate word='registration_conference_price'}</div>
                        <div class="value"><p class="price_full_fee" style="margin: 0px;">&nbsp;</p></div>
                        
                    </div>

 <div class="entry">
                        <div><h5 align="center">&nbsp;</h5></div>
                    </div>

                    <div class="cb"></div>
                    <div>
                            <p>{$indexNews->GetShortnote()}</p>
                    </div>

                    
                    <div class="entry" style="padding-top: 1.1em;">
                    <div class="label"> </div>
                    <div class="value"><div class="g-recaptcha" data-sitekey="6LfUVuoUAAAAAD7noZ6S0rf8ZPiZKQ2KVpNBA274" data-callback="recaptchaCallback"></div>
                    <input type="hidden" class="hiddenRecaptcha required" name="hiddenRecaptcha" id="hiddenRecaptcha">
                    </div>
                    </div>
                    <div class="entry entryLast">
                        <div class="label">&nbsp;</div>
                        <div class="value"><input class="button _sendContact" type="button" id="form--send" value="{translate word='send'}" /></div>
                    </div>	

                </form>
            </div>
            <div class="cb"></div>
        </div>


    </div>
</div>


