Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
35549 ranu 1
$(function () {
2
    $(document).on('click', ".post-bulletin", function () {
3
        loadbulletinPage("main-content");
4
    });
5
 
6
 
7
    $(document).on('click', ".post-bulletin-button", function (event) {
8
        event.preventDefault();
9
 
10
        if (confirm("Are you sure?")) {
11
 
12
            let title = $("#btitle").val();
13
            let description = quill.root.innerHTML;
14
            let regionId = $("#bregionId").val();
15
            let documentIds = $("#bulletinDocumentIds").val();
16
 
17
            let param = {
18
                title: title,
19
                description: description,
20
                regionId: regionId,
21
                documentIds: documentIds
22
            }
23
 
24
            doPostAjaxRequestWithJsonHandler(context + "/bulletinPost", JSON.stringify(param), function (response) {
25
                if (response == 'true') {
26
                    bootbox.alert("Bulletin Post Successfully");
27
                    loadbulletinPage("main-content");
28
                }
29
 
30
            });
31
        }
32
    });
33
 
34
});
35
 
36
 
37
function loadbulletinPage(domId) {
38
    doGetAjaxRequestHandler(context + "/bulletin", function (response) {
39
 
40
        $('#' + domId).html(response);
41
    });
42
}
43
 
44
 
45
$(document).on('click', '.today-bulletin-offer', function () {
46
    let offerId = $(this).data("offerid");
47
    doGetAjaxRequestHandler(`${context}/getOfferMargins?offerId=${offerId}`, function (data) {
48
        $('#todayBulletinOfferDescription .modal-content').html(data);
49
        $("#todayBulletinOfferDescription").modal('show');
50
    });
51
});
52
 
53
 
54
document.querySelectorAll('.bulletin-tabs li').forEach(tab => {
55
    tab.addEventListener('click', function () {
56
 
57
        document.querySelectorAll('.bulletin-tabs li')
58
            .forEach(t => t.classList.remove('active'));
59
 
60
        document.querySelectorAll('.bulletin-tab-content')
61
            .forEach(c => c.style.display = 'none');
62
 
63
        this.classList.add('active');
64
        document.getElementById('tab-' + this.dataset.tab).style.display = 'block';
65
    });
66
});
67
 
68
/* Activate first tab by default */
69
document.querySelector('.bulletin-tabs li')?.click();
70
 
71
 
72
 
73