index.html 17 KB

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