summaryrefslogtreecommitdiffstats
path: root/dashboard/src/templates/notifier/inbox.html
blob: 72207ed87a157b72cf1ae11ae7ca5e4f5962301e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{% extends "base.html" %}


{% load staticfiles %}

{% block content %}

<style media="screen">
    .inbox-panel {
        display: grid;
        grid-template-columns: 30% 5% 65%;
    }

    .section-panel {
        padding: 10px;
    }

    .iframe-panel {
        padding: 0px;
        margin-top: 0px;
    }

    .card-container {
        border: 1px solid #cccccc;
        border-bottom: 0px;
    }

    .card {
        height: 50px;
        position: relative;
        border-bottom: 1px solid #cccccc;
        padding: 10px;
        width: 100%;
        background-color: #ffffff;
        z-index: 5;
    }

    .selected-card {
        background-color: #f3f3f3;
    }

    .card:hover {
        box-shadow: 0px 0 5px 2px #cccccc;
        z-index: 6;
    }

    .half_width {
        width: 50%;
    }

    #page-wrapper {
        padding: 0px;
    }

    .read_notification {
        background-color: #efefef;
    }

    .scrollable {
        overflow-y: auto;
    }
</style>
<div class="container-fluid d-flex flex-grow-1 flex-column">
    <div class="row mt-3 mb-2">
        <div class="col-2 px-0">
            <div class="btn-group w-100" id="filterGroup">
                <button class="btn btn-secondary active" data-read="-1">All</button>
                <button class="btn btn-secondary" data-read="0">Unread</button>
                <button class="btn btn-secondary" data-read="1">Read</button>
            </div>
        </div>
    </div>
    <div class="row flex-grow-1" id="fixHeight">
        <!-- Notification list && Controls -->
        <div class="mb-2 mb-lg-0 col-lg-2 px-0 mh-100">
            <div class="list-group rounded-0 rounded-left scrollable mh-100 notifications" id="unreadNotifications" data-read="0">
                {% for notification in unread_notifications %}
                    <a
                        href="#"
                        onclick="showmessage({{notification.id}}); setactive(this);"
                        class="list-group-item list-group-item-action notification">
                        {{ notification }}
                    </a>
                {% endfor %}
            </div>
            <div class="list-group rounded-0 rounded-left scrollable mh-100 notifications" id="readNotifications" data-read="1">
                {% for notification in read_notifications %}
                    <a
                        href="#"
                        onclick="showmessage({{notification.id}}); setactive(this);"
                        class="list-group-item list-group-item-action list-group-item-secondary notification">
                        {{ notification }}
                    </a>
                {% endfor %}
            </div>
        </div>
        <!-- Content -->
        <div class="col ml-lg-2 border mh-100 p-4">
            <iframe class="w-100 h-100" id="inbox-iframe" frameBorder="0" scrolling="yes">Please select a notification</iframe>
        </div>
    </div>
</div>

<script type="text/javascript">
    function showmessage(msg_id) {
        iframe = document.getElementById("inbox-iframe");
        iframe.src = "notification/" + msg_id;
    }

    function setactive(obj) {
        $(".notification").removeClass("active");
        $(obj).addClass("active");
    }

    $(document).ready(function(){
        // For all / unread / read
        $("#filterGroup button").click(function(){
            let read = $(this).attr("data-read");
            $(this).siblings().removeClass("active");
            $(".notifications").addClass("d-none");
            $(this).addClass("active");
            if (read === "-1") {
                return $(".notifications").removeClass("d-none");
            }
            $(`.notifications[data-read="${read}"]`).removeClass("d-none");
        });
    });
</script>
{% endblock %}