Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<ul class="bulletin-tabs">
    #foreach($entry in $bulletins.entrySet())
        <li data-tab="$entry.key">
            $entry.key
        </li>
    #end
</ul>
<div class="timeline-wrapper">
    #foreach($entry in $bulletins.entrySet())

        <div class="bulletin-tab-content" id="tab-$entry.key">

            <div class="timeline-wrapper">

                #foreach($bulletin in $entry.value)
                    <div class="timeline-row">

                        <div class="timeline-card">
                            <div class="card-header">
                                <div class="header-text">

                                    <div class="timeline-time">
                                        $bulletin.getCreatedTime()
                                        #if($bulletin.getCreatedBy())
                                            | By- $bulletin.getCreatedBy()
                                        #end
                                    </div>

                                    #if($bulletin.isCatalogOffer())
                                        <strong>
                                            <a class="today-bulletin-offer"
                                               data-offerid="$bulletin.offerId">
                                                ${bulletin.title}
                                            </a>
                                        </strong>
                                    #elseif(${bulletin.title})
                                        <strong>${bulletin.title}</strong>
                                    #end

                                </div>
                            </div>

                            <div class="card-body">
                                $bulletin.description

                                #if($bulletin.catalogBriefList)
                                    <p>
                                        #foreach($catalog in $bulletin.catalogBriefList)
                                            <span>${catalog.modelName}</span>,
                                        #end
                                    </p>
                                #end

                                #if($bulletin.documentIds && $bulletin.documentIds.size() > 0)
                                    <div class="bulletin-attachments">
                                        #foreach($docId in $bulletin.documentIds)
                                            <a href="$rc.contextPath/document/$docId"
                                               target="_blank">
                                                Attachment
                                            </a>
                                        #end
                                    </div>
                                #end

                            </div>
                        </div>

                    </div>
                #end

            </div>
        </div>

    #end

</div>


<script>


    $(document).on('click', '.today-bulletin-offer', function () {
        let offerId = $(this).data("offerid");
        doGetAjaxRequestHandler(`${context}/getOfferMargins?offerId=${offerId}`, function (data) {
            $('#todayBulletinOfferDescription .modal-content').html(data);
            $("#todayBulletinOfferDescription").modal('show');
        });
    });


    document.querySelectorAll('.bulletin-tabs li').forEach(tab => {
        tab.addEventListener('click', function () {

            document.querySelectorAll('.bulletin-tabs li')
                    .forEach(t => t.classList.remove('active'));

            document.querySelectorAll('.bulletin-tab-content')
                    .forEach(c => c.style.display = 'none');

            this.classList.add('active');
            document.getElementById('tab-' + this.dataset.tab).style.display = 'block';
        });
    });

    /* Activate first tab by default */
    document.querySelector('.bulletin-tabs li')?.click();

</script>