jstreeAJAX.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. /*
  2. 0:自動編號 SN項次
  3. 1:類別 圖名
  4. 2:X 關鍵字
  5. 3:X 版次
  6. 4:檔案數 X
  7. 5:計畫編號-計畫名稱 計畫編號
  8. 6:類別ID 計畫名稱
  9. 7:X 類別ID
  10. 8:X 工程類別
  11. 9:X 上一層資料夾
  12. 10:X 檔案路徑
  13. */
  14. $(document).ready(function () {
  15. //const types = ["工程概要", "工程計算書", "設計圖", "數量計算書", "工程預算書", "施工規範&特定條款", "設計報告書"];
  16. var types = [];
  17. var path = '';
  18. var category = '';
  19. var project_id = '';
  20. var project_name = '';
  21. var project = '';
  22. var blueprint_SN = '';
  23. var blueprint_path = '';
  24. var notes = [];
  25. var tempTable = [];
  26. var tempTable2 = [];
  27. var tree_data; //save getTree ajax data
  28. var start = true;
  29. var folderPath = "";
  30. var fileNums = [];
  31. var is_blueprint2 = false;
  32. PDFObject.embed("./assets/null.pdf", "#pdfFile");
  33. var table = $('#datatable-ajax').DataTable({
  34. bProcessing: true,
  35. responsive: true,
  36. "pagingType": "full_numbers",
  37. "bLengthChange": true,
  38. "lengthMenu": [
  39. [7, 10, 25, -1],
  40. [7, 10, 25, "全部"]
  41. ],
  42. "searching": false,
  43. "pageLength": 7,
  44. "language": {
  45. "processing": "處理中...",
  46. "loadingRecords": "載入中...",
  47. "lengthMenu": "顯示 _MENU_ 項結果",
  48. "zeroRecords": "沒有符合的結果或是沒有資料",
  49. "info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
  50. "infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
  51. "infoFiltered": "(從 _MAX_ 項結果中過濾)",
  52. "infoPostFix": "",
  53. "search": "搜尋:",
  54. "paginate": {
  55. "first": '<i class="fa fa-step-backward"></i>',
  56. "previous": '<i class="fa fa-backward"></i>',
  57. "next": '<i class="fa fa-forward"></i>',
  58. "last": '<i class="fa fa-step-forward"></i>'
  59. },
  60. "aria": {
  61. "sortAscending": ": 升冪排列",
  62. "sortDescending": ": 降冪排列"
  63. }
  64. },
  65. "columns": [{
  66. "width": "5%"
  67. },
  68. null,
  69. null,
  70. {
  71. "width": "5%"
  72. }, {
  73. "width": "5%"
  74. },
  75. ],
  76. data: [
  77. [
  78. " ", "", "", "", "",
  79. ],
  80. [
  81. " ", "", "", "", "",
  82. ],
  83. [
  84. " ", "", "", "", "",
  85. ],
  86. [
  87. " ", "", "", "", "",
  88. ],
  89. [
  90. " ", "", "", "", "",
  91. ],
  92. [
  93. " ", "", "", "", "",
  94. ],
  95. [
  96. " ", "", "", "", "",
  97. ]
  98. ],
  99. drawCallback: function () {
  100. if (!start) {
  101. var api = this.api();
  102. var rowCount = api.rows({
  103. page: 'current'
  104. }).count();
  105. /*for (var i = 0; i < api.page.len() - (rowCount === 0 ? 1 : rowCount); i++) {
  106. $('#datatable-ajax tbody').append($("<tr><td>&nbsp;</td><td></td><td></td><td></td></tr>"));
  107. }*/
  108. }
  109. start = false;
  110. },
  111. });
  112. $("#datatable-ajax_length").append($("#reset"))
  113. $.ajax({
  114. url: "./script/php/getTree.php",
  115. contentType: "application/json",
  116. dataType: "json",
  117. type: "GET",
  118. async: false
  119. })
  120. .success(function (response) {
  121. tree_data = response;
  122. }).error(function (error) {
  123. console.log(error);
  124. });
  125. displayDetail(false, true);
  126. $('#treeAjaxHTML').jstree({
  127. 'core': {
  128. 'themes': {
  129. variant: 'large'
  130. },
  131. 'data': tree_data,
  132. 'multiple': false,
  133. 'animation': 40,
  134. 'expand_selected_onload': true
  135. },
  136. 'types': {
  137. 'default': {
  138. 'icon': 'fa fa-folder'
  139. },
  140. 'file': {
  141. 'icon': 'fa fa-file'
  142. }
  143. },
  144. 'plugins': ['types', 'search', 'wholerow']
  145. }).bind("loaded.jstree", function (event, data) {
  146. var url_href = window.location.href;
  147. var url = new URL(url_href);
  148. var projectId = url.searchParams.get("projectId");
  149. if (projectId != null) {
  150. $(this).jstree("open_all");
  151. }
  152. }).on(
  153. 'select_node.jstree',
  154. function (event, data) {
  155. if (data.node.text.includes("-")) {
  156. $("#reset").prop("disabled", false);
  157. $("#header").empty();
  158. displayDetail(false, true);
  159. project_id = data.node.text.split("-")[0];
  160. project_name = data.node.text.split("-")[1];
  161. project = data.node.text;
  162. $("#project-id").val(project_id)
  163. $("#header").empty();
  164. category = $('#treeAjaxHTML').jstree(true).get_node(data.node.parents[0]).text;
  165. countFiles(project_id, "false");
  166. var span = $('<span>' + project + ' > </span>');
  167. span.on("click", function (e) {
  168. countFiles(project_id, "false");
  169. displayDetail(false, true);
  170. is_blueprint2 = false;
  171. for (var k = folderPath.length - 1; k > 0; k--) {
  172. $("#header").children().eq(k).remove();
  173. folderPath.pop();
  174. }
  175. let i = 1;
  176. table.clear().draw();
  177. tempTable = [];
  178. types.forEach(function (element) {
  179. if (fileNums[i - 1] == null) {
  180. total = 0;
  181. } else {
  182. total = fileNums[i - 1].total;
  183. }
  184. let temp = [
  185. i,
  186. element.type_name,
  187. category,
  188. '',
  189. total,
  190. project,
  191. element.type_id
  192. ];
  193. table.row.add(temp).draw();
  194. tempTable.push(temp);
  195. i++;
  196. });
  197. $("#tableDetail td").empty();
  198. });
  199. $("#header").append(span);
  200. let i = 1;
  201. table.clear().draw();
  202. tempTable = [];
  203. types.forEach(function (element) {
  204. if (fileNums[i - 1] == null) {
  205. total = 0;
  206. } else {
  207. total = fileNums[i - 1].total;
  208. }
  209. let temp = [
  210. i,
  211. element.type_name,
  212. category,
  213. '',
  214. total,
  215. project,
  216. element.type_id
  217. ];
  218. table.row.add(temp).draw();
  219. tempTable.push(temp);
  220. i++;
  221. });
  222. $("#tableDetail td").empty();
  223. } else {
  224. data.instance.toggle_node(data.node);
  225. }
  226. displayDetail(false, true);
  227. });
  228. $('#btn-search').click(function () {
  229. $("#reset").prop("disabled", true);
  230. $("#header").empty();
  231. $("#header").append("<span>搜尋結果</span>");
  232. $.ajax({
  233. url: "./script/php/search.php",
  234. data: {
  235. search: $("#search").val(),
  236. },
  237. async: false,
  238. contentType: "application/json",
  239. dataType: "json",
  240. type: "GET",
  241. })
  242. .success(function (response) {
  243. displayDetail(true, true);
  244. table.clear().draw();
  245. $("#tableDetail td").empty();
  246. response.forEach(function (data) {
  247. let temp = [
  248. data["SN"],
  249. data["original_name"],
  250. data["keyword"],
  251. '1.0.0',
  252. data["project_id"],
  253. data["project_name"],
  254. data["type_id"],
  255. data["category_name"],
  256. data["notes"],
  257. data["filename"],
  258. ];
  259. table.row.add(temp).draw();
  260. i++;
  261. });
  262. })
  263. .error(function (error) {
  264. console.log(error);
  265. })
  266. .complete(function () {});
  267. });
  268. $('#search').keyup(function (e) {
  269. if (e.keyCode == 13) {
  270. $('#btn-search').click();
  271. }
  272. });
  273. $('#reset').click(function () {
  274. if (folderPath.length != 1) {
  275. folderPath.pop();
  276. let index = folderPath.length;
  277. $("#header").children().eq(index).remove();
  278. table.clear().draw();
  279. if (is_blueprint2) {
  280. tempTable2.forEach(function (data) {
  281. table.row.add(data).draw();
  282. });
  283. is_blueprint2 = false;
  284. } else {
  285. tempTable.forEach(function (data) {
  286. table.row.add(data).draw();
  287. });
  288. }
  289. $("#tableDetail td").empty();
  290. displayDetail(false, true);
  291. }
  292. });
  293. $('#datatable-ajax tbody').on('click', 'tr', function () {
  294. $("#reset").prop("disabled", false);
  295. $(this).parent().find("tr").css('background-color', '');
  296. $(this).css("background-color", "#cccccc");
  297. $("#tableDetail td").empty();
  298. var data = table.row(this).data();
  299. console.log(data)
  300. if (data == null) {
  301. data = ["", "", "null", "", "", "", "", "", "", ""];
  302. }
  303. let project_id = data[5].split("-")[0];
  304. let SN = data[6] != null ? data[6] : 0;
  305. let is_blueprint = data[1] == "設計圖" || data[1] == "成果圖" ? true : false;
  306. let note = notes.includes(data[1]) ? data[1] : '';
  307. if (data[2] == 'null') {
  308. $("#tableDetail td").empty();
  309. } else if (data[3] == '') {
  310. path = data[1];
  311. $.ajax({
  312. url: "./script/php/getDetail.php",
  313. data: {
  314. project_id: project_id,
  315. type_id: SN,
  316. is_blueprint: is_blueprint,
  317. note: note
  318. },
  319. async: false,
  320. contentType: "application/json",
  321. dataType: "json",
  322. type: "GET",
  323. })
  324. .success(function (response) {
  325. var span = $('<span>' + data[1] + ' > </span>');
  326. span.on("click", function (e) {
  327. let clicked = $(e.target).text().split(" > ")[0];
  328. let index = folderPath.indexOf(clicked);
  329. for (k = index + 1; k < folderPath.length; k++) {
  330. $("#header").children().eq(k).remove();
  331. folderPath.pop();
  332. }
  333. addTable(data, notes, response, SN, path);
  334. is_blueprint2 = false;
  335. });
  336. $("#header").append(span);
  337. folderPath = $("#header").text().split(" > ");
  338. folderPath.pop();
  339. addTable(data, notes, response, SN, path);
  340. })
  341. .error(function (error) {
  342. console.log(error);
  343. })
  344. .complete(function () {});
  345. } else {
  346. let type = types[parseInt(data[7]) - 1];
  347. let path = '';
  348. //let category = data[8];
  349. path = data[8] + "/" + data[5] + "-" + data[6] + data[10];
  350. $("#plan_code").text(data[5]);
  351. $("#plan_name").text(data[6]);
  352. $("#version").text(data[3]);
  353. $("#fileName").text(data[1]);
  354. if (path.toLowerCase().includes("pdf")) {
  355. PDFObject.embed("./assets/建置資料/" + path, "#pdfFile");
  356. $("#download").append('<img src="./assets/images/' + 'pdf-icon.png" style="height: 30px; display: inline-block;"> ');
  357. } else {
  358. PDFObject.embed("./assets/notPDF.pdf", "#pdfFile");
  359. if (path.toLowerCase().includes("doc")) {
  360. $("#download").append('<img src="./assets/images/' + 'word-icon.png" style="height: 30px; display: inline-block;"> ');
  361. } else if (path.toLowerCase().includes("xls")) {
  362. $("#download").append('<img src="./assets/images/' + 'excel-icon.png" style="height: 30px; display: inline-block;"> ');
  363. }
  364. }
  365. console.log(data[10]);
  366. let fileNames = data[10].split('/');
  367. let fileName = fileNames[fileNames.length - 1];
  368. $("#download").append('<a target="_blank" href="./assets/建置資料/' + path + '">' + fileName + '</a>');
  369. }
  370. });
  371. function displayDetail(isFile, isBlueprint) {
  372. table.column(0).visible(isBlueprint);
  373. table.column(2).visible(isFile);
  374. table.column(3).visible(isFile);
  375. table.column(4).visible(!isFile);
  376. if (isFile) {
  377. $(".table-responsive").show();
  378. $("#SN").text("圖號");
  379. $("#name").text("圖名");
  380. $('.nav-tabs a[href="#pdfTab"]').tab('show');
  381. test = table;
  382. if (table.rows().count() > 10) {
  383. table.page.len(10).draw();
  384. } else {
  385. table.page.len(-1).draw();
  386. }
  387. } else {
  388. $(".table-responsive").hide();
  389. $("#SN").text("項次");
  390. $("#name").text("類別");
  391. if (isBlueprint) {
  392. table.page.len(-1).draw();
  393. } else {
  394. table.page.len(7).draw();
  395. }
  396. $('.nav-tabs a[href="#arcgisTab"]').tab('show');
  397. }
  398. }
  399. function countFiles(project_id, is_blueprint) {
  400. $.ajax({
  401. url: "./script/php/get_file_count.php",
  402. data: {
  403. project_id: project_id,
  404. is_blueprint: is_blueprint,
  405. },
  406. async: false,
  407. //contentType: "application/json",
  408. dataType: "json",
  409. type: "POST",
  410. })
  411. .success(function (response) {
  412. console.log(response);
  413. fileNums = response;
  414. types = [];
  415. response.forEach(function (element) {
  416. types.push({
  417. type_id: element.type_id,
  418. type_name: element.type_name
  419. })
  420. });
  421. })
  422. .error(function (error) {
  423. console.log(error);
  424. })
  425. .complete(function () {});
  426. }
  427. function addTable(data, notes, response, SN, path) {
  428. table.clear().draw();
  429. if (data[1] != "設計圖" && data[1] != "成果圖") {
  430. for (i = 0; i < response.length; i++) {
  431. table.row.add([
  432. response[i]["SN"],
  433. response[i]["original_name"],
  434. response[i]["keyword"],
  435. '1.0.0',
  436. '',
  437. response[i]["project_id"],
  438. response[i]["project_name"],
  439. response[i]["type_id"],
  440. response[i]["category_name"],
  441. response[i]["notes"],
  442. response[i]["filename"],
  443. ])
  444. table.draw();
  445. }
  446. if (notes.includes(data[1])) {
  447. is_blueprint2 = true;
  448. displayDetail(true, true);
  449. } else {
  450. displayDetail(true, false);
  451. }
  452. } else {
  453. displayDetail(false, true);
  454. blueprint_SN = SN;
  455. blueprint_path = path;
  456. tempTable2 = [];
  457. countFiles(project_id, "true");
  458. for (i = 0; i < response.length; i++) {
  459. notes[i] = response[i]['notes'];
  460. if (fileNums[i] == null) {
  461. total = 0;
  462. } else {
  463. total = fileNums[i].total;
  464. }
  465. let temp = [
  466. i + 1,
  467. response[i]['notes'],
  468. '',
  469. '',
  470. total,
  471. data[5],
  472. ];
  473. table.row.add(temp);
  474. tempTable2.push(temp);
  475. }
  476. table.draw();
  477. }
  478. }
  479. var search_output = {};
  480. var search_word = ""
  481. $("#advanced-search-button").on("click", function (e) {
  482. show_progress_bar(true);
  483. update_progress_bar();
  484. $.ajax({
  485. url: "./script/php/get_search_list.php",
  486. data: {
  487. project_id: [''].concat(search_data["project"]),
  488. type_id: [''].concat(search_data["type"]),
  489. notes_name: [''].concat(search_data["notes"].filter(element => {return element !== undefined;})),
  490. search: $("#search-word").val(),
  491. },
  492. type: "GET",
  493. dataType: "json",
  494. contentType: "application/json",
  495. async: false
  496. }).success(function (response) {
  497. displayDetail(true);
  498. search_output = response;
  499. search_word = $("#search-word").val();
  500. filter_base_data = search_data;
  501. }).error(function(error) {
  502. console.log(error);
  503. });
  504. setTimeout(() => {
  505. draw_datatable(search_output);
  506. e.preventDefault();
  507. $.magnificPopup.close();
  508. if($("#search-filter").css("display") != "none") {
  509. $("#search-filter").slideUp(200);
  510. $("#filter-slide").toggleClass("fa-sort-desc fa-sort-up");
  511. }
  512. $("#search-filter-panel-body .btn-default").toggleClass("btn-primary btn-default");
  513. show_filter(filter_base_data);
  514. show_progress_bar(false);
  515. }, 0);
  516. });
  517. function draw_datatable(search_output) {
  518. table.clear().draw();
  519. for (i = 0; i < search_output.length; i++) {
  520. table.row.add([
  521. search_output[i]["SN"],
  522. search_output[i]["original_name"],
  523. search_output[i]["keyword"],
  524. '1.0.0',
  525. '',
  526. search_output[i]["project_id"],
  527. search_output[i]["project_name"],
  528. search_output[i]["type_id"],
  529. search_output[i]["category_name"],
  530. search_output[i]["notes"],
  531. search_output[i]["filename"],
  532. ])
  533. table.draw();
  534. // progress_bar_value = (i/search_output.length)*100
  535. // update_progress_bar();
  536. }
  537. }
  538. function reset_filter_search_output(){
  539. output_data = [];
  540. click_option = get_filter_click("btn-primary");
  541. $.ajax({
  542. url: "./script/php/get_search_list.php",
  543. data: {
  544. project_id: [''].concat(click_option["project"]),
  545. type_id: [''].concat(click_option["type"]),
  546. notes_name: [''].concat(click_option["notes"]),
  547. search: search_word
  548. },
  549. type: "GET",
  550. dataType: "json",
  551. contentType: "application/json",
  552. async: false
  553. }).success(function (response) {
  554. displayDetail(true);
  555. search_output = response;
  556. }).error(function(error) {
  557. console.log(error);
  558. });
  559. draw_datatable(search_output);
  560. }
  561. function get_filter_click(click_class){
  562. click_id_list = {
  563. "category": [],
  564. "project": [],
  565. "type": [],
  566. "notes": []
  567. };
  568. check_notes = false;
  569. $("#f-category ."+click_class).each(function() {
  570. if($(this).css("display") == "inline-block") {
  571. click_id_list["category"].push($(this).attr("id").replace("f-c", ""));
  572. }
  573. });
  574. $("#f-project ."+click_class).each(function() {
  575. if($(this).css("display") == "inline-block") {
  576. click_id_list["project"].push($(this).attr("id").replace("f-p", ""));
  577. }
  578. });
  579. $("#f-type ."+click_class).each(function() {
  580. if($(this).css("display") == "inline-block") {
  581. click_id_list["type"].push($(this).attr("id").replace("f-t", ""));
  582. if($(this).attr("id").replace("f-t", "") == "3"){
  583. check_notes = true;
  584. }
  585. }
  586. });
  587. if(check_notes) {
  588. $("#f-notes ."+click_class).each(function() {
  589. if($(this).css("display") == "inline-block") {
  590. click_id_list["notes"].push($(this).text());
  591. }
  592. });
  593. }
  594. return click_id_list;
  595. }
  596. function show_filter(filter_base_data) {
  597. show_notes = false;
  598. $("#search-filter button").css("display", "none");
  599. filter_base_data["category"].forEach(element => {
  600. id = "f-c" + element;
  601. $("#" + id).css("display", "inline-block");
  602. });
  603. filter_base_data["project"].forEach(element => {
  604. id = "f-p" + element;
  605. $("#" + id).css("display", "inline-block");
  606. });
  607. filter_base_data["type"].forEach(element => {
  608. id = "f-t" + element;
  609. $("#" + id).css("display", "inline-block");
  610. if(element == "3"){
  611. show_notes = true;
  612. }
  613. });
  614. if(show_notes) {
  615. $("#filter_notes").css("display", "block");
  616. filter_base_data["notes"].forEach(element => {
  617. $("#f-notes button").each(function() {
  618. if($(this).text() == element) {
  619. $(this).css("display", "inline-block");
  620. }
  621. });
  622. });
  623. } else {
  624. $("#filter_notes").css("display", "none");
  625. }
  626. }
  627. var progress_bar_value = 0;
  628. function update_progress_bar() {
  629. var i=0;
  630. if (i == 0) {
  631. i = 1;
  632. var id = setInterval(frame, 10);
  633. function frame() {
  634. if (progress_bar_value >= 100) {
  635. clearInterval(id);
  636. i = 0;
  637. } else {
  638. $("#progress-bars").css("width", progress_bar_value+"%");
  639. }
  640. }
  641. }
  642. }
  643. function show_progress_bar(show) {
  644. if(show) {
  645. $("#advanced-search-button-group").css("display", "none");
  646. $("#loading").css("display", "block");
  647. // $("#progress-bars").parent().css("display", "block");
  648. } else {
  649. $("#advanced-search-button-group").css("display", "block");
  650. $("#loading").css("display", "none");
  651. // $("#progress-bars").parent().css("display", "none");
  652. }
  653. }
  654. $("#filter-slide").on("click", function (e) {
  655. if($("#search-filter").css("display") == "block"){
  656. $("#search-filter").slideUp(200);
  657. } else {
  658. $("#search-filter").slideDown(200);
  659. }
  660. $("#filter-slide").toggleClass("fa-sort-desc fa-sort-up")
  661. });
  662. $("#search-filter-panel-body button").on("click", function (e) {
  663. $(this).toggleClass("btn-primary btn-default");
  664. click_option = get_filter_click("btn-primary");
  665. if(click_option["category"].length>0 && click_option["project"].length>0 && click_option["type"].length>0) {
  666. reset_filter_search_output();
  667. } else {
  668. table.clear().draw();
  669. }
  670. });
  671. $("#f-category button").on("click", function() {
  672. c_id = $(this).attr("id").replace("f-c", "");
  673. sub_project_list = [];
  674. db_table["project"].forEach(element => {
  675. if(element["category_id"] == c_id) {
  676. sub_project_list.push(element["project_id"]);
  677. }
  678. });
  679. sub_project_list.forEach(element => {
  680. if($(this).hasClass("btn-primary")) {
  681. if($("#f-p" + element).hasClass("btn-default")){
  682. $("#f-p" + element).toggleClass("btn-primary btn-default");
  683. }
  684. } else {
  685. if($("#f-p" + element).hasClass("btn-primary")){
  686. $("#f-p" + element).toggleClass("btn-primary btn-default");
  687. }
  688. }
  689. click_option = get_filter_click("btn-primary");
  690. if(click_option["category"].length == 0) {
  691. table.clear().draw();
  692. }
  693. });
  694. reset_filter_search_output();
  695. });
  696. $("#f-type button").on("click", function() {
  697. t_id = $(this).attr("id").replace("f-t", "");
  698. if(t_id == "3") {
  699. if($(this).hasClass("btn-default")) {
  700. $("#filter_notes").css("display", "none");
  701. $("#f-notes .btn-default").toggleClass("btn-primary btn-default");
  702. } else {
  703. $("#filter_notes").css("display", "block");
  704. }
  705. }
  706. });
  707. });