Subversion Repositories SmartDukaan

Rev

Rev 35583 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
35583 ranu 1
<ul class="bulletin-tabs">
2
    #foreach($entry in $bulletins.entrySet())
3
        <li data-tab="$entry.key">
4
            $entry.key
5
        </li>
6
    #end
7
</ul>
8
<div class="timeline-wrapper">
9
    #foreach($entry in $bulletins.entrySet())
10
 
11
        <div class="bulletin-tab-content" id="tab-$entry.key">
12
 
13
            <div class="timeline-wrapper">
14
 
15
                #foreach($bulletin in $entry.value)
16
                    <div class="timeline-row">
17
 
18
                        <div class="timeline-card">
19
                            <div class="card-header">
20
                                <div class="header-text">
21
 
22
                                    <div class="timeline-time">
23
                                        $bulletin.getCreatedTime()
24
                                        #if($bulletin.getCreatedBy())
25
                                            | By- $bulletin.getCreatedBy()
26
                                        #end
27
                                    </div>
28
 
29
                                    #if($bulletin.isCatalogOffer())
30
                                        <strong>
31
                                            <a class="today-bulletin-offer"
32
                                               data-offerid="$bulletin.offerId">
33
                                                ${bulletin.title}
34
                                            </a>
35
                                        </strong>
36
                                    #elseif(${bulletin.title})
37
                                        <strong>${bulletin.title}</strong>
38
                                    #end
39
 
40
                                </div>
41
                            </div>
42
 
43
                            <div class="card-body">
44
                                $bulletin.description
45
 
46
                                #if($bulletin.catalogBriefList)
47
                                    <p>
48
                                        #foreach($catalog in $bulletin.catalogBriefList)
49
                                            <span>${catalog.modelName}</span>,
50
                                        #end
51
                                    </p>
52
                                #end
53
 
54
                                #if($bulletin.documentIds && $bulletin.documentIds.size() > 0)
55
                                    <div class="bulletin-attachments">
56
                                        #foreach($docId in $bulletin.documentIds)
57
                                            <a href="$rc.contextPath/document/$docId"
58
                                               target="_blank">
59
                                                Attachment
60
                                            </a>
61
                                        #end
62
                                    </div>
63
                                #end
64
 
65
                            </div>
66
                        </div>
67
 
68
                    </div>
69
                #end
70
 
71
            </div>
72
        </div>
73
 
74
    #end
75
 
76
</div>
77
 
78
 
79
<script>
80
 
81
 
37498 amit 82
    // Fragment is re-injected with .html(), which re-runs this script; clear the
83
    // namespace first so handlers replace rather than stack.
84
    $(document).off('.bulletinlist');
85
    $(document).on('click.bulletinlist', '.today-bulletin-offer', function () {
35583 ranu 86
        let offerId = $(this).data("offerid");
87
        doGetAjaxRequestHandler(`${context}/getOfferMargins?offerId=${offerId}`, function (data) {
88
            $('#todayBulletinOfferDescription .modal-content').html(data);
89
            $("#todayBulletinOfferDescription").modal('show');
90
        });
91
    });
92
 
93
 
94
    document.querySelectorAll('.bulletin-tabs li').forEach(tab => {
95
        tab.addEventListener('click', function () {
96
 
97
            document.querySelectorAll('.bulletin-tabs li')
98
                    .forEach(t => t.classList.remove('active'));
99
 
100
            document.querySelectorAll('.bulletin-tab-content')
101
                    .forEach(c => c.style.display = 'none');
102
 
103
            this.classList.add('active');
104
            document.getElementById('tab-' + this.dataset.tab).style.display = 'block';
105
        });
106
    });
107
 
108
    /* Activate first tab by default */
109
    document.querySelector('.bulletin-tabs li')?.click();
110
 
111
</script>