File size: 7,863 Bytes
d5880a8
197e6f2
 
 
 
 
d5880a8
 
d1a7514
2083b3c
2e253ae
2083b3c
2e253ae
 
2083b3c
 
 
 
2e253ae
 
 
 
 
d1a7514
 
e98a4c2
2e253ae
 
e98a4c2
2e253ae
e98a4c2
 
 
 
 
d1a7514
2e253ae
e98a4c2
00d4d1a
 
 
 
2e253ae
e98a4c2
2e253ae
d1a7514
e98a4c2
7dc53bc
 
e98a4c2
fe6bd44
 
 
 
 
 
e98a4c2
 
d1a7514
 
 
 
 
2e253ae
e98a4c2
 
d1a7514
fe6bd44
 
 
 
 
 
 
 
 
 
d1a7514
2e253ae
d1a7514
2e253ae
 
d1a7514
 
 
fe6bd44
 
 
 
 
 
 
 
 
 
d1a7514
2e253ae
d1a7514
2e253ae
e98a4c2
d1a7514
2e253ae
d1a7514
 
 
 
00d4d1a
d1a7514
00d4d1a
 
 
 
d1a7514
 
 
 
 
 
00d4d1a
a668a6e
d1a7514
 
2e253ae
 
00d4d1a
d1a7514
 
2e253ae
d1a7514
 
 
 
 
 
2e253ae
e98a4c2
2e253ae
d1a7514
2e253ae
 
 
 
e0a5eab
 
 
 
 
 
 
 
2e253ae
 
 
 
 
5963ea8
e0a5eab
 
 
 
2e253ae
 
 
 
 
 
 
 
 
 
 
d1a7514
 
d5880a8
 
 
 
47016f6
 
 
 
 
 
 
 
 
 
d5880a8
 
 
 
9a6d321
 
 
 
32ff0d0
9a6d321
 
 
 
 
 
574804c
9a6d321
 
 
 
 
ec59ce9
9a6d321
 
a668a6e
 
9a6d321
d5880a8
d1a7514
d5880a8
 
 
197e6f2
42108d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a6d321
 
ec59ce9
9a6d321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42108d8
d5880a8
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
{% extends "base.html" %}
{% block title %}Reports - QuantVAT{% endblock %} 
{% block description %}Hey fellow trader / analyst, welcome to QuantVAT analysis reports page. View and download your cross-market reports.{% endblock %} 
{% block og_title %}Reports - QuantVAT{% endblock %} 
{% block og_description %}Hey fellow trader / analyst, welcome to QuantVAT analysis reports page. View and download your cross-market reports.{% endblock %} 
{% block keywords %}register, secure access, crypto dashboard, quantvat, trading tools{% endblock %} 
{% block extra_css %}
<style>
    /* --- GENERAL LAYOUT --- */
    .container { 
      width: 90%;
      max-width: 600px; 
      margin: 40px auto;
      box-sizing: border-box;
    }
  
    h1 { 
      text-align: center; 
      color: var(--accent-green, #10b981); 
      font-size: 1.6rem;
      font-weight: 800;
      margin-bottom: 30px; 
    }

    /* --- FILE CARD --- */
    .file-item { 
        background: var(--bg-card, #1e252a); 
        padding: 18px 20px; 
        border-radius: 12px; 
        border: 1px solid var(--border, #2b3139); 
        margin-bottom: 12px; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        transition: all 0.2s ease; 
        position: relative; 
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
  
   .file-item:has(.menu-checkbox:checked) {
    z-index: 50;
  }

    .file-item:hover { 
        border-color: var(--accent-green, #10b981); 
        transform: translateX(5px);
    }

    /* --- FILENAME --- */
    .filename { 
    font-family: monospace; 
    font-size: 0.9rem; 
    color: #eaecef; 
    word-break: break-all; 
    margin-right: 15px; 
    flex: 1; 
    }

    /* --- SPLIT BUTTON COMPONENT --- */
    .split-btn {
        position: relative;
        display: inline-flex;
        vertical-align: middle;
        flex-shrink: 0;
    }

    .btn-main {
    background: var(--accent-green, #10b981);
    color: #000 !important; 
    padding: 8px 16px;
    border-radius: 6px 0 0 6px; 
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--accent-green, #10b981);
    transition: background 0.2s;
    z-index: 2;
    }

    .btn-main:hover {
        background: #059669; 
        border-color: #059669;
    }

    .btn-arrow {
    background: var(--accent-green, #10b981);
    color: #000;
    padding: 8px 10px;
    border-radius: 0 6px 6px 0;
    border: 1px solid var(--accent-green, #10b981);
    border-left: 1px solid rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s;
    outline: none;
    }

    .btn-arrow:hover, .btn-arrow:focus {
        background: #059669;
    }

    /* --- DROPDOWN MENU --- */
    .dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 4px;
        background: #1e2329;
        border: 1px solid #2b3139;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        min-width: 130px;
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.2s ease;
    }
  
    .menu-checkbox:checked ~ .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0); 
    }
  
    .dropdown-item {
        display: block;
        padding: 12px 15px;
        color: #eaecef;
        text-decoration: none;
        font-size: 0.85rem;
        transition: background 0.2s;
        display: flex;
        align-items: center;
        font-weight: 500;
    }

    .dropdown-item:hover {
        background: rgba(16, 185, 129, 0.1);
        color: var(--accent-green, #10b981);
    }

    .delete-item {
        color: #ff4d4d !important; /* Overriding the default text color */
    }

    .delete-item:hover {
        background: rgba(255, 77, 77, 0.1) !important; /* Specific red tint for hover */
      }
  
    .icon-dl { 
        margin-right: 8px; 
        color: var(--accent-green, #10b981); 
    }

    .icon-delete { 
        margin-right: 8px; 
        color: #ef4444; 
      }

    /* Mobile Adjustment */
    @media (max-width: 480px) {
        .container {
            width: 90%;
            margin-top: 20px;
            padding: 0;
        }
        .file-item {
            padding: 15px;
        }
        h1 { font-size: 1.4rem; }
    }
</style>
{% endblock %}

{% block content %}
<div class="container">
  {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
        {% for category, message in messages %}
          <div style="padding:15px; margin-bottom:20px; border-radius:8px; font-weight:bold; background:{{ 'rgba(14,203,129,0.15)' if category == 'success' else 'rgba(246,70,93,0.15)' }}; color:{{ '#0ecb81' if category == 'success' else '#f6465d' }}; border:1px solid {{ '#0ecb81' if category == 'success' else '#f6465d' }};">
              {{ message }}
          </div>
        {% endfor %}
      {% endif %}
    {% endwith %}
  
    <h1>📄 Analysis Reports</h1>
    
    {% if report_files %}
        {% for f in report_files %}
      <div class="file-item" id="file-row-{{ loop.index }}">
    <span class="filename">{{ f }}</span>
    
    <div class="split-btn">
        <a href="{{ url_for('main.serve_report', filename=f) }}" class="btn-main">VIEW</a>

        <input type="checkbox" id="toggle-{{ loop.index }}" class="menu-checkbox" style="display: none;">
        <label for="toggle-{{ loop.index }}" class="btn-arrow"></label>

        <div class="dropdown-menu">
            <a href="{{ url_for('main.serve_report', filename=f, dl='1') }}" class="dropdown-item">
                <span class="icon-dl" download="Download the File"></span> Download
            </a>
            
            <a href="javascript:void(0);" 
               class="dropdown-item delete-item" 
               onclick="ajaxDelete('{{ f }}', 'file-row-{{ loop.index }}')">
                <span class="icon-delete">🗑️ </span> Delete
            </a>
        </div>
    </div>
</div>
  {% endfor %}
    {% else %}
        <p style="text-align:center; color:#848e9c; margin-top: 40px;">No reports found yet</p>
    {% endif %}
    
</div>
<!-- Interactive Buttons -->
<script>
    document.addEventListener('change', function(e) {
        if (e.target.classList.contains('menu-checkbox') && e.target.checked) {
            document.querySelectorAll('.menu-checkbox').forEach(box => {
                if (box !== e.target) {
                    box.checked = false;
                }
            });
        }
    });

    document.addEventListener('click', function(e) {
        if (!e.target.closest('.split-btn')) {
            document.querySelectorAll('.menu-checkbox').forEach(box => {
                box.checked = false;
            });
        }
    });
 
  function ajaxDelete(filename, elementId) {
    if (!confirm('Are you sure you want to Permanently delete this report?')) return;

    fetch(`/reports/delete/${filename}`, {
        method: 'GET',
        headers: { 'X-Requested-With': 'XMLHttpRequest' }
    })
    .then(response => {
        if (response.ok) {
            const row = document.getElementById(elementId);
            //  Slide out and fade
            row.style.transition = 'all 0.3s ease';
            row.style.opacity = '0';
            row.style.transform = 'translateX(30px)';
            
            setTimeout(() => {
                row.remove();
                // If no reports left, refresh to show the "No reports" message
                if (document.querySelectorAll('.file-item').length === 0) {
                    window.location.reload();
                }
            }, 300);
        } else {
            alert('Delete failed. Please try again.');
        }
    });
  }
</script>
{% endblock %}