<?php if(! defined('ABSPATH')) exit; ?>
<div class="row mb-5">
    <div class="col-md-12">

        <?php include(ANNFU_PLUGIN_PATH_TEMPLATE_DEFAULT . '_testo_cima_annuncio.php') ?>
        <?php $urlEpigrafe = $annuncio['fileEpigrafe'] ? explode('?', $annuncio['fileEpigrafe']) : null; ?>
        <?php $showEpigrafe = $annuncio['onoranzaFunebre']['showEpigrafe'] && filter_var($annuncio['fileEpigrafe'], FILTER_VALIDATE_URL) && $urlEpigrafe && substr($urlEpigrafe[0], -4) != '.pdf'; ?>

        <div class="row">
            <div class="col-md-8 col-xs-12">

                <div class="annfu_annuncio_wrapper ">
                    <?php $urlEpigrafe = $annuncio['fileEpigrafe'] ? explode('?', $annuncio['fileEpigrafe']) : null; ?>
                    <?php $showEpigrafe = $annuncio['onoranzaFunebre']['showEpigrafe'] && filter_var($annuncio['fileEpigrafe'], FILTER_VALIDATE_URL) && $urlEpigrafe && substr($urlEpigrafe[0], -4) != '.pdf'; ?>
                    <div class="annfu_epigrafe_wrapper <?php echo esc_attr($showEpigrafe ? '' : 'annfu_none'); ?>">
                        <a href="<?php echo esc_url($annuncio['fileEpigrafe']); ?>" rel="epigrafe"
                           class="<?php echo esc_attr(get_option('annfu_lightbox') ? 'annfu_lightbox' : ''); ?>">
                            <img src="<?php echo esc_url($annuncio['fileEpigrafe']); ?>"
                                 alt="<?php echo esc_attr($annuncio['nomeVisualizzato']); ?>">
                        </a>
                    </div>
                    <div class="annfu_annuncio text-center <?php echo esc_attr($showEpigrafe ? 'annfu_none' : ''); ?>">
                        <div class="annfu_annuncio_citazione text-right">
                            <em><?php echo wp_kses_post($annuncio['citazione'] ?? ''); ?></em></div>
                        <div class="annfu_annuncio_apertura"><?php echo wp_kses_post($annuncio['apertura'] ?? ''); ?></div>
                        <div class="annfu_annuncio_foto"
                            <?php echo esc_attr($annuncio['fotoSoloOriginale'] !== false ? "style=\"background-image:url('" . $annuncio['fotoSoloOriginale'] . "');background-position:center;background-size:cover;width:" . get_option('annfu_foto_w_annuncio', ANNFU_FOTO_W_ANNUNCIO) . "px;height:" . get_option('annfu_foto_h_annuncio', ANNFU_FOTO_H_ANNUNCIO) . "px;margin:0 auto;\"" : ""); ?>
                        >
                            <a href="<?php echo esc_url($annuncio['fotoGrande']); ?>">
                                <img style="width:<?php echo esc_attr(get_option('annfu_foto_w_annuncio', ANNFU_FOTO_W_ANNUNCIO)); ?>px;height:<?php echo esc_attr(get_option('annfu_foto_h_annuncio', ANNFU_FOTO_H_ANNUNCIO)); ?>px;<?php echo esc_html($annuncio['fotoSoloOriginale'] !== false ? 'opacity:0;' : ''); ?>"
                                     src="<?php echo esc_url($annuncio['foto']); ?>" alt="<?php echo esc_attr($annuncio['nomeVisualizzato']); ?>">
                            </a>
                        </div>
                        <h2 class="annfu_annuncio_nominativo text-center">
                            <?php echo esc_html($annuncio['titolo']); ?>
                            <?php echo esc_html($annuncio['nomeVisualizzato']); ?>
                            <?php echo wp_kses_post($annuncio['secondaRiga'] ? '<br/>' . $annuncio['secondaRiga'] : ''); ?>
                            <?php echo wp_kses_post($annuncio['terzaRiga'] ? '<br/>' . $annuncio['terzaRiga'] : ''); ?>
                        </h2>
                        <div class="annfu_annuncio_data_morte"><?php echo esc_html($annuncio['dataMorteIta']); ?></div>
                        <div class="annfu_annuncio_anni"><?php echo esc_html($annuncio['eta'] > 0 ? 'di ' . $annuncio['eta'] . ' anni' : ''); ?></div>
                        <div class="annfu_annuncio_testo"><?php echo wp_kses_post($annuncio['testo'] ?? ''); ?></div>
                        <div class="annfu_annuncio_paese text-left"><?php echo esc_html($annuncio['paese']); ?>,
                            <?php echo esc_html($annuncio['dataIta']); ?></div>
                        <div class="annfu_annuncio_onoranza_funebre text-left"><?php echo wp_kses_post($annuncio['chiusuraOnoranzaFunebre'] ?? ''); ?></div>
                    </div>
                </div>
            </div>
            <div class="col-md-4 col-xs-12 annfu_button_actions">
                <a class="annfu_open_tab_cordoglio annfu_pointer btn btn-block btn-cordoglio mb-2">Lascia un
                    cordoglio</a>
                <?php if ($annuncio['abilitatoFotoCordogli']): ?>
                    <a class="annfu_open_tab_foto annfu_pointer btn btn-block btn-photo mb-2">Invia una foto</a>
                <?php endif ?>
                <?php if (filter_var(get_option('annfu_link_fiori', ''), FILTER_VALIDATE_URL)): ?>
                    <a href="<?php echo esc_url(get_option('annfu_link_fiori')); ?>" class="btn btn-block btn-send mb-2"
                       target="_blank">Acquista fiori</a>
                <?php endif ?>
                <?php if (count($annuncio['opereBene'])): ?>
                    <a class="annfu_open_tab_foto annfu_pointer btn btn-block annfu_open_tab_opere_bene mb-2">Dona</a>
                <?php endif ?>
                <div class="annfu_annuncio_streaming_avviso">
                    <?php include(ANNFU_PLUGIN_PATH_TEMPLATE_DEFAULT . '_pulsante_streaming.php'); ?>
                </div>

                <?php include(ANNFU_PLUGIN_PATH . '/templates/360/_social.php'); ?>

            </div>
        </div>

        <?php include(ANNFU_PLUGIN_PATH_TEMPLATE_DEFAULT . '_testo_fondo_annuncio.php') ?>

    </div>
</div>

<div class="row">
    <?php if ($annuncio['tipoAnnuncio'] != 'ringraziamento'): ?>
        <div class="col-12">
            <div id="annfu_form_cordoglio_wrapper">
                <?php include(ANNFU_PLUGIN_PATH . 'templates/360/_annuncio-form.php') ?>
            </div>
        </div>
    <?php endif; ?>
</div>

<?php include(ANNFU_PLUGIN_PATH_TEMPLATE_DEFAULT . '_foto-cordogli.php') ?>

<div class="clearfix"></div>

<?php include(ANNFU_PLUGIN_PATH_TEMPLATE_DEFAULT . '_partecipazioni-cordogli.php') ?>
