Spaces:
Runtime error
Runtime error
| <!-- jinja2 template engine coding style for flask framework --> | |
| <html> | |
| <head> | |
| <title>Project Task Breakdown</title> | |
| <link rel="stylesheet" href="{{ url_for('static', filename='ProjectBreakdown.css') }}"> | |
| <!-- Bootstrap CSS --> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <!-- Navigation bar; To go to different pages without having to go back to index/home page --> | |
| <nav class="navbar navbar-expand-lg bg-body-tertiary"> | |
| <div class="container-fluid"> | |
| <a class="navbar-brand" href="{{ url_for('index') }}">Home</a> | |
| <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | |
| <span class="navbar-toggler-icon"></span> | |
| </button> | |
| <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | |
| <div class="navbar-nav"> | |
| <a class="nav-link active" href="{{ url_for('text_summarization') }}">Summarization</a> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('project_breakdown') }}">Task Breakdown</a> | |
| <a class="nav-link" href="{{ url_for('language_translation') }}">Translation</a> | |
| <a class="nav-link" href="{{ url_for('text_generation') }}">Generation</a> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <header> | |
| <img src="{{ url_for('static', filename='Images/Refineverse logo.png') }}" alt="Refineverse Logo"> | |
| <h1>Project Task Breakdown</h1> | |
| </header> | |
| <!-- User input textarea box; breakdown & clear button functionality; display output functionality --> | |
| <main> | |
| <form action="#" method="POST"> | |
| <div class="user-story"> | |
| <h2>User Story</h2> | |
| <textarea id="user-story-text" name='user-story-text' placeholder="Enter your user story"></textarea> | |
| <button id="clear-btn" formmethod="GET" formaction="#" onclick="clearTextArea()">Clear</button> | |
| <!-- When using flash, it is necessary to always use a for-loop to grab all messages --> | |
| {% with messages = get_flashed_messages(with_categories=true) %} <!-- This is to use flash with pre-set categories --> | |
| {% for category, message in messages %} | |
| {% if category == 'error' %} <!-- If it is a flash message with the error, message, we display our exception message --> | |
| <div class="alert alert-danger alert-dismissible fade show" role="alert"> | |
| {{ message }} | |
| <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | |
| </div> | |
| {% else %} <!-- Otherwise, proceed as usual --> | |
| <div class="alert alert-success alert-dismissible fade show" role="alert"> | |
| {{ message }} | |
| <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | |
| </div> | |
| {% endif %} | |
| {% endfor %} | |
| {% endwith %} | |
| <button id="breakdown-btn" name="breakdown-btn" type="submit">Breakdown</button> | |
| </div> | |
| </form> | |
| <div class="user-story-list"> | |
| <h2>Breakdown Summary</h2> | |
| <!-- Output Table --> | |
| <table id="breakdown-table"> | |
| <thead> | |
| <tr> | |
| <th onclick="sortTable(0)">User Story</th> | |
| <th onclick="sortTable(1)">Project Task</th> | |
| </tr> | |
| </thead> | |
| <!-- will need to Use For Loop to link sqlite3 database --> | |
| <tbody id="breakdown-body"> | |
| {% for row in rows %} | |
| <tr> | |
| <!-- Return and display output from Refineverse.py based on routing from ZeroshotFeature.py --> | |
| <td>{{ row[0] }}</td> | |
| <td>{{ row[1] }}</td> | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| </div> | |
| </main> | |
| <div class="back-Btn-Container"> | |
| <div class="buttons-container"> | |
| <a href="{{ url_for('index') }}"><button class="back-btn">Back</button></a> | |
| </div> | |
| </div> | |
| <!-- Bootstrap JS Bundle --> | |
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script> | |
| <script> | |
| function clearTextArea() { | |
| document.getElementById("user-story-text").value = ""; | |
| } | |
| // Function to sort table in ascending/descending order | |
| function sortTable(columnIndex) { | |
| // Initialize variables | |
| var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0; | |
| table = document.getElementById("breakdown-table"); | |
| switching = true; | |
| // Set the sorting direction to ascending: | |
| dir = "asc"; | |
| /* Make a loop that will continue until | |
| no switching has been done: */ | |
| while (switching) { | |
| // Start by saying: no switching is done: | |
| switching = false; | |
| rows = table.rows; | |
| /* Loop through all table rows (except the | |
| first, which contains table headers): */ | |
| for (i = 1; i < (rows.length - 1); i++) { | |
| // Start by saying there should be no switching: | |
| shouldSwitch = false; | |
| /* Get the two elements you want to compare, | |
| one from current row and one from the next: */ | |
| x = rows[i].getElementsByTagName("TD")[columnIndex]; | |
| y = rows[i + 1].getElementsByTagName("TD")[columnIndex]; | |
| /* Check if the two rows should switch place, | |
| based on the direction, asc or desc: */ | |
| if (dir == "asc") { | |
| if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { | |
| // If so, mark as a switch and break the loop: | |
| shouldSwitch = true; | |
| break; | |
| } | |
| } else if (dir == "desc") { | |
| if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) { | |
| // If so, mark as a switch and break the loop: | |
| shouldSwitch = true; | |
| break; | |
| } | |
| } | |
| } | |
| if (shouldSwitch) { | |
| /* If a switch has been marked, make the switch | |
| and mark that a switch has been done: */ | |
| rows[i].parentNode.insertBefore(rows[i + 1], rows[i]); | |
| switching = true; | |
| // Each time a switch is done, increase this count by 1: | |
| switchcount ++; | |
| } else { | |
| /* If no switching has been done AND the direction is "asc", | |
| set the direction to "desc" and run the while loop again. */ | |
| if (switchcount == 0 && dir == "asc") { | |
| dir = "desc"; | |
| switching = true; | |
| } | |
| } | |
| } | |
| // Add arrow icons to the header cells to indicate the sort direction: | |
| var headers = table.getElementsByTagName("TH"); | |
| for (i = 0; i < headers.length; i++) { | |
| headers[i].innerHTML = headers[i].innerHTML.replace(/ ▲| ▼/g, ""); | |
| } | |
| var arrow = document.createElement("span"); | |
| arrow.className = "arrow"; | |
| if (dir == "asc") { | |
| arrow.innerHTML = " ▲"; | |
| } else { | |
| arrow.innerHTML = " ▼"; | |
| } | |
| headers[columnIndex].appendChild(arrow); | |
| } | |
| </script> | |
| </body> | |
| </html> | |