index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. {% extends base %}
  2. {% block head_extra %}
  3. <style>
  4. .label {
  5. font-weight: bold;
  6. }
  7. </style>
  8. {% endblock %}
  9. {% block content %}
  10. {% import "macros/action_icons_static.html" as icons with context %}
  11. <span class="title"><h2>{% block title %}Landing page{% endblock %}</h2></span>
  12. <div class="content-container content">
  13. <div id="div_filter" class="div_data_filtering">
  14. <h3>Filtering/Searching options</h3>
  15. <form action="{{ url_for("main.index") }}" method="post" id="frm_filters">
  16. {{ filter_form.csrf_token }}
  17. {{ filter_form.hid_page }}
  18. <!-- Buttons -->
  19. <div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px;">
  20. <button type="submit" name="btn_filter" value="Apply Filters" style="background-color: rgb(39, 37, 92); color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;">
  21. {{ icons.search_svg(s_label="apply filters") }}
  22. Search
  23. </button>
  24. <button type="button" id="btn_clear_filter" name="btn_clear_filter" value="Clear Filters" style="background-color: rgb(39, 37, 92); color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;">
  25. {{ icons.delete_svg(s_label="remove filters") }}
  26. Clear
  27. </button>
  28. <label for="chk_case_sensitive" style="font-size: 12px; margin-left: 15px;">
  29. {{ filter_form.chk_case_sensitive }}
  30. Case-sensitive search
  31. </label>
  32. </div>
  33. <!-- end of div for buttons -->
  34. <!-- div containing filter Rows -->
  35. <div class="div_filter_row" style="margin-bottom: 20px;">
  36. <!-- Department and Role -->
  37. <div style="flex: 1 1 200px;">
  38. {{ filter_form.sel_role_department.label }}
  39. {{ filter_form.sel_role_department(style="width: 100%; padding: 6px;") }}
  40. {{ filter_form.sel_role.label(style="margin-top: 10px;") }}
  41. {{ filter_form.sel_role(style="width: 100%; padding: 6px;") }}
  42. </div>
  43. <!-- Name -->
  44. <div style="flex: 1 1 200px;">
  45. {{ filter_form.txt_name.label }}
  46. {{ filter_form.txt_name(style="width: 100%; padding: 6px;") }}
  47. </div>
  48. <!-- Surname -->
  49. <div style="flex: 1 1 200px;">
  50. {{ filter_form.txt_surname.label }}
  51. {{ filter_form.txt_surname(style="width: 100%; padding: 6px;") }}
  52. </div>
  53. <!-- ID/Passport -->
  54. <div style="flex: 1 1 200px;">
  55. {{ filter_form.txt_id_number.label }}
  56. {{ filter_form.txt_id_number(style="width: 100%; padding: 6px;") }}
  57. </div>
  58. <!-- Language -->
  59. <div style="flex: 1 1 200px;">
  60. {{ filter_form.sel_language.label }}
  61. {{ filter_form.sel_language(style="width: 100%; padding: 6px;") }}
  62. </div>
  63. </div>
  64. <!-- end of first div.div_filter_row containing filter rows -->
  65. <!-- Second Filter Row -->
  66. <div class="div_filter_row">
  67. <!-- SAP K-Level -->
  68. <div style="flex: 1 1 200px;">
  69. {{ filter_form.sel_sap_k_level.label }}
  70. {{ filter_form.sel_sap_k_level(style="width: 100%; padding: 6px;") }}
  71. </div>
  72. <!-- Qualification Type 1 & Qualification 1 -->
  73. <div style="flex: 1 1 200px;">
  74. {{ filter_form.sel_qualification_type_1.label }}
  75. {{ filter_form.sel_qualification_type_1(style="width: 100%; padding: 6px;") }}
  76. {{ filter_form.sel_qualification_1.label }}
  77. {{ filter_form.sel_qualification_1(style="width: 100%; padding: 6px;") }}
  78. </div>
  79. <!-- Qualification Type 2 & Qualification 2 -->
  80. <div style="flex: 1 1 200px;">
  81. {{ filter_form.sel_qualification_type_2.label }}
  82. {{ filter_form.sel_qualification_type_2(style="width: 100%; padding: 6px;") }}
  83. {{ filter_form.sel_qualification_2.label }}
  84. {{ filter_form.sel_qualification_2(style="width: 100%; padding: 6px;") }}
  85. </div>
  86. </div>
  87. <!-- end of div.div_filter_row containing filter rows -->
  88. </form>
  89. </div>
  90. <!-- end of div.div_data_filtering -->
  91. {% if records %}
  92. <h3>Records</h3>
  93. <div class="table-container">
  94. <table class="data-table" id="tbl_records">
  95. <thead>
  96. <tr>
  97. <th>Surname</th><th>First name</th><th>Years experience</th><th>Contact number</th><th>E-mail</th><th>Qualifications</th><th style="font-size: smaller;">actions</th>
  98. </tr>
  99. </thead>
  100. {% for record in records %}
  101. <tr>
  102. <td>{{ record.v_surname }}</td><td>{{ record.v_name_1 }}</td><td>{{ record.si_years_experience }}</td><td>{{ record.v_contact_number }}</td><td>{{ record.v_email }}</td><td>
  103. {% if record.record_qualifications %}
  104. <ul>
  105. {% for qualification in record.record_qualifications %}
  106. <li>
  107. {{ qualification.v_qualification_type }} - {{ qualification.v_qualification_name}} - {{ qualification.d_acquired|date_format }}
  108. </li>
  109. {% endfor %}{# end of looping through qualifications #}
  110. </ul>
  111. {% else %}
  112. &nbsp;
  113. {% endif %}{# end of checking if there are qualifications per record #}
  114. </td>
  115. <td>
  116. <ul>
  117. <li><a href="#{{ record.id }}" class="a_view_details">{{ icons.view_svg() }}</a></li>
  118. {% if current_user.bl_admin %}
  119. <li><a href="{{ url_for("main.capture_record", i_record=record.id) }}">{{ icons.edit_svg() }}</a></li>
  120. {% endif %}
  121. </ul>
  122. </td>
  123. </tr>
  124. {% endfor %}{# end of looping through records #}
  125. </table><!-- end of tbl_records -->
  126. </div><!-- end of div.table-container -->
  127. <div class="paging">
  128. <div>Paging...</div>
  129. {#
  130. {% if paging.has_prev %}
  131. <!-- prev_num --><span><a class="a_page_number" href="#{{ paging.prev_num }}"{{ "<<" }}</a></span>
  132. {% endif %}
  133. #}
  134. {% for number in paging.iter_pages() %}
  135. {% if paging.page != number %}
  136. <!-- page_num --><span><a class="a_page_number" href="#{{ number }}">{{ number }}</a></span>&nbsp;&nbsp;
  137. {% else %}
  138. <!-- current_num --><span class="current-page-number">{{ number }}</span>&nbsp;&nbsp;
  139. {% endif %}
  140. {% endfor %}
  141. {#
  142. {% if paging.has_next %}
  143. <span>
  144. <!-- next_num --><a class="a_page_number" href="#{{ paging.next_num }}">{{ ">>" }}</a></span>
  145. {% endif %}
  146. #}
  147. </div><!-- end of div.paging -->
  148. {% endif %}{# end of checking if records existed #}
  149. </div><!-- end of div.content -->
  150. {% from "macros/dialog.html" import dlg_prep with context %}
  151. {{ dlg_prep(["dlg_details"]) }}
  152. {# dlg divs below #}
  153. <div id="dlg_details" aria-labeledby="spn_details">
  154. <span id="spn_details">Record details</span><br>
  155. <a href="#" id="a_full_screen" style="font-size: smaller;">(view full-screen)</a><br>
  156. <div id="div_details">
  157. <h4>Details</h4>
  158. <ul id="ul_details"></ul>
  159. <span id="spn_languages">
  160. <h4>Languages</h4>
  161. <ul id="ul_languages"></ul>
  162. </span>
  163. <span id="spn_qualifications">
  164. <h4>Qualifications</h4>
  165. <ul id="ul_qualifications"></ul>
  166. </span>
  167. </div><!-- end of div_details -->
  168. <div id="div_uploads">
  169. <h4>Uploads</h4>
  170. <ul id="ul_uploads"></ul>
  171. </div>
  172. <span id="spn_tenders">
  173. <h4>Prior Tenders</h4>
  174. <ul id="ul_tenders"></ul>
  175. </span>
  176. </div><!-- end of dlg_details -->
  177. <script type="text/javascript">
  178. $(document).ready( function() {
  179. try {
  180. var s_dlg_details = $("#dlg_details").html();
  181. $("#sel_role_department").change( function(event) {
  182. var s_id = String($(this).val());
  183. // roles_list(i_department_id)
  184. // id, v_role_name
  185. $("#sel_role").empty();
  186. var s_html = "<option value=\"0\" selected>---</option>\n";
  187. var s_url = "{{ url_for("main.roles_list", i_department_id=99999) }}".replace("99999", s_id);
  188. $.get(s_url, function(o_roles) {
  189. if (typeof(o_roles)=="object") {
  190. $.each(o_roles, function(ix, o_role) {
  191. s_html = s_html + "<option value=\"" + String(o_role.id) + "\">" + String(o_role.v_role_name) + "</option>\n";
  192. });// end of .each against o_roles
  193. $("#sel_role").html(s_html);
  194. $("#sel_role").redraw();
  195. }// end of typeof check against o_roles
  196. });// end of .get
  197. do_alert("Roles listing updated");
  198. });// end of sel_department change event
  199. $("#sel_qualification_type_1").change( function(event) {
  200. var s_id = String($(this).val());
  201. // qualifications_list(i_type_id)
  202. // id, v_qualification_name
  203. $("#sel_qualification_1").empty();
  204. var s_html = "<option value=\"0\" selected>---</option>\n";
  205. var s_url = "{{ url_for("main.qualifications_list", i_type_id=99999) }}".replace("99999", s_id);
  206. $.get(s_url, function(o_qualifications) {
  207. if (typeof(o_qualifications)=="object") {
  208. $.each(o_qualifications, function(ix, o_qualification) {
  209. s_html = s_html + "<option value=\"" + String(o_qualification.id) + "\">" + String(o_qualification.v_qualification_name) + "</option>\n";
  210. });// end of .each against o_qualifications
  211. $("#sel_qualification_1").html(s_html);
  212. $("#sel_qualification_1").redraw();
  213. }// end of typeof check against o_qualifications
  214. });// end of .get
  215. do_alert("Roles listing 1 updated");
  216. });// end of sel_qualification_type_1 change event
  217. $("#sel_qualification_type_2").change( function(event) {
  218. var s_id = String($(this).val());
  219. // qualifications_list(i_type_id)
  220. // // id, v_qualification_name
  221. $("#sel_qualification_2").empty();
  222. var s_html = "<option value=\"0\" selected>---</option>\n";
  223. var s_url = "{{ url_for("main.qualifications_list", i_type_id=99999) }}".replace("99999", s_id);
  224. $.get(s_url, function(o_qualifications) {
  225. if (typeof(o_qualifications)=="object") {
  226. $.each(o_qualifications, function(ix, o_qualification) {
  227. s_html = s_html + "<option value=\"" + String(o_qualification.id) + "\">" + String(o_qualification.v_qualification_name) + "</option>\n";
  228. });// end of .each against o_qualifications
  229. $("#sel_qualification_2").html(s_html);
  230. $("#sel_qualification_2").redraw();
  231. }// end of typeof check against o_qualifications
  232. });// end of .get
  233. do_alert("Roles listing 2 updated");
  234. });// end of sel_qualification_type_2 change event
  235. $("#btn_clear_filter").click( function(event) {
  236. event.preventDefault();
  237. // checkbox
  238. $("#chk_case_sensitive").prop("checked", false);
  239. // text boxes
  240. $.each(["#txt_name", "#txt_surname", "#txt_id_number"], function(ix, ss) { $(ss).val(""); });
  241. // dependant selects first
  242. $.each(["#sel_role", "#sel_qualification_1", "#sel_qualification_2"], function(ix, ss) { $(ss).prop("selectedIndex", 0); });
  243. // categorical selects
  244. $.each(["#sel_role_department", "#sel_language", "#sel_sap_k_level", "#sel_qualification_type_1", "#sel_qualification_type_2"], function(ix, ss) { $(ss).prop("selectedIndex", 0); });
  245. document.getElementById("frm_filters").submit();
  246. });// end of btn_clear_filter click event
  247. $(".a_view_details").click( function(event) {
  248. try {
  249. event.preventDefault();
  250. $("#dlg_details").html(s_dlg_details);
  251. $("#dlg_details").redraw();
  252. var s_id = String($(this).attr("href")).replace("#", "");
  253. var s_url = "{{ url_for("main.record_details", i_record_id=99999) }}".replace("99999", s_id);
  254. $.get(s_url, function(o_data) {
  255. if (typeof(o_data)=="object") {
  256. var s_html = "";
  257. if (typeof(o_data.record)=="object") {
  258. s_html = "<li><span class=\"label\">Surname:</span>&nbsp;" + String(o_data.record["v_surname"]) + "</li></li>\n";
  259. var s_names = [o_data.record["v_name_1"], o_data.record["v_name_2"], o_data.record["v_name_3"]].join(" ").trim();
  260. s_html = s_html + "<li><span class=\"label\">Name(s):</span>&nbsp;" + s_names + "</li>\n";
  261. s_html = s_html + "<li><span class=\"label\">I.D./Passport Number:</label>&nbsp;" + String(o_data.record["v_id_number"]) + "</li>\n";
  262. s_html = s_html + "<li><span class=\"label\">Gender:</label>&nbsp;" + String(o_data.record["c_gender"]).toUpperCase() + "</li>\n";
  263. s_html = s_html + "<li><span class=\"label\">Years Experience:</label>&nbsp;" + String(o_data.record["si_years_experience"]) + "</li>\n";
  264. s_html = s_html + "<li><span class=\"label\">SAP K-Level:</label>&nbsp;" + String(o_data.record["v_sap_k_level"]) + "</li>\n";
  265. s_html = s_html + "<li><span class=\"label\">Contact Number:</label>&nbsp;" + String(o_data.record["v_contact_number"]) + "</li>\n";
  266. s_html = s_html + "<li><span class=\"label\">E-Mail Address:</label>&nbsp;" + String(o_data.record["v_email"]) + "</li>\n";
  267. s_html = s_html + "<li><span class=\"label\">Employment Department/Division:</label>&nbsp;" + String(o_data.record["v_department_name"]) + "</li>\n";
  268. s_html = s_html + "<li><span class=\"label\">Employment Position/Role:</label>&nbsp;" + String(o_data.record["v_role_name"]) + "</li>\n";
  269. $("#ul_details").append(s_html);
  270. }// end of typeof check against basic details
  271. // languagess
  272. s_html = "";
  273. if (typeof(o_data.languages)=="object") {
  274. if (o_data.languages.length>0) {
  275. $.each(o_data.languages, function(ix, l) {
  276. s_html = s_html + "<li><ul>";
  277. s_html = s_html + "<li><span class=\"label\">Language:</span>&nbsp;" + String(l.v_language_name) + " (" + String(l.v_language_abbreviation) + ")</li>\n";
  278. s_html = s_html + "<li><span class=\"label\">Level:</span>&nbsp;" + String(l.level) + "</li>\n";
  279. s_html = s_html + "</ul></li>\n";
  280. });// end of looping through languages
  281. $("#ul_languages").append(s_html);
  282. } else {
  283. $("#spn_languages").hide();
  284. }// end of .length check against languages
  285. } else {
  286. $("#spn_languages").hide();
  287. }// end of typeof check against language data
  288. // tenders
  289. s_html = "";
  290. if (typeof(o_data.tenders)=="object") {
  291. if (o_data.tenders.length>0) {
  292. $.each(o_data.tenders, function(ix, t) {
  293. s_html = s_html + "<li><span class=\"label\">Reference no.:</span>&nbsp;" + String(t.v_reference_number) + "</li>\n";
  294. s_html = s_html + "</ul>\n";
  295. });// end of looping through tenders
  296. $("#ul_tenders").append(s_html);
  297. } else {
  298. $("#spn_tenders").hide();
  299. }// end of .length check against languages
  300. } else {
  301. $("#spn_tenders").hide();
  302. }// end of typeof check against prior tender data
  303. // qualifications
  304. if (typeof(o_data.qualifications)=="object") {
  305. if (o_data.qualifications.length>0) {
  306. $.each(o_data.qualifications, function(ix, q) {
  307. s_html = s_html + "<li><ul>";
  308. s_html = s_html + "<li><span class=\"label\">Qualification Type:</span>&nbsp;" + String(q.v_qualification_type) + "</li>\n";
  309. s_html = s_html + "<li><span class=\"label\">Qualification Name:</span>&nbsp;" + String(q.v_qualification_name) + "</li>\n";
  310. s_html = s_html + "<li><span class=\"label\">Acquired Date:</span>&nbsp;" + String(q["d_acquired"]) + "</li>\n";
  311. s_html = s_html + "</ul></li>\n";
  312. });// end of looping through qualifications
  313. $("#ul_qualifications").append(s_html);
  314. } else {
  315. $("#spn_qualifications").hide();
  316. }// end of .length check against qualifications
  317. } else {
  318. $("#spn_qualifications").hide();
  319. }// end of typeof check against qualifications
  320. if (typeof(o_data.uploads)=="object") {
  321. if (o_data.uploads.length>0) {
  322. // uploaded documents
  323. s_html = "";
  324. $.each(o_data.uploads, function(ix, u) {
  325. s_html = s_html + "<li><ul>";
  326. s_html = s_html + "<li><span class=\"label\">Document Type:</span>&nbsp;" + String(u.si_upload_type) + "</li>\n";
  327. s_url_download = "{{ url_for("main.download_upload", i_upload=99999, bl_download=True) }}".replace("99999", String(u["id"]));
  328. s_url_view = "{{ url_for("main.download_upload", i_upload=99999, bl_download=False) }}".replace("99999", String(u["id"]));
  329. s_html = s_html + "<li><span class=\"label\">File Name:</span>&nbsp;<a href=\"" + s_url_download + "\" target=\"_blank\"> download - " + String(u["v_filename"]) + "</a>&nbsp;<a href=\"" + s_url_view + "\" target=\"_blank\"> view - " + String(u["v_filename"]) + "</a></li>\n";
  330. s_html = s_html + "<li><span class=\"label\">Description:</span>&nbsp;" + String(u["v_description"]) + "</li>\n";
  331. if (String(u["v_qualification_name"])!="null") { s_html = s_html + "<li><span class=\"label\">Matching Qualification:</span>&nbsp;" + String(u["v_qualification_name"]) + "</li>\n"; }
  332. s_html = s_html + "</ul></li>\n";
  333. });// end of looping through uploads
  334. $("#ul_uploads").append(s_html);
  335. } else {
  336. $("#div_uploads").hide();
  337. }// end of length check against o_data.uploads
  338. } else {
  339. $("#div_uploads").hide();
  340. }// end of typeof check against uploads
  341. $("#dlg_details").redraw();
  342. $("#dlg_details").dialog("open");
  343. } else {
  344. do_alert(String(o_data));
  345. }// end of typeof check against o_data
  346. });// end of .get
  347. } catch(e) {
  348. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  349. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  350. alert("Error! " + s_err);
  351. }//end of catch
  352. });// end of .a_view_details click event
  353. function jump_page(i_page) {
  354. i_page = (isNaN(i_page)) ? 1 : Number(i_page);
  355. $("#hid_page").val(i_page);
  356. document.getElementById("frm_filters").submit();
  357. }// end of jump_page function
  358. $(".a_page_number").click( function(event) {
  359. event.preventDefault();
  360. var s_page = String($(this).attr("href")).replace("#", "");
  361. i_page = (isNaN(s_page)) ? 1 : Number(s_page);
  362. jump_page(i_page);
  363. });// end of .a_page_number function
  364. $("#dlg_details").on("click", "#a_full_screen", function(event) {
  365. event.preventDefault();
  366. try {
  367. var s_html = "<!doctype html>\n<html lang=\"en\">\n<head>\n<title>C.V. details</title>\n</head>\n<body>\n<a href=\"#\" onclick=\"window.close();\">(close)</a><br>\n";
  368. s_html = s_html + $("#div_details").html();
  369. s_html = s_html + "</body>\n</html>";
  370. var w = window.open();
  371. w.document.write(s_html);
  372. //w.close();
  373. } catch(e) {
  374. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  375. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  376. alert("Error! " + s_err);
  377. }//end of catch
  378. });// end of a_full_screen click event
  379. window.setTimeout( function() {
  380. var s_nada = ""; //alert("hello world");
  381. }, 300);
  382. var s = "nada"; // do_alert("hello world");
  383. } catch(e) {
  384. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  385. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  386. alert("Error! " + s_err);
  387. }//end of catch
  388. });// end of secondary document ready
  389. </script>
  390. {% endblock %}