123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- {% extends base %}
- {% block content %}
- {% import "macros/action_icons_static.html" as icons with context %}
- <span class="title"><h2>{% block title %}Capture Record Uploads{% endblock %}</h2></span>
- <div>Manage documents for <span style="font-weight: bold;">{{ names }}</span>.</div>
- <div class="content-container content">
- {% if record_qualifications %}
- <article>
- <h3>Current Qualifications on Record - for reference</h3>
- <ul>
- {% for qualification in record_qualifications %}
- <li>{{ qualification.v_qualification_name }} {{ qualification.d_acquired|date_format }}</li>
- {% endfor %}
- </ul>
- </article>
- {% endif %}{# end of checking for existing qualification records #}
- <article>
- <h3>Upload Documents</h3>
- <div><a href="#" id="a_upload_document">Upload Document</a></div>
- {% if document_uploads %}
- <div class="table-container">
- <table class="data-table" id="tbl_uploads">
- <thead>
- <tr>
- <th>File Name</th><th>Type</th><th>Matching Qualification></th><th>Description</th><th style="font-size: smaller;">[Actions]</th>
- </tr>
- </thead>
- <tbody>
- {% for upload in document_uploads %}
- <tr>
- <td><a href="{{ url_for("main.download_upload", i_upload=upload.id, bl_download=False) }}" class="a_view_upload" target="_blank">{{ icons.view_svg(s_label="view upload") }}</a> {{ upload.v_filename }}</td><td>{{ upload.si_upload_type }}</td><td>{{ upload.v_qualification_name }}</td><td>{{ upload.v_description }}</td><td><a href="#{{ upload.id }}" class="a_remove_upload">{{ icons.delete_svg(s_label="remove upload") }}</a></td>
- </tr>
- {% endfor %}{# end of looping through existing document uploads #}
- </tbody>
- </table><!-- end of tbl_uploads -->
- </div><!-- end of div.table-container -->
- {% endif %}{# end of checking for existing document uploads #}
- </article>
- </div><!-- end of div.content -->
- {% from "macros/dialog.html" import dlg_prep with context %}
- {{ dlg_prep(["dlg_upload"]) }}
- {# dlg divs below #}
- <div id="dlg_upload" aria-labeledby="spn_upload">
- <span id="spn_upload">Upload document</span><br>
- <form action="{{ url_for("main.uploads", i_record=record_id) }}" method="post" enctype="multipart/form-data" id="frm_upload">
- {{ upload_form.csrf_token }}
- <ul>
- <li>{{ upload_form.sel_upload_type.label }} {{ upload_form.sel_upload_type }}</li>
- <li>{{ upload_form.sel_match.label }} {{ upload_form.sel_match }}</li>
- <li>{{ upload_form.fil_upload_document.label }} {{ upload_form.fil_upload_document }}<br></li>
- <li>{{ upload_form.txt_description.label }}<br>
- {{ upload_form.txt_description }}</li>
- </ul>
- <input type="submit" name="btn_upload" value="Upload document">
- </form>
- </div><!-- end of dlg_upload -->
- <script type="text/javascript">
- $(document).ready( function() {
- try {
- var s_dlg_upload = $("#dlg_upload").html();
- $("#a_upload_document").click( function(event) {
- event.preventDefault();
- $("#dlg_upload").html(s_dlg_upload);
- $("#dlg_upload").redraw();
- $("#dlg_upload").dialog("open");
- });// end of #a_upload_document click event
- $("#tbl_uploads").on("click", ".a_remove_upload", function(event) {
- event.preventDefault();
- var s_id = String($(this).attr("href")).replace("#", "");
- var bl_confirm = confirm("Are you sure?");
- if (bl_confirm) {
- $("#hid_remove_upload_id").val(s_id);
- document.getElementById("frm_remove_upload").submit();
- }// end of confirmation check
- });// end of click event on .a_remove_upload inside tbl_uploads
- do_alert("waiting...");
- } catch(e) {
- var s_err = String(e.name) + "\nmessage:" + String(e.message);
- s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
- alert("Error! " + s_err);
- }//end of catch
- });// end of additional document ready
- </script>
- <form action="{{ url_for("main.uploads", i_record=record_id) }}" method="post" id="frm_remove_upload">
- {{ remove_upload_form.csrf_token }}
- {{remove_upload_form.hid_remove_upload_id }}
- </form>
- {% endblock %}
|