index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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. <span id="spn_tenders">
  155. <h4>Prior Tenders</h4>
  156. <ul id="ul_tenders"></ul>
  157. </span>
  158. </div><!-- end of dlg_details -->
  159. <script type="text/javascript">
  160. $(document).ready( function() {
  161. try {
  162. var s_dlg_details = $("#dlg_details").html();
  163. $("#sel_role_department").change( function(event) {
  164. var s_id = String($(this).val());
  165. // roles_list(i_department_id)
  166. // id, v_role_name
  167. $("#sel_role").empty();
  168. var s_html = "<option value=\"0\" selected>---</option>\n";
  169. var s_url = "{{ url_for("main.roles_list", i_department_id=99999) }}".replace("99999", s_id);
  170. $.get(s_url, function(o_roles) {
  171. if (typeof(o_roles)=="object") {
  172. $.each(o_roles, function(ix, o_role) {
  173. s_html = s_html + "<option value=\"" + String(o_role.id) + "\">" + String(o_role.v_role_name) + "</option>\n";
  174. });// end of .each against o_roles
  175. $("#sel_role").html(s_html);
  176. $("#sel_role").redraw();
  177. }// end of typeof check against o_roles
  178. });// end of .get
  179. do_alert("Roles listing updated");
  180. });// end of sel_department change event
  181. $("#sel_qualification_type_1").change( function(event) {
  182. var s_id = String($(this).val());
  183. // qualifications_list(i_type_id)
  184. // id, v_qualification_name
  185. $("#sel_qualification_1").empty();
  186. var s_html = "<option value=\"0\" selected>---</option>\n";
  187. var s_url = "{{ url_for("main.qualifications_list", i_type_id=99999) }}".replace("99999", s_id);
  188. $.get(s_url, function(o_qualifications) {
  189. if (typeof(o_qualifications)=="object") {
  190. $.each(o_qualifications, function(ix, o_qualification) {
  191. s_html = s_html + "<option value=\"" + String(o_qualification.id) + "\">" + String(o_qualification.v_qualification_name) + "</option>\n";
  192. });// end of .each against o_qualifications
  193. $("#sel_qualification_1").html(s_html);
  194. $("#sel_qualification_1").redraw();
  195. }// end of typeof check against o_qualifications
  196. });// end of .get
  197. do_alert("Roles listing 1 updated");
  198. });// end of sel_qualification_type_1 change event
  199. $("#sel_qualification_type_2").change( function(event) {
  200. var s_id = String($(this).val());
  201. // qualifications_list(i_type_id)
  202. // // id, v_qualification_name
  203. $("#sel_qualification_2").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_2").html(s_html);
  212. $("#sel_qualification_2").redraw();
  213. }// end of typeof check against o_qualifications
  214. });// end of .get
  215. do_alert("Roles listing 2 updated");
  216. });// end of sel_qualification_type_2 change event
  217. $("#btn_clear_filter").click( function(event) {
  218. event.preventDefault();
  219. // checkbox
  220. $("#chk_case_sensitive").prop("checked", false);
  221. // text boxes
  222. $.each(["#txt_name", "#txt_surname", "#txt_id_number"], function(ix, ss) { $(ss).val(""); });
  223. // dependant selects first
  224. $.each(["#sel_role", "#sel_qualification_1", "#sel_qualification_2"], function(ix, ss) { $(ss).prop("selectedIndex", 0); });
  225. // categorical selects
  226. $.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); });
  227. document.getElementById("frm_filters").submit();
  228. });// end of btn_clear_filter click event
  229. $(".a_view_details").click( function(event) {
  230. try {
  231. event.preventDefault();
  232. $("#dlg_details").html(s_dlg_details);
  233. $("#dlg_details").redraw();
  234. var s_id = String($(this).attr("href")).replace("#", "");
  235. var s_url = "{{ url_for("main.record_details", i_record_id=99999) }}".replace("99999", s_id);
  236. $.get(s_url, function(o_data) {
  237. if (typeof(o_data)=="object") {
  238. var s_html = "";
  239. if (typeof(o_data.record)=="object") {
  240. s_html = "<li><span class=\"label\">Surname:</span>&nbsp;" + String(o_data.record["v_surname"]) + "</li></li>\n";
  241. var s_names = [o_data.record["v_name_1"], o_data.record["v_name_2"], o_data.record["v_name_3"]].join(" ").trim();
  242. s_html = s_html + "<li><span class=\"label\">Name(s):</span>&nbsp;" + s_names + "</li>\n";
  243. s_html = s_html + "<li><span class=\"label\">I.D./Passport Number:</label>&nbsp;" + String(o_data.record["v_id_number"]) + "</li>\n";
  244. s_html = s_html + "<li><span class=\"label\">Gender:</label>&nbsp;" + String(o_data.record["c_gender"]).toUpperCase() + "</li>\n";
  245. s_html = s_html + "<li><span class=\"label\">Years Experience:</label>&nbsp;" + String(o_data.record["si_years_experience"]) + "</li>\n";
  246. s_html = s_html + "<li><span class=\"label\">SAP K-Level:</label>&nbsp;" + String(o_data.record["v_sap_k_level"]) + "</li>\n";
  247. s_html = s_html + "<li><span class=\"label\">Contact Number:</label>&nbsp;" + String(o_data.record["v_contact_number"]) + "</li>\n";
  248. s_html = s_html + "<li><span class=\"label\">E-Mail Address:</label>&nbsp;" + String(o_data.record["v_email"]) + "</li>\n";
  249. s_html = s_html + "<li><span class=\"label\">Employment Department/Division:</label>&nbsp;" + String(o_data.record["v_department_name"]) + "</li>\n";
  250. s_html = s_html + "<li><span class=\"label\">Employment Position/Role:</label>&nbsp;" + String(o_data.record["v_role_name"]) + "</li>\n";
  251. $("#ul_details").append(s_html);
  252. }// end of typeof check against basic details
  253. // languagess
  254. s_html = "";
  255. if (typeof(o_data.languages)=="object") {
  256. if (o_data.languages.length>0) {
  257. $.each(o_data.languages, function(ix, l) {
  258. s_html = s_html + "<li><ul>";
  259. s_html = s_html + "<li><span class=\"label\">Language:</span>&nbsp;" + String(l.v_language_name) + " (" + String(l.v_language_abbreviation) + ")</li>\n";
  260. s_html = s_html + "<li><span class=\"label\">Level:</span>&nbsp;" + String(l.level) + "</li>\n";
  261. s_html = s_html + "</ul></li>\n";
  262. });// end of looping through languages
  263. $("#ul_languages").append(s_html);
  264. } else {
  265. $("#spn_languages").hide();
  266. }// end of .length check against languages
  267. } else {
  268. $("#spn_languages").hide();
  269. }// end of typeof check against language data
  270. // tenders
  271. s_html = "";
  272. if (typeof(o_data.tenders)=="object") {
  273. if (o_data.tenders.length>0) {
  274. $.each(o_data.tenders, function(ix, t) {
  275. s_html = s_html + "<li><span class=\"label\">Reference no.:</span>&nbsp;" + String(t.v_reference_number) + "</li>\n";
  276. s_html = s_html + "</ul>\n";
  277. });// end of looping through tenders
  278. $("#ul_tenders").append(s_html);
  279. } else {
  280. $("#spn_tenders").hide();
  281. }// end of .length check against languages
  282. } else {
  283. $("#spn_tenders").hide();
  284. }// end of typeof check against prior tender data
  285. // qualifications
  286. if (typeof(o_data.qualifications)=="object") {
  287. if (o_data.qualifications.length>0) {
  288. $.each(o_data.qualifications, function(ix, q) {
  289. s_html = s_html + "<li><ul>";
  290. s_html = s_html + "<li><span class=\"label\">Qualification Type:</span>&nbsp;" + String(q.v_qualification_type) + "</li>\n";
  291. s_html = s_html + "<li><span class=\"label\">Qualification Name:</span>&nbsp;" + String(q.v_qualification_name) + "</li>\n";
  292. s_html = s_html + "<li><span class=\"label\">Acquired Date:</span>&nbsp;" + String(q["d_acquired"]) + "</li>\n";
  293. s_html = s_html + "</ul></li>\n";
  294. });// end of looping through qualifications
  295. $("#ul_qualifications").append(s_html);
  296. } else {
  297. $("#spn_qualifications").hide();
  298. }// end of .length check against qualifications
  299. } else {
  300. $("#spn_qualifications").hide();
  301. }// end of typeof check against qualifications
  302. if (typeof(o_data.uploads)=="object") {
  303. if (o_data.uploads.length>0) {
  304. // uploaded documents
  305. s_html = "";
  306. $.each(o_data.uploads, function(ix, u) {
  307. s_html = s_html + "<li><ul>";
  308. s_html = s_html + "<li><span class=\"label\">Document Type:</span>&nbsp;" + String(u.si_upload_type) + "</li>\n";
  309. s_url_download = "{{ url_for("main.download_upload", i_upload=99999, bl_download=True) }}".replace("99999", String(u["id"]));
  310. s_url_view = "{{ url_for("main.download_upload", i_upload=99999, bl_download=False) }}".replace("99999", String(u["id"]));
  311. 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";
  312. s_html = s_html + "<li><span class=\"label\">Description:</span>&nbsp;" + String(u["v_description"]) + "</li>\n";
  313. 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"; }
  314. s_html = s_html + "</ul></li>\n";
  315. });// end of looping through uploads
  316. $("#ul_uploads").append(s_html);
  317. } else {
  318. $("#div_uploads").hide();
  319. }// end of length check against o_data.uploads
  320. } else {
  321. $("#div_uploads").hide();
  322. }// end of typeof check against uploads
  323. $("#dlg_details").redraw();
  324. $("#dlg_details").dialog("open");
  325. } else {
  326. do_alert(String(o_data));
  327. }// end of typeof check against o_data
  328. });// end of .get
  329. } catch(e) {
  330. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  331. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  332. alert("Error! " + s_err);
  333. }//end of catch
  334. });// end of .a_view_details click event
  335. function jump_page(i_page) {
  336. i_page = (isNaN(i_page)) ? 1 : Number(i_page);
  337. $("#hid_page").val(i_page);
  338. document.getElementById("frm_filters").submit();
  339. }// end of jump_page function
  340. $(".a_page_number").click( function(event) {
  341. event.preventDefault();
  342. var s_page = String($(this).attr("href")).replace("#", "");
  343. i_page = (isNaN(s_page)) ? 1 : Number(s_page);
  344. jump_page(i_page);
  345. });// end of .a_page_number function
  346. $("#dlg_details").on("click", "#a_full_screen", function(event) {
  347. event.preventDefault();
  348. try {
  349. 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";
  350. s_html = s_html + $("#div_details").html();
  351. s_html = s_html + "</body>\n</html>";
  352. var w = window.open();
  353. w.document.write(s_html);
  354. //w.close();
  355. } catch(e) {
  356. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  357. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  358. alert("Error! " + s_err);
  359. }//end of catch
  360. });// end of a_full_screen click event
  361. window.setTimeout( function() {
  362. var s_nada = ""; //alert("hello world");
  363. }, 300);
  364. var s = "nada"; // do_alert("hello world");
  365. } catch(e) {
  366. var s_err = String(e.name) + "\nmessage:" + String(e.message);
  367. s_err = (typeof(e.lineNumber)!="undefined") ? s_err + "\nline:" + String(e.lineNumber) : s_err;
  368. alert("Error! " + s_err);
  369. }//end of catch
  370. });// end of secondary document ready
  371. </script>
  372. {% endblock %}