index.html 17 KB

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